app/perspective_tool.c app/rotate_tool.c app/scale_tool.c app/shear_tool.c

2000-02-21  Michael Natterer  <mitch@gimp.org>

	* app/perspective_tool.c
	* app/rotate_tool.c
	* app/scale_tool.c
	* app/shear_tool.c
	* plug-ins/common/gauss_iir.c
	* plug-ins/common/gauss_rle.c: fix Solaris compilation problems
	reported by Ludovic Poitou <ludovic.poitou@france.sun.com>.

	* libgimp/gimppixmap.[ch]: new function gimp_pixmap_set().

	* plug-ins/gfig/gfig.c: hacked the ui to use the libgimp widgets &
	constructors and slightly reorganized it to use fewer screen
	space (not yet perfect). Did a general namespace & code cleanup.

	* plug-ins/FractalExplorer/FractalExplorer.c: use a GimpPathEditor
	widget.
This commit is contained in:
Michael Natterer 2000-02-21 11:54:33 +00:00 committed by Michael Natterer
parent e42cece9b1
commit 0a5fadee17
21 changed files with 5042 additions and 6144 deletions

View file

@ -31,8 +31,9 @@ struct _GimpPixmap
gchar **xpm_data;
};
static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap);
static GtkPixmapClass *parent_class = NULL;
@ -66,9 +67,7 @@ gimp_pixmap_class_init (GimpPixmapClass *class)
static void
gimp_pixmap_init (GimpPixmap *pixmap)
{
GtkPixmap *gtk_pixmap;
gtk_pixmap = GTK_PIXMAP (pixmap);
pixmap->xpm_data = NULL;
}
GtkType
@ -109,55 +108,95 @@ GtkWidget *
gimp_pixmap_new (gchar **xpm_data)
{
GimpPixmap *pixmap;
gint width, height;
g_return_val_if_fail (xpm_data != NULL, NULL);
if (!xpm_data)
return NULL;
pixmap = gtk_type_new (gimp_pixmap_get_type ());
GTK_PIXMAP (pixmap)->build_insensitive = TRUE;
gimp_pixmap_set (pixmap, xpm_data);
return GTK_WIDGET (pixmap);
}
/**
* gimp_pixmap_new:
* @pixmap: The pixmap widget you want to set the new xpm_data for.
* @xpm_data: A pointer to a XPM data structure as found in XPM files.
*
* Sets a new image for an existing #GimpPixmap widget.
*
*/
void
gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data)
{
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GIMP_IS_PIXMAP (pixmap));
pixmap->xpm_data = xpm_data;
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
GTK_WIDGET (pixmap)->requisition.width = 0;
GTK_WIDGET (pixmap)->requisition.height = 0;
if (! GTK_WIDGET_REALIZED (GTK_WIDGET (pixmap)))
{
g_warning ("passed pointer is no XPM data");
if (xpm_data)
{
gint width, height;
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
{
g_warning ("passed pointer is no XPM data");
}
else
{
GTK_WIDGET (pixmap)->requisition.width =
width + GTK_MISC (pixmap)->xpad * 2;
GTK_WIDGET (pixmap)->requisition.height =
height + GTK_MISC (pixmap)->ypad * 2;
}
}
}
else
{
GTK_WIDGET (pixmap)->requisition.width =
width + GTK_MISC (pixmap)->xpad * 2;
GTK_WIDGET (pixmap)->requisition.height =
height + GTK_MISC (pixmap)->ypad * 2;
gimp_pixmap_create_from_xpm_d (pixmap);
}
return GTK_WIDGET (pixmap);
}
static void
gimp_pixmap_realize (GtkWidget *widget)
{
GimpPixmap *pixmap;
GtkStyle *style;
GdkPixmap *gdk_pixmap;
GdkBitmap *mask;
pixmap = GIMP_PIXMAP (widget);
if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
style = gtk_widget_get_style (widget);
gimp_pixmap_create_from_xpm_d (GIMP_PIXMAP (widget));
}
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
&mask,
&style->bg[GTK_STATE_NORMAL],
pixmap->xpm_data);
static void
gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap)
{
GtkStyle *style;
GdkPixmap *gdk_pixmap = NULL;
GdkBitmap *mask = NULL;
if (pixmap->xpm_data)
{
GtkWidget *widget;
widget = GTK_WIDGET (pixmap);
style = gtk_widget_get_style (widget);
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
&mask,
&style->bg[GTK_STATE_NORMAL],
pixmap->xpm_data);
}
GTK_PIXMAP (pixmap)->build_insensitive = TRUE;
gtk_pixmap_set (GTK_PIXMAP (pixmap), gdk_pixmap, mask);
gdk_pixmap_unref (gdk_pixmap);
gdk_bitmap_unref (mask);
if (gdk_pixmap)
gdk_pixmap_unref (gdk_pixmap);
if (mask)
gdk_bitmap_unref (mask);
}