2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-02-05 06:10:54 +08:00
|
|
|
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2003-04-13 03:06:25 +08:00
|
|
|
* gimpviewable.c
|
2001-04-22 08:38:56 +08:00
|
|
|
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2001-02-05 06:10:54 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2003-04-13 03:06:25 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
#include <glib-object.h>
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core-types.h"
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/temp-buf.h"
|
|
|
|
|
2003-11-25 20:53:29 +08:00
|
|
|
#include "gimp-utils.h"
|
2006-08-30 05:44:51 +08:00
|
|
|
#include "gimpcontext.h"
|
2001-02-05 06:10:54 +08:00
|
|
|
#include "gimpmarshal.h"
|
|
|
|
#include "gimpviewable.h"
|
|
|
|
|
2004-02-11 02:07:47 +08:00
|
|
|
#include "themes/Default/images/gimp-core-pixbufs.h"
|
|
|
|
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2003-04-05 01:32:08 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2007-11-15 18:26:25 +08:00
|
|
|
PROP_STOCK_ID,
|
|
|
|
PROP_FROZEN
|
2003-04-05 01:32:08 +08:00
|
|
|
};
|
|
|
|
|
2001-02-05 06:10:54 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
INVALIDATE_PREVIEW,
|
2001-06-18 21:10:03 +08:00
|
|
|
SIZE_CHANGED,
|
2001-02-05 06:10:54 +08:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static void gimp_viewable_config_iface_init (GimpConfigInterface *iface);
|
2001-05-07 00:14:34 +08:00
|
|
|
|
2003-04-09 00:01:01 +08:00
|
|
|
static void gimp_viewable_finalize (GObject *object);
|
|
|
|
static void gimp_viewable_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_viewable_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2003-02-27 00:15:50 +08:00
|
|
|
|
2003-11-17 01:51:36 +08:00
|
|
|
static gint64 gimp_viewable_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2003-04-09 00:01:01 +08:00
|
|
|
static void gimp_viewable_real_invalidate_preview (GimpViewable *viewable);
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
static GdkPixbuf * gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
GimpContext *context,
|
2004-05-13 20:15:10 +08:00
|
|
|
gint width,
|
|
|
|
gint height);
|
2003-04-09 00:01:01 +08:00
|
|
|
static void gimp_viewable_real_get_preview_size (GimpViewable *viewable,
|
|
|
|
gint size,
|
|
|
|
gboolean popup,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
2005-05-25 18:05:17 +08:00
|
|
|
static gboolean gimp_viewable_real_get_popup_size (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *popup_width,
|
|
|
|
gint *popup_height);
|
2003-04-09 00:01:01 +08:00
|
|
|
static gchar * gimp_viewable_real_get_description (GimpViewable *viewable,
|
|
|
|
gchar **tooltip);
|
2003-10-11 22:30:18 +08:00
|
|
|
static gboolean gimp_viewable_serialize_property (GimpConfig *config,
|
2003-04-13 03:06:25 +08:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpConfigWriter *writer);
|
2003-02-22 03:03:19 +08:00
|
|
|
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpViewable, gimp_viewable, GIMP_TYPE_OBJECT,
|
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
2006-05-15 17:46:31 +08:00
|
|
|
gimp_viewable_config_iface_init))
|
2002-09-03 01:35:16 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
#define parent_class gimp_viewable_parent_class
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static guint viewable_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
static GQuark quark_preview_temp_buf = 0;
|
|
|
|
static GQuark quark_preview_pixbuf = 0;
|
2001-02-05 06:10:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_viewable_class_init (GimpViewableClass *klass)
|
|
|
|
{
|
2004-07-15 17:53:17 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2002-09-03 01:35:16 +08:00
|
|
|
quark_preview_temp_buf = g_quark_from_static_string ("viewable-preview-temp-buf");
|
|
|
|
quark_preview_pixbuf = g_quark_from_static_string ("viewable-preview-pixbuf");
|
|
|
|
|
2001-02-05 06:10:54 +08:00
|
|
|
viewable_signals[INVALIDATE_PREVIEW] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("invalidate-preview",
|
2004-07-15 07:41:41 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpViewableClass, invalidate_preview),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
viewable_signals[SIZE_CHANGED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("size-changed",
|
2004-07-15 07:41:41 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpViewableClass, size_changed),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2003-02-27 00:15:50 +08:00
|
|
|
object_class->finalize = gimp_viewable_finalize;
|
2003-04-05 01:32:08 +08:00
|
|
|
object_class->get_property = gimp_viewable_get_property;
|
|
|
|
object_class->set_property = gimp_viewable_set_property;
|
2003-02-27 00:15:50 +08:00
|
|
|
|
2002-01-31 00:14:26 +08:00
|
|
|
gimp_object_class->get_memsize = gimp_viewable_get_memsize;
|
2001-08-07 20:42:23 +08:00
|
|
|
|
2003-03-07 00:47:34 +08:00
|
|
|
klass->default_stock_id = "gimp-question";
|
2005-05-27 21:05:26 +08:00
|
|
|
klass->name_changed_signal = "name-changed";
|
2002-04-29 07:10:42 +08:00
|
|
|
|
2002-01-31 00:14:26 +08:00
|
|
|
klass->invalidate_preview = gimp_viewable_real_invalidate_preview;
|
|
|
|
klass->size_changed = NULL;
|
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
klass->get_size = NULL;
|
2003-02-22 03:03:19 +08:00
|
|
|
klass->get_preview_size = gimp_viewable_real_get_preview_size;
|
2005-05-25 18:05:17 +08:00
|
|
|
klass->get_popup_size = gimp_viewable_real_get_popup_size;
|
2002-01-31 00:14:26 +08:00
|
|
|
klass->get_preview = NULL;
|
|
|
|
klass->get_new_preview = NULL;
|
2004-05-13 20:15:10 +08:00
|
|
|
klass->get_pixbuf = NULL;
|
|
|
|
klass->get_new_pixbuf = gimp_viewable_real_get_new_pixbuf;
|
2003-04-09 00:01:01 +08:00
|
|
|
klass->get_description = gimp_viewable_real_get_description;
|
2003-04-05 01:32:08 +08:00
|
|
|
|
|
|
|
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_STOCK_ID, "stock-id",
|
2006-01-19 04:29:40 +08:00
|
|
|
NULL, NULL,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2007-11-15 18:26:25 +08:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_FROZEN,
|
|
|
|
g_param_spec_boolean ("frozen",
|
|
|
|
NULL, NULL,
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READABLE));
|
2001-02-05 06:10:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_viewable_init (GimpViewable *viewable)
|
|
|
|
{
|
2007-10-26 22:42:58 +08:00
|
|
|
viewable->stock_id = NULL;
|
|
|
|
viewable->freeze_count = 0;
|
2003-02-27 00:15:50 +08:00
|
|
|
}
|
|
|
|
|
2003-04-13 03:06:25 +08:00
|
|
|
static void
|
2005-12-11 03:24:36 +08:00
|
|
|
gimp_viewable_config_iface_init (GimpConfigInterface *iface)
|
2003-04-13 03:06:25 +08:00
|
|
|
{
|
2005-12-11 03:24:36 +08:00
|
|
|
iface->serialize_property = gimp_viewable_serialize_property;
|
2003-04-13 03:06:25 +08:00
|
|
|
}
|
|
|
|
|
2003-02-27 00:15:50 +08:00
|
|
|
static void
|
|
|
|
gimp_viewable_finalize (GObject *object)
|
|
|
|
{
|
2004-02-11 02:07:47 +08:00
|
|
|
GimpViewable *viewable = GIMP_VIEWABLE (object);
|
2003-02-27 00:15:50 +08:00
|
|
|
|
|
|
|
if (viewable->stock_id)
|
|
|
|
{
|
|
|
|
g_free (viewable->stock_id);
|
|
|
|
viewable->stock_id = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-02-05 06:10:54 +08:00
|
|
|
}
|
|
|
|
|
2003-04-05 01:32:08 +08:00
|
|
|
static void
|
|
|
|
gimp_viewable_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2007-11-15 18:26:25 +08:00
|
|
|
GimpViewable *viewable = GIMP_VIEWABLE (object);
|
|
|
|
|
2003-04-05 01:32:08 +08:00
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_STOCK_ID:
|
2007-11-15 18:26:25 +08:00
|
|
|
gimp_viewable_set_stock_id (viewable, g_value_get_string (value));
|
2003-04-05 01:32:08 +08:00
|
|
|
break;
|
2007-11-15 18:26:25 +08:00
|
|
|
case PROP_FROZEN:
|
|
|
|
/* read-only, fall through */
|
|
|
|
|
2003-04-05 01:32:08 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
2003-08-25 18:49:33 +08:00
|
|
|
break;
|
2003-04-05 01:32:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_viewable_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2007-11-15 18:26:25 +08:00
|
|
|
GimpViewable *viewable = GIMP_VIEWABLE (object);
|
|
|
|
|
2003-04-05 01:32:08 +08:00
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_STOCK_ID:
|
2007-11-15 18:26:25 +08:00
|
|
|
g_value_set_string (value, gimp_viewable_get_stock_id (viewable));
|
|
|
|
break;
|
|
|
|
case PROP_FROZEN:
|
|
|
|
g_value_set_boolean (value, gimp_viewable_preview_is_frozen (viewable));
|
2003-04-05 01:32:08 +08:00
|
|
|
break;
|
2007-11-15 18:26:25 +08:00
|
|
|
|
2003-04-05 01:32:08 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
2003-08-25 18:49:33 +08:00
|
|
|
}
|
2003-04-05 01:32:08 +08:00
|
|
|
}
|
|
|
|
|
2003-11-17 01:51:36 +08:00
|
|
|
static gint64
|
2003-08-25 18:49:33 +08:00
|
|
|
gimp_viewable_get_memsize (GimpObject *object,
|
2003-11-17 01:51:36 +08:00
|
|
|
gint64 *gui_size)
|
2002-01-31 00:14:26 +08:00
|
|
|
{
|
|
|
|
TempBuf *temp_buf;
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
2002-09-03 01:35:16 +08:00
|
|
|
temp_buf = g_object_get_qdata (G_OBJECT (object), quark_preview_temp_buf);
|
|
|
|
pixbuf = g_object_get_qdata (G_OBJECT (object), quark_preview_pixbuf);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2007-11-17 02:19:30 +08:00
|
|
|
*gui_size += temp_buf_get_memsize (temp_buf);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
|
|
|
if (pixbuf)
|
|
|
|
{
|
|
|
|
static gsize pixbuf_instance_size = 0;
|
|
|
|
|
|
|
|
if (! pixbuf_instance_size)
|
|
|
|
{
|
|
|
|
GTypeQuery type_query;
|
|
|
|
|
|
|
|
g_type_query (G_TYPE_FROM_INSTANCE (pixbuf), &type_query);
|
|
|
|
|
|
|
|
pixbuf_instance_size = type_query.instance_size;
|
|
|
|
}
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
*gui_size += (pixbuf_instance_size +
|
2004-02-14 09:12:19 +08:00
|
|
|
(gsize) gdk_pixbuf_get_height (pixbuf) *
|
|
|
|
gdk_pixbuf_get_rowstride (pixbuf));
|
2002-01-31 00:14:26 +08:00
|
|
|
}
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
return GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, gui_size);
|
2002-01-31 00:14:26 +08:00
|
|
|
}
|
|
|
|
|
2003-02-22 03:03:19 +08:00
|
|
|
static void
|
|
|
|
gimp_viewable_real_invalidate_preview (GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
g_object_set_qdata (G_OBJECT (viewable), quark_preview_temp_buf, NULL);
|
|
|
|
g_object_set_qdata (G_OBJECT (viewable), quark_preview_pixbuf, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_viewable_real_get_preview_size (GimpViewable *viewable,
|
|
|
|
gint size,
|
|
|
|
gboolean popup,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *width,
|
|
|
|
gint *height)
|
|
|
|
{
|
|
|
|
*width = size;
|
|
|
|
*height = size;
|
|
|
|
}
|
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_viewable_real_get_popup_size (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *popup_width,
|
|
|
|
gint *popup_height)
|
|
|
|
{
|
|
|
|
gint w, h;
|
|
|
|
|
|
|
|
if (gimp_viewable_get_size (viewable, &w, &h))
|
|
|
|
{
|
|
|
|
if (w > width || h > height)
|
|
|
|
{
|
|
|
|
*popup_width = w;
|
|
|
|
*popup_height = h;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
static GdkPixbuf *
|
|
|
|
gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
GimpContext *context,
|
2004-05-13 20:15:10 +08:00
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
|
|
|
TempBuf *temp_buf;
|
|
|
|
GdkPixbuf *pixbuf = NULL;
|
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
temp_buf = gimp_viewable_get_preview (viewable, context, width, height);
|
2004-05-13 20:15:10 +08:00
|
|
|
|
|
|
|
if (temp_buf)
|
|
|
|
{
|
|
|
|
TempBuf *color_buf = NULL;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
gint bytes;
|
|
|
|
|
|
|
|
bytes = temp_buf->bytes;
|
|
|
|
width = temp_buf->width;
|
|
|
|
height = temp_buf->height;
|
|
|
|
|
|
|
|
if (bytes == 1 || bytes == 2)
|
|
|
|
{
|
|
|
|
gint color_bytes;
|
|
|
|
|
|
|
|
color_bytes = (bytes == 2) ? 4 : 3;
|
|
|
|
|
|
|
|
color_buf = temp_buf_new (width, height, color_bytes, 0, 0, NULL);
|
|
|
|
temp_buf_copy (temp_buf, color_buf);
|
|
|
|
|
|
|
|
temp_buf = color_buf;
|
|
|
|
bytes = color_bytes;
|
|
|
|
}
|
|
|
|
|
2008-12-13 18:35:53 +08:00
|
|
|
pixbuf = gdk_pixbuf_new_from_data (g_memdup (temp_buf_get_data (temp_buf),
|
2004-05-13 20:15:10 +08:00
|
|
|
width * height * bytes),
|
|
|
|
GDK_COLORSPACE_RGB,
|
|
|
|
(bytes == 4),
|
|
|
|
8,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
width * bytes,
|
|
|
|
(GdkPixbufDestroyNotify) g_free,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (color_buf)
|
|
|
|
temp_buf_free (color_buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return pixbuf;
|
|
|
|
}
|
|
|
|
|
2003-04-09 00:01:01 +08:00
|
|
|
static gchar *
|
|
|
|
gimp_viewable_real_get_description (GimpViewable *viewable,
|
|
|
|
gchar **tooltip)
|
|
|
|
{
|
|
|
|
return g_strdup (gimp_object_get_name (GIMP_OBJECT (viewable)));
|
|
|
|
}
|
|
|
|
|
2003-04-13 03:06:25 +08:00
|
|
|
static gboolean
|
2003-10-11 22:30:18 +08:00
|
|
|
gimp_viewable_serialize_property (GimpConfig *config,
|
2003-04-13 03:06:25 +08:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
GimpConfigWriter *writer)
|
|
|
|
{
|
2003-10-11 22:30:18 +08:00
|
|
|
GimpViewable *viewable = GIMP_VIEWABLE (config);
|
2003-04-13 03:06:25 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_STOCK_ID:
|
|
|
|
if (viewable->stock_id)
|
|
|
|
{
|
|
|
|
gimp_config_writer_open (writer, pspec->name);
|
|
|
|
gimp_config_writer_string (writer, viewable->stock_id);
|
|
|
|
gimp_config_writer_close (writer);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_invalidate_preview:
|
|
|
|
* @viewable: a viewable object
|
|
|
|
*
|
|
|
|
* Causes any cached preview to be marked as invalid, so that a new
|
|
|
|
* preview will be generated at the next attempt to display one.
|
2004-07-15 17:53:17 +08:00
|
|
|
**/
|
2001-02-05 06:10:54 +08:00
|
|
|
void
|
|
|
|
gimp_viewable_invalidate_preview (GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
|
|
|
|
2007-10-26 22:42:58 +08:00
|
|
|
if (viewable->freeze_count == 0)
|
|
|
|
g_signal_emit (viewable, viewable_signals[INVALIDATE_PREVIEW], 0);
|
2001-02-05 06:10:54 +08:00
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_size_changed:
|
|
|
|
* @viewable: a viewable object
|
|
|
|
*
|
|
|
|
* This function sends a signal that is handled at a lower level in the
|
|
|
|
* object hierarchy, and provides a mechanism by which objects derived
|
|
|
|
* from #GimpViewable can respond to size changes.
|
2004-07-15 17:53:17 +08:00
|
|
|
**/
|
2001-06-18 21:10:03 +08:00
|
|
|
void
|
|
|
|
gimp_viewable_size_changed (GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (viewable, viewable_signals[SIZE_CHANGED], 0);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_calc_preview_size:
|
2004-07-15 17:53:17 +08:00
|
|
|
* @aspect_width: unscaled width of the preview for an item.
|
2004-07-15 07:41:41 +08:00
|
|
|
* @aspect_height: unscaled height of the preview for an item.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: maximum available width for scaled preview.
|
|
|
|
* @height: maximum available height for scaled preview.
|
|
|
|
* @dot_for_dot: if #TRUE, ignore any differences in axis resolution.
|
|
|
|
* @xresolution: resolution in the horizontal direction.
|
|
|
|
* @yresolution: resolution in the vertical direction.
|
|
|
|
* @return_width: place to return the calculated preview width.
|
|
|
|
* @return_height: place to return the calculated preview height.
|
|
|
|
* @scaling_up: returns #TRUE here if the calculated preview size
|
|
|
|
* is larger than the viewable itself.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* A utility function, for calculating the dimensions of a preview
|
|
|
|
* based on the information specified in the arguments. The arguments
|
|
|
|
* @aspect_width and @aspect_height are the dimensions of the unscaled
|
|
|
|
* preview. The arguments @width and @height represent the maximum
|
|
|
|
* width and height that the scaled preview must fit into. The
|
|
|
|
* preview is scaled to be as large as possible without exceeding
|
|
|
|
* these constraints.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* If @dot_for_dot is #TRUE, and @xresolution and @yresolution are
|
|
|
|
* different, then these results are corrected for the difference in
|
|
|
|
* resolution on the two axes, so that the requested aspect ratio
|
|
|
|
* applies to the appearance of the display rather than to pixel
|
|
|
|
* counts.
|
|
|
|
**/
|
2003-02-22 03:03:19 +08:00
|
|
|
void
|
2003-11-17 21:34:38 +08:00
|
|
|
gimp_viewable_calc_preview_size (gint aspect_width,
|
|
|
|
gint aspect_height,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gdouble xresolution,
|
|
|
|
gdouble yresolution,
|
|
|
|
gint *return_width,
|
|
|
|
gint *return_height,
|
|
|
|
gboolean *scaling_up)
|
2003-02-22 03:03:19 +08:00
|
|
|
{
|
|
|
|
gdouble xratio;
|
|
|
|
gdouble yratio;
|
|
|
|
|
|
|
|
if (aspect_width > aspect_height)
|
|
|
|
{
|
|
|
|
xratio = yratio = (gdouble) width / (gdouble) aspect_width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xratio = yratio = (gdouble) height / (gdouble) aspect_height;
|
|
|
|
}
|
|
|
|
|
2004-02-18 00:56:48 +08:00
|
|
|
if (! dot_for_dot && xresolution != yresolution)
|
2003-02-22 03:03:19 +08:00
|
|
|
{
|
|
|
|
yratio *= xresolution / yresolution;
|
|
|
|
}
|
|
|
|
|
|
|
|
width = RINT (xratio * (gdouble) aspect_width);
|
|
|
|
height = RINT (yratio * (gdouble) aspect_height);
|
|
|
|
|
|
|
|
if (width < 1) width = 1;
|
|
|
|
if (height < 1) height = 1;
|
|
|
|
|
|
|
|
if (return_width) *return_width = width;
|
|
|
|
if (return_height) *return_height = height;
|
2003-04-01 21:53:47 +08:00
|
|
|
if (scaling_up) *scaling_up = (xratio > 1.0) || (yratio > 1.0);
|
2003-02-22 03:03:19 +08:00
|
|
|
}
|
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
gboolean
|
|
|
|
gimp_viewable_get_size (GimpViewable *viewable,
|
|
|
|
gint *width,
|
|
|
|
gint *height)
|
|
|
|
{
|
|
|
|
GimpViewableClass *viewable_class;
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
gint w = 0;
|
|
|
|
gint h = 0;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), FALSE);
|
|
|
|
|
|
|
|
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
|
|
|
|
|
|
|
if (viewable_class->get_size)
|
|
|
|
retval = viewable_class->get_size (viewable, &w, &h);
|
|
|
|
|
|
|
|
if (width) *width = w;
|
|
|
|
if (height) *height = h;
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_preview_size:
|
2004-07-15 17:53:17 +08:00
|
|
|
* @viewable: the object for which to calculate the preview size.
|
|
|
|
* @size: requested size for preview.
|
|
|
|
* @popup: %TRUE if the preview is intended for a popup window.
|
2004-07-15 07:41:41 +08:00
|
|
|
* @dot_for_dot: If #TRUE, ignore any differences in X and Y resolution.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: return location for the the calculated width.
|
|
|
|
* @height: return location for the calculated height.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* Retrieve the size of a viewable's preview. By default, this
|
|
|
|
* simply returns the value of the @size argument for both the @width
|
|
|
|
* and @height, but this can be overridden in objects derived from
|
|
|
|
* #GimpViewable. If either the width or height exceeds
|
2004-07-15 07:41:41 +08:00
|
|
|
* #GIMP_VIEWABLE_MAX_PREVIEW_SIZE, they are silently truncated.
|
2004-07-15 17:53:17 +08:00
|
|
|
**/
|
2003-02-22 03:03:19 +08:00
|
|
|
void
|
|
|
|
gimp_viewable_get_preview_size (GimpViewable *viewable,
|
|
|
|
gint size,
|
|
|
|
gboolean popup,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *width,
|
|
|
|
gint *height)
|
2001-05-07 00:14:34 +08:00
|
|
|
{
|
2003-04-01 21:53:47 +08:00
|
|
|
gint w, h;
|
|
|
|
|
2001-05-07 00:14:34 +08:00
|
|
|
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
2003-02-22 03:03:19 +08:00
|
|
|
g_return_if_fail (size > 0);
|
2001-05-07 00:14:34 +08:00
|
|
|
|
2003-02-22 03:03:19 +08:00
|
|
|
GIMP_VIEWABLE_GET_CLASS (viewable)->get_preview_size (viewable, size,
|
|
|
|
popup, dot_for_dot,
|
2003-04-01 21:53:47 +08:00
|
|
|
&w, &h);
|
|
|
|
|
|
|
|
w = MIN (w, GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
|
|
|
|
h = MIN (h, GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
|
|
|
|
|
|
|
|
if (width) *width = w;
|
|
|
|
if (height) *height = h;
|
|
|
|
|
2001-05-07 00:14:34 +08:00
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_popup_size:
|
2004-07-15 17:53:17 +08:00
|
|
|
* @viewable: the object for which to calculate the popup size.
|
|
|
|
* @width: the width of the preview from which the popup will be shown.
|
|
|
|
* @height: the height of the preview from which the popup will be shown.
|
|
|
|
* @dot_for_dot: If #TRUE, ignore any differences in X and Y resolution.
|
|
|
|
* @popup_width: return location for the calculated popup width.
|
|
|
|
* @popup_height: return location for the calculated popup height.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* Calculate the size of a viewable's preview, for use in making a
|
|
|
|
* popup. The arguments @width and @height specify the size of the
|
|
|
|
* preview from which the popup will be shown.
|
|
|
|
*
|
|
|
|
* Returns: Whether the viewable wants a popup to be shown. Usually
|
|
|
|
* %TRUE if the passed preview size is smaller than the viewable
|
|
|
|
* size, and %FALSE if the viewable completely fits into the
|
|
|
|
* original preview.
|
|
|
|
**/
|
2003-02-27 21:59:41 +08:00
|
|
|
gboolean
|
|
|
|
gimp_viewable_get_popup_size (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gboolean dot_for_dot,
|
|
|
|
gint *popup_width,
|
|
|
|
gint *popup_height)
|
|
|
|
{
|
2005-05-25 18:05:17 +08:00
|
|
|
gint w, h;
|
2003-02-27 21:59:41 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), FALSE);
|
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
if (GIMP_VIEWABLE_GET_CLASS (viewable)->get_popup_size (viewable,
|
|
|
|
width, height,
|
|
|
|
dot_for_dot,
|
|
|
|
&w, &h))
|
2003-02-27 21:59:41 +08:00
|
|
|
{
|
2005-05-25 18:05:17 +08:00
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
|
|
|
|
|
|
|
/* limit the popup to 2 * GIMP_VIEWABLE_MAX_POPUP_SIZE
|
|
|
|
* on each axis.
|
|
|
|
*/
|
|
|
|
if ((w > (2 * GIMP_VIEWABLE_MAX_POPUP_SIZE)) ||
|
|
|
|
(h > (2 * GIMP_VIEWABLE_MAX_POPUP_SIZE)))
|
|
|
|
{
|
|
|
|
gimp_viewable_calc_preview_size (w, h,
|
|
|
|
2 * GIMP_VIEWABLE_MAX_POPUP_SIZE,
|
|
|
|
2 * GIMP_VIEWABLE_MAX_POPUP_SIZE,
|
|
|
|
dot_for_dot, 1.0, 1.0,
|
|
|
|
&w, &h, NULL);
|
|
|
|
}
|
2003-02-27 21:59:41 +08:00
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
/* limit the number of pixels to
|
|
|
|
* GIMP_VIEWABLE_MAX_POPUP_SIZE ^ 2
|
|
|
|
*/
|
|
|
|
if ((w * h) > SQR (GIMP_VIEWABLE_MAX_POPUP_SIZE))
|
2003-04-01 21:53:47 +08:00
|
|
|
{
|
2005-05-25 18:05:17 +08:00
|
|
|
gdouble factor;
|
2003-02-27 21:59:41 +08:00
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
factor = sqrt (((gdouble) (w * h) /
|
|
|
|
(gdouble) SQR (GIMP_VIEWABLE_MAX_POPUP_SIZE)));
|
|
|
|
|
|
|
|
w = RINT ((gdouble) w / factor);
|
|
|
|
h = RINT ((gdouble) h / factor);
|
2003-04-01 21:53:47 +08:00
|
|
|
}
|
2005-05-25 18:05:17 +08:00
|
|
|
|
|
|
|
if (w < 1) w = 1;
|
|
|
|
if (h < 1) h = 1;
|
|
|
|
|
|
|
|
if (popup_width) *popup_width = w;
|
|
|
|
if (popup_height) *popup_height = h;
|
|
|
|
|
|
|
|
return TRUE;
|
2003-02-27 21:59:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_preview:
|
|
|
|
* @viewable: The viewable object to get a preview for.
|
2006-08-30 05:44:51 +08:00
|
|
|
* @context: The context to render the preview for.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: desired width for the preview
|
|
|
|
* @height: desired height for the preview
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Gets a preview for a viewable object, by running through a variety
|
2004-07-15 17:53:17 +08:00
|
|
|
* of methods until it finds one that works. First, if an
|
|
|
|
* implementation exists of a "get_preview" method, it is tried, and
|
|
|
|
* the result is returned if it is not #NULL. Second, the function
|
|
|
|
* checks to see whether there is a cached preview with the correct
|
|
|
|
* dimensions; if so, it is returned. If neither of these works, then
|
|
|
|
* the function looks for an implementation of the "get_new_preview"
|
|
|
|
* method, and executes it, caching the result. If everything fails,
|
|
|
|
* #NULL is returned.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Returns: A #TempBuf containg the preview image, or #NULL if none can
|
2004-07-15 17:53:17 +08:00
|
|
|
* be found or created.
|
|
|
|
**/
|
2001-02-05 06:10:54 +08:00
|
|
|
TempBuf *
|
2001-02-07 08:06:58 +08:00
|
|
|
gimp_viewable_get_preview (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
GimpContext *context,
|
2004-07-15 07:41:41 +08:00
|
|
|
gint width,
|
|
|
|
gint height)
|
2001-02-05 06:10:54 +08:00
|
|
|
{
|
2001-08-07 20:42:23 +08:00
|
|
|
GimpViewableClass *viewable_class;
|
|
|
|
TempBuf *temp_buf = NULL;
|
2001-02-05 06:10:54 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
2006-08-30 05:44:51 +08:00
|
|
|
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
2001-02-05 06:10:54 +08:00
|
|
|
g_return_val_if_fail (width > 0, NULL);
|
|
|
|
g_return_val_if_fail (height > 0, NULL);
|
|
|
|
|
2007-09-13 21:30:21 +08:00
|
|
|
if (G_UNLIKELY (context == NULL))
|
2006-08-30 05:44:51 +08:00
|
|
|
g_warning ("%s: context is NULL", G_STRFUNC);
|
|
|
|
|
2001-08-07 20:42:23 +08:00
|
|
|
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
|
|
|
|
|
|
|
if (viewable_class->get_preview)
|
2006-08-30 05:44:51 +08:00
|
|
|
temp_buf = viewable_class->get_preview (viewable, context, width, height);
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2001-02-06 05:52:57 +08:00
|
|
|
if (temp_buf)
|
|
|
|
return temp_buf;
|
|
|
|
|
2002-09-03 01:35:16 +08:00
|
|
|
temp_buf = g_object_get_qdata (G_OBJECT (viewable), quark_preview_temp_buf);
|
2001-02-06 05:52:57 +08:00
|
|
|
|
2001-05-07 00:14:34 +08:00
|
|
|
if (temp_buf &&
|
|
|
|
temp_buf->width == width &&
|
|
|
|
temp_buf->height == height)
|
|
|
|
return temp_buf;
|
2001-02-06 05:52:57 +08:00
|
|
|
|
2001-05-07 00:14:34 +08:00
|
|
|
temp_buf = NULL;
|
2001-02-06 05:52:57 +08:00
|
|
|
|
2001-08-07 20:42:23 +08:00
|
|
|
if (viewable_class->get_new_preview)
|
2006-08-30 05:44:51 +08:00
|
|
|
temp_buf = viewable_class->get_new_preview (viewable, context,
|
|
|
|
width, height);
|
2001-02-06 05:52:57 +08:00
|
|
|
|
2002-09-03 01:35:16 +08:00
|
|
|
g_object_set_qdata_full (G_OBJECT (viewable), quark_preview_temp_buf,
|
|
|
|
temp_buf,
|
|
|
|
(GDestroyNotify) temp_buf_free);
|
2001-02-06 05:52:57 +08:00
|
|
|
|
2001-02-05 06:10:54 +08:00
|
|
|
return temp_buf;
|
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_new_preview:
|
|
|
|
* @viewable: The viewable object to get a preview for.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: desired width for the preview
|
|
|
|
* @height: desired height for the preview
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* Gets a new preview for a viewable object. Similar to
|
|
|
|
* gimp_viewable_get_preview(), except that it tries things in a
|
|
|
|
* different order, first looking for a "get_new_preview" method, and
|
|
|
|
* then if that fails for a "get_preview" method. This function does
|
|
|
|
* not look for a cached preview.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Returns: A #TempBuf containg the preview image, or #NULL if none can
|
2004-07-15 17:53:17 +08:00
|
|
|
* be found or created.
|
|
|
|
**/
|
2001-02-05 06:10:54 +08:00
|
|
|
TempBuf *
|
2001-02-07 08:06:58 +08:00
|
|
|
gimp_viewable_get_new_preview (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
GimpContext *context,
|
2004-07-15 07:41:41 +08:00
|
|
|
gint width,
|
|
|
|
gint height)
|
2001-02-05 06:10:54 +08:00
|
|
|
{
|
2001-08-07 20:42:23 +08:00
|
|
|
GimpViewableClass *viewable_class;
|
|
|
|
TempBuf *temp_buf = NULL;
|
2001-02-05 06:10:54 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
2006-08-30 05:44:51 +08:00
|
|
|
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
2001-02-05 06:10:54 +08:00
|
|
|
g_return_val_if_fail (width > 0, NULL);
|
|
|
|
g_return_val_if_fail (height > 0, NULL);
|
|
|
|
|
2007-09-13 21:30:21 +08:00
|
|
|
if (G_UNLIKELY (context == NULL))
|
2006-08-30 05:44:51 +08:00
|
|
|
g_warning ("%s: context is NULL", G_STRFUNC);
|
|
|
|
|
2001-08-07 20:42:23 +08:00
|
|
|
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
|
|
|
|
|
|
|
if (viewable_class->get_new_preview)
|
2006-08-30 05:44:51 +08:00
|
|
|
temp_buf = viewable_class->get_new_preview (viewable, context,
|
|
|
|
width, height);
|
2001-02-05 06:10:54 +08:00
|
|
|
|
|
|
|
if (temp_buf)
|
|
|
|
return temp_buf;
|
|
|
|
|
2001-08-07 20:42:23 +08:00
|
|
|
if (viewable_class->get_preview)
|
2006-08-30 05:44:51 +08:00
|
|
|
temp_buf = viewable_class->get_preview (viewable, context,
|
|
|
|
width, height);
|
2001-02-05 06:10:54 +08:00
|
|
|
|
|
|
|
if (temp_buf)
|
|
|
|
return temp_buf_copy (temp_buf, NULL);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_dummy_preview:
|
|
|
|
* @viewable: viewable object for which to get a dummy preview.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: width of the preview.
|
|
|
|
* @height: height of the preview.
|
|
|
|
* @bpp: bytes per pixel for the preview, must be 3 or 4.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Creates a dummy preview the fits into the specified dimensions,
|
2004-07-15 17:53:17 +08:00
|
|
|
* containing a default "question" symbol. This function is used to
|
|
|
|
* generate a preview in situations where layer previews have been
|
2004-07-15 07:41:41 +08:00
|
|
|
* disabled in the current Gimp configuration.
|
|
|
|
*
|
|
|
|
* Returns: a #TempBuf containing the preview image.
|
2004-07-15 17:53:17 +08:00
|
|
|
**/
|
2004-02-10 23:33:37 +08:00
|
|
|
TempBuf *
|
|
|
|
gimp_viewable_get_dummy_preview (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bpp)
|
|
|
|
{
|
2004-02-11 02:07:47 +08:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
TempBuf *buf;
|
|
|
|
guchar *src;
|
|
|
|
guchar *dest;
|
2004-02-10 23:33:37 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
|
|
|
g_return_val_if_fail (width > 0, NULL);
|
|
|
|
g_return_val_if_fail (height > 0, NULL);
|
2004-02-11 02:07:47 +08:00
|
|
|
g_return_val_if_fail (bpp == 3 || bpp == 4, NULL);
|
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
pixbuf = gimp_viewable_get_dummy_pixbuf (viewable, width, height, bpp);
|
2004-02-11 02:07:47 +08:00
|
|
|
|
|
|
|
buf = temp_buf_new (width, height, bpp, 0, 0, NULL);
|
|
|
|
|
|
|
|
src = gdk_pixbuf_get_pixels (pixbuf);
|
2008-12-13 18:35:53 +08:00
|
|
|
dest = temp_buf_get_data (buf);
|
2004-02-11 02:07:47 +08:00
|
|
|
|
|
|
|
while (height--)
|
|
|
|
{
|
|
|
|
memcpy (dest, src, width * bpp);
|
|
|
|
|
|
|
|
src += gdk_pixbuf_get_rowstride (pixbuf);
|
|
|
|
dest += width * bpp;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref (pixbuf);
|
2004-02-10 23:33:37 +08:00
|
|
|
|
2004-02-11 02:07:47 +08:00
|
|
|
return buf;
|
2004-02-10 23:33:37 +08:00
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_pixbuf:
|
|
|
|
* @viewable: The viewable object to get a pixbuf preview for.
|
2006-08-30 05:44:51 +08:00
|
|
|
* @context: The context to render the preview for.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: desired width for the preview
|
|
|
|
* @height: desired height for the preview
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Gets a preview for a viewable object, by running through a variety
|
2004-07-15 17:53:17 +08:00
|
|
|
* of methods until it finds one that works. First, if an
|
|
|
|
* implementation exists of a "get_pixbuf" method, it is tried, and
|
|
|
|
* the result is returned if it is not #NULL. Second, the function
|
|
|
|
* checks to see whether there is a cached preview with the correct
|
|
|
|
* dimensions; if so, it is returned. If neither of these works, then
|
|
|
|
* the function looks for an implementation of the "get_new_pixbuf"
|
|
|
|
* method, and executes it, caching the result. If everything fails,
|
|
|
|
* #NULL is returned.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Returns: A #GdkPixbuf containing the preview pixbuf, or #NULL if none can
|
2004-07-15 17:53:17 +08:00
|
|
|
* be found or created.
|
|
|
|
**/
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
GdkPixbuf *
|
2004-05-13 20:15:10 +08:00
|
|
|
gimp_viewable_get_pixbuf (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
GimpContext *context,
|
2004-05-13 20:15:10 +08:00
|
|
|
gint width,
|
|
|
|
gint height)
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
{
|
2004-05-13 20:15:10 +08:00
|
|
|
GimpViewableClass *viewable_class;
|
|
|
|
GdkPixbuf *pixbuf = NULL;
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
2006-08-30 05:44:51 +08:00
|
|
|
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
g_return_val_if_fail (width > 0, NULL);
|
|
|
|
g_return_val_if_fail (height > 0, NULL);
|
|
|
|
|
2007-09-13 21:30:21 +08:00
|
|
|
if (G_UNLIKELY (context == NULL))
|
2006-08-30 05:44:51 +08:00
|
|
|
g_warning ("%s: context is NULL", G_STRFUNC);
|
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
|
|
|
|
|
|
|
if (viewable_class->get_pixbuf)
|
2006-08-30 05:44:51 +08:00
|
|
|
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height);
|
2004-05-13 20:15:10 +08:00
|
|
|
|
|
|
|
if (pixbuf)
|
|
|
|
return pixbuf;
|
|
|
|
|
2002-09-03 01:35:16 +08:00
|
|
|
pixbuf = g_object_get_qdata (G_OBJECT (viewable), quark_preview_pixbuf);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
|
|
|
if (pixbuf &&
|
2004-05-13 20:15:10 +08:00
|
|
|
gdk_pixbuf_get_width (pixbuf) == width &&
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
gdk_pixbuf_get_height (pixbuf) == height)
|
2004-05-13 20:15:10 +08:00
|
|
|
return pixbuf;
|
|
|
|
|
|
|
|
pixbuf = NULL;
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
if (viewable_class->get_new_pixbuf)
|
2006-08-30 05:44:51 +08:00
|
|
|
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2002-09-03 01:35:16 +08:00
|
|
|
g_object_set_qdata_full (G_OBJECT (viewable), quark_preview_pixbuf,
|
|
|
|
pixbuf,
|
|
|
|
(GDestroyNotify) g_object_unref);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
|
|
|
return pixbuf;
|
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_new_pixbuf:
|
|
|
|
* @viewable: The viewable object to get a new pixbuf preview for.
|
2006-08-30 05:44:51 +08:00
|
|
|
* @context: The context to render the preview for.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: desired width for the pixbuf
|
|
|
|
* @height: desired height for the pixbuf
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* Gets a new preview for a viewable object. Similar to
|
|
|
|
* gimp_viewable_get_pixbuf(), except that it tries things in a
|
|
|
|
* different order, first looking for a "get_new_pixbuf" method, and
|
|
|
|
* then if that fails for a "get_pixbuf" method. This function does
|
|
|
|
* not look for a cached pixbuf.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Returns: A #GdkPixbuf containing the preview, or #NULL if none can
|
2004-07-15 17:53:17 +08:00
|
|
|
* be created.
|
|
|
|
**/
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
GdkPixbuf *
|
2004-05-13 20:15:10 +08:00
|
|
|
gimp_viewable_get_new_pixbuf (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
GimpContext *context,
|
2004-05-13 20:15:10 +08:00
|
|
|
gint width,
|
|
|
|
gint height)
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
{
|
2004-05-13 20:15:10 +08:00
|
|
|
GimpViewableClass *viewable_class;
|
|
|
|
GdkPixbuf *pixbuf = NULL;
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
2006-08-30 05:44:51 +08:00
|
|
|
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
g_return_val_if_fail (width > 0, NULL);
|
|
|
|
g_return_val_if_fail (height > 0, NULL);
|
|
|
|
|
2007-09-13 21:30:21 +08:00
|
|
|
if (G_UNLIKELY (context == NULL))
|
2006-08-30 05:44:51 +08:00
|
|
|
g_warning ("%s: context is NULL", G_STRFUNC);
|
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
if (viewable_class->get_new_pixbuf)
|
2006-08-30 05:44:51 +08:00
|
|
|
pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
if (pixbuf)
|
|
|
|
return pixbuf;
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
if (viewable_class->get_pixbuf)
|
2006-08-30 05:44:51 +08:00
|
|
|
pixbuf = viewable_class->get_pixbuf (viewable, context, width, height);
|
2002-04-17 04:25:27 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
if (pixbuf)
|
|
|
|
return gdk_pixbuf_copy (pixbuf);
|
2002-04-17 04:25:27 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
2002-04-17 04:25:27 +08:00
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_dummy_pixbuf:
|
|
|
|
* @viewable: the viewable object for which to create a dummy representation.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @width: maximum permitted width for the pixbuf.
|
|
|
|
* @height: maximum permitted height for the pixbuf.
|
|
|
|
* @bpp: bytes per pixel for the pixbuf, must equal 3 or 4.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* Creates a pixbuf containing a default "question" symbol, sized to
|
|
|
|
* fit into the specified dimensions. The depth of the pixbuf must be
|
|
|
|
* 3 or 4 because #GdkPixbuf does not support grayscale. This
|
|
|
|
* function is used to generate a preview in situations where
|
|
|
|
* previewing has been disabled in the current Gimp configuration.
|
|
|
|
* [Note: this function is currently unused except internally to
|
|
|
|
* #GimpViewable -- consider making it static?]
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Returns: the created #GdkPixbuf.
|
2004-07-15 17:53:17 +08:00
|
|
|
**/
|
2004-05-13 20:15:10 +08:00
|
|
|
GdkPixbuf *
|
|
|
|
gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bpp)
|
|
|
|
{
|
|
|
|
GdkPixbuf *icon;
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
gdouble ratio;
|
|
|
|
gint w, h;
|
2002-04-17 04:25:27 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
|
|
|
g_return_val_if_fail (width > 0, NULL);
|
|
|
|
g_return_val_if_fail (height > 0, NULL);
|
|
|
|
g_return_val_if_fail (bpp == 3 || bpp == 4, NULL);
|
2002-04-17 04:25:27 +08:00
|
|
|
|
2004-05-13 20:15:10 +08:00
|
|
|
icon = gdk_pixbuf_new_from_inline (-1, stock_question_64, FALSE, NULL);
|
|
|
|
|
|
|
|
g_return_val_if_fail (icon != NULL, NULL);
|
|
|
|
|
|
|
|
w = gdk_pixbuf_get_width (icon);
|
|
|
|
h = gdk_pixbuf_get_height (icon);
|
|
|
|
|
|
|
|
ratio = (gdouble) MIN (width, height) / (gdouble) MAX (w, h);
|
|
|
|
ratio = MIN (ratio, 1.0);
|
|
|
|
|
|
|
|
w = RINT (ratio * (gdouble) w);
|
|
|
|
h = RINT (ratio * (gdouble) h);
|
|
|
|
|
|
|
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, (bpp == 4), 8, width, height);
|
|
|
|
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
|
|
|
|
|
|
|
if (w && h)
|
|
|
|
gdk_pixbuf_composite (icon, pixbuf,
|
|
|
|
(width - w) / 2, (height - h) / 2, w, h,
|
|
|
|
(width - w) / 2, (height - h) / 2, ratio, ratio,
|
|
|
|
GDK_INTERP_BILINEAR, 0xFF);
|
|
|
|
|
|
|
|
g_object_unref (icon);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
|
|
|
return pixbuf;
|
|
|
|
}
|
2003-02-27 02:08:26 +08:00
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_description:
|
|
|
|
* @viewable: viewable object for which to retrieve a description.
|
2004-07-15 17:53:17 +08:00
|
|
|
* @tooltip: return loaction for an optional tooltip string.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Retrieves a string containing a description of the viewable object,
|
2004-07-15 17:53:17 +08:00
|
|
|
* By default, it simply returns the name of the object, but this can
|
|
|
|
* be overridden by object types that inherit from #GimpViewable.
|
2004-07-15 07:41:41 +08:00
|
|
|
*
|
|
|
|
* Returns: a copy of the description string. This should be freed
|
2004-07-15 17:53:17 +08:00
|
|
|
* when it is no longer needed.
|
|
|
|
**/
|
2003-04-09 00:01:01 +08:00
|
|
|
gchar *
|
|
|
|
gimp_viewable_get_description (GimpViewable *viewable,
|
|
|
|
gchar **tooltip)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
|
|
|
|
2005-10-10 07:05:25 +08:00
|
|
|
if (tooltip)
|
|
|
|
*tooltip = NULL;
|
|
|
|
|
2003-04-09 00:01:01 +08:00
|
|
|
return GIMP_VIEWABLE_GET_CLASS (viewable)->get_description (viewable,
|
|
|
|
tooltip);
|
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_get_stock_id:
|
|
|
|
* @viewable: viewable object for which to retrieve a stock ID.
|
|
|
|
*
|
|
|
|
* Gets the current value of the object's stock ID, for use in
|
|
|
|
* constructing an iconic representation of the object.
|
|
|
|
*
|
|
|
|
* Returns: a pointer to the string containing the stock ID. The
|
2004-07-15 17:53:17 +08:00
|
|
|
* contents must not be altered or freed.
|
|
|
|
**/
|
2003-02-27 02:08:26 +08:00
|
|
|
const gchar *
|
|
|
|
gimp_viewable_get_stock_id (GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
|
|
|
|
|
|
|
if (viewable->stock_id)
|
|
|
|
return (const gchar *) viewable->stock_id;
|
|
|
|
|
|
|
|
return GIMP_VIEWABLE_GET_CLASS (viewable)->default_stock_id;
|
|
|
|
}
|
|
|
|
|
2004-07-15 07:41:41 +08:00
|
|
|
/**
|
|
|
|
* gimp_viewable_set_stock_id:
|
|
|
|
* @viewable: viewable object to assign the specified stock ID.
|
|
|
|
* @stock_id: string containing a stock identifier.
|
|
|
|
*
|
2004-07-15 17:53:17 +08:00
|
|
|
* Seta the object's stock ID, for use in constructing iconic smbols
|
|
|
|
* of the object. The contents of @stock_id are copied, so you can
|
|
|
|
* free it when you are done with it.
|
|
|
|
**/
|
2003-02-27 02:08:26 +08:00
|
|
|
void
|
|
|
|
gimp_viewable_set_stock_id (GimpViewable *viewable,
|
|
|
|
const gchar *stock_id)
|
|
|
|
{
|
2003-04-13 03:06:25 +08:00
|
|
|
GimpViewableClass *viewable_class;
|
|
|
|
|
2003-02-27 02:08:26 +08:00
|
|
|
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
|
|
|
|
|
|
|
g_free (viewable->stock_id);
|
2003-04-13 03:06:25 +08:00
|
|
|
viewable->stock_id = NULL;
|
|
|
|
|
|
|
|
viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable);
|
|
|
|
|
|
|
|
if (stock_id)
|
|
|
|
{
|
|
|
|
if (viewable_class->default_stock_id == NULL ||
|
|
|
|
strcmp (stock_id, viewable_class->default_stock_id))
|
|
|
|
viewable->stock_id = g_strdup (stock_id);
|
|
|
|
}
|
2003-04-05 01:32:08 +08:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (viewable), "stock-id");
|
2003-02-27 02:08:26 +08:00
|
|
|
}
|
2007-10-26 22:42:58 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_viewable_preview_freeze (GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
|
|
|
|
|
|
|
viewable->freeze_count++;
|
2007-11-15 18:26:25 +08:00
|
|
|
|
|
|
|
if (viewable->freeze_count == 1)
|
|
|
|
g_object_notify (G_OBJECT (viewable), "frozen");
|
2007-10-26 22:42:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_viewable_preview_thaw (GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
|
|
|
g_return_if_fail (viewable->freeze_count > 0);
|
|
|
|
|
|
|
|
viewable->freeze_count--;
|
|
|
|
|
|
|
|
if (viewable->freeze_count == 0)
|
2007-11-15 18:26:25 +08:00
|
|
|
{
|
|
|
|
gimp_viewable_invalidate_preview (viewable);
|
|
|
|
g_object_notify (G_OBJECT (viewable), "frozen");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_viewable_preview_is_frozen (GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), FALSE);
|
|
|
|
|
|
|
|
return viewable->freeze_count != 0;
|
2007-10-26 22:42:58 +08:00
|
|
|
}
|