app: rename GimpImageViewable to GimpImageProxy

We're going to have GimpImageProxy implement GimpPickable, so that
it can be used as either a viewable or a pickable proxy for an
image.

(cherry picked from commit 8d8cc12f40)
This commit is contained in:
Ell
2019-11-03 19:12:55 +02:00
parent defe920d43
commit d1324ad802
7 changed files with 284 additions and 283 deletions

View File

@ -186,7 +186,7 @@ typedef struct _GimpEnvironTable GimpEnvironTable;
typedef struct _GimpHistogram GimpHistogram;
typedef struct _GimpIdTable GimpIdTable;
typedef struct _GimpImagefile GimpImagefile;
typedef struct _GimpImageViewable GimpImageViewable;
typedef struct _GimpImageProxy GimpImageProxy;
typedef struct _GimpInterpreterDB GimpInterpreterDB;
typedef struct _GimpLineArt GimpLineArt;
typedef struct _GimpObjectQueue GimpObjectQueue;

View File

@ -1,7 +1,7 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpimageviewable.c
* gimpimageproxy.c
* Copyright (C) 2019 Ell
*
* This program is free software: you can redistribute it and/or modify
@ -34,7 +34,7 @@
#include "gimpimage.h"
#include "gimpimage-color-profile.h"
#include "gimpimage-preview.h"
#include "gimpimageviewable.h"
#include "gimpimageproxy.h"
#include "gimppickable.h"
#include "gimpprojectable.h"
#include "gimptempbuf.h"
@ -48,7 +48,7 @@ enum
};
struct _GimpImageViewablePrivate
struct _GimpImageProxyPrivate
{
GimpImage *image;
gboolean show_all;
@ -60,86 +60,86 @@ struct _GimpImageViewablePrivate
/* local function prototypes */
static void gimp_image_viewable_finalize (GObject *object);
static void gimp_image_viewable_set_property (GObject *object,
static void gimp_image_proxy_finalize (GObject *object);
static void gimp_image_proxy_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_image_viewable_get_property (GObject *object,
static void gimp_image_proxy_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static gboolean gimp_image_viewable_get_size (GimpViewable *viewable,
static gboolean gimp_image_proxy_get_size (GimpViewable *viewable,
gint *width,
gint *height);
static void gimp_image_viewable_get_preview_size (GimpViewable *viewable,
static void gimp_image_proxy_get_preview_size (GimpViewable *viewable,
gint size,
gboolean is_popup,
gboolean dot_for_dot,
gint *width,
gint *height);
static gboolean gimp_image_viewable_get_popup_size (GimpViewable *viewable,
static gboolean gimp_image_proxy_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static GimpTempBuf * gimp_image_viewable_get_new_preview (GimpViewable *viewable,
static GimpTempBuf * gimp_image_proxy_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
static GdkPixbuf * gimp_image_viewable_get_new_pixbuf (GimpViewable *viewable,
static GdkPixbuf * gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height);
static gchar * gimp_image_viewable_get_description (GimpViewable *viewable,
static gchar * gimp_image_proxy_get_description (GimpViewable *viewable,
gchar **tooltip);
static void gimp_image_viewable_image_frozen_notify (GimpImage *image,
static void gimp_image_proxy_image_frozen_notify (GimpImage *image,
const GParamSpec *pspec,
GimpImageViewable *image_viewable);
static void gimp_image_viewable_image_invalidate_preview (GimpImage *image,
GimpImageViewable *image_viewable);
static void gimp_image_viewable_image_size_changed (GimpImage *image,
GimpImageViewable *image_viewable);
static void gimp_image_viewable_image_bounds_changed (GimpImage *image,
GimpImageProxy *image_proxy);
static void gimp_image_proxy_image_invalidate_preview (GimpImage *image,
GimpImageProxy *image_proxy);
static void gimp_image_proxy_image_size_changed (GimpImage *image,
GimpImageProxy *image_proxy);
static void gimp_image_proxy_image_bounds_changed (GimpImage *image,
gint old_x,
gint old_y,
GimpImageViewable *image_viewable);
GimpImageProxy *image_proxy);
static void gimp_image_viewable_set_image (GimpImageViewable *image_viewable,
static void gimp_image_proxy_set_image (GimpImageProxy *image_proxy,
GimpImage *image);
static void gimp_image_viewable_update_bounding_box (GimpImageViewable *image_viewable);
static void gimp_image_viewable_update_frozen (GimpImageViewable *image_viewable);
static void gimp_image_proxy_update_bounding_box (GimpImageProxy *image_proxy);
static void gimp_image_proxy_update_frozen (GimpImageProxy *image_proxy);
G_DEFINE_TYPE_WITH_PRIVATE (GimpImageViewable, gimp_image_viewable,
G_DEFINE_TYPE_WITH_PRIVATE (GimpImageProxy, gimp_image_proxy,
GIMP_TYPE_VIEWABLE)
#define parent_class gimp_image_viewable_parent_class
#define parent_class gimp_image_proxy_parent_class
/* private functions */
static void
gimp_image_viewable_class_init (GimpImageViewableClass *klass)
static void-
gimp_image_proxy_class_init (GimpImageProxyClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->finalize = gimp_image_viewable_finalize;
object_class->set_property = gimp_image_viewable_set_property;
object_class->get_property = gimp_image_viewable_get_property;
object_class->finalize = gimp_image_proxy_finalize;
object_class->set_property = gimp_image_proxy_set_property;
object_class->get_property = gimp_image_proxy_get_property;
viewable_class->default_icon_name = "gimp-image";
viewable_class->get_size = gimp_image_viewable_get_size;
viewable_class->get_preview_size = gimp_image_viewable_get_preview_size;
viewable_class->get_popup_size = gimp_image_viewable_get_popup_size;
viewable_class->get_new_preview = gimp_image_viewable_get_new_preview;
viewable_class->get_new_pixbuf = gimp_image_viewable_get_new_pixbuf;
viewable_class->get_description = gimp_image_viewable_get_description;
viewable_class->get_size = gimp_image_proxy_get_size;
viewable_class->get_preview_size = gimp_image_proxy_get_preview_size;
viewable_class->get_popup_size = gimp_image_proxy_get_popup_size;
viewable_class->get_new_preview = gimp_image_proxy_get_new_preview;
viewable_class->get_new_pixbuf = gimp_image_proxy_get_new_pixbuf;
viewable_class->get_description = gimp_image_proxy_get_description;
g_object_class_install_property (object_class, PROP_IMAGE,
g_param_spec_object ("image",
@ -157,38 +157,38 @@ gimp_image_viewable_class_init (GimpImageViewableClass *klass)
}
static void
gimp_image_viewable_init (GimpImageViewable *image_viewable)
gimp_image_proxy_init (GimpImageProxy *image_proxy)
{
image_viewable->priv = gimp_image_viewable_get_instance_private (image_viewable);
image_proxy->priv = gimp_image_proxy_get_instance_private (image_proxy);
}
static void
gimp_image_viewable_finalize (GObject *object)
gimp_image_proxy_finalize (GObject *object)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (object);
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (object);
gimp_image_viewable_set_image (image_viewable, NULL);
gimp_image_proxy_set_image (image_proxy, NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_image_viewable_set_property (GObject *object,
gimp_image_proxy_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (object);
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (object);
switch (property_id)
{
case PROP_IMAGE:
gimp_image_viewable_set_image (image_viewable,
gimp_image_proxy_set_image (image_proxy,
g_value_get_object (value));
break;
case PROP_SHOW_ALL:
gimp_image_viewable_set_show_all (image_viewable,
gimp_image_proxy_set_show_all (image_proxy,
g_value_get_boolean (value));
break;
@ -199,23 +199,23 @@ gimp_image_viewable_set_property (GObject *object,
}
static void
gimp_image_viewable_get_property (GObject *object,
gimp_image_proxy_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (object);
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (object);
switch (property_id)
{
case PROP_IMAGE:
g_value_set_object (value,
gimp_image_viewable_get_image (image_viewable));
gimp_image_proxy_get_image (image_proxy));
break;
case PROP_SHOW_ALL:
g_value_set_boolean (value,
gimp_image_viewable_get_show_all (image_viewable));
gimp_image_proxy_get_show_all (image_proxy));
break;
default:
@ -225,28 +225,28 @@ gimp_image_viewable_get_property (GObject *object,
}
static gboolean
gimp_image_viewable_get_size (GimpViewable *viewable,
gimp_image_proxy_get_size (GimpViewable *viewable,
gint *width,
gint *height)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (viewable);
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
*width = image_viewable->priv->bounding_box.width;
*height = image_viewable->priv->bounding_box.height;
*width = image_proxy->priv->bounding_box.width;
*height = image_proxy->priv->bounding_box.height;
return TRUE;
}
static void
gimp_image_viewable_get_preview_size (GimpViewable *viewable,
gimp_image_proxy_get_preview_size (GimpViewable *viewable,
gint size,
gboolean is_popup,
gboolean dot_for_dot,
gint *width,
gint *height)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (viewable);
GimpImage *image = image_viewable->priv->image;
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
GimpImage *image = image_proxy->priv->image;
gdouble xres;
gdouble yres;
gint viewable_width;
@ -269,7 +269,7 @@ gimp_image_viewable_get_preview_size (GimpViewable *viewable,
}
static gboolean
gimp_image_viewable_get_popup_size (GimpViewable *viewable,
gimp_image_proxy_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
@ -307,13 +307,13 @@ gimp_image_viewable_get_popup_size (GimpViewable *viewable,
}
static GimpTempBuf *
gimp_image_viewable_get_new_preview (GimpViewable *viewable,
gimp_image_proxy_get_new_preview (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (viewable);
GimpImage *image = image_viewable->priv->image;
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
GimpImage *image = image_proxy->priv->image;
GimpPickable *pickable;
const Babl *format;
GeglRectangle bounding_box;
@ -322,12 +322,12 @@ gimp_image_viewable_get_new_preview (GimpViewable *viewable,
gdouble scale_y;
gdouble scale;
if (! image_viewable->priv->show_all)
if (! image_proxy->priv->show_all)
pickable = GIMP_PICKABLE (image);
else
pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
bounding_box = gimp_image_viewable_get_bounding_box (image_viewable);
bounding_box = gimp_image_proxy_get_bounding_box (image_proxy);
scale_x = (gdouble) width / (gdouble) bounding_box.width;
scale_y = (gdouble) height / (gdouble) bounding_box.height;
@ -352,13 +352,13 @@ gimp_image_viewable_get_new_preview (GimpViewable *viewable,
}
static GdkPixbuf *
gimp_image_viewable_get_new_pixbuf (GimpViewable *viewable,
gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable,
GimpContext *context,
gint width,
gint height)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (viewable);
GimpImage *image = image_viewable->priv->image;
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
GimpImage *image = image_proxy->priv->image;
GimpPickable *pickable;
GeglRectangle bounding_box;
GdkPixbuf *pixbuf;
@ -367,12 +367,12 @@ gimp_image_viewable_get_new_pixbuf (GimpViewable *viewable,
gdouble scale;
GimpColorTransform *transform;
if (! image_viewable->priv->show_all)
if (! image_proxy->priv->show_all)
pickable = GIMP_PICKABLE (image);
else
pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
bounding_box = gimp_image_viewable_get_bounding_box (image_viewable);
bounding_box = gimp_image_proxy_get_bounding_box (image_proxy);
scale_x = (gdouble) width / (gdouble) bounding_box.width;
scale_y = (gdouble) height / (gdouble) bounding_box.height;
@ -436,11 +436,11 @@ gimp_image_viewable_get_new_pixbuf (GimpViewable *viewable,
}
static gchar *
gimp_image_viewable_get_description (GimpViewable *viewable,
gimp_image_proxy_get_description (GimpViewable *viewable,
gchar **tooltip)
{
GimpImageViewable *image_viewable = GIMP_IMAGE_VIEWABLE (viewable);
GimpImage *image = image_viewable->priv->image;
GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable);
GimpImage *image = image_proxy->priv->image;
if (tooltip)
*tooltip = g_strdup (gimp_image_get_display_path (image));
@ -451,102 +451,102 @@ gimp_image_viewable_get_description (GimpViewable *viewable,
}
static void
gimp_image_viewable_image_frozen_notify (GimpImage *image,
gimp_image_proxy_image_frozen_notify (GimpImage *image,
const GParamSpec *pspec,
GimpImageViewable *image_viewable)
GimpImageProxy *image_proxy)
{
gimp_image_viewable_update_frozen (image_viewable);
gimp_image_proxy_update_frozen (image_proxy);
}
static void
gimp_image_viewable_image_invalidate_preview (GimpImage *image,
GimpImageViewable *image_viewable)
gimp_image_proxy_image_invalidate_preview (GimpImage *image,
GimpImageProxy *image_proxy)
{
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_viewable));
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_proxy));
}
static void
gimp_image_viewable_image_size_changed (GimpImage *image,
GimpImageViewable *image_viewable)
gimp_image_proxy_image_size_changed (GimpImage *image,
GimpImageProxy *image_proxy)
{
gimp_image_viewable_update_bounding_box (image_viewable);
gimp_image_proxy_update_bounding_box (image_proxy);
}
static void
gimp_image_viewable_image_bounds_changed (GimpImage *image,
gimp_image_proxy_image_bounds_changed (GimpImage *image,
gint old_x,
gint old_y,
GimpImageViewable *image_viewable)
GimpImageProxy *image_proxy)
{
gimp_image_viewable_update_bounding_box (image_viewable);
gimp_image_proxy_update_bounding_box (image_proxy);
}
static void
gimp_image_viewable_set_image (GimpImageViewable *image_viewable,
gimp_image_proxy_set_image (GimpImageProxy *image_proxy,
GimpImage *image)
{
if (image_viewable->priv->image)
if (image_proxy->priv->image)
{
g_signal_handlers_disconnect_by_func (
image_viewable->priv->image,
gimp_image_viewable_image_frozen_notify,
image_viewable);
image_proxy->priv->image,
gimp_image_proxy_image_frozen_notify,
image_proxy);
g_signal_handlers_disconnect_by_func (
image_viewable->priv->image,
gimp_image_viewable_image_invalidate_preview,
image_viewable);
image_proxy->priv->image,
gimp_image_proxy_image_invalidate_preview,
image_proxy);
g_signal_handlers_disconnect_by_func (
image_viewable->priv->image,
gimp_image_viewable_image_size_changed,
image_viewable);
image_proxy->priv->image,
gimp_image_proxy_image_size_changed,
image_proxy);
g_signal_handlers_disconnect_by_func (
image_viewable->priv->image,
gimp_image_viewable_image_bounds_changed,
image_viewable);
image_proxy->priv->image,
gimp_image_proxy_image_bounds_changed,
image_proxy);
g_object_unref (image_viewable->priv->image);
g_object_unref (image_proxy->priv->image);
}
image_viewable->priv->image = image;
image_proxy->priv->image = image;
if (image_viewable->priv->image)
if (image_proxy->priv->image)
{
g_object_ref (image_viewable->priv->image);
g_object_ref (image_proxy->priv->image);
g_signal_connect (
image_viewable->priv->image, "notify::frozen",
G_CALLBACK (gimp_image_viewable_image_frozen_notify),
image_viewable);
image_proxy->priv->image, "notify::frozen",
G_CALLBACK (gimp_image_proxy_image_frozen_notify),
image_proxy);
g_signal_connect (
image_viewable->priv->image, "invalidate-preview",
G_CALLBACK (gimp_image_viewable_image_invalidate_preview),
image_viewable);
image_proxy->priv->image, "invalidate-preview",
G_CALLBACK (gimp_image_proxy_image_invalidate_preview),
image_proxy);
g_signal_connect (
image_viewable->priv->image, "size-changed",
G_CALLBACK (gimp_image_viewable_image_size_changed),
image_viewable);
image_proxy->priv->image, "size-changed",
G_CALLBACK (gimp_image_proxy_image_size_changed),
image_proxy);
g_signal_connect (
image_viewable->priv->image, "bounds-changed",
G_CALLBACK (gimp_image_viewable_image_bounds_changed),
image_viewable);
image_proxy->priv->image, "bounds-changed",
G_CALLBACK (gimp_image_proxy_image_bounds_changed),
image_proxy);
gimp_image_viewable_update_bounding_box (image_viewable);
gimp_image_viewable_update_frozen (image_viewable);
gimp_image_proxy_update_bounding_box (image_proxy);
gimp_image_proxy_update_frozen (image_proxy);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_viewable));
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image_proxy));
}
}
static void
gimp_image_viewable_update_bounding_box (GimpImageViewable *image_viewable)
gimp_image_proxy_update_bounding_box (GimpImageProxy *image_proxy)
{
GimpImage *image = image_viewable->priv->image;
GimpImage *image = image_proxy->priv->image;
GeglRectangle bounding_box;
if (gimp_viewable_preview_is_frozen (GIMP_VIEWABLE (image_viewable)))
if (gimp_viewable_preview_is_frozen (GIMP_VIEWABLE (image_proxy)))
return;
if (! image_viewable->priv->show_all)
if (! image_proxy->priv->show_all)
{
bounding_box.x = 0;
bounding_box.y = 0;
@ -560,35 +560,35 @@ gimp_image_viewable_update_bounding_box (GimpImageViewable *image_viewable)
}
if (! gegl_rectangle_equal (&bounding_box,
&image_viewable->priv->bounding_box))
&image_proxy->priv->bounding_box))
{
image_viewable->priv->bounding_box = bounding_box;
image_proxy->priv->bounding_box = bounding_box;
gimp_viewable_size_changed (GIMP_VIEWABLE (image_viewable));
gimp_viewable_size_changed (GIMP_VIEWABLE (image_proxy));
}
}
static void
gimp_image_viewable_update_frozen (GimpImageViewable *image_viewable)
gimp_image_proxy_update_frozen (GimpImageProxy *image_proxy)
{
gboolean frozen;
frozen = gimp_viewable_preview_is_frozen (
GIMP_VIEWABLE (image_viewable->priv->image));
GIMP_VIEWABLE (image_proxy->priv->image));
if (frozen != image_viewable->priv->frozen)
if (frozen != image_proxy->priv->frozen)
{
image_viewable->priv->frozen = frozen;
image_proxy->priv->frozen = frozen;
if (frozen)
{
gimp_viewable_preview_freeze (GIMP_VIEWABLE (image_viewable));
gimp_viewable_preview_freeze (GIMP_VIEWABLE (image_proxy));
}
else
{
gimp_viewable_preview_thaw (GIMP_VIEWABLE (image_viewable));
gimp_viewable_preview_thaw (GIMP_VIEWABLE (image_proxy));
gimp_image_viewable_update_bounding_box (image_viewable);
gimp_image_proxy_update_bounding_box (image_proxy);
}
}
}
@ -597,51 +597,51 @@ gimp_image_viewable_update_frozen (GimpImageViewable *image_viewable)
/* public functions */
GimpImageViewable *
gimp_image_viewable_new (GimpImage *image)
GimpImageProxy *
gimp_image_proxy_new (GimpImage *image)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
return g_object_new (GIMP_TYPE_IMAGE_VIEWABLE,
return g_object_new (GIMP_TYPE_IMAGE_PROXY,
"image", image,
NULL);
}
GimpImage *
gimp_image_viewable_get_image (GimpImageViewable *image_viewable)
gimp_image_proxy_get_image (GimpImageProxy *image_proxy)
{
g_return_val_if_fail (GIMP_IS_IMAGE_VIEWABLE (image_viewable), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE_PROXY (image_proxy), NULL);
return image_viewable->priv->image;
return image_proxy->priv->image;
}
void
gimp_image_viewable_set_show_all (GimpImageViewable *image_viewable,
gimp_image_proxy_set_show_all (GimpImageProxy *image_proxy,
gboolean show_all)
{
g_return_if_fail (GIMP_IS_IMAGE_VIEWABLE (image_viewable));
g_return_if_fail (GIMP_IS_IMAGE_PROXY (image_proxy));
if (show_all != image_viewable->priv->show_all)
if (show_all != image_proxy->priv->show_all)
{
image_viewable->priv->show_all = show_all;
image_proxy->priv->show_all = show_all;
gimp_image_viewable_update_bounding_box (image_viewable);
gimp_image_proxy_update_bounding_box (image_proxy);
}
}
gboolean
gimp_image_viewable_get_show_all (GimpImageViewable *image_viewable)
gimp_image_proxy_get_show_all (GimpImageProxy *image_proxy)
{
g_return_val_if_fail (GIMP_IS_IMAGE_VIEWABLE (image_viewable), FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE_PROXY (image_proxy), FALSE);
return image_viewable->priv->show_all;
return image_proxy->priv->show_all;
}
GeglRectangle
gimp_image_viewable_get_bounding_box (GimpImageViewable *image_viewable)
gimp_image_proxy_get_bounding_box (GimpImageProxy *image_proxy)
{
g_return_val_if_fail (GIMP_IS_IMAGE_VIEWABLE (image_viewable),
g_return_val_if_fail (GIMP_IS_IMAGE_PROXY (image_proxy),
*GEGL_RECTANGLE (0, 0, 0, 0));
return image_viewable->priv->bounding_box;
return image_proxy->priv->bounding_box;
}

View File

@ -1,7 +1,7 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpimageviewable.h
* gimpimageproxy.h
* Copyright (C) 2019 Ell
*
* This program is free software: you can redistribute it and/or modify
@ -18,48 +18,48 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_IMAGE_VIEWABLE_H__
#define __GIMP_IMAGE_VIEWABLE_H__
#ifndef __GIMP_IMAGE_PROXY_H__
#define __GIMP_IMAGE_PROXY_H__
#include "gimpviewable.h"
#define GIMP_TYPE_IMAGE_VIEWABLE (gimp_image_viewable_get_type ())
#define GIMP_IMAGE_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE_VIEWABLE, GimpImageViewable))
#define GIMP_IMAGE_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_IMAGE_VIEWABLE, GimpImageViewableClass))
#define GIMP_IS_IMAGE_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE_VIEWABLE))
#define GIMP_IS_IMAGE_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_IMAGE_VIEWABLE))
#define GIMP_IMAGE_VIEWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_IMAGE_VIEWABLE, GimpImageViewableClass))
#define GIMP_TYPE_IMAGE_PROXY (gimp_image_proxy_get_type ())
#define GIMP_IMAGE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE_PROXY, GimpImageProxy))
#define GIMP_IMAGE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_IMAGE_PROXY, GimpImageProxyClass))
#define GIMP_IS_IMAGE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE_PROXY))
#define GIMP_IS_IMAGE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_IMAGE_PROXY))
#define GIMP_IMAGE_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_IMAGE_PROXY, GimpImageProxyClass))
typedef struct _GimpImageViewablePrivate GimpImageViewablePrivate;
typedef struct _GimpImageViewableClass GimpImageViewableClass;
typedef struct _GimpImageProxyPrivate GimpImageProxyPrivate;
typedef struct _GimpImageProxyClass GimpImageProxyClass;
struct _GimpImageViewable
struct _GimpImageProxy
{
GimpViewable parent_instance;
GimpImageViewablePrivate *priv;
GimpImageProxyPrivate *priv;
};
struct _GimpImageViewableClass
struct _GimpImageProxyClass
{
GimpViewableClass parent_class;
};
GType gimp_image_viewable_get_type (void) G_GNUC_CONST;
GType gimp_image_proxy_get_type (void) G_GNUC_CONST;
GimpImageViewable * gimp_image_viewable_new (GimpImage *image);
GimpImageProxy * gimp_image_proxy_new (GimpImage *image);
GimpImage * gimp_image_viewable_get_image (GimpImageViewable *image_viewable);
GimpImage * gimp_image_proxy_get_image (GimpImageProxy *image_proxy);
void gimp_image_viewable_set_show_all (GimpImageViewable *image_viewable,
void gimp_image_proxy_set_show_all (GimpImageProxy *image_proxy,
gboolean show_all);
gboolean gimp_image_viewable_get_show_all (GimpImageViewable *image_viewable);
gboolean gimp_image_proxy_get_show_all (GimpImageProxy *image_proxy);
GeglRectangle gimp_image_viewable_get_bounding_box (GimpImageViewable *image_viewable);
GeglRectangle gimp_image_proxy_get_bounding_box (GimpImageProxy *image_proxy);
#endif /* __GIMP_IMAGE_VIEWABLE_H__ */
#endif /* __GIMP_IMAGE_PROXY_H__ */

View File

@ -36,7 +36,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimageviewable.h"
#include "core/gimpimageproxy.h"
#include "widgets/gimpdocked.h"
#include "widgets/gimphelp-ids.h"
@ -150,7 +150,7 @@ gimp_navigation_editor_init (GimpNavigationEditor *editor)
editor->view = gimp_view_new_by_types (NULL,
GIMP_TYPE_NAVIGATION_VIEW,
GIMP_TYPE_IMAGE_VIEWABLE,
GIMP_TYPE_IMAGE_PROXY,
GIMP_VIEW_SIZE_MEDIUM, 0, TRUE);
gtk_container_add (GTK_CONTAINER (frame), editor->view);
gtk_widget_show (editor->view);
@ -530,20 +530,20 @@ gimp_navigation_editor_set_shell (GimpNavigationEditor *editor,
{
GimpImage *image = gimp_display_get_image (shell->display);
g_clear_object (&editor->image_viewable);
g_clear_object (&editor->image_proxy);
if (image)
{
editor->image_viewable = gimp_image_viewable_new (image);
editor->image_proxy = gimp_image_proxy_new (image);
g_signal_connect (
editor->image_viewable, "size-changed",
editor->image_proxy, "size-changed",
G_CALLBACK (gimp_navigation_editor_viewable_size_changed),
editor);
}
gimp_view_set_viewable (GIMP_VIEW (editor->view),
GIMP_VIEWABLE (editor->image_viewable));
GIMP_VIEWABLE (editor->image_proxy));
g_signal_connect (editor->shell, "notify::infinite-canvas",
G_CALLBACK (gimp_navigation_editor_shell_infinite_canvas_notify),
@ -575,7 +575,7 @@ gimp_navigation_editor_set_shell (GimpNavigationEditor *editor,
gimp_view_set_viewable (GIMP_VIEW (editor->view), NULL);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
g_clear_object (&editor->image_viewable);
g_clear_object (&editor->image_proxy);
}
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
@ -612,8 +612,8 @@ gimp_navigation_editor_marker_changed (GimpNavigationView *view,
{
GeglRectangle bounding_box;
bounding_box = gimp_image_viewable_get_bounding_box (
GIMP_IMAGE_VIEWABLE (renderer->viewable));
bounding_box = gimp_image_proxy_get_bounding_box (
GIMP_IMAGE_PROXY (renderer->viewable));
center_x += bounding_box.x;
center_y += bounding_box.y;
@ -818,20 +818,20 @@ gimp_navigation_editor_shell_reconnect (GimpDisplayShell *shell,
{
GimpImage *image = gimp_display_get_image (shell->display);
g_clear_object (&editor->image_viewable);
g_clear_object (&editor->image_proxy);
if (image)
{
editor->image_viewable = gimp_image_viewable_new (image);
editor->image_proxy = gimp_image_proxy_new (image);
g_signal_connect (
editor->image_viewable, "size-changed",
editor->image_proxy, "size-changed",
G_CALLBACK (gimp_navigation_editor_viewable_size_changed),
editor);
}
gimp_view_set_viewable (GIMP_VIEW (editor->view),
GIMP_VIEWABLE (editor->image_viewable));
GIMP_VIEWABLE (editor->image_proxy));
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
@ -855,15 +855,15 @@ gimp_navigation_editor_update_marker (GimpNavigationEditor *editor)
gdouble x, y;
gdouble w, h;
image = gimp_image_viewable_get_image (
GIMP_IMAGE_VIEWABLE (renderer->viewable));
image = gimp_image_proxy_get_image (
GIMP_IMAGE_PROXY (renderer->viewable));
gimp_image_viewable_set_show_all (
GIMP_IMAGE_VIEWABLE (renderer->viewable),
gimp_image_proxy_set_show_all (
GIMP_IMAGE_PROXY (renderer->viewable),
gimp_display_shell_get_infinite_canvas (shell));
bounding_box = gimp_image_viewable_get_bounding_box (
GIMP_IMAGE_VIEWABLE (renderer->viewable));
bounding_box = gimp_image_proxy_get_bounding_box (
GIMP_IMAGE_PROXY (renderer->viewable));
gimp_display_shell_scroll_get_viewport (shell, &x, &y, &w, &h);
gimp_display_shell_untransform_xy_f (shell,

View File

@ -45,7 +45,7 @@ struct _GimpNavigationEditor
GimpContext *context;
GimpDisplayShell *shell;
GimpImageViewable *image_viewable;
GimpImageProxy *image_proxy;
GtkWidget *view;
GtkWidget *zoom_label;

View File

@ -30,7 +30,8 @@
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimpimagefile.h"
#include "core/gimpimageviewable.h"
#include "core/gimpimageproxy.h"
#include "core/gimplayer.h"
#include "core/gimppalette.h"
@ -64,7 +65,7 @@ gimp_view_renderer_type_from_viewable_type (GType viewable_type)
type = GIMP_TYPE_VIEW_RENDERER_BUFFER;
}
else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGE) ||
g_type_is_a (viewable_type, GIMP_TYPE_IMAGE_VIEWABLE))
g_type_is_a (viewable_type, GIMP_TYPE_IMAGE_PROXY))
{
type = GIMP_TYPE_VIEW_RENDERER_IMAGE;
}

View File

@ -28,7 +28,7 @@
#include "widgets-types.h"
#include "core/gimpimage.h"
#include "core/gimpimageviewable.h"
#include "core/gimpimageproxy.h"
#include "core/gimptempbuf.h"
#include "gimpviewrendererimage.h"
@ -72,10 +72,10 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer,
{
image = GIMP_IMAGE (renderer->viewable);
}
else if (GIMP_IS_IMAGE_VIEWABLE (renderer->viewable))
else if (GIMP_IS_IMAGE_PROXY (renderer->viewable))
{
image = gimp_image_viewable_get_image (
GIMP_IMAGE_VIEWABLE (renderer->viewable));
image = gimp_image_proxy_get_image (
GIMP_IMAGE_PROXY (renderer->viewable));
}
else
{