Commit a001920e authored by David Odin's avatar David Odin

libgimpwidgets/gimppreview.c split this widget into itself (more abstract

* libgimpwidgets/gimppreview.c
* libgimpwidgets/gimppreview.h: split this widget into itself (more
  abstract now) and ...

* libgimpwidgets/gimpscrolledpreview.c
* libgimpwidgets/gimpscrolledpreview.h: this widget which also have
  some scrollbars and a nagivation preview.

* libgimpwidgets/Makefile.am
* libgimpwidgets/gimpwidgetstypes.h: changed accordingly.

* libgimp/gimpaspectpreview.c
* libgimp/gimpaspectpreview.h: Added this widget, derived from
  GimpPreview, which has always the same ratio has the given drawable.
  This widget has almost the same api as GimpDrawablePreview, and is
  useful for plug-ins that show the whole (scaled) drawable in their
  preview.

* libgimp/gimpdrawablepreview.c
* libgimp/gimpdrawablepreview.h: GimpDrawablePreview is now derived
  from GimpScrolledPreview.

* libgimp/Makefile.am
* libgimp/gimpui.h
* libgimp/gimpuitypes.h: changed accordingly.

* plug-ins/common/plasma.c: use a GimpAspectPreview.

* plug-ins/common/bumpmap.c
* plug-ins/common/cartoon.c
* plug-ins/common/deinterlace.c
* plug-ins/common/despeckle.c
* plug-ins/common/dog.c
* plug-ins/common/edge.c
* plug-ins/common/engrave.c
* plug-ins/common/exchange.c
* plug-ins/common/gauss.c
* plug-ins/common/grid.c
* plug-ins/common/mblur.c
* plug-ins/common/neon.c
* plug-ins/common/noisify.c
* plug-ins/common/oilify.c
* plug-ins/common/photocopy.c
* plug-ins/common/sel_gauss.c
* plug-ins/common/sharpen.c
* plug-ins/common/shift.c
* plug-ins/common/sobel.c
* plug-ins/common/softglow.c
* plug-ins/common/spread.c
* plug-ins/common/struc.c
* plug-ins/common/unsharp.c
* plug-ins/common/wind.c: use gimp_scrolled_preview_get_position
  instead of gimp_preview_get_position.
parent a8f621fe
2004-09-29 DindinX <dindinx@gimp.org>
* libgimpwidgets/gimppreview.c
* libgimpwidgets/gimppreview.h: split this widget into itself (more
abstract now) and ...
* libgimpwidgets/gimpscrolledpreview.c
* libgimpwidgets/gimpscrolledpreview.h: this widget which also have
some scrollbars and a nagivation preview.
* libgimpwidgets/Makefile.am
* libgimpwidgets/gimpwidgetstypes.h: changed accordingly.
* libgimp/gimpaspectpreview.c
* libgimp/gimpaspectpreview.h: Added this widget, derived from
GimpPreview, which has always the same ratio has the given drawable.
This widget has almost the same api as GimpDrawablePreview, and is
useful for plug-ins that show the whole (scaled) drawable in their
preview.
* libgimp/gimpdrawablepreview.c
* libgimp/gimpdrawablepreview.h: GimpDrawablePreview is now derived
from GimpScrolledPreview.
* libgimp/Makefile.am
* libgimp/gimpui.h
* libgimp/gimpuitypes.h: changed accordingly.
* plug-ins/common/plasma.c: use a GimpAspectPreview.
* plug-ins/common/bumpmap.c
* plug-ins/common/cartoon.c
* plug-ins/common/deinterlace.c
* plug-ins/common/despeckle.c
* plug-ins/common/dog.c
* plug-ins/common/edge.c
* plug-ins/common/engrave.c
* plug-ins/common/exchange.c
* plug-ins/common/gauss.c
* plug-ins/common/grid.c
* plug-ins/common/mblur.c
* plug-ins/common/neon.c
* plug-ins/common/noisify.c
* plug-ins/common/oilify.c
* plug-ins/common/photocopy.c
* plug-ins/common/sel_gauss.c
* plug-ins/common/sharpen.c
* plug-ins/common/shift.c
* plug-ins/common/sobel.c
* plug-ins/common/softglow.c
* plug-ins/common/spread.c
* plug-ins/common/struc.c
* plug-ins/common/unsharp.c
* plug-ins/common/wind.c: use gimp_scrolled_preview_get_position
instead of gimp_preview_get_position.
2004-09-29 Michael Natterer <mitch@gimp.org>
* libgimp/gimpregioniterator.[ch]: renamed the "run_mode"
......
......@@ -224,6 +224,8 @@ libgimpui_2_0_la_SOURCES = \
gimpuitypes.h \
gimpmenu.c \
gimpmenu.h \
gimpaspectpreview.c \
gimpaspectpreview.h \
gimpbrushmenu.c \
gimpbrushmenu.h \
gimpdrawablepreview.c \
......@@ -279,6 +281,7 @@ gimpinclude_HEADERS = \
gimpui.h \
gimpuitypes.h \
gimpmenu.h \
gimpaspectpreview.h \
gimpbrushmenu.h \
gimpdrawablepreview.h \
gimpfontmenu.h \
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpaspectpreview.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 "libgimpwidgets/gimpwidgets.h"
#include "gimpuitypes.h"
#include "gimp.h"
#include "libgimp-intl.h"
#include "gimpaspectpreview.h"
static void gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass);
static void gimp_aspect_preview_init (GimpAspectPreview *preview);
static void gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_aspect_preview_draw (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
GType
gimp_aspect_preview_get_type (void)
{
static GType preview_type = 0;
if (! preview_type)
{
static const GTypeInfo preview_info =
{
sizeof (GimpAspectPreviewClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_aspect_preview_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpAspectPreview),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_aspect_preview_init,
};
preview_type = g_type_register_static (GIMP_TYPE_PREVIEW,
"GimpAspectPreview",
&preview_info, 0);
}
return preview_type;
}
static void
gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
widget_class->style_set = gimp_aspect_preview_style_set;
preview_class->draw = gimp_aspect_preview_draw;
}
static void
gimp_aspect_preview_init (GimpAspectPreview *preview)
{
g_object_set (GIMP_PREVIEW (preview)->area,
"check-size", gimp_check_size (),
"check-type", gimp_check_type (),
NULL);
}
static void
gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (widget);
gint size;
gint width, height;
if (GTK_WIDGET_CLASS (parent_class)->style_set)
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
gtk_widget_style_get (widget,
"size", &size,
NULL);
width = gimp_drawable_width (preview->drawable->drawable_id);
height = gimp_drawable_height (preview->drawable->drawable_id);
if (width > height)
{
GIMP_PREVIEW (preview)->width = MIN (width, size);
GIMP_PREVIEW (preview)->height = (height * GIMP_PREVIEW (preview)->width) / width;
}
else
{
GIMP_PREVIEW (preview)->height = MIN (height, size);
GIMP_PREVIEW (preview)->width = (width * GIMP_PREVIEW (preview)->height) / height;
}
gtk_widget_set_size_request (GIMP_PREVIEW (preview)->area,
GIMP_PREVIEW (preview)->width,
GIMP_PREVIEW (preview)->height);
}
GtkWidget *
gimp_aspect_preview_new (GimpDrawable *drawable,
gboolean *toggle)
{
GimpAspectPreview *preview;
gint width, height;
preview = g_object_new (GIMP_TYPE_ASPECT_PREVIEW, NULL);
preview->drawable = drawable;
width = gimp_drawable_width (drawable->drawable_id);
height = gimp_drawable_height (drawable->drawable_id);
gimp_preview_set_bounds (GIMP_PREVIEW (preview), 0, 0, width, height);
g_object_set (GIMP_PREVIEW (preview)->frame,
"ratio", (gdouble)width / (gdouble)height,
NULL);
return GTK_WIDGET (preview);
}
static void
gimp_aspect_preview_draw (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_ASPECT_PREVIEW (preview));
gimp_preview_area_fill (GIMP_PREVIEW_AREA (preview->area),
0, 0,
preview->width,
preview->height,
0, 0, 0);
}
/**
* gimp_aspect_preview_draw_buffer:
* @preview: a #GimpAspectPreview widget
* @buffer:
* @rowstride:
*
* Since: GIMP 2.2
**/
void
gimp_aspect_preview_draw_buffer (GimpAspectPreview *preview,
const guchar *buffer,
gint rowstride)
{
g_return_if_fail (GIMP_IS_ASPECT_PREVIEW (preview));
g_return_if_fail (buffer != NULL);
gimp_preview_area_draw (GIMP_PREVIEW_AREA (GIMP_PREVIEW (preview)->area),
0, 0,
GIMP_PREVIEW (preview)->width,
GIMP_PREVIEW (preview)->height,
gimp_drawable_type (preview->drawable->drawable_id),
buffer,
rowstride);
}
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpaspectpreview.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_ASPECT_PREVIEW_H__
#define __GIMP_ASPECT_PREVIEW_H__
#include <libgimpwidgets/gimppreview.h>
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_ASPECT_PREVIEW (gimp_aspect_preview_get_type ())
#define GIMP_ASPECT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ASPECT_PREVIEW, GimpAspectPreview))
#define GIMP_ASPECT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ASPECT_PREVIEW, GimpAspectPreviewClass))
#define GIMP_IS_ASPECT_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ASPECT_PREVIEW))
#define GIMP_IS_ASPECT_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ASPECT_PREVIEW))
#define GIMP_ASPECT_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ASPECT_PREVIEW, GimpAspectPreviewClass))
typedef struct _GimpAspectPreviewClass GimpAspectPreviewClass;
struct _GimpAspectPreview
{
GimpPreview parent_instance;
/*< private >*/
GimpDrawable *drawable;
};
struct _GimpAspectPreviewClass
{
GimpPreviewClass parent_class;
};
GType gimp_aspect_preview_get_type (void) G_GNUC_CONST;
GtkWidget *gimp_aspect_preview_new (GimpDrawable *drawable,
gboolean *toggle);
void gimp_aspect_preview_draw_buffer (GimpAspectPreview *preview,
const guchar *buffer,
gint rowstride);
G_END_DECLS
#endif /* __GIMP_ASPECT_PREVIEW_H__ */
......@@ -42,14 +42,12 @@ static void gimp_drawable_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gimp_drawable_preview_draw_original (GimpPreview *preview);
static void gimp_drawable_preview_draw_thumb (GimpPreview *preview,
static void gimp_drawable_preview_draw_thumb (GimpScrolledPreview *preview,
GimpPreviewArea *area,
gint width,
gint height);
static GimpPreviewClass *parent_class = NULL;
static GimpScrolledPreviewClass *parent_class = NULL;
GType
gimp_drawable_preview_get_type (void)
......@@ -71,7 +69,7 @@ gimp_drawable_preview_get_type (void)
(GInstanceInitFunc) gimp_drawable_preview_init
};
preview_type = g_type_register_static (GIMP_TYPE_PREVIEW,
preview_type = g_type_register_static (GIMP_TYPE_SCROLLED_PREVIEW,
"GimpDrawablePreview",
&drawable_preview_info, 0);
}
......@@ -84,13 +82,14 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
GimpScrolledPreviewClass *scrolled_preview_class = GIMP_SCROLLED_PREVIEW_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
widget_class->style_set = gimp_drawable_preview_style_set;
widget_class->style_set = gimp_drawable_preview_style_set;
preview_class->draw = gimp_drawable_preview_draw_original;
preview_class->draw_thumb = gimp_drawable_preview_draw_thumb;
preview_class->draw = gimp_drawable_preview_draw_original;
scrolled_preview_class->draw_thumb = gimp_drawable_preview_draw_thumb;
}
static void
......@@ -126,6 +125,7 @@ static void
gimp_drawable_preview_draw_original (GimpPreview *preview)
{
GimpDrawablePreview *drawable_preview = GIMP_DRAWABLE_PREVIEW (preview);
GimpScrolledPreview *scrolled_preview = GIMP_SCROLLED_PREVIEW (preview);
GimpDrawable *drawable = drawable_preview->drawable;
guchar *buffer;
GimpPixelRgn srcPR;
......@@ -137,20 +137,20 @@ gimp_drawable_preview_draw_original (GimpPreview *preview)
rowstride = preview->width * 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);
scrolled_preview->xoff = CLAMP (scrolled_preview->xoff,
0, preview->xmax - preview->xmin - preview->width);
scrolled_preview->yoff = CLAMP (scrolled_preview->yoff,
0, preview->ymax - preview->ymin - preview->height);
gimp_pixel_rgn_init (&srcPR, drawable,
preview->xoff + preview->xmin,
preview->yoff + preview->ymin,
scrolled_preview->xoff + preview->xmin,
scrolled_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,
scrolled_preview->xoff + preview->xmin,
scrolled_preview->yoff + preview->ymin,
preview->width, preview->height);
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview->area),
......@@ -162,10 +162,10 @@ gimp_drawable_preview_draw_original (GimpPreview *preview)
}
static void
gimp_drawable_preview_draw_thumb (GimpPreview *preview,
GimpPreviewArea *area,
gint width,
gint height)
gimp_drawable_preview_draw_thumb (GimpScrolledPreview *preview,
GimpPreviewArea *area,
gint width,
gint height)
{
GimpDrawablePreview *drawable_preview = GIMP_DRAWABLE_PREVIEW (preview);
GimpDrawable *drawable = drawable_preview->drawable;
......@@ -214,17 +214,18 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
const guchar *buf,
gint rowstride)
{
GimpPreview *gimp_preview = GIMP_PREVIEW (preview);
GimpDrawable *drawable = preview->drawable;
gint32 image_id;
GimpPreview *gimp_preview = GIMP_PREVIEW (preview);
GimpScrolledPreview *scrolled_preview = GIMP_SCROLLED_PREVIEW (preview);
GimpDrawable *drawable = preview->drawable;
gint32 image_id;
image_id = gimp_drawable_get_image (drawable->drawable_id);
if (gimp_selection_is_empty (image_id))
{
gimp_preview_area_draw (GIMP_PREVIEW_AREA (gimp_preview->area),
x - gimp_preview->xoff - gimp_preview->xmin,
y - gimp_preview->yoff - gimp_preview->ymin,
x - scrolled_preview->xoff - gimp_preview->xmin,
y - scrolled_preview->yoff - gimp_preview->ymin,
width,
height,
gimp_drawable_type (drawable->drawable_id),
......@@ -254,8 +255,8 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
gimp_pixel_rgn_get_rect (&selection_rgn, sel, x, y, width, height);
gimp_preview_area_mask (GIMP_PREVIEW_AREA (gimp_preview->area),
x - gimp_preview->xoff - gimp_preview->xmin,
y - gimp_preview->yoff - gimp_preview->ymin,
x - scrolled_preview->xoff - gimp_preview->xmin,
y - scrolled_preview->yoff - gimp_preview->ymin,
width,
height,
gimp_drawable_type (drawable->drawable_id),
......@@ -380,17 +381,19 @@ gimp_drawable_preview_draw_buffer (GimpDrawablePreview *preview,
const guchar *buffer,
gint rowstride)
{
GimpPreview *gimp_preview;
GimpPreview *gimp_preview;
GimpScrolledPreview *scrolled_preview;
g_return_if_fail (GIMP_IS_DRAWABLE_PREVIEW (preview));
g_return_if_fail (preview->drawable != NULL);
g_return_if_fail (buffer != NULL);
gimp_preview = GIMP_PREVIEW (preview);
gimp_preview = GIMP_PREVIEW (preview);
scrolled_preview = GIMP_SCROLLED_PREVIEW (preview);
gimp_drawable_preview_draw_area (preview,
gimp_preview->xmin + gimp_preview->xoff,
gimp_preview->ymin + gimp_preview->yoff,
gimp_preview->xmin + scrolled_preview->xoff,
gimp_preview->ymin + scrolled_preview->yoff,
gimp_preview->width,
gimp_preview->height,
buffer, rowstride);
......
......@@ -22,7 +22,7 @@
#ifndef __GIMP_DRAWABLE_PREVIEW_H__
#define __GIMP_DRAWABLE_PREVIEW_H__
#include <libgimpwidgets/gimppreview.h>
#include <libgimpwidgets/gimpscrolledpreview.h>
G_BEGIN_DECLS
......@@ -42,14 +42,14 @@ typedef struct _GimpDrawablePreviewClass GimpDrawablePreviewClass;
struct _GimpDrawablePreview
{
GimpPreview parent_instance;
GimpScrolledPreview parent_instance;
GimpDrawable *drawable;
GimpDrawable *drawable;
};
struct _GimpDrawablePreviewClass
{
GimpPreviewClass parent_class;
GimpScrolledPreviewClass parent_class;
};
......
......@@ -28,6 +28,7 @@
#include <libgimp/gimpexport.h>
#include <libgimp/gimpmenu.h>
#include <libgimp/gimpaspectpreview.h>
#include <libgimp/gimpbrushmenu.h>
#include <libgimp/gimpdrawablepreview.h>
#include <libgimp/gimpfontmenu.h>
......@@ -46,7 +47,7 @@ G_BEGIN_DECLS
void gimp_ui_init (const gchar *prog_name,
gboolean preview);
gboolean preview);
G_END_DECLS
......
......@@ -29,6 +29,7 @@ G_BEGIN_DECLS
/* For information look into the html documentation */
typedef struct _GimpAspectPreview GimpAspectPreview;
typedef struct _GimpDrawablePreview GimpDrawablePreview;
typedef struct _GimpProgressBar GimpProgressBar;
......
......@@ -124,6 +124,8 @@ libgimpwidgets_2_0_la_sources = \
gimppreviewarea.h \
gimpquerybox.c \
gimpquerybox.h \
gimpscrolledpreview.c \
gimpscrolledpreview.h \
gimpsizeentry.c \
gimpsizeentry.h \
gimpstock.c \
......@@ -182,6 +184,7 @@ libgimpwidgetsinclude_HEADERS = \
gimppreview.h \
gimppreviewarea.h \
gimpquerybox.h \
gimpscrolledpreview.h \
gimpsizeentry.h \
gimpstock.h \
gimpunitmenu.h
......
This diff is collapsed.
......@@ -48,36 +48,25 @@ struct _GimpPreview
/*< protected >*/
GtkWidget *area;
GtkWidget *table;
GtkWidget *frame;
GtkWidget *hscr;
GtkWidget *vscr;
GtkWidget *nav_icon;
GtkWidget *nav_popup;
GtkWidget *toggle;
GdkCursor *cursor_move;
GdkCursor *cursor_busy;
GdkGC *nav_gc;
/*< private >*/
gint xoff, yoff;
gint xmin, xmax, ymin, ymax;
gint drag_x, drag_y;
gint drag_xoff, drag_yoff;
gint width, height;
gboolean in_drag;
guint timeout_id;
};
struct _GimpPreviewClass
{
GtkVBoxClass parent_class;
/* virtuals */
void (* draw) (GimpPreview *preview);
void (* draw_thumb) (GimpPreview *preview,
GimpPreviewArea *area,
gint width,
gint height);
void (* set_cursor) (GimpPreview *preview);
/* signal */
void (* invalidated) (GimpPreview *preview);
......@@ -99,9 +88,6 @@ void gimp_preview_set_bounds (GimpPreview *preview,
void gimp_preview_get_size (GimpPreview *preview,
gint *width,
gint *height);
void gimp_preview_get_position (GimpPreview *preview,
gint *x,
gint *y);
void gimp_preview_draw (GimpPreview *preview);
void gimp_preview_invalidate (GimpPreview *preview);
......
This diff is collapsed.
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpscrolledpreview.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_SCROLLED_PREVIEW_H__
#define __GIMP_SCROLLED_PREVIEW_H__
#include "gimppreview.h"
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_SCROLLED_PREVIEW (gimp_scrolled_preview_get_type ())
#define GIMP_SCROLLED_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SCROLLED_PREVIEW, GimpScrolledPreview))
#define GIMP_SCROLLED_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SCROLLED_PREVIEW, GimpScrolledPreviewClass))
#define GIMP_IS_SCROLLED_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SCROLLED_PREVIEW))
#define GIMP_IS_SCROLLED_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SCROLLED_PREVIEW))
#define GIMP_SCROLLED_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SCROLLED_PREVIEW, GimpScrolledPreviewClass))
typedef struct _GimpScrolledPreviewClass GimpScrolledPreviewClass;
struct _GimpScrolledPreview
{
GimpPreview parent_instance;
/*< protected >*/
GtkWidget *hscr;
GtkWidget *vscr;
GtkWidget *nav_icon;
GtkWidget *nav_popup;
GdkCursor *cursor_move;
GdkGC *nav_gc;
/*< private >*/
gint xoff, yoff;
gint drag_x, drag_y;
gint drag_xoff, drag_yoff;
gboolean in_drag;
};
struct _GimpScrolledPreviewClass
{
GimpPreviewClass parent_class;
/* virtuals */
void (* draw_thumb) (GimpScrolledPreview *preview,
GimpPreviewArea *area,
gint width,
gint height);
};
GType gimp_scrolled_preview_get_type (void) G_GNUC_CONST;
void gimp_scrolled_preview_get_position (GimpScrolledPreview *preview,
gint *x,
gint *y);
G_END_DECLS
#endif /* __GIMP_SCROLLED_PREVIEW_H__ */
......@@ -83,6 +83,7 @@ typedef struct _GimpPickButton GimpPickButton;
typedef struct _GimpPreview GimpPreview;
typedef struct _GimpPreviewArea GimpPreviewArea;
typedef struct _GimpPixmap GimpPixmap;
typedef struct _GimpScrolledPreview GimpScrolledPreview;
typedef struct _GimpSizeEntry GimpSizeEntry;
typedef struct _GimpUnitMenu GimpUnitMenu;
......
......@@ -1229,7 +1229,8 @@ dialog_update_preview (GimpPreview *preview)
gint width, height;
gint bytes;
gimp_preview_get_position (preview, &x1, &y1);
gimp_scrolled_preview_get_position (GIMP_SCROLLED_PREVIEW (preview),
&x1, &y1);
gimp_preview_get_size (preview, &width, &height);
bytes =drawable->bpp;
......
......@@ -289,7 +289,8 @@ cartoon (GimpDrawable *drawable,
if (preview)
{
gimp_preview_get_position (GIMP_PREVIEW (preview), &x1, &y1);
gimp_scrolled_preview_get_position (GIMP_SCROLLED_PREVIEW (preview),
&x1, &y1);
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
}