converted tabs to spaces.

2006-04-12  Sven Neumann  <sven@gimp.org>

	* libgimp*/gimp*.[ch]: converted tabs to spaces.
This commit is contained in:
Sven Neumann 2006-04-12 10:53:28 +00:00 committed by Sven Neumann
parent 8ed41a7c60
commit f2df31a50e
101 changed files with 2720 additions and 2716 deletions

View File

@ -1,3 +1,7 @@
2006-04-12 Sven Neumann <sven@gimp.org>
* libgimp*/gimp*.[ch]: converted tabs to spaces.
2006-04-12 Sven Neumann <sven@gimp.org> 2006-04-12 Sven Neumann <sven@gimp.org>
* tools/pdbgen/lib.pl: create code with spaces instead of tabs. * tools/pdbgen/lib.pl: create code with spaces instead of tabs.

View File

@ -42,13 +42,13 @@ enum
static void gimp_aspect_preview_get_property (GObject *object, static void gimp_aspect_preview_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_aspect_preview_set_property (GObject *object, static void gimp_aspect_preview_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_aspect_preview_style_set (GtkWidget *widget, static void gimp_aspect_preview_style_set (GtkWidget *widget,
GtkStyle *prev_style); GtkStyle *prev_style);
static void gimp_aspect_preview_draw (GimpPreview *preview); static void gimp_aspect_preview_draw (GimpPreview *preview);
@ -57,7 +57,7 @@ static void gimp_aspect_preview_draw_buffer (GimpPreview *preview,
gint rowstride); gint rowstride);
static void gimp_aspect_preview_set_drawable (GimpAspectPreview *preview, static void gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
GimpDrawable *drawable); GimpDrawable *drawable);
G_DEFINE_TYPE (GimpAspectPreview, gimp_aspect_preview, GIMP_TYPE_PREVIEW); G_DEFINE_TYPE (GimpAspectPreview, gimp_aspect_preview, GIMP_TYPE_PREVIEW);
@ -87,8 +87,8 @@ gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
*/ */
g_object_class_install_property (object_class, PROP_DRAWABLE, g_object_class_install_property (object_class, PROP_DRAWABLE,
g_param_spec_pointer ("drawable", NULL, NULL, g_param_spec_pointer ("drawable", NULL, NULL,
GIMP_PARAM_READWRITE | GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY)); G_PARAM_CONSTRUCT_ONLY));
} }
static void static void
@ -102,9 +102,9 @@ gimp_aspect_preview_init (GimpAspectPreview *preview)
static void static void
gimp_aspect_preview_get_property (GObject *object, gimp_aspect_preview_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (object); GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (object);
@ -122,9 +122,9 @@ gimp_aspect_preview_get_property (GObject *object,
static void static void
gimp_aspect_preview_set_property (GObject *object, gimp_aspect_preview_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (object); GimpAspectPreview *preview = GIMP_ASPECT_PREVIEW (object);
@ -132,7 +132,7 @@ gimp_aspect_preview_set_property (GObject *object,
{ {
case PROP_DRAWABLE: case PROP_DRAWABLE:
gimp_aspect_preview_set_drawable (preview, gimp_aspect_preview_set_drawable (preview,
g_value_get_pointer (value)); g_value_get_pointer (value));
break; break;
default: default:
@ -238,7 +238,7 @@ gimp_aspect_preview_draw_buffer (GimpPreview *preview,
static void static void
gimp_aspect_preview_set_drawable (GimpAspectPreview *preview, gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
GimpDrawable *drawable) GimpDrawable *drawable)
{ {
gint width, height; gint width, height;
gint max_width, max_height; gint max_width, max_height;
@ -259,12 +259,12 @@ gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
max_width = (width * max_height) / height; max_width = (width * max_height) / height;
} }
gimp_preview_set_bounds (GIMP_PREVIEW (preview), gimp_preview_set_bounds (GIMP_PREVIEW (preview),
0, 0, max_width, max_height); 0, 0, max_width, max_height);
if (height > 0) if (height > 0)
g_object_set (GIMP_PREVIEW (preview)->frame, g_object_set (GIMP_PREVIEW (preview)->frame,
"ratio", (gdouble) width / (gdouble) height, "ratio", (gdouble) width / (gdouble) height,
NULL); NULL);
} }
static void static void
@ -295,8 +295,8 @@ gimp_aspect_preview_new (GimpDrawable *drawable,
g_return_val_if_fail (drawable != NULL, NULL); g_return_val_if_fail (drawable != NULL, NULL);
preview = g_object_new (GIMP_TYPE_ASPECT_PREVIEW, preview = g_object_new (GIMP_TYPE_ASPECT_PREVIEW,
"drawable", drawable, "drawable", drawable,
NULL); NULL);
if (toggle) if (toggle)
{ {

View File

@ -376,10 +376,10 @@ gimp_brush_select_widget_clicked (GtkWidget *widget,
{ {
/* calling gimp_brushes_set_popup() raises the dialog */ /* calling gimp_brushes_set_popup() raises the dialog */
gimp_brushes_set_popup (brush_sel->temp_brush_callback, gimp_brushes_set_popup (brush_sel->temp_brush_callback,
brush_sel->brush_name, brush_sel->brush_name,
brush_sel->opacity, brush_sel->opacity,
brush_sel->spacing, brush_sel->spacing,
brush_sel->paint_mode); brush_sel->paint_mode);
} }
else else
{ {
@ -433,30 +433,30 @@ gimp_brush_select_preview_events (GtkWidget *widget,
if (brush_sel->mask_data) if (brush_sel->mask_data)
{ {
switch (event->type) switch (event->type)
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event; bevent = (GdkEventButton *) event;
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_add (widget); gtk_grab_add (widget);
gimp_brush_select_popup_open (brush_sel, bevent->x, bevent->y); gimp_brush_select_popup_open (brush_sel, bevent->x, bevent->y);
} }
break; break;
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
bevent = (GdkEventButton *) event; bevent = (GdkEventButton *) event;
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_remove (widget); gtk_grab_remove (widget);
gimp_brush_select_popup_close (brush_sel); gimp_brush_select_popup_close (brush_sel);
} }
break; break;
default: default:
break; break;
} }
} }
return FALSE; return FALSE;

View File

@ -86,17 +86,17 @@ gimp_brush_select_new (const gchar *title,
gchar *brush_callback = gimp_procedural_db_temp_name (); gchar *brush_callback = gimp_procedural_db_temp_name ();
gimp_install_temp_proc (brush_callback, gimp_install_temp_proc (brush_callback,
"Temporary brush popup callback procedure", "Temporary brush popup callback procedure",
"", "",
"Andy Thomas", "Andy Thomas",
"Andy Thomas", "Andy Thomas",
"1997", "1997",
NULL, NULL,
"RGB*, GRAY*", "RGB*, GRAY*",
GIMP_TEMPORARY, GIMP_TEMPORARY,
G_N_ELEMENTS (args), 0, G_N_ELEMENTS (args), 0,
args, NULL, args, NULL,
gimp_temp_brush_run); gimp_temp_brush_run);
if (gimp_brushes_popup (brush_callback, title, brush_name, if (gimp_brushes_popup (brush_callback, title, brush_name,
opacity, spacing, paint_mode)) opacity, spacing, paint_mode))

View File

@ -47,16 +47,16 @@
*/ */
gint32 gint32
gimp_channel_new (gint32 image_ID, gimp_channel_new (gint32 image_ID,
const gchar *name, const gchar *name,
guint width, guint width,
guint height, guint height,
gdouble opacity, gdouble opacity,
const GimpRGB *color) const GimpRGB *color)
{ {
return _gimp_channel_new (image_ID, return _gimp_channel_new (image_ID,
width, width,
height, height,
name, name,
opacity, opacity,
color); color);
} }

View File

@ -28,11 +28,11 @@ G_BEGIN_DECLS
gint32 gimp_channel_new (gint32 image_ID, gint32 gimp_channel_new (gint32 image_ID,
const gchar *name, const gchar *name,
guint width, guint width,
guint height, guint height,
gdouble opacity, gdouble opacity,
const GimpRGB *color); const GimpRGB *color);
G_END_DECLS G_END_DECLS

View File

@ -145,9 +145,9 @@ gimp_drawable_flush (GimpDrawable *drawable)
GimpTile * GimpTile *
gimp_drawable_get_tile (GimpDrawable *drawable, gimp_drawable_get_tile (GimpDrawable *drawable,
gboolean shadow, gboolean shadow,
gint row, gint row,
gint col) gint col)
{ {
GimpTile *tiles; GimpTile *tiles;
guint right_tile; guint right_tile;
@ -210,9 +210,9 @@ gimp_drawable_get_tile (GimpDrawable *drawable,
GimpTile * GimpTile *
gimp_drawable_get_tile2 (GimpDrawable *drawable, gimp_drawable_get_tile2 (GimpDrawable *drawable,
gboolean shadow, gboolean shadow,
gint x, gint x,
gint y) gint y)
{ {
gint row; gint row;
gint col; gint col;
@ -264,9 +264,9 @@ gimp_drawable_get_color_uchar (gint32 drawable_ID,
guchar * guchar *
gimp_drawable_get_thumbnail_data (gint32 drawable_ID, gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint *width, gint *width,
gint *height, gint *height,
gint *bpp) gint *bpp)
{ {
gint ret_width; gint ret_width;
gint ret_height; gint ret_height;
@ -274,13 +274,13 @@ gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint data_size; gint data_size;
_gimp_drawable_thumbnail (drawable_ID, _gimp_drawable_thumbnail (drawable_ID,
*width, *width,
*height, *height,
&ret_width, &ret_width,
&ret_height, &ret_height,
bpp, bpp,
&data_size, &data_size,
&image_data); &image_data);
*width = ret_width; *width = ret_width;
*height = ret_height; *height = ret_height;
@ -338,10 +338,10 @@ gimp_drawable_get_sub_thumbnail_data (gint32 drawable_ID,
*/ */
gboolean gboolean
gimp_drawable_attach_new_parasite (gint32 drawable_ID, gimp_drawable_attach_new_parasite (gint32 drawable_ID,
const gchar *name, const gchar *name,
gint flags, gint flags,
gint size, gint size,
gconstpointer data) gconstpointer data)
{ {
GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); GimpParasite *parasite = gimp_parasite_new (name, flags, size, data);
gboolean success; gboolean success;

View File

@ -190,7 +190,7 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
G_DEFINE_TYPE(GimpChannelComboBox, G_DEFINE_TYPE(GimpChannelComboBox,
gimp_channel_combo_box, gimp_channel_combo_box,
GIMP_TYPE_INT_COMBO_BOX); GIMP_TYPE_INT_COMBO_BOX);
static void static void
gimp_channel_combo_box_class_init (GimpChannelComboBoxClass *klass) gimp_channel_combo_box_class_init (GimpChannelComboBoxClass *klass)
@ -269,7 +269,7 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
G_DEFINE_TYPE(GimpLayerComboBox, G_DEFINE_TYPE(GimpLayerComboBox,
gimp_layer_combo_box, gimp_layer_combo_box,
GIMP_TYPE_INT_COMBO_BOX); GIMP_TYPE_INT_COMBO_BOX);
static void static void
gimp_layer_combo_box_class_init (GimpLayerComboBoxClass *klass) gimp_layer_combo_box_class_init (GimpLayerComboBoxClass *klass)

View File

@ -48,17 +48,17 @@ typedef struct
static GObject * gimp_drawable_preview_constructor (GType type, static GObject * gimp_drawable_preview_constructor (GType type,
guint n_params, guint n_params,
GObjectConstructParam *params); GObjectConstructParam *params);
static void gimp_drawable_preview_get_property (GObject *object, static void gimp_drawable_preview_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_drawable_preview_set_property (GObject *object, static void gimp_drawable_preview_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_drawable_preview_destroy (GtkObject *object); static void gimp_drawable_preview_destroy (GtkObject *object);
static void gimp_drawable_preview_style_set (GtkWidget *widget, static void gimp_drawable_preview_style_set (GtkWidget *widget,
@ -74,7 +74,7 @@ static void gimp_drawable_preview_draw_buffer (GimpPreview *preview,
gint rowstride); gint rowstride);
static void gimp_drawable_preview_set_drawable (GimpDrawablePreview *preview, static void gimp_drawable_preview_set_drawable (GimpDrawablePreview *preview,
GimpDrawable *drawable); GimpDrawable *drawable);
G_DEFINE_TYPE (GimpDrawablePreview, gimp_drawable_preview, G_DEFINE_TYPE (GimpDrawablePreview, gimp_drawable_preview,
@ -110,8 +110,8 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
*/ */
g_object_class_install_property (object_class, PROP_DRAWABLE, g_object_class_install_property (object_class, PROP_DRAWABLE,
g_param_spec_pointer ("drawable", NULL, NULL, g_param_spec_pointer ("drawable", NULL, NULL,
GIMP_PARAM_READWRITE | GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY)); G_PARAM_CONSTRUCT_ONLY));
} }
static void static void
@ -125,8 +125,8 @@ gimp_drawable_preview_init (GimpDrawablePreview *preview)
static GObject * static GObject *
gimp_drawable_preview_constructor (GType type, gimp_drawable_preview_constructor (GType type,
guint n_params, guint n_params,
GObjectConstructParam *params) GObjectConstructParam *params)
{ {
GObject *object; GObject *object;
PreviewSettings settings; PreviewSettings settings;
@ -145,9 +145,9 @@ gimp_drawable_preview_constructor (GType type,
static void static void
gimp_drawable_preview_get_property (GObject *object, gimp_drawable_preview_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpDrawablePreview *preview = GIMP_DRAWABLE_PREVIEW (object); GimpDrawablePreview *preview = GIMP_DRAWABLE_PREVIEW (object);
@ -155,7 +155,7 @@ gimp_drawable_preview_get_property (GObject *object,
{ {
case PROP_DRAWABLE: case PROP_DRAWABLE:
g_value_set_pointer (value, g_value_set_pointer (value,
gimp_drawable_preview_get_drawable (preview)); gimp_drawable_preview_get_drawable (preview));
break; break;
default: default:
@ -166,9 +166,9 @@ gimp_drawable_preview_get_property (GObject *object,
static void static void
gimp_drawable_preview_set_property (GObject *object, gimp_drawable_preview_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpDrawablePreview *preview = GIMP_DRAWABLE_PREVIEW (object); GimpDrawablePreview *preview = GIMP_DRAWABLE_PREVIEW (object);
@ -176,7 +176,7 @@ gimp_drawable_preview_set_property (GObject *object,
{ {
case PROP_DRAWABLE: case PROP_DRAWABLE:
gimp_drawable_preview_set_drawable (preview, gimp_drawable_preview_set_drawable (preview,
g_value_get_pointer (value)); g_value_get_pointer (value));
break; break;
default: default:
@ -277,9 +277,9 @@ gimp_drawable_preview_draw_thumb (GimpPreview *preview,
void void
_gimp_drawable_preview_area_draw_thumb (GimpPreviewArea *area, _gimp_drawable_preview_area_draw_thumb (GimpPreviewArea *area,
GimpDrawable *drawable, GimpDrawable *drawable,
gint width, gint width,
gint height) gint height)
{ {
guchar *buffer; guchar *buffer;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
@ -317,13 +317,13 @@ _gimp_drawable_preview_area_draw_thumb (GimpPreviewArea *area,
buffer = gimp_drawable_get_sub_thumbnail_data (drawable->drawable_id, buffer = gimp_drawable_get_sub_thumbnail_data (drawable->drawable_id,
x1, y1, x2 - x1, y2 - y1, x1, y1, x2 - x1, y2 - y1,
&nav_width, &nav_height, &nav_width, &nav_height,
&bpp); &bpp);
} }
else else
{ {
buffer = gimp_drawable_get_thumbnail_data (drawable->drawable_id, buffer = gimp_drawable_get_thumbnail_data (drawable->drawable_id,
&nav_width, &nav_height, &nav_width, &nav_height,
&bpp); &bpp);
} }
if (buffer) if (buffer)
@ -467,10 +467,10 @@ gimp_drawable_preview_set_drawable (GimpDrawablePreview *drawable_preview,
gboolean gboolean
_gimp_drawable_preview_get_bounds (GimpDrawable *drawable, _gimp_drawable_preview_get_bounds (GimpDrawable *drawable,
gint *xmin, gint *xmin,
gint *ymin, gint *ymin,
gint *xmax, gint *xmax,
gint *ymax) gint *ymax)
{ {
gint width; gint width;
gint height; gint height;
@ -533,8 +533,8 @@ gimp_drawable_preview_new (GimpDrawable *drawable,
g_return_val_if_fail (drawable != NULL, NULL); g_return_val_if_fail (drawable != NULL, NULL);
preview = g_object_new (GIMP_TYPE_DRAWABLE_PREVIEW, preview = g_object_new (GIMP_TYPE_DRAWABLE_PREVIEW,
"drawable", drawable, "drawable", drawable,
NULL); NULL);
if (toggle) if (toggle)
{ {

View File

@ -70,14 +70,14 @@ void gimp_drawable_preview_draw_region (GimpDrawablePreview *preview,
/* for internal use only */ /* for internal use only */
void _gimp_drawable_preview_area_draw_thumb (GimpPreviewArea *area, void _gimp_drawable_preview_area_draw_thumb (GimpPreviewArea *area,
GimpDrawable *drawable, GimpDrawable *drawable,
gint width, gint width,
gint height) G_GNUC_INTERNAL; gint height) G_GNUC_INTERNAL;
gboolean _gimp_drawable_preview_get_bounds (GimpDrawable *drawable, gboolean _gimp_drawable_preview_get_bounds (GimpDrawable *drawable,
gint *xmin, gint *xmin,
gint *ymin, gint *ymin,
gint *xmax, gint *xmax,
gint *ymax) G_GNUC_INTERNAL; gint *ymax) G_GNUC_INTERNAL;
G_END_DECLS G_END_DECLS

View File

@ -31,7 +31,7 @@
typedef void (* ExportFunc) (gint32 imageID, typedef void (* ExportFunc) (gint32 imageID,
gint32 *drawable_ID); gint32 *drawable_ID);
/* the export action structure */ /* the export action structure */
@ -49,7 +49,7 @@ typedef struct
static void static void
export_merge (gint32 image_ID, export_merge (gint32 image_ID,
gint32 *drawable_ID) gint32 *drawable_ID)
{ {
gint32 nlayers; gint32 nlayers;
gint32 nvisible = 0; gint32 nvisible = 0;
@ -62,19 +62,19 @@ export_merge (gint32 image_ID,
for (i = 0; i < nlayers; i++) for (i = 0; i < nlayers; i++)
{ {
if (gimp_drawable_get_visible (layers[i])) if (gimp_drawable_get_visible (layers[i]))
nvisible++; nvisible++;
} }
if (nvisible <= 1) if (nvisible <= 1)
{ {
/* if there is only one (or zero) visible layer, add a new transparent /* if there is only one (or zero) visible layer, add a new transparent
layer that has the same size as the canvas. The merge that follows layer that has the same size as the canvas. The merge that follows
will ensure that the offset, opacity and size are correct */ will ensure that the offset, opacity and size are correct */
transp = gimp_layer_new (image_ID, "-", transp = gimp_layer_new (image_ID, "-",
gimp_image_width (image_ID), gimp_image_width (image_ID),
gimp_image_height (image_ID), gimp_image_height (image_ID),
gimp_drawable_type (*drawable_ID) | 1, gimp_drawable_type (*drawable_ID) | 1,
100.0, GIMP_NORMAL_MODE); 100.0, GIMP_NORMAL_MODE);
gimp_image_add_layer (image_ID, transp, 1); gimp_image_add_layer (image_ID, transp, 1);
gimp_selection_none (image_ID); gimp_selection_none (image_ID);
gimp_edit_clear (transp); gimp_edit_clear (transp);
@ -87,9 +87,9 @@ export_merge (gint32 image_ID,
merged = gimp_image_merge_visible_layers (image_ID, GIMP_CLIP_TO_IMAGE); merged = gimp_image_merge_visible_layers (image_ID, GIMP_CLIP_TO_IMAGE);
if (merged != -1) if (merged != -1)
*drawable_ID = merged; *drawable_ID = merged;
else else
return; /* shouldn't happen */ return; /* shouldn't happen */
layers = gimp_image_get_layers (image_ID, &nlayers); layers = gimp_image_get_layers (image_ID, &nlayers);
@ -111,14 +111,14 @@ export_merge (gint32 image_ID,
for (i = 0; i < nlayers; i++) for (i = 0; i < nlayers; i++)
{ {
if (layers[i] != *drawable_ID) if (layers[i] != *drawable_ID)
gimp_image_remove_layer (image_ID, layers[i]); gimp_image_remove_layer (image_ID, layers[i]);
} }
g_free (layers); g_free (layers);
} }
static void static void
export_flatten (gint32 image_ID, export_flatten (gint32 image_ID,
gint32 *drawable_ID) gint32 *drawable_ID)
{ {
gint32 flattened; gint32 flattened;
@ -149,21 +149,21 @@ export_apply_masks (gint32 image_ID,
static void static void
export_convert_rgb (gint32 image_ID, export_convert_rgb (gint32 image_ID,
gint32 *drawable_ID) gint32 *drawable_ID)
{ {
gimp_image_convert_rgb (image_ID); gimp_image_convert_rgb (image_ID);
} }
static void static void
export_convert_grayscale (gint32 image_ID, export_convert_grayscale (gint32 image_ID,
gint32 *drawable_ID) gint32 *drawable_ID)
{ {
gimp_image_convert_grayscale (image_ID); gimp_image_convert_grayscale (image_ID);
} }
static void static void
export_convert_indexed (gint32 image_ID, export_convert_indexed (gint32 image_ID,
gint32 *drawable_ID) gint32 *drawable_ID)
{ {
gint32 nlayers; gint32 nlayers;
@ -190,7 +190,7 @@ export_convert_bitmap (gint32 image_ID,
static void static void
export_add_alpha (gint32 image_ID, export_add_alpha (gint32 image_ID,
gint32 *drawable_ID) gint32 *drawable_ID)
{ {
gint32 nlayers; gint32 nlayers;
gint32 i; gint32 i;
@ -200,7 +200,7 @@ export_add_alpha (gint32 image_ID,
for (i = 0; i < nlayers; i++) for (i = 0; i < nlayers; i++)
{ {
if (!gimp_drawable_has_alpha (layers[i])) if (!gimp_drawable_has_alpha (layers[i]))
gimp_layer_add_alpha (layers[i]); gimp_layer_add_alpha (layers[i]);
} }
g_free (layers); g_free (layers);
} }
@ -324,7 +324,7 @@ static ExportAction export_action_convert_rgb_or_indexed =
export_convert_indexed, export_convert_indexed,
N_("%s can only handle RGB or indexed images"), N_("%s can only handle RGB or indexed images"),
{ N_("Convert to RGB"), N_("Convert to Indexed using default settings\n" { N_("Convert to RGB"), N_("Convert to Indexed using default settings\n"
"(Do it manually to tune the result)")}, "(Do it manually to tune the result)")},
0 0
}; };
@ -353,7 +353,7 @@ static ExportAction export_action_add_alpha =
static void static void
export_toggle_callback (GtkWidget *widget, export_toggle_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gint *choice = (gint *) data; gint *choice = (gint *) data;
@ -365,7 +365,7 @@ export_toggle_callback (GtkWidget *widget,
static GimpExportReturn static GimpExportReturn
confirm_save_dialog (const gchar *message, confirm_save_dialog (const gchar *message,
const gchar *format_name) const gchar *format_name)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *hbox; GtkWidget *hbox;
@ -380,13 +380,13 @@ confirm_save_dialog (const gchar *message,
dialog = gimp_dialog_new (_("Confirm Save"), "gimp-export-image-confirm", dialog = gimp_dialog_new (_("Confirm Save"), "gimp-export-image-confirm",
NULL, 0, NULL, 0,
gimp_standard_help_func, gimp_standard_help_func,
"gimp-export-confirm-dialog", "gimp-export-confirm-dialog",
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("Confirm"), GTK_RESPONSE_OK, _("Confirm"), GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK, GTK_RESPONSE_OK,
@ -445,7 +445,7 @@ confirm_save_dialog (const gchar *message,
static GimpExportReturn static GimpExportReturn
export_dialog (GSList *actions, export_dialog (GSList *actions,
const gchar *format_name) const gchar *format_name)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *hbox; GtkWidget *hbox;
@ -463,11 +463,11 @@ export_dialog (GSList *actions,
NULL, 0, NULL, 0,
gimp_standard_help_func, "gimp-export-dialog", gimp_standard_help_func, "gimp-export-dialog",
_("_Ignore"), GTK_RESPONSE_NO, _("_Ignore"), GTK_RESPONSE_NO,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Export"), GTK_RESPONSE_OK, _("_Export"), GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_NO, GTK_RESPONSE_NO,
@ -526,43 +526,43 @@ export_dialog (GSList *actions,
gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_container_add (GTK_CONTAINER (frame), vbox);
if (action->possibilities[0] && action->possibilities[1]) if (action->possibilities[0] && action->possibilities[1])
{ {
GtkWidget *button; GtkWidget *button;
GSList *radio_group = NULL; GSList *radio_group = NULL;
button = gtk_radio_button_new_with_label (radio_group, button = gtk_radio_button_new_with_label (radio_group,
gettext (action->possibilities[0])); gettext (action->possibilities[0]));
gtk_label_set_justify (GTK_LABEL (GTK_BIN (button)->child), gtk_label_set_justify (GTK_LABEL (GTK_BIN (button)->child),
GTK_JUSTIFY_LEFT); GTK_JUSTIFY_LEFT);
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
G_CALLBACK (export_toggle_callback), G_CALLBACK (export_toggle_callback),
&action->choice); &action->choice);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
(action->choice == 0)); (action->choice == 0));
gtk_widget_show (button); gtk_widget_show (button);
button = gtk_radio_button_new_with_label (radio_group, button = gtk_radio_button_new_with_label (radio_group,
gettext (action->possibilities[1])); gettext (action->possibilities[1]));
gtk_label_set_justify (GTK_LABEL (GTK_BIN (button)->child), gtk_label_set_justify (GTK_LABEL (GTK_BIN (button)->child),
GTK_JUSTIFY_LEFT); GTK_JUSTIFY_LEFT);
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
(action->choice == 1)); (action->choice == 1));
gtk_widget_show (button); gtk_widget_show (button);
} }
else if (action->possibilities[0]) else if (action->possibilities[0])
{ {
label = gtk_label_new (gettext (action->possibilities[0])); label = gtk_label_new (gettext (action->possibilities[0]));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
action->choice = 0; action->choice = 0;
} }
gtk_widget_show (vbox); gtk_widget_show (vbox);
} }
@ -630,9 +630,9 @@ export_dialog (GSList *actions,
**/ **/
GimpExportReturn GimpExportReturn
gimp_export_image (gint32 *image_ID, gimp_export_image (gint32 *image_ID,
gint32 *drawable_ID, gint32 *drawable_ID,
const gchar *format_name, const gchar *format_name,
GimpExportCapabilities capabilities) GimpExportCapabilities capabilities)
{ {
GSList *actions = NULL; GSList *actions = NULL;
GSList *list; GSList *list;
@ -685,7 +685,7 @@ gimp_export_image (gint32 *image_ID,
/* cancel - the user can then select an appropriate layer to save */ /* cancel - the user can then select an appropriate layer to save */
if (retval == GIMP_EXPORT_CANCEL) if (retval == GIMP_EXPORT_CANCEL)
return GIMP_EXPORT_CANCEL; return GIMP_EXPORT_CANCEL;
} }
@ -695,28 +695,28 @@ gimp_export_image (gint32 *image_ID,
for (i = 0; i < n_layers; i++) for (i = 0; i < n_layers; i++)
{ {
if (gimp_drawable_has_alpha (layers[i])) if (gimp_drawable_has_alpha (layers[i]))
{ {
if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_ALPHA)) if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_ALPHA))
{ {
actions = g_slist_prepend (actions, &export_action_flatten); actions = g_slist_prepend (actions, &export_action_flatten);
added_flatten = TRUE; added_flatten = TRUE;
break; break;
} }
} }
else else
{ {
/* If this is the last layer, it's visible and has no alpha /* If this is the last layer, it's visible and has no alpha
* channel, then the image has a "flat" background * channel, then the image has a "flat" background
*/ */
if (i == n_layers - 1 && gimp_drawable_get_visible (layers[i])) if (i == n_layers - 1 && gimp_drawable_get_visible (layers[i]))
background_has_alpha = FALSE; background_has_alpha = FALSE;
if (capabilities & GIMP_EXPORT_NEEDS_ALPHA) if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
{ {
actions = g_slist_prepend (actions, &export_action_add_alpha); actions = g_slist_prepend (actions, &export_action_add_alpha);
break; break;
} }
} }
} }
if (! added_flatten) if (! added_flatten)
@ -798,40 +798,40 @@ gimp_export_image (gint32 *image_ID,
{ {
case GIMP_RGB: case GIMP_RGB:
if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB)) if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB))
{ {
if ((capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED) && if ((capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED) &&
(capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY)) (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY))
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_indexed_or_grayscale); &export_action_convert_indexed_or_grayscale);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED)
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_indexed); &export_action_convert_indexed);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY)
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_grayscale); &export_action_convert_grayscale);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP)
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_bitmap); &export_action_convert_bitmap);
} }
break; break;
case GIMP_GRAY: case GIMP_GRAY:
if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY)) if (! (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY))
{ {
if ((capabilities & GIMP_EXPORT_CAN_HANDLE_RGB) && if ((capabilities & GIMP_EXPORT_CAN_HANDLE_RGB) &&
(capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED)) (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED))
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_rgb_or_indexed); &export_action_convert_rgb_or_indexed);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_RGB)
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_rgb); &export_action_convert_rgb);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_INDEXED)
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_indexed); &export_action_convert_indexed);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP)
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_bitmap); &export_action_convert_bitmap);
} }
break; break;
case GIMP_INDEXED: case GIMP_INDEXED:
@ -847,7 +847,7 @@ gimp_export_image (gint32 *image_ID,
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_GRAY)
actions = g_slist_prepend (actions, actions = g_slist_prepend (actions,
&export_action_convert_grayscale); &export_action_convert_grayscale);
else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP) else if (capabilities & GIMP_EXPORT_CAN_HANDLE_BITMAP)
{ {
gint n_colors; gint n_colors;
@ -879,14 +879,14 @@ gimp_export_image (gint32 *image_ID,
gimp_image_undo_disable (*image_ID); gimp_image_undo_disable (*image_ID);
for (list = actions; list; list = list->next) for (list = actions; list; list = list->next)
{ {
action = (ExportAction *) list->data; action = (ExportAction *) list->data;
if (action->choice == 0 && action->default_action) if (action->choice == 0 && action->default_action)
action->default_action (*image_ID, drawable_ID); action->default_action (*image_ID, drawable_ID);
else if (action->choice == 1 && action->alt_action) else if (action->choice == 1 && action->alt_action)
action->alt_action (*image_ID, drawable_ID); action->alt_action (*image_ID, drawable_ID);
} }
} }
g_slist_free (actions); g_slist_free (actions);

View File

@ -70,17 +70,17 @@ gimp_font_select_new (const gchar *title,
gchar *font_callback = gimp_procedural_db_temp_name (); gchar *font_callback = gimp_procedural_db_temp_name ();
gimp_install_temp_proc (font_callback, gimp_install_temp_proc (font_callback,
"Temporary font popup callback procedure", "Temporary font popup callback procedure",
"", "",
"Andy Thomas", "Andy Thomas",
"Andy Thomas", "Andy Thomas",
"1997", "1997",
NULL, NULL,
"RGB*, GRAY*", "RGB*, GRAY*",
GIMP_TEMPORARY, GIMP_TEMPORARY,
G_N_ELEMENTS (args), 0, G_N_ELEMENTS (args), 0,
args, NULL, args, NULL,
gimp_temp_font_run); gimp_temp_font_run);
if (gimp_fonts_popup (font_callback, title, font_name)) if (gimp_fonts_popup (font_callback, title, font_name))
{ {

View File

@ -234,12 +234,12 @@ gimp_gradient_select_widget_set (GtkWidget *widget,
&n_samples, &n_samples,
&samples)) &samples))
{ {
gimp_gradient_select_widget_callback (name, gimp_gradient_select_widget_callback (name,
n_samples, samples, n_samples, samples,
FALSE, gradient_sel); FALSE, gradient_sel);
g_free (samples); g_free (samples);
} }
g_free (name); g_free (name);
} }
@ -368,15 +368,15 @@ gimp_gradient_select_preview_expose (GtkWidget *widget,
a = src[x * 4 + 3]; a = src[x * 4 + 3];
if ((x / GIMP_CHECK_SIZE_SM) & 1) if ((x / GIMP_CHECK_SIZE_SM) & 1)
{ {
c0 = GIMP_CHECK_LIGHT; c0 = GIMP_CHECK_LIGHT;
c1 = GIMP_CHECK_DARK; c1 = GIMP_CHECK_DARK;
} }
else else
{ {
c0 = GIMP_CHECK_DARK; c0 = GIMP_CHECK_DARK;
c1 = GIMP_CHECK_LIGHT; c1 = GIMP_CHECK_LIGHT;
} }
*p0++ = (c0 + (r - c0) * a) * 255.0; *p0++ = (c0 + (r - c0) * a) * 255.0;
*p0++ = (c0 + (g - c0) * a) * 255.0; *p0++ = (c0 + (g - c0) * a) * 255.0;

View File

@ -75,17 +75,17 @@ gimp_gradient_select_new (const gchar *title,
gchar *gradient_callback = gimp_procedural_db_temp_name (); gchar *gradient_callback = gimp_procedural_db_temp_name ();
gimp_install_temp_proc (gradient_callback, gimp_install_temp_proc (gradient_callback,
"Temporary gradient popup callback procedure", "Temporary gradient popup callback procedure",
"", "",
"Andy Thomas", "Andy Thomas",
"Andy Thomas", "Andy Thomas",
"1997", "1997",
NULL, NULL,
"RGB*, GRAY*", "RGB*, GRAY*",
GIMP_TEMPORARY, GIMP_TEMPORARY,
G_N_ELEMENTS (args), 0, G_N_ELEMENTS (args), 0,
args, NULL, args, NULL,
gimp_temp_gradient_run); gimp_temp_gradient_run);
if (gimp_gradients_popup (gradient_callback, title, gradient_name, if (gimp_gradients_popup (gradient_callback, title, gradient_name,
sample_size)) sample_size))
@ -97,7 +97,7 @@ gimp_gradient_select_new (const gchar *title,
/* Now add to hash table so we can find it again */ /* Now add to hash table so we can find it again */
if (! gimp_gradient_select_ht) if (! gimp_gradient_select_ht)
gimp_gradient_select_ht = g_hash_table_new_full (g_str_hash, gimp_gradient_select_ht = g_hash_table_new_full (g_str_hash,
g_str_equal, g_str_equal,
g_free, g_free); g_free, g_free);
gradient_data = g_new0 (GimpGradientData, 1); gradient_data = g_new0 (GimpGradientData, 1);

View File

@ -35,7 +35,7 @@
*/ */
guchar * guchar *
gimp_image_get_cmap (gint32 image_ID, gimp_image_get_cmap (gint32 image_ID,
gint *num_colors) gint *num_colors)
{ {
return gimp_image_get_colormap (image_ID, num_colors); return gimp_image_get_colormap (image_ID, num_colors);
} }
@ -52,8 +52,8 @@ gimp_image_get_cmap (gint32 image_ID,
*/ */
gboolean gboolean
gimp_image_set_cmap (gint32 image_ID, gimp_image_set_cmap (gint32 image_ID,
const guchar *cmap, const guchar *cmap,
gint num_colors) gint num_colors)
{ {
return gimp_image_set_colormap (image_ID, cmap, num_colors); return gimp_image_set_colormap (image_ID, cmap, num_colors);
} }
@ -110,9 +110,9 @@ gimp_image_set_colormap (gint32 image_ID,
guchar * guchar *
gimp_image_get_thumbnail_data (gint32 image_ID, gimp_image_get_thumbnail_data (gint32 image_ID,
gint *width, gint *width,
gint *height, gint *height,
gint *bpp) gint *bpp)
{ {
gint ret_width; gint ret_width;
gint ret_height; gint ret_height;
@ -120,13 +120,13 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
gint data_size; gint data_size;
_gimp_image_thumbnail (image_ID, _gimp_image_thumbnail (image_ID,
*width, *width,
*height, *height,
&ret_width, &ret_width,
&ret_height, &ret_height,
bpp, bpp,
&data_size, &data_size,
&image_data); &image_data);
*width = ret_width; *width = ret_width;
*height = ret_height; *height = ret_height;
@ -152,10 +152,10 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
*/ */
gboolean gboolean
gimp_image_attach_new_parasite (gint32 image_ID, gimp_image_attach_new_parasite (gint32 image_ID,
const gchar *name, const gchar *name,
gint flags, gint flags,
gint size, gint size,
gconstpointer data) gconstpointer data)
{ {
GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); GimpParasite *parasite = gimp_parasite_new (name, flags, size, data);
gboolean success; gboolean success;

View File

@ -32,7 +32,7 @@ guchar * gimp_image_get_cmap (gint32 image_ID,
gint *num_colors); gint *num_colors);
gboolean gimp_image_set_cmap (gint32 image_ID, gboolean gimp_image_set_cmap (gint32 image_ID,
const guchar *cmap, const guchar *cmap,
gint num_colors); gint num_colors);
#endif /* GIMP_DISABLE_DEPRECATED */ #endif /* GIMP_DISABLE_DEPRECATED */
guchar * gimp_image_get_colormap (gint32 image_ID, guchar * gimp_image_get_colormap (gint32 image_ID,

View File

@ -190,7 +190,7 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
G_DEFINE_TYPE(GimpChannelComboBox, G_DEFINE_TYPE(GimpChannelComboBox,
gimp_channel_combo_box, gimp_channel_combo_box,
GIMP_TYPE_INT_COMBO_BOX); GIMP_TYPE_INT_COMBO_BOX);
static void static void
gimp_channel_combo_box_class_init (GimpChannelComboBoxClass *klass) gimp_channel_combo_box_class_init (GimpChannelComboBoxClass *klass)
@ -269,7 +269,7 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
G_DEFINE_TYPE(GimpLayerComboBox, G_DEFINE_TYPE(GimpLayerComboBox,
gimp_layer_combo_box, gimp_layer_combo_box,
GIMP_TYPE_INT_COMBO_BOX); GIMP_TYPE_INT_COMBO_BOX);
static void static void
gimp_layer_combo_box_class_init (GimpLayerComboBoxClass *klass) gimp_layer_combo_box_class_init (GimpLayerComboBoxClass *klass)

View File

@ -47,20 +47,20 @@
*/ */
gint32 gint32
gimp_layer_new (gint32 image_ID, gimp_layer_new (gint32 image_ID,
const gchar *name, const gchar *name,
gint width, gint width,
gint height, gint height,
GimpImageType type, GimpImageType type,
gdouble opacity, gdouble opacity,
GimpLayerModeEffects mode) GimpLayerModeEffects mode)
{ {
return _gimp_layer_new (image_ID, return _gimp_layer_new (image_ID,
width, width,
height, height,
type, type,
name, name,
opacity, opacity,
mode); mode);
} }
/** /**

View File

@ -69,9 +69,9 @@ static void gimp_menu_callback (GtkWidget *widget,
*/ */
GtkWidget * GtkWidget *
gimp_image_menu_new (GimpConstraintFunc constraint, gimp_image_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_image) gint32 active_image)
{ {
GtkWidget *menu; GtkWidget *menu;
gchar *name; gchar *name;
@ -90,15 +90,15 @@ gimp_image_menu_new (GimpConstraintFunc constraint,
for (i = 0, k = 0; i < n_images; i++) for (i = 0, k = 0; i < n_images; i++)
if (! constraint || (* constraint) (images[i], -1, data)) if (! constraint || (* constraint) (images[i], -1, data))
{ {
name = gimp_image_get_name (images[i]); name = gimp_image_get_name (images[i]);
label = g_strdup_printf ("%s-%d", name, images[i]); label = g_strdup_printf ("%s-%d", name, images[i]);
g_free (name); g_free (name);
gimp_menu_add_item (menu, label, NULL, images[i]); gimp_menu_add_item (menu, label, NULL, images[i]);
g_free (label); g_free (label);
if (images[i] == active_image) if (images[i] == active_image)
{ {
image = active_image; image = active_image;
gtk_menu_set_active (GTK_MENU (menu), k); gtk_menu_set_active (GTK_MENU (menu), k);
@ -108,7 +108,7 @@ gimp_image_menu_new (GimpConstraintFunc constraint,
image = images[i]; image = images[i];
} }
k += 1; k += 1;
} }
if (k == 0) if (k == 0)
@ -134,9 +134,9 @@ gimp_image_menu_new (GimpConstraintFunc constraint,
*/ */
GtkWidget * GtkWidget *
gimp_layer_menu_new (GimpConstraintFunc constraint, gimp_layer_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_layer) gint32 active_layer)
{ {
GtkWidget *menu; GtkWidget *menu;
gchar *image_label; gchar *image_label;
@ -158,33 +158,33 @@ gimp_layer_menu_new (GimpConstraintFunc constraint,
{ {
gchar *name; gchar *name;
name = gimp_image_get_name (images[i]); name = gimp_image_get_name (images[i]);
image_label = g_strdup_printf ("%s-%d", name, images[i]); image_label = g_strdup_printf ("%s-%d", name, images[i]);
g_free (name); g_free (name);
layers = gimp_image_get_layers (images[i], &n_layers); layers = gimp_image_get_layers (images[i], &n_layers);
for (j = 0; j < n_layers; j++) for (j = 0; j < n_layers; j++)
if (! constraint || (* constraint) (images[i], layers[j], data)) if (! constraint || (* constraint) (images[i], layers[j], data))
{ {
name = gimp_drawable_get_name (layers[j]); name = gimp_drawable_get_name (layers[j]);
gimp_menu_add_item (menu, image_label, name, layers[j]); gimp_menu_add_item (menu, image_label, name, layers[j]);
g_free (name); g_free (name);
if (layers[j] == active_layer) if (layers[j] == active_layer)
{ {
layer = active_layer; layer = active_layer;
gtk_menu_set_active (GTK_MENU (menu), k); gtk_menu_set_active (GTK_MENU (menu), k);
} }
else if (layer == -1) else if (layer == -1)
{ {
layer = layers[j]; layer = layers[j];
} }
k += 1; k += 1;
} }
g_free (image_label); g_free (image_label);
g_free (layers); g_free (layers);
} }
@ -211,9 +211,9 @@ gimp_layer_menu_new (GimpConstraintFunc constraint,
*/ */
GtkWidget * GtkWidget *
gimp_channel_menu_new (GimpConstraintFunc constraint, gimp_channel_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_channel) gint32 active_channel)
{ {
GtkWidget *menu; GtkWidget *menu;
gchar *image_label; gchar *image_label;
@ -237,33 +237,33 @@ gimp_channel_menu_new (GimpConstraintFunc constraint,
{ {
gchar *name; gchar *name;
name = gimp_image_get_name (images[i]); name = gimp_image_get_name (images[i]);
image_label = g_strdup_printf ("%s-%d", name, images[i]); image_label = g_strdup_printf ("%s-%d", name, images[i]);
g_free (name); g_free (name);
channels = gimp_image_get_channels (images[i], &n_channels); channels = gimp_image_get_channels (images[i], &n_channels);
for (j = 0; j < n_channels; j++) for (j = 0; j < n_channels; j++)
if (! constraint || (* constraint) (images[i], channels[j], data)) if (! constraint || (* constraint) (images[i], channels[j], data))
{ {
name = gimp_drawable_get_name (channels[j]); name = gimp_drawable_get_name (channels[j]);
gimp_menu_add_item (menu, image_label, name, channels[j]); gimp_menu_add_item (menu, image_label, name, channels[j]);
g_free (name); g_free (name);
if (channels[j] == active_channel) if (channels[j] == active_channel)
{ {
channel = active_channel; channel = active_channel;
gtk_menu_set_active (GTK_MENU (menu), k); gtk_menu_set_active (GTK_MENU (menu), k);
} }
else if (channel == -1) else if (channel == -1)
{ {
channel = channels[j]; channel = channels[j];
} }
k += 1; k += 1;
} }
g_free (image_label); g_free (image_label);
g_free (channels); g_free (channels);
} }
@ -290,9 +290,9 @@ gimp_channel_menu_new (GimpConstraintFunc constraint,
*/ */
GtkWidget * GtkWidget *
gimp_drawable_menu_new (GimpConstraintFunc constraint, gimp_drawable_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_drawable) gint32 active_drawable)
{ {
GtkWidget *menu; GtkWidget *menu;
gchar *name; gchar *name;
@ -315,54 +315,54 @@ gimp_drawable_menu_new (GimpConstraintFunc constraint,
for (i = 0, k = 0; i < n_images; i++) for (i = 0, k = 0; i < n_images; i++)
if (! constraint || (* constraint) (images[i], -1, data)) if (! constraint || (* constraint) (images[i], -1, data))
{ {
name = gimp_image_get_name (images[i]); name = gimp_image_get_name (images[i]);
image_label = g_strdup_printf ("%s-%d", name, images[i]); image_label = g_strdup_printf ("%s-%d", name, images[i]);
g_free (name); g_free (name);
layers = gimp_image_get_layers (images[i], &n_layers); layers = gimp_image_get_layers (images[i], &n_layers);
channels = gimp_image_get_channels (images[i], &n_channels); channels = gimp_image_get_channels (images[i], &n_channels);
for (j = 0; j < n_layers; j++) for (j = 0; j < n_layers; j++)
if (! constraint || (* constraint) (images[i], layers[j], data)) if (! constraint || (* constraint) (images[i], layers[j], data))
{ {
name = gimp_drawable_get_name (layers[j]); name = gimp_drawable_get_name (layers[j]);
gimp_menu_add_item (menu, image_label, name, layers[j]); gimp_menu_add_item (menu, image_label, name, layers[j]);
g_free (name); g_free (name);
if (layers[j] == active_drawable) if (layers[j] == active_drawable)
{ {
drawable = active_drawable; drawable = active_drawable;
gtk_menu_set_active (GTK_MENU (menu), k); gtk_menu_set_active (GTK_MENU (menu), k);
} }
else if (drawable == -1) else if (drawable == -1)
{ {
drawable = layers[j]; drawable = layers[j];
} }
k += 1; k += 1;
} }
for (j = 0; j < n_channels; j++) for (j = 0; j < n_channels; j++)
if (! constraint || (* constraint) (images[i], channels[j], data)) if (! constraint || (* constraint) (images[i], channels[j], data))
{ {
name = gimp_drawable_get_name (channels[j]); name = gimp_drawable_get_name (channels[j]);
gimp_menu_add_item (menu, image_label, name, channels[j]); gimp_menu_add_item (menu, image_label, name, channels[j]);
g_free (name); g_free (name);
if (channels[j] == active_drawable) if (channels[j] == active_drawable)
{ {
drawable = active_drawable; drawable = active_drawable;
gtk_menu_set_active (GTK_MENU (menu), k); gtk_menu_set_active (GTK_MENU (menu), k);
} }
else if (drawable == -1) else if (drawable == -1)
{ {
drawable = channels[j]; drawable = channels[j];
} }
k += 1; k += 1;
} }
g_free (image_label); g_free (image_label);
g_free (layers); g_free (layers);
g_free (channels); g_free (channels);
} }
@ -382,7 +382,7 @@ gimp_drawable_menu_new (GimpConstraintFunc constraint,
static GtkWidget * static GtkWidget *
gimp_menu_make_menu (GimpMenuCallback callback, gimp_menu_make_menu (GimpMenuCallback callback,
gpointer data) gpointer data)
{ {
GtkWidget *menu; GtkWidget *menu;
@ -482,7 +482,7 @@ gimp_menu_make_preview (gint32 any_ID,
static void static void
gimp_menu_callback (GtkWidget *widget, gimp_menu_callback (GtkWidget *widget,
gpointer any_ID) gpointer any_ID)
{ {
GimpMenuCallback callback; GimpMenuCallback callback;
gpointer callback_data; gpointer callback_data;

View File

@ -40,21 +40,21 @@ typedef void (* GimpMenuCallback) (gint32 any_id,
GtkWidget * gimp_image_menu_new (GimpConstraintFunc constraint, GtkWidget * gimp_image_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_image); gint32 active_image);
GtkWidget * gimp_layer_menu_new (GimpConstraintFunc constraint, GtkWidget * gimp_layer_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_layer); gint32 active_layer);
GtkWidget * gimp_channel_menu_new (GimpConstraintFunc constraint, GtkWidget * gimp_channel_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_channel); gint32 active_channel);
GtkWidget * gimp_drawable_menu_new (GimpConstraintFunc constraint, GtkWidget * gimp_drawable_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback, GimpMenuCallback callback,
gpointer data, gpointer data,
gint32 active_drawable); gint32 active_drawable);
G_END_DECLS G_END_DECLS

View File

@ -70,17 +70,17 @@ gimp_palette_select_new (const gchar *title,
gchar *palette_callback = gimp_procedural_db_temp_name (); gchar *palette_callback = gimp_procedural_db_temp_name ();
gimp_install_temp_proc (palette_callback, gimp_install_temp_proc (palette_callback,
"Temporary palette popup callback procedure", "Temporary palette popup callback procedure",
"", "",
"Michael Natterer", "Michael Natterer",
"Michael Natterer", "Michael Natterer",
"2004", "2004",
NULL, NULL,
"RGB*, GRAY*", "RGB*, GRAY*",
GIMP_TEMPORARY, GIMP_TEMPORARY,
G_N_ELEMENTS (args), 0, G_N_ELEMENTS (args), 0,
args, NULL, args, NULL,
gimp_temp_palette_run); gimp_temp_palette_run);
if (gimp_palettes_popup (palette_callback, title, palette_name)) if (gimp_palettes_popup (palette_callback, title, palette_name))
{ {

View File

@ -319,7 +319,7 @@ gimp_pattern_select_widget_clicked (GtkWidget *widget,
else else
{ {
pattern_sel->temp_pattern_callback = pattern_sel->temp_pattern_callback =
gimp_pattern_select_new (pattern_sel->title, gimp_pattern_select_new (pattern_sel->title,
pattern_sel->pattern_name, pattern_sel->pattern_name,
gimp_pattern_select_widget_callback, gimp_pattern_select_widget_callback,
pattern_sel); pattern_sel);
@ -364,31 +364,31 @@ gimp_pattern_select_preview_events (GtkWidget *widget,
if (pattern_sel->mask_data) if (pattern_sel->mask_data)
{ {
switch (event->type) switch (event->type)
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event; bevent = (GdkEventButton *) event;
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_add (widget); gtk_grab_add (widget);
gimp_pattern_select_popup_open (pattern_sel, gimp_pattern_select_popup_open (pattern_sel,
bevent->x, bevent->y); bevent->x, bevent->y);
} }
break; break;
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
bevent = (GdkEventButton *) event; bevent = (GdkEventButton *) event;
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_grab_remove (widget); gtk_grab_remove (widget);
gimp_pattern_select_popup_close (pattern_sel); gimp_pattern_select_popup_close (pattern_sel);
} }
break; break;
default: default:
break; break;
} }
} }
return FALSE; return FALSE;

View File

@ -79,17 +79,17 @@ gimp_pattern_select_new (const gchar *title,
gchar *pattern_callback = gimp_procedural_db_temp_name (); gchar *pattern_callback = gimp_procedural_db_temp_name ();
gimp_install_temp_proc (pattern_callback, gimp_install_temp_proc (pattern_callback,
"Temporary pattern popup callback procedure", "Temporary pattern popup callback procedure",
"", "",
"Andy Thomas", "Andy Thomas",
"Andy Thomas", "Andy Thomas",
"1997", "1997",
NULL, NULL,
"RGB*, GRAY*", "RGB*, GRAY*",
GIMP_TEMPORARY, GIMP_TEMPORARY,
G_N_ELEMENTS (args), 0, G_N_ELEMENTS (args), 0,
args, NULL, args, NULL,
gimp_temp_pattern_run); gimp_temp_pattern_run);
if (gimp_patterns_popup (pattern_callback, title, pattern_name)) if (gimp_patterns_popup (pattern_callback, title, pattern_name))
{ {

View File

@ -42,62 +42,62 @@ struct _GimpPixelRgn
void gimp_pixel_rgn_init (GimpPixelRgn *pr, void gimp_pixel_rgn_init (GimpPixelRgn *pr,
GimpDrawable *drawable, GimpDrawable *drawable,
gint x, gint x,
gint y, gint y,
gint width, gint width,
gint height, gint height,
gint dirty, gint dirty,
gint shadow); gint shadow);
void gimp_pixel_rgn_resize (GimpPixelRgn *pr, void gimp_pixel_rgn_resize (GimpPixelRgn *pr,
gint x, gint x,
gint y, gint y,
gint width, gint width,
gint height); gint height);
void gimp_pixel_rgn_get_pixel (GimpPixelRgn *pr, void gimp_pixel_rgn_get_pixel (GimpPixelRgn *pr,
guchar *buf, guchar *buf,
gint x, gint x,
gint y); gint y);
void gimp_pixel_rgn_get_row (GimpPixelRgn *pr, void gimp_pixel_rgn_get_row (GimpPixelRgn *pr,
guchar *buf, guchar *buf,
gint x, gint x,
gint y, gint y,
gint width); gint width);
void gimp_pixel_rgn_get_col (GimpPixelRgn *pr, void gimp_pixel_rgn_get_col (GimpPixelRgn *pr,
guchar *buf, guchar *buf,
gint x, gint x,
gint y, gint y,
gint height); gint height);
void gimp_pixel_rgn_get_rect (GimpPixelRgn *pr, void gimp_pixel_rgn_get_rect (GimpPixelRgn *pr,
guchar *buf, guchar *buf,
gint x, gint x,
gint y, gint y,
gint width, gint width,
gint height); gint height);
void gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr, void gimp_pixel_rgn_set_pixel (GimpPixelRgn *pr,
const guchar *buf, const guchar *buf,
gint x, gint x,
gint y); gint y);
void gimp_pixel_rgn_set_row (GimpPixelRgn *pr, void gimp_pixel_rgn_set_row (GimpPixelRgn *pr,
const guchar *buf, const guchar *buf,
gint x, gint x,
gint y, gint y,
gint width); gint width);
void gimp_pixel_rgn_set_col (GimpPixelRgn *pr, void gimp_pixel_rgn_set_col (GimpPixelRgn *pr,
const guchar *buf, const guchar *buf,
gint x, gint x,
gint y, gint y,
gint height); gint height);
void gimp_pixel_rgn_set_rect (GimpPixelRgn *pr, void gimp_pixel_rgn_set_rect (GimpPixelRgn *pr,
const guchar *buf, const guchar *buf,
gint x, gint x,
gint y, gint y,
gint width, gint width,
gint height); gint height);
gpointer gimp_pixel_rgns_register (gint nrgns, gpointer gimp_pixel_rgns_register (gint nrgns,
...); ...);
gpointer gimp_pixel_rgns_register2 (gint nrgns, gpointer gimp_pixel_rgns_register2 (gint nrgns,
GimpPixelRgn **prs); GimpPixelRgn **prs);
gpointer gimp_pixel_rgns_process (gpointer pri_ptr); gpointer gimp_pixel_rgns_process (gpointer pri_ptr);

View File

@ -52,29 +52,29 @@
*/ */
gboolean gboolean
gimp_procedural_db_proc_info (const gchar *procedure, gimp_procedural_db_proc_info (const gchar *procedure,
gchar **blurb, gchar **blurb,
gchar **help, gchar **help,
gchar **author, gchar **author,
gchar **copyright, gchar **copyright,
gchar **date, gchar **date,
GimpPDBProcType *proc_type, GimpPDBProcType *proc_type,
gint *num_args, gint *num_args,
gint *num_values, gint *num_values,
GimpParamDef **args, GimpParamDef **args,
GimpParamDef **return_vals) GimpParamDef **return_vals)
{ {
gint i; gint i;
gboolean success = TRUE; gboolean success = TRUE;
success = _gimp_procedural_db_proc_info (procedure, success = _gimp_procedural_db_proc_info (procedure,
blurb, blurb,
help, help,
author, author,
copyright, copyright,
date, date,
proc_type, proc_type,
num_args, num_args,
num_values); num_values);
if (success) if (success)
{ {
@ -84,10 +84,10 @@ gimp_procedural_db_proc_info (const gchar *procedure,
for (i = 0; i < *num_args; i++) for (i = 0; i < *num_args; i++)
{ {
if (! gimp_procedural_db_proc_arg (procedure, if (! gimp_procedural_db_proc_arg (procedure,
i, i,
&(*args)[i].type, &(*args)[i].type,
&(*args)[i].name, &(*args)[i].name,
&(*args)[i].description)) &(*args)[i].description))
{ {
g_free (*args); g_free (*args);
g_free (*return_vals); g_free (*return_vals);
@ -99,10 +99,10 @@ gimp_procedural_db_proc_info (const gchar *procedure,
for (i = 0; i < *num_values; i++) for (i = 0; i < *num_values; i++)
{ {
if (! gimp_procedural_db_proc_val (procedure, if (! gimp_procedural_db_proc_val (procedure,
i, i,
&(*return_vals)[i].type, &(*return_vals)[i].type,
&(*return_vals)[i].name, &(*return_vals)[i].name,
&(*return_vals)[i].description)) &(*return_vals)[i].description))
{ {
g_free (*args); g_free (*args);
g_free (*return_vals); g_free (*return_vals);
@ -131,15 +131,15 @@ gimp_procedural_db_proc_info (const gchar *procedure,
*/ */
gboolean gboolean
gimp_procedural_db_get_data (const gchar *identifier, gimp_procedural_db_get_data (const gchar *identifier,
gpointer data) gpointer data)
{ {
gint size; gint size;
guint8 *hack; guint8 *hack;
gboolean success; gboolean success;
success = _gimp_procedural_db_get_data (identifier, success = _gimp_procedural_db_get_data (identifier,
&size, &size,
&hack); &hack);
if (hack) if (hack)
{ {
memcpy (data, (gpointer) hack, size * sizeof (guint8)); memcpy (data, (gpointer) hack, size * sizeof (guint8));
@ -165,10 +165,10 @@ gimp_procedural_db_get_data (const gchar *identifier,
*/ */
gboolean gboolean
gimp_procedural_db_set_data (const gchar *identifier, gimp_procedural_db_set_data (const gchar *identifier,
gpointer data, gpointer data,
guint32 bytes) guint32 bytes)
{ {
return _gimp_procedural_db_set_data (identifier, return _gimp_procedural_db_set_data (identifier,
bytes, bytes,
data); data);
} }

View File

@ -28,21 +28,21 @@ G_BEGIN_DECLS
gboolean gimp_procedural_db_proc_info (const gchar *procedure, gboolean gimp_procedural_db_proc_info (const gchar *procedure,
gchar **blurb, gchar **blurb,
gchar **help, gchar **help,
gchar **author, gchar **author,
gchar **copyright, gchar **copyright,
gchar **date, gchar **date,
GimpPDBProcType *proc_type, GimpPDBProcType *proc_type,
gint *num_args, gint *num_args,
gint *num_values, gint *num_values,
GimpParamDef **args, GimpParamDef **args,
GimpParamDef **return_vals); GimpParamDef **return_vals);
gboolean gimp_procedural_db_get_data (const gchar *identifier, gboolean gimp_procedural_db_get_data (const gchar *identifier,
gpointer data); gpointer data);
gboolean gimp_procedural_db_set_data (const gchar *identifier, gboolean gimp_procedural_db_set_data (const gchar *identifier,
gpointer data, gpointer data,
guint32 bytes); guint32 bytes);
G_END_DECLS G_END_DECLS

View File

@ -134,17 +134,17 @@ gimp_progress_install_vtable (const GimpProgressVtable *vtable,
progress_callback = gimp_procedural_db_temp_name (); progress_callback = gimp_procedural_db_temp_name ();
gimp_install_temp_proc (progress_callback, gimp_install_temp_proc (progress_callback,
"Temporary progress callback procedure", "Temporary progress callback procedure",
"", "",
"Michael Natterer <mitch@gimp.org>", "Michael Natterer <mitch@gimp.org>",
"Michael Natterer", "Michael Natterer",
"2004", "2004",
NULL, NULL,
"RGB*, GRAY*, INDEXED*", "RGB*, GRAY*, INDEXED*",
GIMP_TEMPORARY, GIMP_TEMPORARY,
G_N_ELEMENTS (args), G_N_ELEMENTS (values), G_N_ELEMENTS (args), G_N_ELEMENTS (values),
args, values, args, values,
gimp_temp_progress_run); gimp_temp_progress_run);
if (_gimp_progress_install (progress_callback)) if (_gimp_progress_install (progress_callback))
{ {

View File

@ -43,13 +43,13 @@
*/ */
gint32 gint32
gimp_selection_float (gint32 image_ID, gimp_selection_float (gint32 image_ID,
gint32 drawable_ID, gint32 drawable_ID,
gint offx, gint offx,
gint offy) gint offy)
{ {
return _gimp_selection_float (drawable_ID, return _gimp_selection_float (drawable_ID,
offx, offx,
offy); offy);
} }
/** /**

View File

@ -40,7 +40,7 @@
void gimp_read_expect_msg (GimpWireMessage *msg, void gimp_read_expect_msg (GimpWireMessage *msg,
gint type); gint type);
static void gimp_tile_get (GimpTile *tile); static void gimp_tile_get (GimpTile *tile);
static void gimp_tile_put (GimpTile *tile); static void gimp_tile_put (GimpTile *tile);
@ -91,7 +91,7 @@ gimp_tile_ref_zero (GimpTile *tile)
void void
gimp_tile_unref (GimpTile *tile, gimp_tile_unref (GimpTile *tile,
gboolean dirty) gboolean dirty)
{ {
g_return_if_fail (tile != NULL); g_return_if_fail (tile != NULL);
g_return_if_fail (tile->ref_count > 0); g_return_if_fail (tile->ref_count > 0);
@ -318,24 +318,24 @@ gimp_tile_cache_insert (GimpTile *tile)
*/ */
if ((cur_cache_size + max_tile_size) > max_cache_size) if ((cur_cache_size + max_tile_size) > max_cache_size)
{ {
while (tile_list_head && while (tile_list_head &&
(cur_cache_size + (cur_cache_size +
max_cache_size * FREE_QUANTUM) > max_cache_size) max_cache_size * FREE_QUANTUM) > max_cache_size)
{ {
gimp_tile_cache_flush ((GimpTile *) tile_list_head->data); gimp_tile_cache_flush ((GimpTile *) tile_list_head->data);
} }
if ((cur_cache_size + max_tile_size) > max_cache_size) if ((cur_cache_size + max_tile_size) > max_cache_size)
return; return;
} }
/* Place the tile at the end of the tile list. /* Place the tile at the end of the tile list.
*/ */
tile_list_tail = g_list_append (tile_list_tail, tile); tile_list_tail = g_list_append (tile_list_tail, tile);
if (! tile_list_head) if (! tile_list_head)
tile_list_head = tile_list_tail; tile_list_head = tile_list_tail;
tile_list_tail = g_list_last (tile_list_tail); tile_list_tail = g_list_last (tile_list_tail);

View File

@ -44,7 +44,7 @@ struct _GimpTile
void gimp_tile_ref (GimpTile *tile); void gimp_tile_ref (GimpTile *tile);
void gimp_tile_ref_zero (GimpTile *tile); void gimp_tile_ref_zero (GimpTile *tile);
void gimp_tile_unref (GimpTile *tile, void gimp_tile_unref (GimpTile *tile,
gboolean dirty); gboolean dirty);
void gimp_tile_flush (GimpTile *tile); void gimp_tile_flush (GimpTile *tile);
void gimp_tile_cache_size (gulong kilobytes); void gimp_tile_cache_size (gulong kilobytes);

View File

@ -65,7 +65,7 @@ static gboolean gimp_ui_initialized = FALSE;
**/ **/
void void
gimp_ui_init (const gchar *prog_name, gimp_ui_init (const gchar *prog_name,
gboolean preview) gboolean preview)
{ {
const gchar *display_name; const gchar *display_name;
gint argc; gint argc;

View File

@ -122,12 +122,12 @@ _gimp_unit_cache_new (gchar *identifier,
gchar *plural) gchar *plural)
{ {
return _gimp_unit_new (identifier, return _gimp_unit_new (identifier,
factor, factor,
digits, digits,
symbol, symbol,
abbreviation, abbreviation,
singular, singular,
plural); plural);
} }
gboolean gboolean
@ -151,7 +151,7 @@ _gimp_unit_cache_set_deletion_flag (GimpUnit unit,
return; return;
_gimp_unit_set_deletion_flag (unit, _gimp_unit_set_deletion_flag (unit,
deletion_flag); deletion_flag);
} }
gdouble gdouble

View File

@ -64,21 +64,21 @@ is_script (const gchar *filename)
{ {
pathext = g_getenv ("PATHEXT"); pathext = g_getenv ("PATHEXT");
if (pathext != NULL) if (pathext != NULL)
{ {
exts = g_strsplit (pathext, G_SEARCHPATH_SEPARATOR_S, 100); exts = g_strsplit (pathext, G_SEARCHPATH_SEPARATOR_S, 100);
} }
else else
{ {
exts = g_new (gchar *, 1); exts = g_new (gchar *, 1);
exts[0] = NULL; exts[0] = NULL;
} }
} }
i = 0; i = 0;
while (exts[i] != NULL) while (exts[i] != NULL)
{ {
if (g_ascii_strcasecmp (ext, exts[i]) == 0) if (g_ascii_strcasecmp (ext, exts[i]) == 0)
return TRUE; return TRUE;
i++; i++;
} }
@ -90,7 +90,7 @@ is_script (const gchar *filename)
gboolean gboolean
gimp_datafiles_check_extension (const gchar *filename, gimp_datafiles_check_extension (const gchar *filename,
const gchar *extension) const gchar *extension)
{ {
gint name_len; gint name_len;
gint ext_len; gint ext_len;
@ -109,9 +109,9 @@ gimp_datafiles_check_extension (const gchar *filename,
void void
gimp_datafiles_read_directories (const gchar *path_str, gimp_datafiles_read_directories (const gchar *path_str,
GFileTest flags, GFileTest flags,
GimpDatafileLoaderFunc loader_func, GimpDatafileLoaderFunc loader_func,
gpointer user_data) gpointer user_data)
{ {
GimpDatafileData file_data; GimpDatafileData file_data;
struct stat filestat; struct stat filestat;
@ -137,12 +137,12 @@ gimp_datafiles_read_directories (const gchar *path_str,
dir = g_dir_open (dirname, 0, NULL); dir = g_dir_open (dirname, 0, NULL);
if (dir) if (dir)
{ {
while ((dir_ent = g_dir_read_name (dir))) while ((dir_ent = g_dir_read_name (dir)))
{ {
filename = g_build_filename (dirname, dir_ent, NULL); filename = g_build_filename (dirname, dir_ent, NULL);
err = g_stat (filename, &filestat); err = g_stat (filename, &filestat);
file_data.filename = filename; file_data.filename = filename;
file_data.dirname = dirname; file_data.dirname = dirname;
@ -151,8 +151,8 @@ gimp_datafiles_read_directories (const gchar *path_str,
file_data.mtime = filestat.st_mtime; file_data.mtime = filestat.st_mtime;
file_data.ctime = filestat.st_ctime; file_data.ctime = filestat.st_ctime;
if (! err) if (! err)
{ {
if (flags & G_FILE_TEST_EXISTS) if (flags & G_FILE_TEST_EXISTS)
{ {
(* loader_func) (&file_data, user_data); (* loader_func) (&file_data, user_data);
@ -162,33 +162,33 @@ gimp_datafiles_read_directories (const gchar *path_str,
{ {
(* loader_func) (&file_data, user_data); (* loader_func) (&file_data, user_data);
} }
else if ((flags & G_FILE_TEST_IS_DIR) && else if ((flags & G_FILE_TEST_IS_DIR) &&
S_ISDIR (filestat.st_mode)) S_ISDIR (filestat.st_mode))
{ {
(* loader_func) (&file_data, user_data); (* loader_func) (&file_data, user_data);
} }
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
else if ((flags & G_FILE_TEST_IS_SYMLINK) && else if ((flags & G_FILE_TEST_IS_SYMLINK) &&
S_ISLNK (filestat.st_mode)) S_ISLNK (filestat.st_mode))
{ {
(* loader_func) (&file_data, user_data); (* loader_func) (&file_data, user_data);
} }
#endif #endif
else if ((flags & G_FILE_TEST_IS_EXECUTABLE) && else if ((flags & G_FILE_TEST_IS_EXECUTABLE) &&
(((filestat.st_mode & S_IXUSR) && (((filestat.st_mode & S_IXUSR) &&
!S_ISDIR (filestat.st_mode)) || !S_ISDIR (filestat.st_mode)) ||
(S_ISREG (filestat.st_mode) && (S_ISREG (filestat.st_mode) &&
is_script (filename)))) is_script (filename))))
{ {
(* loader_func) (&file_data, user_data); (* loader_func) (&file_data, user_data);
} }
} }
g_free (filename); g_free (filename);
} }
g_dir_close (dir); g_dir_close (dir);
} }
} }
gimp_path_free (path); gimp_path_free (path);

View File

@ -41,12 +41,12 @@ struct _GimpDatafileData
gboolean gimp_datafiles_check_extension (const gchar *filename, gboolean gimp_datafiles_check_extension (const gchar *filename,
const gchar *extension); const gchar *extension);
void gimp_datafiles_read_directories (const gchar *path_str, void gimp_datafiles_read_directories (const gchar *path_str,
GFileTest flags, GFileTest flags,
GimpDatafileLoaderFunc loader_func, GimpDatafileLoaderFunc loader_func,
gpointer user_data); gpointer user_data);
G_END_DECLS G_END_DECLS

View File

@ -31,16 +31,16 @@ G_BEGIN_DECLS
const gchar * gimp_directory (void) G_GNUC_CONST; const gchar * gimp_directory (void) G_GNUC_CONST;
const gchar * gimp_data_directory (void) G_GNUC_CONST; const gchar * gimp_data_directory (void) G_GNUC_CONST;
const gchar * gimp_locale_directory (void) G_GNUC_CONST; const gchar * gimp_locale_directory (void) G_GNUC_CONST;
const gchar * gimp_sysconf_directory (void) G_GNUC_CONST; const gchar * gimp_sysconf_directory (void) G_GNUC_CONST;
const gchar * gimp_plug_in_directory (void) G_GNUC_CONST; const gchar * gimp_plug_in_directory (void) G_GNUC_CONST;
const gchar * gimp_gtkrc (void) G_GNUC_CONST; const gchar * gimp_gtkrc (void) G_GNUC_CONST;
gchar * gimp_personal_rc_file (const gchar *basename); gchar * gimp_personal_rc_file (const gchar *basename);
GList * gimp_path_parse (const gchar *path, GList * gimp_path_parse (const gchar *path,
gint max_paths, gint max_paths,
gboolean check, gboolean check,
GList **check_failed); GList **check_failed);
gchar * gimp_path_to_str (GList *path); gchar * gimp_path_to_str (GList *path);
void gimp_path_free (GList *path); void gimp_path_free (GList *path);

View File

@ -31,7 +31,7 @@
#include <glib-object.h> #include <glib-object.h>
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
#include <process.h> /* For _getpid() */ #include <process.h> /* For _getpid() */
#endif #endif
#include "gimpbasetypes.h" #include "gimpbasetypes.h"
@ -189,9 +189,9 @@ gimp_parasite_print (GimpParasite *parasite)
GimpParasite * GimpParasite *
gimp_parasite_new (const gchar *name, gimp_parasite_new (const gchar *name,
guint32 flags, guint32 flags,
guint32 size, guint32 size,
gconstpointer data) gconstpointer data)
{ {
GimpParasite *parasite; GimpParasite *parasite;
@ -226,7 +226,7 @@ gimp_parasite_free (GimpParasite *parasite)
gboolean gboolean
gimp_parasite_is_type (const GimpParasite *parasite, gimp_parasite_is_type (const GimpParasite *parasite,
const gchar *name) const gchar *name)
{ {
if (!parasite || !parasite->name) if (!parasite || !parasite->name)
return FALSE; return FALSE;
@ -241,12 +241,12 @@ gimp_parasite_copy (const GimpParasite *parasite)
return NULL; return NULL;
return gimp_parasite_new (parasite->name, parasite->flags, return gimp_parasite_new (parasite->name, parasite->flags,
parasite->size, parasite->data); parasite->size, parasite->data);
} }
gboolean gboolean
gimp_parasite_compare (const GimpParasite *a, gimp_parasite_compare (const GimpParasite *a,
const GimpParasite *b) const GimpParasite *b)
{ {
if (a && b && if (a && b &&
a->name && b->name && a->name && b->name &&
@ -255,9 +255,9 @@ gimp_parasite_compare (const GimpParasite *a,
a->size == b->size) a->size == b->size)
{ {
if (a->data == NULL && b->data == NULL) if (a->data == NULL && b->data == NULL)
return TRUE; return TRUE;
else if (a->data && b->data && memcmp (a->data, b->data, a->size) == 0) else if (a->data && b->data && memcmp (a->data, b->data, a->size) == 0)
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -292,7 +292,7 @@ gimp_parasite_is_undoable (const GimpParasite *parasite)
gboolean gboolean
gimp_parasite_has_flag (const GimpParasite *parasite, gimp_parasite_has_flag (const GimpParasite *parasite,
gulong flag) gulong flag)
{ {
if (parasite == NULL) if (parasite == NULL)
return FALSE; return FALSE;

View File

@ -79,7 +79,7 @@ struct _GimpParasite
guint32 flags; /* save Parasite in XCF file, etc. */ guint32 flags; /* save Parasite in XCF file, etc. */
guint32 size; /* amount of data */ guint32 size; /* amount of data */
gpointer data; /* a pointer to the data. plugin is * gpointer data; /* a pointer to the data. plugin is *
* responsible for tracking byte order */ * responsible for tracking byte order */
}; };

View File

@ -64,7 +64,7 @@ gimp_pixpipe_params_init (GimpPixPipeParams *params)
void void
gimp_pixpipe_params_parse (const gchar *string, gimp_pixpipe_params_parse (const gchar *string,
GimpPixPipeParams *params) GimpPixPipeParams *params)
{ {
gchar *copy; gchar *copy;
gchar *p, *q, *r; gchar *p, *q, *r;
@ -81,77 +81,77 @@ gimp_pixpipe_params_parse (const gchar *string,
q = NULL; q = NULL;
r = strchr (p, ':'); r = strchr (p, ':');
if (r) if (r)
*r = 0; *r = 0;
if (strcmp (p, "ncells") == 0) if (strcmp (p, "ncells") == 0)
{ {
if (r) if (r)
params->ncells = atoi (r + 1); params->ncells = atoi (r + 1);
} }
else if (strcmp (p, "step") == 0) else if (strcmp (p, "step") == 0)
{ {
if (r) if (r)
params->step = atoi (r + 1); params->step = atoi (r + 1);
} }
else if (strcmp (p, "dim") == 0) else if (strcmp (p, "dim") == 0)
{ {
if (r) if (r)
{ {
params->dim = atoi (r + 1); params->dim = atoi (r + 1);
params->dim = CLAMP (params->dim, 1, GIMP_PIXPIPE_MAXDIM); params->dim = CLAMP (params->dim, 1, GIMP_PIXPIPE_MAXDIM);
} }
} }
else if (strcmp (p, "cols") == 0) else if (strcmp (p, "cols") == 0)
{ {
if (r) if (r)
params->cols = atoi (r + 1); params->cols = atoi (r + 1);
} }
else if (strcmp (p, "rows") == 0) else if (strcmp (p, "rows") == 0)
{ {
if (r) if (r)
params->rows = atoi (r + 1); params->rows = atoi (r + 1);
} }
else if (strcmp (p, "cellwidth") == 0) else if (strcmp (p, "cellwidth") == 0)
{ {
if (r) if (r)
params->cellwidth = atoi (r + 1); params->cellwidth = atoi (r + 1);
} }
else if (strcmp (p, "cellheight") == 0) else if (strcmp (p, "cellheight") == 0)
{ {
if (r) if (r)
params->cellheight = atoi (r + 1); params->cellheight = atoi (r + 1);
} }
else if (strcmp (p, "placement") == 0) else if (strcmp (p, "placement") == 0)
{ {
if (r) if (r)
{ {
params->placement = g_strdup (r + 1); params->placement = g_strdup (r + 1);
params->free_placement_string = TRUE; params->free_placement_string = TRUE;
} }
} }
else if (strncmp (p, "rank", strlen ("rank")) == 0 && r) else if (strncmp (p, "rank", strlen ("rank")) == 0 && r)
{ {
if (r) if (r)
{ {
i = atoi (p + strlen ("rank")); i = atoi (p + strlen ("rank"));
if (i >= 0 && i < params->dim) if (i >= 0 && i < params->dim)
params->rank[i] = atoi (r + 1); params->rank[i] = atoi (r + 1);
} }
} }
else if (strncmp (p, "sel", strlen ("sel")) == 0 && r) else if (strncmp (p, "sel", strlen ("sel")) == 0 && r)
{ {
if (r) if (r)
{ {
i = atoi (p + strlen ("sel")); i = atoi (p + strlen ("sel"));
if (i >= 0 && i < params->dim) if (i >= 0 && i < params->dim)
{ {
params->selection[i] = g_strdup (r + 1); params->selection[i] = g_strdup (r + 1);
params->free_selection_string = TRUE; params->free_selection_string = TRUE;
} }
} }
} }
if (r) if (r)
*r = ':'; *r = ':';
} }
g_free (copy); g_free (copy);

View File

@ -60,7 +60,7 @@ void gimp_pixpipe_params_init (GimpPixPipeParams *params);
/* Parse a string into a GimpPixPipeParams */ /* Parse a string into a GimpPixPipeParams */
void gimp_pixpipe_params_parse (const gchar *parameters, void gimp_pixpipe_params_parse (const gchar *parameters,
GimpPixPipeParams *params); GimpPixPipeParams *params);
/* Build a string representation of GimpPixPipeParams */ /* Build a string representation of GimpPixPipeParams */
gchar * gimp_pixpipe_params_build (GimpPixPipeParams *params); gchar * gimp_pixpipe_params_build (GimpPixPipeParams *params);

File diff suppressed because it is too large Load Diff

View File

@ -196,33 +196,33 @@ void gp_init (void);
gboolean gp_quit_write (GIOChannel *channel, gboolean gp_quit_write (GIOChannel *channel,
gpointer user_data); gpointer user_data);
gboolean gp_config_write (GIOChannel *channel, gboolean gp_config_write (GIOChannel *channel,
GPConfig *config, GPConfig *config,
gpointer user_data); gpointer user_data);
gboolean gp_tile_req_write (GIOChannel *channel, gboolean gp_tile_req_write (GIOChannel *channel,
GPTileReq *tile_req, GPTileReq *tile_req,
gpointer user_data); gpointer user_data);
gboolean gp_tile_ack_write (GIOChannel *channel, gboolean gp_tile_ack_write (GIOChannel *channel,
gpointer user_data); gpointer user_data);
gboolean gp_tile_data_write (GIOChannel *channel, gboolean gp_tile_data_write (GIOChannel *channel,
GPTileData *tile_data, GPTileData *tile_data,
gpointer user_data); gpointer user_data);
gboolean gp_proc_run_write (GIOChannel *channel, gboolean gp_proc_run_write (GIOChannel *channel,
GPProcRun *proc_run, GPProcRun *proc_run,
gpointer user_data); gpointer user_data);
gboolean gp_proc_return_write (GIOChannel *channel, gboolean gp_proc_return_write (GIOChannel *channel,
GPProcReturn *proc_return, GPProcReturn *proc_return,
gpointer user_data); gpointer user_data);
gboolean gp_temp_proc_run_write (GIOChannel *channel, gboolean gp_temp_proc_run_write (GIOChannel *channel,
GPProcRun *proc_run, GPProcRun *proc_run,
gpointer user_data); gpointer user_data);
gboolean gp_temp_proc_return_write (GIOChannel *channel, gboolean gp_temp_proc_return_write (GIOChannel *channel,
GPProcReturn *proc_return, GPProcReturn *proc_return,
gpointer user_data); gpointer user_data);
gboolean gp_proc_install_write (GIOChannel *channel, gboolean gp_proc_install_write (GIOChannel *channel,
GPProcInstall *proc_install, GPProcInstall *proc_install,
gpointer user_data); gpointer user_data);
gboolean gp_proc_uninstall_write (GIOChannel *channel, gboolean gp_proc_uninstall_write (GIOChannel *channel,
GPProcUninstall *proc_uninstall, GPProcUninstall *proc_uninstall,
gpointer user_data); gpointer user_data);
gboolean gp_extension_ack_write (GIOChannel *channel, gboolean gp_extension_ack_write (GIOChannel *channel,
gpointer user_data); gpointer user_data);

View File

@ -53,8 +53,8 @@
*/ */
GimpSignalHandlerFunc GimpSignalHandlerFunc
gimp_signal_private (gint signum, gimp_signal_private (gint signum,
GimpSignalHandlerFunc handler, GimpSignalHandlerFunc handler,
gint flags) gint flags)
{ {
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
gint ret; gint ret;
@ -89,9 +89,9 @@ gimp_signal_private (gint signum,
return (GimpSignalHandlerFunc) osa.sa_handler; return (GimpSignalHandlerFunc) osa.sa_handler;
#else #else
return NULL; /* Or g_error()? Should all calls to return NULL; /* Or g_error()? Should all calls to
* this function really be inside * this function really be inside
* #ifdef G_OS_UNIX? * #ifdef G_OS_UNIX?
*/ */
#endif #endif
} }

View File

@ -34,8 +34,8 @@ G_BEGIN_DECLS
typedef void (* GimpSignalHandlerFunc) (gint signum); typedef void (* GimpSignalHandlerFunc) (gint signum);
GimpSignalHandlerFunc gimp_signal_private (gint signum, GimpSignalHandlerFunc gimp_signal_private (gint signum,
GimpSignalHandlerFunc handler, GimpSignalHandlerFunc handler,
gint flags); gint flags);
G_END_DECLS G_END_DECLS

View File

@ -47,7 +47,7 @@
**/ **/
gchar * gchar *
gimp_utf8_strtrim (const gchar *str, gimp_utf8_strtrim (const gchar *str,
gint max_chars) gint max_chars)
{ {
/* FIXME: should we make this translatable? */ /* FIXME: should we make this translatable? */
static const gchar *ellipsis = "..."; static const gchar *ellipsis = "...";
@ -77,7 +77,7 @@ gimp_utf8_strtrim (const gchar *str,
continue; continue;
} }
break; break;
} }
if (*p) if (*p)

View File

@ -86,9 +86,9 @@ G_BEGIN_DECLS
/* /*
2004-09-15 Tor Lillqvist <tml@iki.fi> 2004-09-15 Tor Lillqvist <tml@iki.fi>
* glib/gwin32.h: Don't define ftruncate as a macro. Was never a * glib/gwin32.h: Don't define ftruncate as a macro. Was never a
good idea, and it clashes with newest mingw headers, which have a good idea, and it clashes with newest mingw headers, which have a
ftruncate implementation as an inline function. Thanks to Dominik R. ftruncate implementation as an inline function. Thanks to Dominik R.
*/ */
/* needs coorection for msvc though ;( */ /* needs coorection for msvc though ;( */
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -58,7 +58,7 @@ void gimp_wire_set_reader (GimpWireIOFunc read_func);
void gimp_wire_set_writer (GimpWireIOFunc write_func); void gimp_wire_set_writer (GimpWireIOFunc write_func);
void gimp_wire_set_flusher (GimpWireFlushFunc flush_func); void gimp_wire_set_flusher (GimpWireFlushFunc flush_func);
gboolean gimp_wire_read (GIOChannel *channel, gboolean gimp_wire_read (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gsize count, gsize count,
gpointer user_data); gpointer user_data);
@ -72,10 +72,10 @@ gboolean gimp_wire_flush (GIOChannel *channel,
gboolean gimp_wire_error (void); gboolean gimp_wire_error (void);
void gimp_wire_clear_error (void); void gimp_wire_clear_error (void);
gboolean gimp_wire_read_msg (GIOChannel *channel, gboolean gimp_wire_read_msg (GIOChannel *channel,
GimpWireMessage *msg, GimpWireMessage *msg,
gpointer user_data); gpointer user_data);
gboolean gimp_wire_write_msg (GIOChannel *channel, gboolean gimp_wire_write_msg (GIOChannel *channel,
GimpWireMessage *msg, GimpWireMessage *msg,
gpointer user_data); gpointer user_data);
@ -85,7 +85,7 @@ gboolean _gimp_wire_read_int32 (GIOChannel *channel,
guint32 *data, guint32 *data,
gint count, gint count,
gpointer user_data) G_GNUC_INTERNAL; gpointer user_data) G_GNUC_INTERNAL;
gboolean _gimp_wire_read_int16 (GIOChannel *channel, gboolean _gimp_wire_read_int16 (GIOChannel *channel,
guint16 *data, guint16 *data,
gint count, gint count,
gpointer user_data) G_GNUC_INTERNAL; gpointer user_data) G_GNUC_INTERNAL;

View File

@ -50,19 +50,19 @@ struct _GimpSampleType
static gulong static gulong
gimp_render_sub_pixel (gint max_depth, gimp_render_sub_pixel (gint max_depth,
gint depth, gint depth,
GimpSampleType **block, GimpSampleType **block,
gint x, gint x,
gint y, gint y,
gint x1, gint x1,
gint y1, gint y1,
gint x3, gint x3,
gint y3, gint y3,
gdouble threshold, gdouble threshold,
gint sub_pixel_size, gint sub_pixel_size,
GimpRGB *color, GimpRGB *color,
GimpRenderFunc render_func, GimpRenderFunc render_func,
gpointer render_data) gpointer render_data)
{ {
gint x2, y2; /* Coords of center sample */ gint x2, y2; /* Coords of center sample */
gdouble dx1, dy1; /* Delta to upper left sample */ gdouble dx1, dy1; /* Delta to upper left sample */
@ -86,7 +86,7 @@ gimp_render_sub_pixel (gint max_depth,
num_samples++; num_samples++;
if (render_func) if (render_func)
(* render_func) (x + dx1, y + dy1, &c[0], render_data); (* render_func) (x + dx1, y + dy1, &c[0], render_data);
block[y1][x1].ready = TRUE; block[y1][x1].ready = TRUE;
block[y1][x1].color = c[0]; block[y1][x1].color = c[0];
@ -103,7 +103,7 @@ gimp_render_sub_pixel (gint max_depth,
num_samples++; num_samples++;
if (render_func) if (render_func)
(* render_func) (x + dx3, y + dy1, &c[1], render_data); (* render_func) (x + dx3, y + dy1, &c[1], render_data);
block[y1][x3].ready = TRUE; block[y1][x3].ready = TRUE;
block[y1][x3].color = c[1]; block[y1][x3].color = c[1];
@ -120,7 +120,7 @@ gimp_render_sub_pixel (gint max_depth,
num_samples++; num_samples++;
if (render_func) if (render_func)
(* render_func) (x + dx1, y + dy3, &c[2], render_data); (* render_func) (x + dx1, y + dy3, &c[2], render_data);
block[y3][x1].ready = TRUE; block[y3][x1].ready = TRUE;
block[y3][x1].color = c[2]; block[y3][x1].color = c[2];
@ -137,7 +137,7 @@ gimp_render_sub_pixel (gint max_depth,
num_samples++; num_samples++;
if (render_func) if (render_func)
(* render_func) (x + dx3, y + dy3, &c[3], render_data); (* render_func) (x + dx3, y + dy3, &c[3], render_data);
block[y3][x3].ready = TRUE; block[y3][x3].ready = TRUE;
block[y3][x3].color = c[3]; block[y3][x3].color = c[3];
@ -154,43 +154,43 @@ gimp_render_sub_pixel (gint max_depth,
/* Check whether we have to supersample */ /* Check whether we have to supersample */
if ((gimp_rgba_distance (&c[0], &c[1]) >= threshold) || if ((gimp_rgba_distance (&c[0], &c[1]) >= threshold) ||
(gimp_rgba_distance (&c[0], &c[2]) >= threshold) || (gimp_rgba_distance (&c[0], &c[2]) >= threshold) ||
(gimp_rgba_distance (&c[0], &c[3]) >= threshold) || (gimp_rgba_distance (&c[0], &c[3]) >= threshold) ||
(gimp_rgba_distance (&c[1], &c[2]) >= threshold) || (gimp_rgba_distance (&c[1], &c[2]) >= threshold) ||
(gimp_rgba_distance (&c[1], &c[3]) >= threshold) || (gimp_rgba_distance (&c[1], &c[3]) >= threshold) ||
(gimp_rgba_distance (&c[2], &c[3]) >= threshold)) (gimp_rgba_distance (&c[2], &c[3]) >= threshold))
{ {
/* Calc coordinates of center subsample */ /* Calc coordinates of center subsample */
x2 = (x1 + x3) / 2; x2 = (x1 + x3) / 2;
y2 = (y1 + y3) / 2; y2 = (y1 + y3) / 2;
/* Render sub-blocks */ /* Render sub-blocks */
num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block, num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block,
x, y, x1, y1, x2, y2, x, y, x1, y1, x2, y2,
threshold, sub_pixel_size, threshold, sub_pixel_size,
&c[0], &c[0],
render_func, render_data); render_func, render_data);
num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block, num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block,
x, y, x2, y1, x3, y2, x, y, x2, y1, x3, y2,
threshold, sub_pixel_size, threshold, sub_pixel_size,
&c[1], &c[1],
render_func, render_data); render_func, render_data);
num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block, num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block,
x, y, x1, y2, x2, y3, x, y, x1, y2, x2, y3,
threshold, sub_pixel_size, threshold, sub_pixel_size,
&c[2], &c[2],
render_func, render_data); render_func, render_data);
num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block, num_samples += gimp_render_sub_pixel (max_depth, depth + 1, block,
x, y, x2, y2, x3, y3, x, y, x2, y2, x3, y3,
threshold, sub_pixel_size, threshold, sub_pixel_size,
&c[3], &c[3],
render_func, render_data); render_func, render_data);
} }
} }
if (c[0].a == 0.0 || c[1].a == 0.0 || c[2].a == 0.0 || c[3].a == 0.0) if (c[0].a == 0.0 || c[1].a == 0.0 || c[2].a == 0.0 || c[3].a == 0.0)
@ -232,17 +232,17 @@ gimp_render_sub_pixel (gint max_depth,
gulong gulong
gimp_adaptive_supersample_area (gint x1, gimp_adaptive_supersample_area (gint x1,
gint y1, gint y1,
gint x2, gint x2,
gint y2, gint y2,
gint max_depth, gint max_depth,
gdouble threshold, gdouble threshold,
GimpRenderFunc render_func, GimpRenderFunc render_func,
gpointer render_data, gpointer render_data,
GimpPutPixelFunc put_pixel_func, GimpPutPixelFunc put_pixel_func,
gpointer put_pixel_data, gpointer put_pixel_data,
GimpProgressFunc progress_func, GimpProgressFunc progress_func,
gpointer progress_data) gpointer progress_data)
{ {
gint x, y, width; /* Counters, width of region */ gint x, y, width; /* Counters, width of region */
gint xt, xtt, yt; /* Temporary counters */ gint xt, xtt, yt; /* Temporary counters */
@ -288,11 +288,11 @@ gimp_adaptive_supersample_area (gint x1,
block[y] = g_new (GimpSampleType, sub_pixel_size + 1); /* Columns */ block[y] = g_new (GimpSampleType, sub_pixel_size + 1); /* Columns */
for (x = 0; x < (sub_pixel_size + 1); x++) for (x = 0; x < (sub_pixel_size + 1); x++)
{ {
block[y][x].ready = FALSE; block[y][x].ready = FALSE;
gimp_rgba_set (&block[y][x].color, 0.0, 0.0, 0.0, 0.0); gimp_rgba_set (&block[y][x].color, 0.0, 0.0, 0.0, 0.0);
} }
} }
/* Render region */ /* Render region */
@ -304,59 +304,59 @@ gimp_adaptive_supersample_area (gint x1,
/* Clear the bottom row */ /* Clear the bottom row */
for (xt = 0; xt < (sub_pixel_size * width + 1); xt++) for (xt = 0; xt < (sub_pixel_size * width + 1); xt++)
bot_row[xt].ready = FALSE; bot_row[xt].ready = FALSE;
/* Clear first column */ /* Clear first column */
for (yt = 0; yt < (sub_pixel_size + 1); yt++) for (yt = 0; yt < (sub_pixel_size + 1); yt++)
block[yt][0].ready = FALSE; block[yt][0].ready = FALSE;
/* Render row */ /* Render row */
for (x = x1; x <= x2; x++) for (x = x1; x <= x2; x++)
{ {
/* Initialize block by clearing all but first row/column */ /* Initialize block by clearing all but first row/column */
for (yt = 1; yt < (sub_pixel_size + 1); yt++) for (yt = 1; yt < (sub_pixel_size + 1); yt++)
for (xt = 1; xt < (sub_pixel_size + 1); xt++) for (xt = 1; xt < (sub_pixel_size + 1); xt++)
block[yt][xt].ready = FALSE; block[yt][xt].ready = FALSE;
/* Copy samples from top row to block */ /* Copy samples from top row to block */
for (xtt = 0, xt = (x - x1) * sub_pixel_size; for (xtt = 0, xt = (x - x1) * sub_pixel_size;
xtt < (sub_pixel_size + 1); xtt < (sub_pixel_size + 1);
xtt++, xt++) xtt++, xt++)
block[0][xtt] = top_row[xt]; block[0][xtt] = top_row[xt];
/* Render pixel on (x, y) */ /* Render pixel on (x, y) */
num_samples += gimp_render_sub_pixel (max_depth, 1, block, x, y, 0, 0, num_samples += gimp_render_sub_pixel (max_depth, 1, block, x, y, 0, 0,
sub_pixel_size, sub_pixel_size, sub_pixel_size, sub_pixel_size,
threshold, sub_pixel_size, threshold, sub_pixel_size,
&color, &color,
render_func, render_data); render_func, render_data);
if (put_pixel_func) if (put_pixel_func)
(* put_pixel_func) (x, y, &color, put_pixel_data); (* put_pixel_func) (x, y, &color, put_pixel_data);
/* Copy block information to rows */ /* Copy block information to rows */
top_row[(x - x1 + 1) * sub_pixel_size] = block[0][sub_pixel_size]; top_row[(x - x1 + 1) * sub_pixel_size] = block[0][sub_pixel_size];
for (xtt = 0, xt = (x - x1) * sub_pixel_size; for (xtt = 0, xt = (x - x1) * sub_pixel_size;
xtt < (sub_pixel_size + 1); xtt < (sub_pixel_size + 1);
xtt++, xt++) xtt++, xt++)
bot_row[xt] = block[sub_pixel_size][xtt]; bot_row[xt] = block[sub_pixel_size][xtt];
/* Swap first and last columns */ /* Swap first and last columns */
for (yt = 0; yt < (sub_pixel_size + 1); yt++) for (yt = 0; yt < (sub_pixel_size + 1); yt++)
{ {
tmp_sample = block[yt][0]; tmp_sample = block[yt][0];
block[yt][0] = block[yt][sub_pixel_size]; block[yt][0] = block[yt][sub_pixel_size];
block[yt][sub_pixel_size] = tmp_sample; block[yt][sub_pixel_size] = tmp_sample;
} }
} }
/* Swap rows */ /* Swap rows */
@ -367,7 +367,7 @@ gimp_adaptive_supersample_area (gint x1,
/* Call progress display function (if any) */ /* Call progress display function (if any) */
if (progress_func != NULL) if (progress_func != NULL)
(* progress_func) (y1, y2, y, progress_data); (* progress_func) (y1, y2, y, progress_data);
} }
/* Free memory */ /* Free memory */

View File

@ -30,8 +30,8 @@
gdouble gdouble
gimp_bilinear (gdouble x, gimp_bilinear (gdouble x,
gdouble y, gdouble y,
gdouble *values) gdouble *values)
{ {
gdouble m0, m1; gdouble m0, m1;
@ -53,8 +53,8 @@ gimp_bilinear (gdouble x,
guchar guchar
gimp_bilinear_8 (gdouble x, gimp_bilinear_8 (gdouble x,
gdouble y, gdouble y,
guchar *values) guchar *values)
{ {
gdouble m0, m1; gdouble m0, m1;
@ -76,8 +76,8 @@ gimp_bilinear_8 (gdouble x,
guint16 guint16
gimp_bilinear_16 (gdouble x, gimp_bilinear_16 (gdouble x,
gdouble y, gdouble y,
guint16 *values) guint16 *values)
{ {
gdouble m0, m1; gdouble m0, m1;
@ -99,8 +99,8 @@ gimp_bilinear_16 (gdouble x,
guint32 guint32
gimp_bilinear_32 (gdouble x, gimp_bilinear_32 (gdouble x,
gdouble y, gdouble y,
guint32 *values) guint32 *values)
{ {
gdouble m0, m1; gdouble m0, m1;
@ -122,8 +122,8 @@ gimp_bilinear_32 (gdouble x,
GimpRGB GimpRGB
gimp_bilinear_rgb (gdouble x, gimp_bilinear_rgb (gdouble x,
gdouble y, gdouble y,
GimpRGB *values) GimpRGB *values)
{ {
gdouble m0, m1; gdouble m0, m1;
gdouble ix, iy; gdouble ix, iy;
@ -168,8 +168,8 @@ gimp_bilinear_rgb (gdouble x,
GimpRGB GimpRGB
gimp_bilinear_rgba (gdouble x, gimp_bilinear_rgba (gdouble x,
gdouble y, gdouble y,
GimpRGB *values) GimpRGB *values)
{ {
gdouble m0, m1; gdouble m0, m1;
gdouble ix, iy; gdouble ix, iy;

View File

@ -52,7 +52,7 @@
**/ **/
void void
gimp_rgb_to_hsv (const GimpRGB *rgb, gimp_rgb_to_hsv (const GimpRGB *rgb,
GimpHSV *hsv) GimpHSV *hsv)
{ {
gdouble max, min, delta; gdouble max, min, delta;
@ -72,8 +72,8 @@ gimp_rgb_to_hsv (const GimpRGB *rgb,
if (rgb->r == max) if (rgb->r == max)
{ {
hsv->h = (rgb->g - rgb->b) / delta; hsv->h = (rgb->g - rgb->b) / delta;
if (hsv->h < 0.0) if (hsv->h < 0.0)
hsv->h += 6.0; hsv->h += 6.0;
} }
else if (rgb->g == max) else if (rgb->g == max)
{ {
@ -104,7 +104,7 @@ gimp_rgb_to_hsv (const GimpRGB *rgb,
**/ **/
void void
gimp_hsv_to_rgb (const GimpHSV *hsv, gimp_hsv_to_rgb (const GimpHSV *hsv,
GimpRGB *rgb) GimpRGB *rgb)
{ {
gint i; gint i;
gdouble f, w, q, t; gdouble f, w, q, t;
@ -211,7 +211,7 @@ gimp_rgb_to_hsl (const GimpRGB *rgb,
delta = max - min; delta = max - min;
if (delta == 0.0) if (delta == 0.0)
delta = 1.0; delta = 1.0;
if (rgb->r == max) if (rgb->r == max)
{ {
@ -269,7 +269,7 @@ gimp_hsl_value (gdouble n1,
**/ **/
void void
gimp_hsl_to_rgb (const GimpHSL *hsl, gimp_hsl_to_rgb (const GimpHSL *hsl,
GimpRGB *rgb) GimpRGB *rgb)
{ {
g_return_if_fail (hsl != NULL); g_return_if_fail (hsl != NULL);
g_return_if_fail (rgb != NULL); g_return_if_fail (rgb != NULL);
@ -416,9 +416,9 @@ gimp_cmyk_to_rgb (const GimpCMYK *cmyk,
**/ **/
void void
gimp_rgb_to_hwb (const GimpRGB *rgb, gimp_rgb_to_hwb (const GimpRGB *rgb,
gdouble *hue, gdouble *hue,
gdouble *whiteness, gdouble *whiteness,
gdouble *blackness) gdouble *blackness)
{ {
/* RGB are each on [0, 1]. W and B are returned on [0, 1] and H is */ /* RGB are each on [0, 1]. W and B are returned on [0, 1] and H is */
/* returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B. */ /* returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B. */
@ -460,9 +460,9 @@ gimp_rgb_to_hwb (const GimpRGB *rgb,
**/ **/
void void
gimp_hwb_to_rgb (gdouble hue, gimp_hwb_to_rgb (gdouble hue,
gdouble whiteness, gdouble whiteness,
gdouble blackness, gdouble blackness,
GimpRGB *rgb) GimpRGB *rgb)
{ {
/* H is given on [0, 6] or UNDEFINED. whiteness and /* H is given on [0, 6] or UNDEFINED. whiteness and
* blackness are given on [0, 1]. * blackness are given on [0, 1].
@ -487,7 +487,7 @@ gimp_hwb_to_rgb (gdouble hue,
f = h - i; f = h - i;
if (i & 1) if (i & 1)
f = 1.0 - f; /* if i is odd */ f = 1.0 - f; /* if i is odd */
n = w + f * (v - w); /* linear interpolation between w and v */ n = w + f * (v - w); /* linear interpolation between w and v */
@ -530,8 +530,8 @@ gimp_hwb_to_rgb (gdouble hue,
**/ **/
void void
gimp_rgb_to_hsv_int (gint *red, gimp_rgb_to_hsv_int (gint *red,
gint *green, gint *green,
gint *blue) gint *blue)
{ {
gdouble r, g, b; gdouble r, g, b;
gdouble h, s, v; gdouble h, s, v;
@ -565,16 +565,16 @@ gimp_rgb_to_hsv_int (gint *red,
else else
{ {
if (r == v) if (r == v)
h = 60.0 * (g - b) / delta; h = 60.0 * (g - b) / delta;
else if (g == v) else if (g == v)
h = 120 + 60.0 * (b - r) / delta; h = 120 + 60.0 * (b - r) / delta;
else else
h = 240 + 60.0 * (r - g) / delta; h = 240 + 60.0 * (r - g) / delta;
if (h < 0.0) if (h < 0.0)
h += 360.0; h += 360.0;
if (h > 360.0) if (h > 360.0)
h -= 360.0; h -= 360.0;
} }
*red = ROUND (h); *red = ROUND (h);
@ -596,8 +596,8 @@ gimp_rgb_to_hsv_int (gint *red,
**/ **/
void void
gimp_hsv_to_rgb_int (gint *hue, gimp_hsv_to_rgb_int (gint *hue,
gint *saturation, gint *saturation,
gint *value) gint *value)
{ {
gdouble h, s, v, h_temp; gdouble h, s, v, h_temp;
gdouble f, p, q, t; gdouble f, p, q, t;
@ -628,43 +628,43 @@ gimp_hsv_to_rgb_int (gint *hue,
t = v * (1.0 - (s * (1.0 - f))); t = v * (1.0 - (s * (1.0 - f)));
switch (i) switch (i)
{ {
case 0: case 0:
*hue = ROUND (v * 255.0); *hue = ROUND (v * 255.0);
*saturation = ROUND (t * 255.0); *saturation = ROUND (t * 255.0);
*value = ROUND (p * 255.0); *value = ROUND (p * 255.0);
break; break;
case 1: case 1:
*hue = ROUND (q * 255.0); *hue = ROUND (q * 255.0);
*saturation = ROUND (v * 255.0); *saturation = ROUND (v * 255.0);
*value = ROUND (p * 255.0); *value = ROUND (p * 255.0);
break; break;
case 2: case 2:
*hue = ROUND (p * 255.0); *hue = ROUND (p * 255.0);
*saturation = ROUND (v * 255.0); *saturation = ROUND (v * 255.0);
*value = ROUND (t * 255.0); *value = ROUND (t * 255.0);
break; break;
case 3: case 3:
*hue = ROUND (p * 255.0); *hue = ROUND (p * 255.0);
*saturation = ROUND (q * 255.0); *saturation = ROUND (q * 255.0);
*value = ROUND (v * 255.0); *value = ROUND (v * 255.0);
break; break;
case 4: case 4:
*hue = ROUND (t * 255.0); *hue = ROUND (t * 255.0);
*saturation = ROUND (p * 255.0); *saturation = ROUND (p * 255.0);
*value = ROUND (v * 255.0); *value = ROUND (v * 255.0);
break; break;
case 5: case 5:
*hue = ROUND (v * 255.0); *hue = ROUND (v * 255.0);
*saturation = ROUND (p * 255.0); *saturation = ROUND (p * 255.0);
*value = ROUND (q * 255.0); *value = ROUND (q * 255.0);
break; break;
} }
} }
} }
@ -683,8 +683,8 @@ gimp_hsv_to_rgb_int (gint *hue,
**/ **/
void void
gimp_rgb_to_hsl_int (gint *red, gimp_rgb_to_hsl_int (gint *red,
gint *green, gint *green,
gint *blue) gint *blue)
{ {
gint r, g, b; gint r, g, b;
gdouble h, s, l; gdouble h, s, l;
@ -718,23 +718,23 @@ gimp_rgb_to_hsl_int (gint *red,
delta = (max - min); delta = (max - min);
if (l < 128) if (l < 128)
s = 255 * (gdouble) delta / (gdouble) (max + min); s = 255 * (gdouble) delta / (gdouble) (max + min);
else else
s = 255 * (gdouble) delta / (gdouble) (511 - max - min); s = 255 * (gdouble) delta / (gdouble) (511 - max - min);
if (r == max) if (r == max)
h = (g - b) / (gdouble) delta; h = (g - b) / (gdouble) delta;
else if (g == max) else if (g == max)
h = 2 + (b - r) / (gdouble) delta; h = 2 + (b - r) / (gdouble) delta;
else else
h = 4 + (r - g) / (gdouble) delta; h = 4 + (r - g) / (gdouble) delta;
h = h * 42.5; h = h * 42.5;
if (h < 0) if (h < 0)
h += 255; h += 255;
else if (h > 255) else if (h > 255)
h -= 255; h -= 255;
} }
*red = ROUND (h); *red = ROUND (h);
@ -755,8 +755,8 @@ gimp_rgb_to_hsl_int (gint *red,
**/ **/
gint gint
gimp_rgb_to_l_int (gint red, gimp_rgb_to_l_int (gint red,
gint green, gint green,
gint blue) gint blue)
{ {
gint min, max; gint min, max;
@ -776,8 +776,8 @@ gimp_rgb_to_l_int (gint red,
static gint static gint
gimp_hsl_value_int (gdouble n1, gimp_hsl_value_int (gdouble n1,
gdouble n2, gdouble n2,
gdouble hue) gdouble hue)
{ {
gdouble value; gdouble value;
@ -812,8 +812,8 @@ gimp_hsl_value_int (gdouble n1,
**/ **/
void void
gimp_hsl_to_rgb_int (gint *hue, gimp_hsl_to_rgb_int (gint *hue,
gint *saturation, gint *saturation,
gint *lightness) gint *lightness)
{ {
gdouble h, s, l; gdouble h, s, l;
@ -833,9 +833,9 @@ gimp_hsl_to_rgb_int (gint *hue,
gdouble m1, m2; gdouble m1, m2;
if (l < 128) if (l < 128)
m2 = (l * (255 + s)) / 65025.0; m2 = (l * (255 + s)) / 65025.0;
else else
m2 = (l + s - (l * s) / 255.0) / 255.0; m2 = (l + s - (l * s) / 255.0) / 255.0;
m1 = (l / 127.5) - m2; m1 = (l / 127.5) - m2;
@ -941,9 +941,9 @@ gimp_cmyk_to_rgb_int (gint *cyan,
void void
gimp_rgb_to_hsv4 (guchar *rgb, gimp_rgb_to_hsv4 (guchar *rgb,
gdouble *hue, gdouble *hue,
gdouble *saturation, gdouble *saturation,
gdouble *value) gdouble *value)
{ {
gdouble red, green, blue; gdouble red, green, blue;
gdouble h, s, v; gdouble h, s, v;
@ -981,21 +981,21 @@ gimp_rgb_to_hsv4 (guchar *rgb,
delta = max - min; delta = max - min;
if (delta == 0.0) if (delta == 0.0)
delta = 1.0; delta = 1.0;
if (red == max) if (red == max)
h = (green - blue) / delta; h = (green - blue) / delta;
else if (green == max) else if (green == max)
h = 2 + (blue - red) / delta; h = 2 + (blue - red) / delta;
else if (blue == max) else if (blue == max)
h = 4 + (red - green) / delta; h = 4 + (red - green) / delta;
h /= 6.0; h /= 6.0;
if (h < 0.0) if (h < 0.0)
h += 1.0; h += 1.0;
else if (h > 1.0) else if (h > 1.0)
h -= 1.0; h -= 1.0;
} }
*hue = h; *hue = h;
@ -1014,9 +1014,9 @@ gimp_rgb_to_hsv4 (guchar *rgb,
void void
gimp_hsv_to_rgb4 (guchar *rgb, gimp_hsv_to_rgb4 (guchar *rgb,
gdouble hue, gdouble hue,
gdouble saturation, gdouble saturation,
gdouble value) gdouble value)
{ {
gdouble h, s, v; gdouble h, s, v;
gdouble f, p, q, t; gdouble f, p, q, t;
@ -1034,7 +1034,7 @@ gimp_hsv_to_rgb4 (guchar *rgb,
v = value; v = value;
if (h == 6.0) if (h == 6.0)
h = 0.0; h = 0.0;
f = h - (gint) h; f = h - (gint) h;
p = v * (1.0 - s); p = v * (1.0 - s);
@ -1042,43 +1042,43 @@ gimp_hsv_to_rgb4 (guchar *rgb,
t = v * (1.0 - s * (1.0 - f)); t = v * (1.0 - s * (1.0 - f));
switch ((int) h) switch ((int) h)
{ {
case 0: case 0:
hue = v; hue = v;
saturation = t; saturation = t;
value = p; value = p;
break; break;
case 1: case 1:
hue = q; hue = q;
saturation = v; saturation = v;
value = p; value = p;
break; break;
case 2: case 2:
hue = p; hue = p;
saturation = v; saturation = v;
value = t; value = t;
break; break;
case 3: case 3:
hue = p; hue = p;
saturation = q; saturation = q;
value = v; value = v;
break; break;
case 4: case 4:
hue = t; hue = t;
saturation = p; saturation = p;
value = v; value = v;
break; break;
case 5: case 5:
hue = v; hue = v;
saturation = p; saturation = p;
value = q; value = q;
break; break;
} }
} }
rgb[0] = ROUND (hue * 255.0); rgb[0] = ROUND (hue * 255.0);

View File

@ -31,38 +31,38 @@ G_BEGIN_DECLS
/* GimpRGB function */ /* GimpRGB function */
void gimp_rgb_to_hsv (const GimpRGB *rgb, void gimp_rgb_to_hsv (const GimpRGB *rgb,
GimpHSV *hsv); GimpHSV *hsv);
void gimp_rgb_to_hsl (const GimpRGB *rgb, void gimp_rgb_to_hsl (const GimpRGB *rgb,
GimpHSL *hsl); GimpHSL *hsl);
void gimp_rgb_to_cmyk (const GimpRGB *rgb, void gimp_rgb_to_cmyk (const GimpRGB *rgb,
gdouble pullout, gdouble pullout,
GimpCMYK *cmyk); GimpCMYK *cmyk);
void gimp_hsv_to_rgb (const GimpHSV *hsv, void gimp_hsv_to_rgb (const GimpHSV *hsv,
GimpRGB *rgb); GimpRGB *rgb);
void gimp_hsl_to_rgb (const GimpHSL *hsl, void gimp_hsl_to_rgb (const GimpHSL *hsl,
GimpRGB *rgb); GimpRGB *rgb);
void gimp_cmyk_to_rgb (const GimpCMYK *cmyk, void gimp_cmyk_to_rgb (const GimpCMYK *cmyk,
GimpRGB *rgb); GimpRGB *rgb);
void gimp_rgb_to_hwb (const GimpRGB *rgb, void gimp_rgb_to_hwb (const GimpRGB *rgb,
gdouble *hue, gdouble *hue,
gdouble *whiteness, gdouble *whiteness,
gdouble *blackness); gdouble *blackness);
void gimp_hwb_to_rgb (gdouble hue, void gimp_hwb_to_rgb (gdouble hue,
gdouble whiteness, gdouble whiteness,
gdouble blackness, gdouble blackness,
GimpRGB *rgb); GimpRGB *rgb);
/* gint functions */ /* gint functions */
void gimp_rgb_to_hsv_int (gint *red /* returns hue */, void gimp_rgb_to_hsv_int (gint *red /* returns hue */,
gint *green /* returns saturation */, gint *green /* returns saturation */,
gint *blue /* returns value */); gint *blue /* returns value */);
void gimp_hsv_to_rgb_int (gint *hue /* returns red */, void gimp_hsv_to_rgb_int (gint *hue /* returns red */,
gint *saturation /* returns green */, gint *saturation /* returns green */,
gint *value /* returns blue */); gint *value /* returns blue */);
void gimp_rgb_to_cmyk_int (gint *red /* returns cyan */, void gimp_rgb_to_cmyk_int (gint *red /* returns cyan */,
gint *green /* returns magenta */, gint *green /* returns magenta */,
@ -73,15 +73,15 @@ void gimp_cmyk_to_rgb_int (gint *cyan /* returns red */,
gint *yellow /* returns blue */, gint *yellow /* returns blue */,
gint *black /* not changed */); gint *black /* not changed */);
void gimp_rgb_to_hsl_int (gint *red /* returns hue */, void gimp_rgb_to_hsl_int (gint *red /* returns hue */,
gint *green /* returns saturation */, gint *green /* returns saturation */,
gint *blue /* returns lightness */); gint *blue /* returns lightness */);
gint gimp_rgb_to_l_int (gint red, gint gimp_rgb_to_l_int (gint red,
gint green, gint green,
gint blue); gint blue);
void gimp_hsl_to_rgb_int (gint *hue /* returns red */, void gimp_hsl_to_rgb_int (gint *hue /* returns red */,
gint *saturation /* returns green */, gint *saturation /* returns green */,
gint *lightness /* returns blue */); gint *lightness /* returns blue */);
/* gdouble functions */ /* gdouble functions */
@ -91,9 +91,9 @@ void gimp_rgb_to_hsv4 (guchar *rgb,
gdouble *saturation, gdouble *saturation,
gdouble *value); gdouble *value);
void gimp_hsv_to_rgb4 (guchar *rgb, void gimp_hsv_to_rgb4 (guchar *rgb,
gdouble hue, gdouble hue,
gdouble saturation, gdouble saturation,
gdouble value); gdouble value);
G_END_DECLS G_END_DECLS

View File

@ -30,9 +30,9 @@
void void
gimp_hsv_set (GimpHSV *hsv, gimp_hsv_set (GimpHSV *hsv,
gdouble h, gdouble h,
gdouble s, gdouble s,
gdouble v) gdouble v)
{ {
g_return_if_fail (hsv != NULL); g_return_if_fail (hsv != NULL);
@ -58,10 +58,10 @@ gimp_hsv_clamp (GimpHSV *hsv)
void void
gimp_hsva_set (GimpHSV *hsva, gimp_hsva_set (GimpHSV *hsva,
gdouble h, gdouble h,
gdouble s, gdouble s,
gdouble v, gdouble v,
gdouble a) gdouble a)
{ {
g_return_if_fail (hsva != NULL); g_return_if_fail (hsva != NULL);

View File

@ -26,16 +26,16 @@ G_BEGIN_DECLS
void gimp_hsv_set (GimpHSV *hsv, void gimp_hsv_set (GimpHSV *hsv,
gdouble hue, gdouble hue,
gdouble saturation, gdouble saturation,
gdouble value); gdouble value);
void gimp_hsv_clamp (GimpHSV *hsv); void gimp_hsv_clamp (GimpHSV *hsv);
void gimp_hsva_set (GimpHSV *hsva, void gimp_hsva_set (GimpHSV *hsva,
gdouble hue, gdouble hue,
gdouble saturation, gdouble saturation,
gdouble value, gdouble value,
gdouble alpha); gdouble alpha);
G_END_DECLS G_END_DECLS

View File

@ -95,9 +95,9 @@ gimp_rgb_copy (const GimpRGB *rgb)
**/ **/
void void
gimp_rgb_set (GimpRGB *rgb, gimp_rgb_set (GimpRGB *rgb,
gdouble r, gdouble r,
gdouble g, gdouble g,
gdouble b) gdouble b)
{ {
g_return_if_fail (rgb != NULL); g_return_if_fail (rgb != NULL);
@ -115,7 +115,7 @@ gimp_rgb_set (GimpRGB *rgb,
**/ **/
void void
gimp_rgb_set_alpha (GimpRGB *rgb, gimp_rgb_set_alpha (GimpRGB *rgb,
gdouble a) gdouble a)
{ {
g_return_if_fail (rgb != NULL); g_return_if_fail (rgb != NULL);
@ -134,9 +134,9 @@ gimp_rgb_set_alpha (GimpRGB *rgb,
**/ **/
void void
gimp_rgb_set_uchar (GimpRGB *rgb, gimp_rgb_set_uchar (GimpRGB *rgb,
guchar r, guchar r,
guchar g, guchar g,
guchar b) guchar b)
{ {
g_return_if_fail (rgb != NULL); g_return_if_fail (rgb != NULL);
@ -147,9 +147,9 @@ gimp_rgb_set_uchar (GimpRGB *rgb,
void void
gimp_rgb_get_uchar (const GimpRGB *rgb, gimp_rgb_get_uchar (const GimpRGB *rgb,
guchar *r, guchar *r,
guchar *g, guchar *g,
guchar *b) guchar *b)
{ {
g_return_if_fail (rgb != NULL); g_return_if_fail (rgb != NULL);
@ -160,7 +160,7 @@ gimp_rgb_get_uchar (const GimpRGB *rgb,
void void
gimp_rgb_add (GimpRGB *rgb1, gimp_rgb_add (GimpRGB *rgb1,
const GimpRGB *rgb2) const GimpRGB *rgb2)
{ {
g_return_if_fail (rgb1 != NULL); g_return_if_fail (rgb1 != NULL);
g_return_if_fail (rgb2 != NULL); g_return_if_fail (rgb2 != NULL);
@ -172,7 +172,7 @@ gimp_rgb_add (GimpRGB *rgb1,
void void
gimp_rgb_subtract (GimpRGB *rgb1, gimp_rgb_subtract (GimpRGB *rgb1,
const GimpRGB *rgb2) const GimpRGB *rgb2)
{ {
g_return_if_fail (rgb1 != NULL); g_return_if_fail (rgb1 != NULL);
g_return_if_fail (rgb2 != NULL); g_return_if_fail (rgb2 != NULL);
@ -184,7 +184,7 @@ gimp_rgb_subtract (GimpRGB *rgb1,
void void
gimp_rgb_multiply (GimpRGB *rgb, gimp_rgb_multiply (GimpRGB *rgb,
gdouble factor) gdouble factor)
{ {
g_return_if_fail (rgb != NULL); g_return_if_fail (rgb != NULL);
@ -195,14 +195,14 @@ gimp_rgb_multiply (GimpRGB *rgb,
gdouble gdouble
gimp_rgb_distance (const GimpRGB *rgb1, gimp_rgb_distance (const GimpRGB *rgb1,
const GimpRGB *rgb2) const GimpRGB *rgb2)
{ {
g_return_val_if_fail (rgb1 != NULL, 0.0); g_return_val_if_fail (rgb1 != NULL, 0.0);
g_return_val_if_fail (rgb2 != NULL, 0.0); g_return_val_if_fail (rgb2 != NULL, 0.0);
return (fabs (rgb1->r - rgb2->r) + return (fabs (rgb1->r - rgb2->r) +
fabs (rgb1->g - rgb2->g) + fabs (rgb1->g - rgb2->g) +
fabs (rgb1->b - rgb2->b)); fabs (rgb1->b - rgb2->b));
} }
gdouble gdouble
@ -238,7 +238,7 @@ gimp_rgb_clamp (GimpRGB *rgb)
void void
gimp_rgb_gamma (GimpRGB *rgb, gimp_rgb_gamma (GimpRGB *rgb,
gdouble gamma) gdouble gamma)
{ {
gdouble ig; gdouble ig;
@ -328,8 +328,8 @@ gimp_rgb_intensity_uchar (const GimpRGB *rgb)
void void
gimp_rgb_composite (GimpRGB *color1, gimp_rgb_composite (GimpRGB *color1,
const GimpRGB *color2, const GimpRGB *color2,
GimpRGBCompositeMode mode) GimpRGBCompositeMode mode)
{ {
gdouble factor; gdouble factor;
@ -344,29 +344,29 @@ gimp_rgb_composite (GimpRGB *color1,
case GIMP_RGB_COMPOSITE_NORMAL: case GIMP_RGB_COMPOSITE_NORMAL:
/* put color2 on top of color1 */ /* put color2 on top of color1 */
if (color2->a == 1.0) if (color2->a == 1.0)
{ {
*color1 = *color2; *color1 = *color2;
} }
else else
{ {
factor = color1->a * (1.0 - color2->a); factor = color1->a * (1.0 - color2->a);
color1->r = color1->r * factor + color2->r * color2->a; color1->r = color1->r * factor + color2->r * color2->a;
color1->g = color1->g * factor + color2->g * color2->a; color1->g = color1->g * factor + color2->g * color2->a;
color1->b = color1->b * factor + color2->b * color2->a; color1->b = color1->b * factor + color2->b * color2->a;
color1->a = factor + color2->a; color1->a = factor + color2->a;
} }
break; break;
case GIMP_RGB_COMPOSITE_BEHIND: case GIMP_RGB_COMPOSITE_BEHIND:
/* put color2 below color1 */ /* put color2 below color1 */
if (color1->a < 1.0) if (color1->a < 1.0)
{ {
factor = color2->a * (1.0 - color1->a); factor = color2->a * (1.0 - color1->a);
color1->r = color2->r * factor + color1->r * color1->a; color1->r = color2->r * factor + color1->r * color1->a;
color1->g = color2->g * factor + color1->g * color1->a; color1->g = color2->g * factor + color1->g * color1->a;
color1->b = color2->b * factor + color1->b * color1->a; color1->b = color2->b * factor + color1->b * color1->a;
color1->a = factor + color1->a; color1->a = factor + color1->a;
} }
break; break;
} }
} }
@ -387,10 +387,10 @@ gimp_rgb_composite (GimpRGB *color1,
**/ **/
void void
gimp_rgba_set (GimpRGB *rgba, gimp_rgba_set (GimpRGB *rgba,
gdouble r, gdouble r,
gdouble g, gdouble g,
gdouble b, gdouble b,
gdouble a) gdouble a)
{ {
g_return_if_fail (rgba != NULL); g_return_if_fail (rgba != NULL);
@ -413,10 +413,10 @@ gimp_rgba_set (GimpRGB *rgba,
**/ **/
void void
gimp_rgba_set_uchar (GimpRGB *rgba, gimp_rgba_set_uchar (GimpRGB *rgba,
guchar r, guchar r,
guchar g, guchar g,
guchar b, guchar b,
guchar a) guchar a)
{ {
g_return_if_fail (rgba != NULL); g_return_if_fail (rgba != NULL);
@ -428,10 +428,10 @@ gimp_rgba_set_uchar (GimpRGB *rgba,
void void
gimp_rgba_get_uchar (const GimpRGB *rgba, gimp_rgba_get_uchar (const GimpRGB *rgba,
guchar *r, guchar *r,
guchar *g, guchar *g,
guchar *b, guchar *b,
guchar *a) guchar *a)
{ {
g_return_if_fail (rgba != NULL); g_return_if_fail (rgba != NULL);
@ -443,7 +443,7 @@ gimp_rgba_get_uchar (const GimpRGB *rgba,
void void
gimp_rgba_add (GimpRGB *rgba1, gimp_rgba_add (GimpRGB *rgba1,
const GimpRGB *rgba2) const GimpRGB *rgba2)
{ {
g_return_if_fail (rgba1 != NULL); g_return_if_fail (rgba1 != NULL);
g_return_if_fail (rgba2 != NULL); g_return_if_fail (rgba2 != NULL);
@ -456,7 +456,7 @@ gimp_rgba_add (GimpRGB *rgba1,
void void
gimp_rgba_subtract (GimpRGB *rgba1, gimp_rgba_subtract (GimpRGB *rgba1,
const GimpRGB *rgba2) const GimpRGB *rgba2)
{ {
g_return_if_fail (rgba1 != NULL); g_return_if_fail (rgba1 != NULL);
g_return_if_fail (rgba2 != NULL); g_return_if_fail (rgba2 != NULL);
@ -469,7 +469,7 @@ gimp_rgba_subtract (GimpRGB *rgba1,
void void
gimp_rgba_multiply (GimpRGB *rgba, gimp_rgba_multiply (GimpRGB *rgba,
gdouble factor) gdouble factor)
{ {
g_return_if_fail (rgba != NULL); g_return_if_fail (rgba != NULL);
@ -481,7 +481,7 @@ gimp_rgba_multiply (GimpRGB *rgba,
gdouble gdouble
gimp_rgba_distance (const GimpRGB *rgba1, gimp_rgba_distance (const GimpRGB *rgba1,
const GimpRGB *rgba2) const GimpRGB *rgba2)
{ {
g_return_val_if_fail (rgba1 != NULL, 0.0); g_return_val_if_fail (rgba1 != NULL, 0.0);
g_return_val_if_fail (rgba2 != NULL, 0.0); g_return_val_if_fail (rgba2 != NULL, 0.0);

View File

@ -106,7 +106,7 @@ gdouble gimp_rgb_min (const GimpRGB *rgb);
void gimp_rgb_clamp (GimpRGB *rgb); void gimp_rgb_clamp (GimpRGB *rgb);
void gimp_rgb_gamma (GimpRGB *rgb, void gimp_rgb_gamma (GimpRGB *rgb,
gdouble gamma); gdouble gamma);
gdouble gimp_rgb_luminance (const GimpRGB *rgb); gdouble gimp_rgb_luminance (const GimpRGB *rgb);
guchar gimp_rgb_luminance_uchar (const GimpRGB *rgb); guchar gimp_rgb_luminance_uchar (const GimpRGB *rgb);
@ -154,7 +154,7 @@ void gimp_rgba_multiply (GimpRGB *rgba,
gdouble factor); gdouble factor);
gdouble gimp_rgba_distance (const GimpRGB *rgba1, gdouble gimp_rgba_distance (const GimpRGB *rgba1,
const GimpRGB *rgba2); const GimpRGB *rgba2);
@ -173,8 +173,8 @@ gdouble gimp_rgba_distance (const GimpRGB *rgba1,
#define GIMP_RGB_LUMINANCE_BLUE (0.0722) #define GIMP_RGB_LUMINANCE_BLUE (0.0722)
#define GIMP_RGB_LUMINANCE(r,g,b) ((r) * GIMP_RGB_LUMINANCE_RED + \ #define GIMP_RGB_LUMINANCE(r,g,b) ((r) * GIMP_RGB_LUMINANCE_RED + \
(g) * GIMP_RGB_LUMINANCE_GREEN + \ (g) * GIMP_RGB_LUMINANCE_GREEN + \
(b) * GIMP_RGB_LUMINANCE_BLUE) (b) * GIMP_RGB_LUMINANCE_BLUE)
#ifndef GIMP_DISABLE_DEPRECATED #ifndef GIMP_DISABLE_DEPRECATED
@ -193,8 +193,8 @@ gdouble gimp_rgba_distance (const GimpRGB *rgba1,
#define GIMP_RGB_INTENSITY_BLUE (0.11) #define GIMP_RGB_INTENSITY_BLUE (0.11)
#define GIMP_RGB_INTENSITY(r,g,b) ((r) * GIMP_RGB_INTENSITY_RED + \ #define GIMP_RGB_INTENSITY(r,g,b) ((r) * GIMP_RGB_INTENSITY_RED + \
(g) * GIMP_RGB_INTENSITY_GREEN + \ (g) * GIMP_RGB_INTENSITY_GREEN + \
(b) * GIMP_RGB_INTENSITY_BLUE) (b) * GIMP_RGB_INTENSITY_BLUE)
#endif #endif

View File

@ -121,8 +121,8 @@ gimp_config_deserialize_properties (GimpConfig *config,
guint i; guint i;
guint scope_id; guint scope_id;
guint old_scope_id; guint old_scope_id;
GTokenType token; GTokenType token;
GTokenType next; GTokenType next;
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE); g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
@ -486,18 +486,18 @@ gimp_config_deserialize_enum (GValue *value,
g_scanner_get_next_token (scanner); g_scanner_get_next_token (scanner);
enum_value = g_enum_get_value_by_nick (enum_class, enum_value = g_enum_get_value_by_nick (enum_class,
scanner->value.v_identifier); scanner->value.v_identifier);
if (!enum_value) if (!enum_value)
enum_value = g_enum_get_value_by_name (enum_class, enum_value = g_enum_get_value_by_name (enum_class,
scanner->value.v_identifier); scanner->value.v_identifier);
if (!enum_value) if (!enum_value)
{ {
g_scanner_error (scanner, g_scanner_error (scanner,
_("invalid value '%s' for token %s"), _("invalid value '%s' for token %s"),
scanner->value.v_identifier, prop_spec->name); scanner->value.v_identifier, prop_spec->name);
return G_TOKEN_NONE; return G_TOKEN_NONE;
} }
break; break;
case G_TOKEN_INT: case G_TOKEN_INT:
@ -507,12 +507,12 @@ gimp_config_deserialize_enum (GValue *value,
(gint) scanner->value.v_int64); (gint) scanner->value.v_int64);
if (!enum_value) if (!enum_value)
{ {
g_scanner_error (scanner, g_scanner_error (scanner,
_("invalid value '%ld' for token %s"), _("invalid value '%ld' for token %s"),
(glong) scanner->value.v_int64, prop_spec->name); (glong) scanner->value.v_int64, prop_spec->name);
return G_TOKEN_NONE; return G_TOKEN_NONE;
} }
break; break;
default: default:

View File

@ -69,8 +69,8 @@ gimp_config_interface_get_type (void)
static const GTypeInfo config_iface_info = static const GTypeInfo config_iface_info =
{ {
sizeof (GimpConfigInterface), sizeof (GimpConfigInterface),
(GBaseInitFunc) gimp_config_iface_base_init, (GBaseInitFunc) gimp_config_iface_base_init,
(GBaseFinalizeFunc) NULL, (GBaseFinalizeFunc) NULL,
}; };
config_iface_type = g_type_register_static (G_TYPE_INTERFACE, config_iface_type = g_type_register_static (G_TYPE_INTERFACE,
@ -105,7 +105,7 @@ gimp_config_iface_base_init (GimpConfigInterface *config_iface)
static gboolean static gboolean
gimp_config_iface_serialize (GimpConfig *config, gimp_config_iface_serialize (GimpConfig *config,
GimpConfigWriter *writer, GimpConfigWriter *writer,
gpointer data) gpointer data)
{ {
return gimp_config_serialize_properties (config, writer); return gimp_config_serialize_properties (config, writer);
@ -255,11 +255,11 @@ gimp_config_iface_reset (GimpConfig *config)
**/ **/
gboolean gboolean
gimp_config_serialize_to_file (GimpConfig *config, gimp_config_serialize_to_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
const gchar *header, const gchar *header,
const gchar *footer, const gchar *footer,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GimpConfigWriter *writer; GimpConfigWriter *writer;
@ -321,7 +321,7 @@ gimp_config_serialize_to_fd (GimpConfig *config,
**/ **/
gchar * gchar *
gimp_config_serialize_to_string (GimpConfig *config, gimp_config_serialize_to_string (GimpConfig *config,
gpointer data) gpointer data)
{ {
GimpConfigWriter *writer; GimpConfigWriter *writer;
GString *str; GString *str;
@ -356,9 +356,9 @@ gimp_config_serialize_to_string (GimpConfig *config,
**/ **/
gboolean gboolean
gimp_config_deserialize_file (GimpConfig *config, gimp_config_deserialize_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GScanner *scanner; GScanner *scanner;
gboolean success; gboolean success;
@ -402,7 +402,7 @@ gboolean
gimp_config_deserialize_string (GimpConfig *config, gimp_config_deserialize_string (GimpConfig *config,
const gchar *text, const gchar *text,
gint text_len, gint text_len,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GScanner *scanner; GScanner *scanner;

View File

@ -77,7 +77,7 @@ gboolean gimp_config_serialize_to_fd (GimpConfig *config,
gint fd, gint fd,
gpointer data); gpointer data);
gchar * gimp_config_serialize_to_string (GimpConfig *config, gchar * gimp_config_serialize_to_string (GimpConfig *config,
gpointer data); gpointer data);
gboolean gimp_config_deserialize_file (GimpConfig *config, gboolean gimp_config_deserialize_file (GimpConfig *config,
const gchar *filename, const gchar *filename,
gpointer data, gpointer data,

View File

@ -329,10 +329,10 @@ gimp_config_path_expand_only (const gchar *path,
while (*p) while (*p)
{ {
if (*p == '~' && home) if (*p == '~' && home)
{ {
length += strlen (home); length += strlen (home);
p += 1; p += 1;
} }
else if ((token = gimp_config_path_extract_token (&p)) != NULL) else if ((token = gimp_config_path_extract_token (&p)) != NULL)
{ {
for (i = 0; i < n_substs; i++) for (i = 0; i < n_substs; i++)
@ -352,7 +352,7 @@ gimp_config_path_expand_only (const gchar *path,
else if (strcmp (token, "gimp_data_dir") == 0) else if (strcmp (token, "gimp_data_dir") == 0)
s = gimp_data_directory (); s = gimp_data_directory ();
else if (strcmp (token, "gimp_plug_in_dir") == 0 || else if (strcmp (token, "gimp_plug_in_dir") == 0 ||
strcmp (token, "gimp_plugin_dir") == 0) strcmp (token, "gimp_plugin_dir") == 0)
s = gimp_plug_in_directory (); s = gimp_plug_in_directory ();
else if (strcmp (token, "gimp_sysconf_dir") == 0) else if (strcmp (token, "gimp_sysconf_dir") == 0)
s = gimp_sysconf_directory (); s = gimp_sysconf_directory ();
@ -389,10 +389,10 @@ gimp_config_path_expand_only (const gchar *path,
n_substs++; n_substs++;
} }
else else
{ {
length += g_utf8_skip[(const guchar) *p]; length += g_utf8_skip[(const guchar) *p];
p = g_utf8_next_char (p); p = g_utf8_next_char (p);
} }
} }
if (n_substs == 0) if (n_substs == 0)
@ -406,12 +406,12 @@ gimp_config_path_expand_only (const gchar *path,
while (*p) while (*p)
{ {
if (*p == '~' && home) if (*p == '~' && home)
{ {
*n = '\0'; *n = '\0';
strcat (n, home); strcat (n, home);
n += strlen (home); n += strlen (home);
p += 1; p += 1;
} }
else if ((token = gimp_config_path_extract_token (&p)) != NULL) else if ((token = gimp_config_path_extract_token (&p)) != NULL)
{ {
for (i = 0; i < n_substs; i++) for (i = 0; i < n_substs; i++)
@ -429,11 +429,11 @@ gimp_config_path_expand_only (const gchar *path,
} }
g_free (token); g_free (token);
} }
else else
{ {
*n++ = *p++; *n++ = *p++;
} }
} }
*n = '\0'; *n = '\0';

View File

@ -253,19 +253,19 @@ gimp_config_serialize_property (GimpConfig *config,
} }
else if (! G_VALUE_HOLDS_OBJECT (&value)) else if (! G_VALUE_HOLDS_OBJECT (&value))
{ {
GString *str = g_string_new (NULL); GString *str = g_string_new (NULL);
success = gimp_config_serialize_value (&value, str, TRUE); success = gimp_config_serialize_value (&value, str, TRUE);
if (success) if (success)
{ {
gimp_config_writer_open (writer, param_spec->name); gimp_config_writer_open (writer, param_spec->name);
gimp_config_writer_print (writer, str->str, str->len); gimp_config_writer_print (writer, str->str, str->len);
gimp_config_writer_close (writer); gimp_config_writer_close (writer);
} }
g_string_free (str, TRUE); g_string_free (str, TRUE);
} }
if (! success) if (! success)
{ {
@ -395,7 +395,7 @@ gimp_config_serialize_value (const GValue *value,
G_ASCII_DTOSTR_BUF_SIZE, "%f", trafo->coeff[i][j]); G_ASCII_DTOSTR_BUF_SIZE, "%f", trafo->coeff[i][j]);
g_string_append_printf (str, "(matrix %s %s %s %s)", g_string_append_printf (str, "(matrix %s %s %s %s)",
buf[0], buf[1], buf[2], buf[3]); buf[0], buf[1], buf[2], buf[3]);
return TRUE; return TRUE;
} }
@ -416,7 +416,7 @@ gimp_config_serialize_value (const GValue *value,
g_string_append (str, " "); g_string_append (str, " ");
if (! gimp_config_serialize_value (g_value_array_get_nth (array, if (! gimp_config_serialize_value (g_value_array_get_nth (array,
i), i),
str, TRUE)) str, TRUE))
return FALSE; return FALSE;
} }

View File

@ -29,13 +29,13 @@ G_BEGIN_DECLS
gboolean gimp_config_serialize_properties (GimpConfig *config, gboolean gimp_config_serialize_properties (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_changed_properties (GimpConfig *config, gboolean gimp_config_serialize_changed_properties (GimpConfig *config,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_property (GimpConfig *config, gboolean gimp_config_serialize_property (GimpConfig *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GimpConfigWriter *writer); GimpConfigWriter *writer);
gboolean gimp_config_serialize_value (const GValue *value, gboolean gimp_config_serialize_value (const GValue *value,
GString *str, GString *str,
gboolean escaped); gboolean escaped);

View File

@ -75,7 +75,7 @@ gimp_config_writer_flush (GimpConfigWriter *writer)
{ {
if (write (writer->fd, writer->buffer->str, writer->buffer->len) < 0) if (write (writer->fd, writer->buffer->str, writer->buffer->len) < 0)
g_set_error (&writer->error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, g_set_error (&writer->error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
g_strerror (errno)); g_strerror (errno));
g_string_truncate (writer->buffer, 0); g_string_truncate (writer->buffer, 0);
} }
@ -112,9 +112,9 @@ gimp_config_writer_newline (GimpConfigWriter *writer)
**/ **/
GimpConfigWriter * GimpConfigWriter *
gimp_config_writer_new_file (const gchar *filename, gimp_config_writer_new_file (const gchar *filename,
gboolean atomic, gboolean atomic,
const gchar *header, const gchar *header,
GError **error) GError **error)
{ {
GimpConfigWriter *writer; GimpConfigWriter *writer;
gchar *tmpname = NULL; gchar *tmpname = NULL;
@ -130,25 +130,25 @@ gimp_config_writer_new_file (const gchar *filename,
fd = g_mkstemp (tmpname); fd = g_mkstemp (tmpname);
if (fd == -1) if (fd == -1)
{ {
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not create temporary file for '%s': %s"), _("Could not create temporary file for '%s': %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno)); gimp_filename_to_utf8 (filename), g_strerror (errno));
g_free (tmpname); g_free (tmpname);
return NULL; return NULL;
} }
} }
else else
{ {
fd = g_creat (filename, 0644); fd = g_creat (filename, 0644);
if (fd == -1) if (fd == -1)
{ {
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not open '%s' for writing: %s"), _("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno)); gimp_filename_to_utf8 (filename), g_strerror (errno));
return NULL; return NULL;
} }
} }
writer = g_new0 (GimpConfigWriter, 1); writer = g_new0 (GimpConfigWriter, 1);
@ -265,7 +265,7 @@ gimp_config_writer_comment_mode (GimpConfigWriter *writer,
**/ **/
void void
gimp_config_writer_open (GimpConfigWriter *writer, gimp_config_writer_open (GimpConfigWriter *writer,
const gchar *name) const gchar *name)
{ {
g_return_if_fail (writer != NULL); g_return_if_fail (writer != NULL);
g_return_if_fail (name != NULL); g_return_if_fail (name != NULL);
@ -297,8 +297,8 @@ gimp_config_writer_open (GimpConfigWriter *writer,
**/ **/
void void
gimp_config_writer_print (GimpConfigWriter *writer, gimp_config_writer_print (GimpConfigWriter *writer,
const gchar *string, const gchar *string,
gint len) gint len)
{ {
g_return_if_fail (writer != NULL); g_return_if_fail (writer != NULL);
g_return_if_fail (len == 0 || string != NULL); g_return_if_fail (len == 0 || string != NULL);
@ -328,8 +328,8 @@ gimp_config_writer_print (GimpConfigWriter *writer,
**/ **/
void void
gimp_config_writer_printf (GimpConfigWriter *writer, gimp_config_writer_printf (GimpConfigWriter *writer,
const gchar *format, const gchar *format,
...) ...)
{ {
gchar *buffer; gchar *buffer;
va_list args; va_list args;
@ -506,8 +506,8 @@ gimp_config_writer_close (GimpConfigWriter *writer)
**/ **/
gboolean gboolean
gimp_config_writer_finish (GimpConfigWriter *writer, gimp_config_writer_finish (GimpConfigWriter *writer,
const gchar *footer, const gchar *footer,
GError **error) GError **error)
{ {
gboolean success = TRUE; gboolean success = TRUE;
@ -521,7 +521,7 @@ gimp_config_writer_finish (GimpConfigWriter *writer,
else else
{ {
while (writer->depth) while (writer->depth)
gimp_config_writer_close (writer); gimp_config_writer_close (writer);
} }
if (footer) if (footer)
@ -582,7 +582,7 @@ gimp_config_writer_linefeed (GimpConfigWriter *writer)
**/ **/
void void
gimp_config_writer_comment (GimpConfigWriter *writer, gimp_config_writer_comment (GimpConfigWriter *writer,
const gchar *comment) const gchar *comment)
{ {
const gchar *s; const gchar *s;
gboolean comment_mode; gboolean comment_mode;
@ -640,7 +640,7 @@ gimp_config_writer_comment (GimpConfigWriter *writer,
static gboolean static gboolean
gimp_config_writer_close_file (GimpConfigWriter *writer, gimp_config_writer_close_file (GimpConfigWriter *writer,
GError **error) GError **error)
{ {
g_return_val_if_fail (writer->fd != 0, FALSE); g_return_val_if_fail (writer->fd != 0, FALSE);
@ -652,7 +652,7 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
close (writer->fd); close (writer->fd);
if (writer->tmpname) if (writer->tmpname)
g_unlink (writer->tmpname); g_unlink (writer->tmpname);
return TRUE; return TRUE;
} }
@ -660,33 +660,33 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
if (close (writer->fd) != 0) if (close (writer->fd) != 0)
{ {
if (writer->tmpname) if (writer->tmpname)
{ {
if (g_file_test (writer->filename, G_FILE_TEST_EXISTS)) if (g_file_test (writer->filename, G_FILE_TEST_EXISTS))
{ {
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to temporary file for '%s': %s\n" _("Error writing to temporary file for '%s': %s\n"
"The original file has not been touched."), "The original file has not been touched."),
gimp_filename_to_utf8 (writer->filename), gimp_filename_to_utf8 (writer->filename),
g_strerror (errno)); g_strerror (errno));
} }
else else
{ {
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to temporary file for '%s': %s\n" _("Error writing to temporary file for '%s': %s\n"
"No file has been created."), "No file has been created."),
gimp_filename_to_utf8 (writer->filename), gimp_filename_to_utf8 (writer->filename),
g_strerror (errno)); g_strerror (errno));
} }
g_unlink (writer->tmpname); g_unlink (writer->tmpname);
} }
else else
{ {
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Error writing to '%s': %s"), _("Error writing to '%s': %s"),
gimp_filename_to_utf8 (writer->filename), gimp_filename_to_utf8 (writer->filename),
g_strerror (errno)); g_strerror (errno));
} }
return FALSE; return FALSE;
} }
@ -699,15 +699,15 @@ gimp_config_writer_close_file (GimpConfigWriter *writer,
#endif #endif
if (g_rename (writer->tmpname, writer->filename) == -1) if (g_rename (writer->tmpname, writer->filename) == -1)
{ {
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE, g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_WRITE,
_("Could not create '%s': %s"), _("Could not create '%s': %s"),
gimp_filename_to_utf8 (writer->filename), gimp_filename_to_utf8 (writer->filename),
g_strerror (errno)); g_strerror (errno));
g_unlink (writer->tmpname); g_unlink (writer->tmpname);
return FALSE; return FALSE;
} }
} }
return TRUE; return TRUE;

View File

@ -50,15 +50,15 @@ void gimp_config_writer_data (GimpConfigWriter *writer,
gint length, gint length,
const guint8 *data); const guint8 *data);
void gimp_config_writer_comment (GimpConfigWriter *writer, void gimp_config_writer_comment (GimpConfigWriter *writer,
const gchar *comment); const gchar *comment);
void gimp_config_writer_linefeed (GimpConfigWriter *writer); void gimp_config_writer_linefeed (GimpConfigWriter *writer);
void gimp_config_writer_revert (GimpConfigWriter *writer); void gimp_config_writer_revert (GimpConfigWriter *writer);
void gimp_config_writer_close (GimpConfigWriter *writer); void gimp_config_writer_close (GimpConfigWriter *writer);
gboolean gimp_config_writer_finish (GimpConfigWriter *writer, gboolean gimp_config_writer_finish (GimpConfigWriter *writer,
const gchar *footer, const gchar *footer,
GError **error); GError **error);
#endif /* __GIMP_CONFIG_WRITER_H__ */ #endif /* __GIMP_CONFIG_WRITER_H__ */

View File

@ -69,7 +69,7 @@ static void gimp_scanner_message (GScanner *scanner,
**/ **/
GScanner * GScanner *
gimp_scanner_new_file (const gchar *filename, gimp_scanner_new_file (const gchar *filename,
GError **error) GError **error)
{ {
GScanner *scanner; GScanner *scanner;
GMappedFile *file; GMappedFile *file;
@ -114,8 +114,8 @@ gimp_scanner_new_file (const gchar *filename,
**/ **/
GScanner * GScanner *
gimp_scanner_new_string (const gchar *text, gimp_scanner_new_string (const gchar *text,
gint text_len, gint text_len,
GError **error) GError **error)
{ {
GScanner *scanner; GScanner *scanner;

View File

@ -48,8 +48,8 @@ gimp_matrix2_get_type (void)
if (!matrix_type) if (!matrix_type)
matrix_type = g_boxed_type_register_static ("GimpMatrix2", matrix_type = g_boxed_type_register_static ("GimpMatrix2",
(GBoxedCopyFunc) matrix2_copy, (GBoxedCopyFunc) matrix2_copy,
(GBoxedFreeFunc) g_free); (GBoxedFreeFunc) g_free);
return matrix_type; return matrix_type;
} }

View File

@ -137,7 +137,7 @@ const gchar * gimp_module_state_name (GimpModuleState state);
#ifndef GIMP_DISABLE_DEPRECATED #ifndef GIMP_DISABLE_DEPRECATED
GType gimp_module_register_enum (GTypeModule *module, GType gimp_module_register_enum (GTypeModule *module,
const gchar *name, const gchar *name,
const GEnumValue *const_static_values); const GEnumValue *const_static_values);
#endif /* GIMP_DISABLE_DEPRECATED */ #endif /* GIMP_DISABLE_DEPRECATED */

View File

@ -133,27 +133,27 @@ gimp_thumbnail_class_init (GimpThumbnailClass *klass)
object_class->get_property = gimp_thumbnail_get_property; object_class->get_property = gimp_thumbnail_get_property;
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_IMAGE_STATE, PROP_IMAGE_STATE,
g_param_spec_enum ("image-state", NULL, g_param_spec_enum ("image-state", NULL,
"State of the image associated to the thumbnail object", "State of the image associated to the thumbnail object",
GIMP_TYPE_THUMB_STATE, GIMP_TYPE_THUMB_STATE,
GIMP_THUMB_STATE_UNKNOWN, GIMP_THUMB_STATE_UNKNOWN,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_IMAGE_URI, PROP_IMAGE_URI,
g_param_spec_string ("image-uri", NULL, g_param_spec_string ("image-uri", NULL,
"URI of the image file", "URI of the image file",
NULL, NULL,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_IMAGE_MTIME, PROP_IMAGE_MTIME,
g_param_spec_int64 ("image-mtime", NULL, g_param_spec_int64 ("image-mtime", NULL,
"Modification time of the image file in seconds since the Epoch", "Modification time of the image file in seconds since the Epoch",
0, G_MAXINT64, 0, 0, G_MAXINT64, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_IMAGE_FILESIZE, PROP_IMAGE_FILESIZE,
g_param_spec_int64 ("image-filesize", NULL, g_param_spec_int64 ("image-filesize", NULL,
"Size of the image file in bytes", "Size of the image file in bytes",
0, G_MAXINT64, 0, 0, G_MAXINT64, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
@ -163,20 +163,20 @@ gimp_thumbnail_class_init (GimpThumbnailClass *klass)
* Since: GIMP 2.2 * Since: GIMP 2.2
**/ **/
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_IMAGE_MIMETYPE, PROP_IMAGE_MIMETYPE,
g_param_spec_string ("image-mimetype", NULL, g_param_spec_string ("image-mimetype", NULL,
"Image mimetype", "Image mimetype",
NULL, NULL,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_IMAGE_WIDTH, PROP_IMAGE_WIDTH,
g_param_spec_int ("image-width", NULL, g_param_spec_int ("image-width", NULL,
"Width of the image in pixels", "Width of the image in pixels",
0, G_MAXINT, 0, 0, G_MAXINT, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_IMAGE_HEIGHT, PROP_IMAGE_HEIGHT,
g_param_spec_int ("image-height", NULL, g_param_spec_int ("image-height", NULL,
"Height of the image in pixels", "Height of the image in pixels",
0, G_MAXINT, 0, 0, G_MAXINT, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
@ -193,8 +193,8 @@ gimp_thumbnail_class_init (GimpThumbnailClass *klass)
0, G_MAXINT, 0, 0, G_MAXINT, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_THUMB_STATE, PROP_THUMB_STATE,
g_param_spec_enum ("thumb-state", NULL, g_param_spec_enum ("thumb-state", NULL,
"State of the thumbnail file", "State of the thumbnail file",
GIMP_TYPE_THUMB_STATE, GIMP_TYPE_THUMB_STATE,
GIMP_THUMB_STATE_UNKNOWN, GIMP_THUMB_STATE_UNKNOWN,
@ -884,10 +884,10 @@ gimp_thumbnail_save (GimpThumbnail *thumbnail,
#endif #endif
if (g_rename (tmpname, filename) == -1) if (g_rename (tmpname, filename) == -1)
{ {
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not create thumbnail for %s: %s"), _("Could not create thumbnail for %s: %s"),
thumbnail->image_uri, g_strerror (errno)); thumbnail->image_uri, g_strerror (errno));
success = FALSE; success = FALSE;
} }

View File

@ -53,7 +53,7 @@ struct _GimpButtonClass
GtkButtonClass parent_class; GtkButtonClass parent_class;
void (* extended_clicked) (GimpButton *preview, void (* extended_clicked) (GimpButton *preview,
GdkModifierType modifier_state); GdkModifierType modifier_state);
/* Padding for future expansion */ /* Padding for future expansion */
void (* _gimp_reserved1) (void); void (* _gimp_reserved1) (void);

View File

@ -98,7 +98,7 @@ gimp_cell_renderer_color_class_init (GimpCellRendererColorClass *klass)
GIMP_PARAM_READWRITE | GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT)); G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_SIZE, PROP_SIZE,
g_param_spec_int ("icon-size", NULL, NULL, g_param_spec_int ("icon-size", NULL, NULL,
0, G_MAXINT, 0, G_MAXINT,
DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE,
@ -183,18 +183,18 @@ gimp_cell_renderer_color_get_size (GtkCellRenderer *cell,
if (cell_area && calc_width > 0 && calc_height > 0) if (cell_area && calc_width > 0 && calc_height > 0)
{ {
if (x_offset) if (x_offset)
{ {
*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
1.0 - cell->xalign : cell->xalign) * 1.0 - cell->xalign : cell->xalign) *
(cell_area->width - calc_width)); (cell_area->width - calc_width));
*x_offset = MAX (*x_offset, 0) + cell->xpad; *x_offset = MAX (*x_offset, 0) + cell->xpad;
} }
if (y_offset) if (y_offset)
{ {
*y_offset = (cell->yalign * *y_offset = (cell->yalign *
(cell_area->height - calc_height)); (cell_area->height - calc_height));
*y_offset = MAX (*y_offset, 0) + cell->ypad; *y_offset = MAX (*y_offset, 0) + cell->ypad;
} }
} }
else else
{ {

View File

@ -97,13 +97,13 @@ gimp_cell_renderer_toggle_class_init (GimpCellRendererToggleClass *klass)
toggle_cell_signals[CLICKED] = toggle_cell_signals[CLICKED] =
g_signal_new ("clicked", g_signal_new ("clicked",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GimpCellRendererToggleClass, clicked), G_STRUCT_OFFSET (GimpCellRendererToggleClass, clicked),
NULL, NULL, NULL, NULL,
_gimp_widgets_marshal_VOID__STRING_FLAGS, _gimp_widgets_marshal_VOID__STRING_FLAGS,
G_TYPE_NONE, 2, G_TYPE_NONE, 2,
G_TYPE_STRING, G_TYPE_STRING,
GDK_TYPE_MODIFIER_TYPE); GDK_TYPE_MODIFIER_TYPE);
object_class->finalize = gimp_cell_renderer_toggle_finalize; object_class->finalize = gimp_cell_renderer_toggle_finalize;
@ -192,7 +192,7 @@ gimp_cell_renderer_toggle_set_property (GObject *object,
{ {
case PROP_STOCK_ID: case PROP_STOCK_ID:
if (toggle->stock_id) if (toggle->stock_id)
g_free (toggle->stock_id); g_free (toggle->stock_id);
toggle->stock_id = g_value_dup_string (value); toggle->stock_id = g_value_dup_string (value);
break; break;
case PROP_STOCK_SIZE: case PROP_STOCK_SIZE:
@ -256,17 +256,17 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
if (cell_area) if (cell_area)
{ {
if (x_offset) if (x_offset)
{ {
*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - cell->xalign) : cell->xalign) * (1.0 - cell->xalign) : cell->xalign) *
(cell_area->width - calc_width)); (cell_area->width - calc_width));
*x_offset = MAX (*x_offset, 0); *x_offset = MAX (*x_offset, 0);
} }
if (y_offset) if (y_offset)
{ {
*y_offset = cell->yalign * (cell_area->height - calc_height); *y_offset = cell->yalign * (cell_area->height - calc_height);
*y_offset = MAX (*y_offset, 0); *y_offset = MAX (*y_offset, 0);
} }
} }
} }
@ -314,9 +314,9 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED) if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{ {
if (GTK_WIDGET_HAS_FOCUS (widget)) if (GTK_WIDGET_HAS_FOCUS (widget))
state = GTK_STATE_SELECTED; state = GTK_STATE_SELECTED;
else else
state = GTK_STATE_ACTIVE; state = GTK_STATE_ACTIVE;
} }
else else
{ {

View File

@ -36,10 +36,10 @@ enum
static void gimp_chain_button_clicked_callback (GtkWidget *widget, static void gimp_chain_button_clicked_callback (GtkWidget *widget,
GimpChainButton *button); GimpChainButton *button);
static gboolean gimp_chain_button_draw_lines (GtkWidget *widget, static gboolean gimp_chain_button_draw_lines (GtkWidget *widget,
GdkEventExpose *eevent, GdkEventExpose *eevent,
GimpChainButton *button); GimpChainButton *button);
G_DEFINE_TYPE (GimpChainButton, gimp_chain_button, GTK_TYPE_TABLE); G_DEFINE_TYPE (GimpChainButton, gimp_chain_button, GTK_TYPE_TABLE);
@ -62,12 +62,12 @@ gimp_chain_button_class_init (GimpChainButtonClass *klass)
{ {
gimp_chain_button_signals[TOGGLED] = gimp_chain_button_signals[TOGGLED] =
g_signal_new ("toggled", g_signal_new ("toggled",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpChainButtonClass, toggled), G_STRUCT_OFFSET (GimpChainButtonClass, toggled),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
klass->toggled = NULL; klass->toggled = NULL;
} }
@ -136,21 +136,21 @@ gimp_chain_button_new (GimpChainPosition position)
{ {
gtk_table_resize (GTK_TABLE (button), 3, 1); gtk_table_resize (GTK_TABLE (button), 3, 1);
gtk_table_attach (GTK_TABLE (button), button->button, 0, 1, 1, 2, gtk_table_attach (GTK_TABLE (button), button->button, 0, 1, 1, 2,
GTK_SHRINK, GTK_SHRINK, 0, 0); GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_table_attach_defaults (GTK_TABLE (button), gtk_table_attach_defaults (GTK_TABLE (button),
button->line1, 0, 1, 0, 1); button->line1, 0, 1, 0, 1);
gtk_table_attach_defaults (GTK_TABLE (button), gtk_table_attach_defaults (GTK_TABLE (button),
button->line2, 0, 1, 2, 3); button->line2, 0, 1, 2, 3);
} }
else else
{ {
gtk_table_resize (GTK_TABLE (button), 1, 3); gtk_table_resize (GTK_TABLE (button), 1, 3);
gtk_table_attach (GTK_TABLE (button), button->button, 1, 2, 0, 1, gtk_table_attach (GTK_TABLE (button), button->button, 1, 2, 0, 1,
GTK_SHRINK, GTK_SHRINK, 0, 0); GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_table_attach_defaults (GTK_TABLE (button), gtk_table_attach_defaults (GTK_TABLE (button),
button->line1, 0, 1, 0, 1); button->line1, 0, 1, 0, 1);
gtk_table_attach_defaults (GTK_TABLE (button), gtk_table_attach_defaults (GTK_TABLE (button),
button->line2, 2, 3, 0, 1); button->line2, 2, 3, 0, 1);
} }
gtk_widget_show (button->button); gtk_widget_show (button->button);
@ -170,7 +170,7 @@ gimp_chain_button_new (GimpChainPosition position)
*/ */
void void
gimp_chain_button_set_active (GimpChainButton *button, gimp_chain_button_set_active (GimpChainButton *button,
gboolean active) gboolean active)
{ {
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (button)); g_return_if_fail (GIMP_IS_CHAIN_BUTTON (button));
@ -206,7 +206,7 @@ gimp_chain_button_get_active (GimpChainButton *button)
static void static void
gimp_chain_button_clicked_callback (GtkWidget *widget, gimp_chain_button_clicked_callback (GtkWidget *widget,
GimpChainButton *button) GimpChainButton *button)
{ {
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (button)); g_return_if_fail (GIMP_IS_CHAIN_BUTTON (button));
@ -217,12 +217,12 @@ gimp_chain_button_clicked_callback (GtkWidget *widget,
static gboolean static gboolean
gimp_chain_button_draw_lines (GtkWidget *widget, gimp_chain_button_draw_lines (GtkWidget *widget,
GdkEventExpose *eevent, GdkEventExpose *eevent,
GimpChainButton *button) GimpChainButton *button)
{ {
GdkPoint points[3]; GdkPoint points[3];
GdkPoint buf; GdkPoint buf;
GtkShadowType shadow; GtkShadowType shadow;
GimpChainPosition position; GimpChainPosition position;
gint which_line; gint which_line;
@ -299,15 +299,15 @@ gimp_chain_button_draw_lines (GtkWidget *widget,
} }
gtk_paint_polygon (widget->style, gtk_paint_polygon (widget->style,
widget->window, widget->window,
GTK_STATE_NORMAL, GTK_STATE_NORMAL,
shadow, shadow,
&eevent->area, &eevent->area,
widget, widget,
"chainbutton", "chainbutton",
points, points,
3, 3,
FALSE); FALSE);
return TRUE; return TRUE;
} }

View File

@ -78,7 +78,7 @@ GType gimp_chain_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_chain_button_new (GimpChainPosition position); GtkWidget * gimp_chain_button_new (GimpChainPosition position);
void gimp_chain_button_set_active (GimpChainButton *button, void gimp_chain_button_set_active (GimpChainButton *button,
gboolean active); gboolean active);
gboolean gimp_chain_button_get_active (GimpChainButton *button); gboolean gimp_chain_button_get_active (GimpChainButton *button);

View File

@ -71,21 +71,21 @@ static gboolean gimp_color_area_expose (GtkWidget *widget,
static void gimp_color_area_render (GimpColorArea *area); static void gimp_color_area_render (GimpColorArea *area);
static void gimp_color_area_drag_begin (GtkWidget *widget, static void gimp_color_area_drag_begin (GtkWidget *widget,
GdkDragContext *context); GdkDragContext *context);
static void gimp_color_area_drag_end (GtkWidget *widget, static void gimp_color_area_drag_end (GtkWidget *widget,
GdkDragContext *context); GdkDragContext *context);
static void gimp_color_area_drag_data_received (GtkWidget *widget, static void gimp_color_area_drag_data_received (GtkWidget *widget,
GdkDragContext *context, GdkDragContext *context,
gint x, gint x,
gint y, gint y,
GtkSelectionData *selection_data, GtkSelectionData *selection_data,
guint info, guint info,
guint time); guint time);
static void gimp_color_area_drag_data_get (GtkWidget *widget, static void gimp_color_area_drag_data_get (GtkWidget *widget,
GdkDragContext *context, GdkDragContext *context,
GtkSelectionData *selection_data, GtkSelectionData *selection_data,
guint info, guint info,
guint time); guint time);
G_DEFINE_TYPE (GimpColorArea, gimp_color_area, GTK_TYPE_DRAWING_AREA); G_DEFINE_TYPE (GimpColorArea, gimp_color_area, GTK_TYPE_DRAWING_AREA);
@ -283,7 +283,7 @@ gimp_color_area_set_property (GObject *object,
static void static void
gimp_color_area_size_allocate (GtkWidget *widget, gimp_color_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GimpColorArea *area = GIMP_COLOR_AREA (widget); GimpColorArea *area = GIMP_COLOR_AREA (widget);
@ -371,8 +371,8 @@ gimp_color_area_expose (GtkWidget *widget,
**/ **/
GtkWidget * GtkWidget *
gimp_color_area_new (const GimpRGB *color, gimp_color_area_new (const GimpRGB *color,
GimpColorAreaType type, GimpColorAreaType type,
GdkModifierType drag_mask) GdkModifierType drag_mask)
{ {
return g_object_new (GIMP_TYPE_COLOR_AREA, return g_object_new (GIMP_TYPE_COLOR_AREA,
"color", color, "color", color,
@ -653,7 +653,7 @@ gimp_color_area_render (GimpColorArea *area)
static void static void
gimp_color_area_drag_begin (GtkWidget *widget, gimp_color_area_drag_begin (GtkWidget *widget,
GdkDragContext *context) GdkDragContext *context)
{ {
GimpRGB color; GimpRGB color;
GtkWidget *window; GtkWidget *window;

View File

@ -78,19 +78,19 @@ struct _GimpColorButtonClass
GType gimp_color_button_get_type (void) G_GNUC_CONST; GType gimp_color_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_color_button_new (const gchar *title, GtkWidget * gimp_color_button_new (const gchar *title,
gint width, gint width,
gint height, gint height,
const GimpRGB *color, const GimpRGB *color,
GimpColorAreaType type); GimpColorAreaType type);
void gimp_color_button_set_color (GimpColorButton *button, void gimp_color_button_set_color (GimpColorButton *button,
const GimpRGB *color); const GimpRGB *color);
void gimp_color_button_get_color (GimpColorButton *button, void gimp_color_button_get_color (GimpColorButton *button,
GimpRGB *color); GimpRGB *color);
gboolean gimp_color_button_has_alpha (GimpColorButton *button); gboolean gimp_color_button_has_alpha (GimpColorButton *button);
void gimp_color_button_set_type (GimpColorButton *button, void gimp_color_button_set_type (GimpColorButton *button,
GimpColorAreaType type); GimpColorAreaType type);
gboolean gimp_color_button_get_update (GimpColorButton *button); gboolean gimp_color_button_get_update (GimpColorButton *button);
void gimp_color_button_set_update (GimpColorButton *button, void gimp_color_button_set_update (GimpColorButton *button,

View File

@ -134,7 +134,7 @@ gimp_color_notebook_init (GimpColorNotebook *notebook)
notebook); notebook);
selector_types = g_type_children (GIMP_TYPE_COLOR_SELECTOR, selector_types = g_type_children (GIMP_TYPE_COLOR_SELECTOR,
&n_selector_types); &n_selector_types);
if (n_selector_types == 2) if (n_selector_types == 2)
{ {

View File

@ -181,7 +181,7 @@ gimp_color_scale_expose (GtkWidget *widget,
{ {
GimpColorScale *scale = GIMP_COLOR_SCALE (widget); GimpColorScale *scale = GIMP_COLOR_SCALE (widget);
GtkRange *range; GtkRange *range;
GdkRectangle expose_area; /* Relative to widget->allocation */ GdkRectangle expose_area; /* Relative to widget->allocation */
GdkRectangle area; GdkRectangle area;
gint focus = 0; gint focus = 0;
gint slider_size; gint slider_size;

View File

@ -144,27 +144,27 @@ gimp_color_scales_init (GimpColorScales *scales)
enum_desc = gimp_enum_get_desc (enum_class, i); enum_desc = gimp_enum_get_desc (enum_class, i);
if (i == GIMP_COLOR_SELECTOR_ALPHA) if (i == GIMP_COLOR_SELECTOR_ALPHA)
{ {
scales->toggles[i] = NULL; scales->toggles[i] = NULL;
} }
else else
{ {
scales->toggles[i] = gtk_radio_button_new (group); scales->toggles[i] = gtk_radio_button_new (group);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (scales->toggles[i])); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (scales->toggles[i]));
gtk_table_attach (GTK_TABLE (table), scales->toggles[i], gtk_table_attach (GTK_TABLE (table), scales->toggles[i],
0, 1, i, i + 1, 0, 1, i, i + 1,
GTK_SHRINK, GTK_EXPAND, 0, 0); GTK_SHRINK, GTK_EXPAND, 0, 0);
if (selector->toggles_visible) if (selector->toggles_visible)
gtk_widget_show (scales->toggles[i]); gtk_widget_show (scales->toggles[i]);
gimp_help_set_help_data (scales->toggles[i], gimp_help_set_help_data (scales->toggles[i],
gettext (enum_desc->value_help), NULL); gettext (enum_desc->value_help), NULL);
g_signal_connect (scales->toggles[i], "toggled", g_signal_connect (scales->toggles[i], "toggled",
G_CALLBACK (gimp_color_scales_toggle_update), G_CALLBACK (gimp_color_scales_toggle_update),
scales); scales);
} }
scales->slider_data[i] = scales->slider_data[i] =
gimp_color_scale_entry_new (GTK_TABLE (table), 1, i, gimp_color_scale_entry_new (GTK_TABLE (table), 1, i,
@ -182,8 +182,8 @@ gimp_color_scales_init (GimpColorScales *scales)
gimp_color_scale_set_channel (GIMP_COLOR_SCALE (scales->sliders[i]), i); gimp_color_scale_set_channel (GIMP_COLOR_SCALE (scales->sliders[i]), i);
g_signal_connect (scales->slider_data[i], "value-changed", g_signal_connect (scales->slider_data[i], "value-changed",
G_CALLBACK (gimp_color_scales_scale_update), G_CALLBACK (gimp_color_scales_scale_update),
scales); scales);
} }
g_type_class_unref (enum_class); g_type_class_unref (enum_class);

View File

@ -184,8 +184,8 @@ gimp_color_selection_init (GimpColorSelection *selection)
gtk_widget_set_size_request (frame, -1, COLOR_AREA_SIZE); gtk_widget_set_size_request (frame, -1, COLOR_AREA_SIZE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Current:"), 1.0, 0.5, _("Current:"), 1.0, 0.5,
frame, 1, FALSE); frame, 1, FALSE);
selection->new_color = gimp_color_area_new (&selection->rgb, selection->new_color = gimp_color_area_new (&selection->rgb,
selection->show_alpha ? selection->show_alpha ?
@ -197,8 +197,8 @@ gimp_color_selection_init (GimpColorSelection *selection)
gtk_widget_show (selection->new_color); gtk_widget_show (selection->new_color);
g_signal_connect (selection->new_color, "color-changed", g_signal_connect (selection->new_color, "color-changed",
G_CALLBACK (gimp_color_selection_new_color_changed), G_CALLBACK (gimp_color_selection_new_color_changed),
selection); selection);
/* The old color area */ /* The old color area */
frame = gtk_frame_new (NULL); frame = gtk_frame_new (NULL);
@ -206,8 +206,8 @@ gimp_color_selection_init (GimpColorSelection *selection)
gtk_widget_set_size_request (frame, -1, COLOR_AREA_SIZE); gtk_widget_set_size_request (frame, -1, COLOR_AREA_SIZE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Old:"), 1.0, 0.5, _("Old:"), 1.0, 0.5,
frame, 1, FALSE); frame, 1, FALSE);
selection->old_color = gimp_color_area_new (&selection->rgb, selection->old_color = gimp_color_area_new (&selection->rgb,
selection->show_alpha ? selection->show_alpha ?
@ -589,13 +589,13 @@ gimp_color_selection_update (GimpColorSelection *selection,
{ {
g_signal_handlers_block_by_func (selection->new_color, g_signal_handlers_block_by_func (selection->new_color,
gimp_color_selection_new_color_changed, gimp_color_selection_new_color_changed,
selection); selection);
gimp_color_area_set_color (GIMP_COLOR_AREA (selection->new_color), gimp_color_area_set_color (GIMP_COLOR_AREA (selection->new_color),
&selection->rgb); &selection->rgb);
g_signal_handlers_unblock_by_func (selection->new_color, g_signal_handlers_unblock_by_func (selection->new_color,
gimp_color_selection_new_color_changed, gimp_color_selection_new_color_changed,
selection); selection);
} }
} }

View File

@ -71,12 +71,12 @@ gimp_file_entry_class_init (GimpFileEntryClass *klass)
**/ **/
gimp_file_entry_signals[FILENAME_CHANGED] = gimp_file_entry_signals[FILENAME_CHANGED] =
g_signal_new ("filename-changed", g_signal_new ("filename-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpFileEntryClass, filename_changed), G_STRUCT_OFFSET (GimpFileEntryClass, filename_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
object_class->destroy = gimp_file_entry_destroy; object_class->destroy = gimp_file_entry_destroy;
@ -243,7 +243,7 @@ gimp_file_entry_entry_activate (GtkWidget *widget,
utf8 = g_strstrip (utf8); utf8 = g_strstrip (utf8);
while (((len = strlen (utf8)) > 1) && while (((len = strlen (utf8)) > 1) &&
(utf8[len - 1] == G_DIR_SEPARATOR)) (utf8[len - 1] == G_DIR_SEPARATOR))
utf8[len - 1] = '\0'; utf8[len - 1] = '\0';
filename = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL); filename = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
@ -333,7 +333,7 @@ gimp_file_entry_browse_clicked (GtkWidget *widget,
NULL); NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (entry->file_dialog), gtk_dialog_set_alternative_button_order (GTK_DIALOG (entry->file_dialog),
GTK_RESPONSE_OK, GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL, GTK_RESPONSE_CANCEL,
-1); -1);

View File

@ -40,14 +40,14 @@ void gimp_standard_help_func (const gchar *help_id,
/* connect the help callback of a window */ /* connect the help callback of a window */
void gimp_help_connect (GtkWidget *widget, void gimp_help_connect (GtkWidget *widget,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
gpointer help_data); gpointer help_data);
/* set help data for non-window widgets */ /* set help data for non-window widgets */
void gimp_help_set_help_data (GtkWidget *widget, void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip, const gchar *tooltip,
const gchar *help_id); const gchar *help_id);
/* activate the context help inspector */ /* activate the context help inspector */
void gimp_context_help (GtkWidget *widget); void gimp_context_help (GtkWidget *widget);

View File

@ -96,9 +96,9 @@ gimp_int_combo_box_class_init (GimpIntComboBoxClass *klass)
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_ELLIPSIZE, PROP_ELLIPSIZE,
g_param_spec_enum ("ellipsize", NULL, NULL, g_param_spec_enum ("ellipsize", NULL, NULL,
PANGO_TYPE_ELLIPSIZE_MODE, PANGO_TYPE_ELLIPSIZE_MODE,
PANGO_ELLIPSIZE_NONE, PANGO_ELLIPSIZE_NONE,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (GimpIntComboBoxPrivate)); g_type_class_add_private (object_class, sizeof (GimpIntComboBoxPrivate));
} }

View File

@ -101,8 +101,8 @@ gimp_int_store_finalize (GObject *object)
static void static void
gimp_int_store_row_inserted (GtkTreeModel *model, gimp_int_store_row_inserted (GtkTreeModel *model,
GtkTreePath *path, GtkTreePath *path,
GtkTreeIter *iter) GtkTreeIter *iter)
{ {
GimpIntStore *store = GIMP_INT_STORE (model); GimpIntStore *store = GIMP_INT_STORE (model);

View File

@ -42,9 +42,9 @@ enum
static void gimp_memsize_entry_finalize (GObject *object); static void gimp_memsize_entry_finalize (GObject *object);
static void gimp_memsize_entry_adj_callback (GtkAdjustment *adj, static void gimp_memsize_entry_adj_callback (GtkAdjustment *adj,
GimpMemsizeEntry *entry); GimpMemsizeEntry *entry);
static void gimp_memsize_entry_unit_callback (GtkWidget *widget, static void gimp_memsize_entry_unit_callback (GtkWidget *widget,
GimpMemsizeEntry *entry); GimpMemsizeEntry *entry);
G_DEFINE_TYPE (GimpMemsizeEntry, gimp_memsize_entry, GTK_TYPE_HBOX); G_DEFINE_TYPE (GimpMemsizeEntry, gimp_memsize_entry, GTK_TYPE_HBOX);
@ -65,12 +65,12 @@ gimp_memsize_entry_class_init (GimpMemsizeEntryClass *klass)
gimp_memsize_entry_signals[VALUE_CHANGED] = gimp_memsize_entry_signals[VALUE_CHANGED] =
g_signal_new ("value-changed", g_signal_new ("value-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpMemsizeEntryClass, value_changed), G_STRUCT_OFFSET (GimpMemsizeEntryClass, value_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
} }
static void static void
@ -102,7 +102,7 @@ gimp_memsize_entry_finalize (GObject *object)
static void static void
gimp_memsize_entry_adj_callback (GtkAdjustment *adj, gimp_memsize_entry_adj_callback (GtkAdjustment *adj,
GimpMemsizeEntry *entry) GimpMemsizeEntry *entry)
{ {
guint64 size = gtk_adjustment_get_value (adj); guint64 size = gtk_adjustment_get_value (adj);
@ -113,7 +113,7 @@ gimp_memsize_entry_adj_callback (GtkAdjustment *adj,
static void static void
gimp_memsize_entry_unit_callback (GtkWidget *widget, gimp_memsize_entry_unit_callback (GtkWidget *widget,
GimpMemsizeEntry *entry) GimpMemsizeEntry *entry)
{ {
guint shift; guint shift;
@ -153,8 +153,8 @@ gimp_memsize_entry_unit_callback (GtkWidget *widget,
**/ **/
GtkWidget * GtkWidget *
gimp_memsize_entry_new (guint64 value, gimp_memsize_entry_new (guint64 value,
guint64 lower, guint64 lower,
guint64 upper) guint64 upper)
{ {
GimpMemsizeEntry *entry; GimpMemsizeEntry *entry;
guint shift; guint shift;
@ -227,7 +227,7 @@ gimp_memsize_entry_new (guint64 value,
**/ **/
void void
gimp_memsize_entry_set_value (GimpMemsizeEntry *entry, gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
guint64 value) guint64 value)
{ {
guint shift; guint shift;

View File

@ -70,10 +70,10 @@ struct _GimpMemsizeEntryClass
GType gimp_memsize_entry_get_type (void) G_GNUC_CONST; GType gimp_memsize_entry_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_memsize_entry_new (guint64 value, GtkWidget * gimp_memsize_entry_new (guint64 value,
guint64 lower, guint64 lower,
guint64 upper); guint64 upper);
void gimp_memsize_entry_set_value (GimpMemsizeEntry *entry, void gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
guint64 value); guint64 value);
guint64 gimp_memsize_entry_get_value (GimpMemsizeEntry *entry); guint64 gimp_memsize_entry_get_value (GimpMemsizeEntry *entry);

View File

@ -63,14 +63,14 @@ gimp_offset_area_class_init (GimpOffsetAreaClass *klass)
gimp_offset_area_signals[OFFSETS_CHANGED] = gimp_offset_area_signals[OFFSETS_CHANGED] =
g_signal_new ("offsets-changed", g_signal_new ("offsets-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpOffsetAreaClass, offsets_changed), G_STRUCT_OFFSET (GimpOffsetAreaClass, offsets_changed),
NULL, NULL, NULL, NULL,
_gimp_widgets_marshal_VOID__INT_INT, _gimp_widgets_marshal_VOID__INT_INT,
G_TYPE_NONE, 2, G_TYPE_NONE, 2,
G_TYPE_INT, G_TYPE_INT,
G_TYPE_INT); G_TYPE_INT);
widget_class->event = gimp_offset_area_event; widget_class->event = gimp_offset_area_event;
widget_class->expose_event = gimp_offset_area_expose_event; widget_class->expose_event = gimp_offset_area_expose_event;
@ -328,9 +328,9 @@ gimp_offset_area_event (GtkWidget *widget,
{ {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
gdk_pointer_grab (widget->window, FALSE, gdk_pointer_grab (widget->window, FALSE,
(GDK_BUTTON1_MOTION_MASK | (GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK), GDK_BUTTON_RELEASE_MASK),
NULL, NULL, event->button.time); NULL, NULL, event->button.time);
orig_offset_x = area->offset_x; orig_offset_x = area->offset_x;
orig_offset_y = area->offset_y; orig_offset_y = area->offset_y;
@ -409,26 +409,26 @@ gimp_offset_area_expose_event (GtkWidget *widget,
if (area->orig_width > area->width || area->orig_height > area->height) if (area->orig_width > area->width || area->orig_height > area->height)
{ {
if (area->orig_width > area->width) if (area->orig_width > area->width)
{ {
x = area->display_ratio_x * (area->orig_width - area->width); x = area->display_ratio_x * (area->orig_width - area->width);
w = area->display_ratio_x * area->width; w = area->display_ratio_x * area->width;
} }
else else
{ {
x = -1; x = -1;
w = widget->allocation.width + 2; w = widget->allocation.width + 2;
} }
if (area->orig_height > area->height) if (area->orig_height > area->height)
{ {
y = area->display_ratio_y * (area->orig_height - area->height); y = area->display_ratio_y * (area->orig_height - area->height);
h = area->display_ratio_y * area->height; h = area->display_ratio_y * area->height;
} }
else else
{ {
y = -1; y = -1;
h = widget->allocation.height + 2; h = widget->allocation.height + 2;
} }
w = MAX (w, 1); w = MAX (w, 1);
h = MAX (h, 1); h = MAX (h, 1);

View File

@ -49,16 +49,16 @@
GtkWidget * GtkWidget *
gimp_option_menu_new (gboolean menu_only, gimp_option_menu_new (gboolean menu_only,
/* specify menu items as va_list: /* specify menu items as va_list:
* const gchar *label, * const gchar *label,
* GCallback callback, * GCallback callback,
* gpointer callback_data, * gpointer callback_data,
* gpointer item_data, * gpointer item_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
* gboolean active * gboolean active
*/ */
...) ...)
{ {
GtkWidget *menu; GtkWidget *menu;
GtkWidget *menuitem; GtkWidget *menuitem;
@ -92,14 +92,14 @@ gimp_option_menu_new (gboolean menu_only,
active = va_arg (args, gboolean); active = va_arg (args, gboolean);
if (strcmp (label, "---")) if (strcmp (label, "---"))
{ {
menuitem = gtk_menu_item_new_with_label (label); menuitem = gtk_menu_item_new_with_label (label);
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",
callback, callback,
callback_data); callback_data);
if (item_data) if (item_data)
{ {
g_object_set_data (G_OBJECT (menuitem), "gimp-item-data", g_object_set_data (G_OBJECT (menuitem), "gimp-item-data",
item_data); item_data);
@ -107,24 +107,24 @@ gimp_option_menu_new (gboolean menu_only,
/* backward compat */ /* backward compat */
g_object_set_data (G_OBJECT (menuitem), "user_data", item_data); g_object_set_data (G_OBJECT (menuitem), "user_data", item_data);
} }
} }
else else
{ {
menuitem = gtk_menu_item_new (); menuitem = gtk_menu_item_new ();
gtk_widget_set_sensitive (menuitem, FALSE); gtk_widget_set_sensitive (menuitem, FALSE);
} }
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
if (widget_ptr) if (widget_ptr)
*widget_ptr = menuitem; *widget_ptr = menuitem;
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
/* remember the initial menu item */ /* remember the initial menu item */
if (active) if (active)
initial_index = i; initial_index = i;
label = va_arg (args, const gchar *); label = va_arg (args, const gchar *);
} }
@ -162,17 +162,17 @@ gimp_option_menu_new (gboolean menu_only,
**/ **/
GtkWidget * GtkWidget *
gimp_option_menu_new2 (gboolean menu_only, gimp_option_menu_new2 (gboolean menu_only,
GCallback menu_item_callback, GCallback menu_item_callback,
gpointer callback_data, gpointer callback_data,
gpointer initial, /* item_data */ gpointer initial, /* item_data */
/* specify menu items as va_list: /* specify menu items as va_list:
* const gchar *label, * const gchar *label,
* gpointer item_data, * gpointer item_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
{ {
GtkWidget *menu; GtkWidget *menu;
GtkWidget *menuitem; GtkWidget *menuitem;
@ -200,14 +200,14 @@ gimp_option_menu_new2 (gboolean menu_only,
widget_ptr = va_arg (args, GtkWidget **); widget_ptr = va_arg (args, GtkWidget **);
if (strcmp (label, "---")) if (strcmp (label, "---"))
{ {
menuitem = gtk_menu_item_new_with_label (label); menuitem = gtk_menu_item_new_with_label (label);
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",
menu_item_callback, menu_item_callback,
callback_data); callback_data);
if (item_data) if (item_data)
{ {
g_object_set_data (G_OBJECT (menuitem), "gimp-item-data", g_object_set_data (G_OBJECT (menuitem), "gimp-item-data",
item_data); item_data);
@ -215,24 +215,24 @@ gimp_option_menu_new2 (gboolean menu_only,
/* backward compat */ /* backward compat */
g_object_set_data (G_OBJECT (menuitem), "user_data", item_data); g_object_set_data (G_OBJECT (menuitem), "user_data", item_data);
} }
} }
else else
{ {
menuitem = gtk_menu_item_new (); menuitem = gtk_menu_item_new ();
gtk_widget_set_sensitive (menuitem, FALSE); gtk_widget_set_sensitive (menuitem, FALSE);
} }
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
if (widget_ptr) if (widget_ptr)
*widget_ptr = menuitem; *widget_ptr = menuitem;
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
/* remember the initial menu item */ /* remember the initial menu item */
if (item_data == initial) if (item_data == initial)
initial_index = i; initial_index = i;
label = va_arg (args, const gchar *); label = va_arg (args, const gchar *);
} }
@ -274,17 +274,17 @@ gimp_option_menu_new2 (gboolean menu_only,
**/ **/
GtkWidget * GtkWidget *
gimp_int_option_menu_new (gboolean menu_only, gimp_int_option_menu_new (gboolean menu_only,
GCallback menu_item_callback, GCallback menu_item_callback,
gpointer callback_data, gpointer callback_data,
gint initial, /* item_data */ gint initial, /* item_data */
/* specify menu items as va_list: /* specify menu items as va_list:
* const gchar *label, * const gchar *label,
* gint item_data, * gint item_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
{ {
GtkWidget *menu; GtkWidget *menu;
GtkWidget *menuitem; GtkWidget *menuitem;
@ -315,14 +315,14 @@ gimp_int_option_menu_new (gboolean menu_only,
item_ptr = GINT_TO_POINTER (item_data); item_ptr = GINT_TO_POINTER (item_data);
if (strcmp (label, "---")) if (strcmp (label, "---"))
{ {
menuitem = gtk_menu_item_new_with_label (label); menuitem = gtk_menu_item_new_with_label (label);
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",
menu_item_callback, menu_item_callback,
callback_data); callback_data);
if (item_data) if (item_data)
{ {
g_object_set_data (G_OBJECT (menuitem), "gimp-item-data", g_object_set_data (G_OBJECT (menuitem), "gimp-item-data",
item_ptr); item_ptr);
@ -330,24 +330,24 @@ gimp_int_option_menu_new (gboolean menu_only,
/* backward compat */ /* backward compat */
g_object_set_data (G_OBJECT (menuitem), "user_data", item_ptr); g_object_set_data (G_OBJECT (menuitem), "user_data", item_ptr);
} }
} }
else else
{ {
menuitem = gtk_menu_item_new (); menuitem = gtk_menu_item_new ();
gtk_widget_set_sensitive (menuitem, FALSE); gtk_widget_set_sensitive (menuitem, FALSE);
} }
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
if (widget_ptr) if (widget_ptr)
*widget_ptr = menuitem; *widget_ptr = menuitem;
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
/* remember the initial menu item */ /* remember the initial menu item */
if (item_data == initial) if (item_data == initial)
initial_index = i; initial_index = i;
label = va_arg (args, const gchar *); label = va_arg (args, const gchar *);
} }
@ -382,7 +382,7 @@ gimp_int_option_menu_new (gboolean menu_only,
**/ **/
void void
gimp_option_menu_set_history (GtkOptionMenu *option_menu, gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer item_data) gpointer item_data)
{ {
GtkWidget *menu_item; GtkWidget *menu_item;
GList *list; GList *list;
@ -397,11 +397,11 @@ gimp_option_menu_set_history (GtkOptionMenu *option_menu,
menu_item = GTK_WIDGET (list->data); menu_item = GTK_WIDGET (list->data);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child) && if (GTK_IS_LABEL (GTK_BIN (menu_item)->child) &&
g_object_get_data (G_OBJECT (menu_item), g_object_get_data (G_OBJECT (menu_item),
"gimp-item-data") == item_data) "gimp-item-data") == item_data)
{ {
break; break;
} }
history++; history++;
} }
@ -423,7 +423,7 @@ gimp_option_menu_set_history (GtkOptionMenu *option_menu,
**/ **/
void void
gimp_int_option_menu_set_history (GtkOptionMenu *option_menu, gimp_int_option_menu_set_history (GtkOptionMenu *option_menu,
gint item_data) gint item_data)
{ {
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu)); g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
@ -467,7 +467,7 @@ gimp_option_menu_set_sensitive (GtkOptionMenu *option_menu,
"gimp-item-data"); "gimp-item-data");
sensitive = callback (item_data, callback_data); sensitive = callback (item_data, callback_data);
gtk_widget_set_sensitive (menu_item, sensitive); gtk_widget_set_sensitive (menu_item, sensitive);
} }
} }
} }
@ -510,7 +510,7 @@ gimp_int_option_menu_set_sensitive (GtkOptionMenu *option
"gimp-item-data")); "gimp-item-data"));
sensitive = callback (item_data, callback_data); sensitive = callback (item_data, callback_data);
gtk_widget_set_sensitive (menu_item, sensitive); gtk_widget_set_sensitive (menu_item, sensitive);
} }
} }
} }
@ -523,12 +523,12 @@ gimp_int_option_menu_set_sensitive (GtkOptionMenu *option
**/ **/
void void
gimp_menu_item_update (GtkWidget *widget, gimp_menu_item_update (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gint *item_val; gint *item_val;
item_val = (gint *) data; item_val = (gint *) data;
*item_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), *item_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"gimp-item-data")); "gimp-item-data"));
} }

View File

@ -169,12 +169,12 @@ gimp_page_selector_class_init (GimpPageSelectorClass *klass)
*/ */
selector_signals[ACTIVATE] = selector_signals[ACTIVATE] =
g_signal_new ("activate", g_signal_new ("activate",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GimpPageSelectorClass, activate), G_STRUCT_OFFSET (GimpPageSelectorClass, activate),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
widget_class->activate_signal = selector_signals[ACTIVATE]; widget_class->activate_signal = selector_signals[ACTIVATE];
/** /**

View File

@ -85,12 +85,12 @@ gimp_path_editor_class_init (GimpPathEditorClass *klass)
**/ **/
gimp_path_editor_signals[PATH_CHANGED] = gimp_path_editor_signals[PATH_CHANGED] =
g_signal_new ("path-changed", g_signal_new ("path-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPathEditorClass, path_changed), G_STRUCT_OFFSET (GimpPathEditorClass, path_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
/** /**
* GimpPathEditor::writable-changed: * GimpPathEditor::writable-changed:
@ -101,12 +101,12 @@ gimp_path_editor_class_init (GimpPathEditorClass *klass)
**/ **/
gimp_path_editor_signals[WRITABLE_CHANGED] = gimp_path_editor_signals[WRITABLE_CHANGED] =
g_signal_new ("writable-changed", g_signal_new ("writable-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPathEditorClass, writable_changed), G_STRUCT_OFFSET (GimpPathEditorClass, writable_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
klass->path_changed = NULL; klass->path_changed = NULL;
klass->writable_changed = NULL; klass->writable_changed = NULL;
@ -145,7 +145,7 @@ gimp_path_editor_init (GimpPathEditor *editor)
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (gimp_path_editor_new_clicked), G_CALLBACK (gimp_path_editor_new_clicked),
editor); editor);
editor->up_button = button = gtk_button_new (); editor->up_button = button = gtk_button_new ();
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
@ -158,7 +158,7 @@ gimp_path_editor_init (GimpPathEditor *editor)
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (gimp_path_editor_move_clicked), G_CALLBACK (gimp_path_editor_move_clicked),
editor); editor);
editor->down_button = button = gtk_button_new (); editor->down_button = button = gtk_button_new ();
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
@ -171,7 +171,7 @@ gimp_path_editor_init (GimpPathEditor *editor)
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (gimp_path_editor_move_clicked), G_CALLBACK (gimp_path_editor_move_clicked),
editor); editor);
editor->delete_button = button = gtk_button_new (); editor->delete_button = button = gtk_button_new ();
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
@ -184,11 +184,11 @@ gimp_path_editor_init (GimpPathEditor *editor)
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (gimp_path_editor_delete_clicked), G_CALLBACK (gimp_path_editor_delete_clicked),
editor); editor);
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_IN); GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS); GTK_POLICY_ALWAYS);
@ -218,10 +218,10 @@ gimp_path_editor_init (GimpPathEditor *editor)
gtk_tree_view_column_set_visible (col, FALSE); gtk_tree_view_column_set_visible (col, FALSE);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv), gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv),
-1, _("Folder"), -1, _("Folder"),
gtk_cell_renderer_text_new (), gtk_cell_renderer_text_new (),
"text", COLUMN_UTF8, "text", COLUMN_UTF8,
NULL); NULL);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tv), TRUE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tv), TRUE);
@ -230,8 +230,8 @@ gimp_path_editor_init (GimpPathEditor *editor)
editor->sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv)); editor->sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tv));
g_signal_connect (editor->sel, "changed", g_signal_connect (editor->sel, "changed",
G_CALLBACK (gimp_path_editor_selection_changed), G_CALLBACK (gimp_path_editor_selection_changed),
editor); editor);
} }
/** /**
@ -249,7 +249,7 @@ gimp_path_editor_init (GimpPathEditor *editor)
**/ **/
GtkWidget * GtkWidget *
gimp_path_editor_new (const gchar *filesel_title, gimp_path_editor_new (const gchar *filesel_title,
const gchar *path) const gchar *path)
{ {
GimpPathEditor *editor; GimpPathEditor *editor;
@ -265,7 +265,7 @@ gimp_path_editor_new (const gchar *filesel_title,
g_signal_connect (editor->file_entry, "filename-changed", g_signal_connect (editor->file_entry, "filename-changed",
G_CALLBACK (gimp_path_editor_file_entry_changed), G_CALLBACK (gimp_path_editor_file_entry_changed),
editor); editor);
if (path) if (path)
gimp_path_editor_set_path (editor, path); gimp_path_editor_set_path (editor, path);
@ -558,13 +558,13 @@ gimp_path_editor_new_clicked (GtkWidget *widget,
if (editor->sel_path) if (editor->sel_path)
{ {
g_signal_handlers_block_by_func (editor->sel, g_signal_handlers_block_by_func (editor->sel,
gimp_path_editor_selection_changed, gimp_path_editor_selection_changed,
editor); editor);
gtk_tree_selection_unselect_path (editor->sel, editor->sel_path); gtk_tree_selection_unselect_path (editor->sel, editor->sel_path);
g_signal_handlers_unblock_by_func (editor->sel, g_signal_handlers_unblock_by_func (editor->sel,
gimp_path_editor_selection_changed, gimp_path_editor_selection_changed,
editor); editor);
gtk_tree_path_free (editor->sel_path); gtk_tree_path_free (editor->sel_path);
@ -652,7 +652,7 @@ gimp_path_editor_delete_clicked (GtkWidget *widget,
return; return;
gtk_tree_model_get_iter (GTK_TREE_MODEL (editor->dir_list), &iter, gtk_tree_model_get_iter (GTK_TREE_MODEL (editor->dir_list), &iter,
editor->sel_path); editor->sel_path);
gtk_tree_model_get (GTK_TREE_MODEL (editor->dir_list), &iter, gtk_tree_model_get (GTK_TREE_MODEL (editor->dir_list), &iter,
COLUMN_WRITABLE, &dir_writable, COLUMN_WRITABLE, &dir_writable,
@ -731,7 +731,7 @@ gimp_path_editor_file_entry_changed (GtkWidget *widget,
else else
{ {
gtk_tree_model_get_iter (GTK_TREE_MODEL (editor->dir_list), &iter, gtk_tree_model_get_iter (GTK_TREE_MODEL (editor->dir_list), &iter,
editor->sel_path); editor->sel_path);
gtk_list_store_set (editor->dir_list, &iter, gtk_list_store_set (editor->dir_list, &iter,
COLUMN_UTF8, utf8, COLUMN_UTF8, utf8,
COLUMN_DIRECTORY, dir, COLUMN_DIRECTORY, dir,
@ -772,7 +772,7 @@ gimp_path_editor_selection_changed (GtkTreeSelection *sel,
g_free (directory); g_free (directory);
if (editor->sel_path) if (editor->sel_path)
gtk_tree_path_free (editor->sel_path); gtk_tree_path_free (editor->sel_path);
editor->sel_path = editor->sel_path =
gtk_tree_model_get_path (GTK_TREE_MODEL (editor->dir_list), &iter); gtk_tree_model_get_path (GTK_TREE_MODEL (editor->dir_list), &iter);

View File

@ -78,12 +78,12 @@ gimp_pick_button_class_init (GimpPickButtonClass* klass)
pick_button_signals[COLOR_PICKED] = pick_button_signals[COLOR_PICKED] =
g_signal_new ("color-picked", g_signal_new ("color-picked",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPickButtonClass, color_picked), G_STRUCT_OFFSET (GimpPickButtonClass, color_picked),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__POINTER, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
G_TYPE_POINTER); G_TYPE_POINTER);
object_class->destroy = gimp_pick_button_destroy; object_class->destroy = gimp_pick_button_destroy;

View File

@ -80,7 +80,7 @@ gimp_pixmap_new (gchar **xpm_data)
**/ **/
void void
gimp_pixmap_set (GimpPixmap *pixmap, gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data) gchar **xpm_data)
{ {
g_return_if_fail (GIMP_IS_PIXMAP (pixmap)); g_return_if_fail (GIMP_IS_PIXMAP (pixmap));
@ -92,21 +92,21 @@ gimp_pixmap_set (GimpPixmap *pixmap,
if (! GTK_WIDGET_REALIZED (GTK_WIDGET (pixmap))) if (! GTK_WIDGET_REALIZED (GTK_WIDGET (pixmap)))
{ {
if (xpm_data) if (xpm_data)
{ {
gint width, height; gint width, height;
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2) if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
{ {
g_warning ("%s: passed pointer is no XPM data", G_STRFUNC); g_warning ("%s: passed pointer is no XPM data", G_STRFUNC);
} }
else else
{ {
GTK_WIDGET (pixmap)->requisition.width = GTK_WIDGET (pixmap)->requisition.width =
width + GTK_MISC (pixmap)->xpad * 2; width + GTK_MISC (pixmap)->xpad * 2;
GTK_WIDGET (pixmap)->requisition.height = GTK_WIDGET (pixmap)->requisition.height =
height + GTK_MISC (pixmap)->ypad * 2; height + GTK_MISC (pixmap)->ypad * 2;
} }
} }
} }
else else
{ {
@ -139,9 +139,9 @@ gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap)
style = gtk_widget_get_style (widget); style = gtk_widget_get_style (widget);
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window, gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
&mask, &mask,
&style->bg[GTK_STATE_NORMAL], &style->bg[GTK_STATE_NORMAL],
pixmap->xpm_data); pixmap->xpm_data);
} }
gtk_image_set_from_pixmap (GTK_IMAGE (pixmap), gdk_pixmap, mask); gtk_image_set_from_pixmap (GTK_IMAGE (pixmap), gdk_pixmap, mask);

View File

@ -66,7 +66,7 @@ GType gimp_pixmap_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_pixmap_new (gchar **xpm_data); GtkWidget * gimp_pixmap_new (gchar **xpm_data);
void gimp_pixmap_set (GimpPixmap *pixmap, void gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data); gchar **xpm_data);
G_END_DECLS G_END_DECLS

View File

@ -112,8 +112,8 @@ gimp_prop_check_button_new (GObject *config,
set_param_spec (G_OBJECT (button), button, param_spec); set_param_spec (G_OBJECT (button), button, param_spec);
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
G_CALLBACK (gimp_prop_check_button_callback), G_CALLBACK (gimp_prop_check_button_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_check_button_notify), G_CALLBACK (gimp_prop_check_button_notify),
@ -227,8 +227,8 @@ gimp_prop_enum_check_button_new (GObject *config,
GINT_TO_POINTER (true_value)); GINT_TO_POINTER (true_value));
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
G_CALLBACK (gimp_prop_enum_check_button_callback), G_CALLBACK (gimp_prop_enum_check_button_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_enum_check_button_notify), G_CALLBACK (gimp_prop_enum_check_button_notify),
@ -1083,8 +1083,8 @@ gimp_prop_spin_button_new (GObject *config,
set_param_spec (G_OBJECT (adjustment), spinbutton, param_spec); set_param_spec (G_OBJECT (adjustment), spinbutton, param_spec);
g_signal_connect (adjustment, "value-changed", g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gimp_prop_adjustment_callback), G_CALLBACK (gimp_prop_adjustment_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_adjustment_notify), G_CALLBACK (gimp_prop_adjustment_notify),
@ -1144,8 +1144,8 @@ gimp_prop_hscale_new (GObject *config,
set_param_spec (G_OBJECT (adjustment), scale, param_spec); set_param_spec (G_OBJECT (adjustment), scale, param_spec);
g_signal_connect (adjustment, "value-changed", g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gimp_prop_adjustment_callback), G_CALLBACK (gimp_prop_adjustment_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_adjustment_notify), G_CALLBACK (gimp_prop_adjustment_notify),
@ -1240,8 +1240,8 @@ gimp_prop_scale_entry_new (GObject *config,
set_param_spec (G_OBJECT (adjustment), NULL, param_spec); set_param_spec (G_OBJECT (adjustment), NULL, param_spec);
g_signal_connect (adjustment, "value-changed", g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gimp_prop_adjustment_callback), G_CALLBACK (gimp_prop_adjustment_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_adjustment_notify), G_CALLBACK (gimp_prop_adjustment_notify),
@ -1314,8 +1314,8 @@ gimp_prop_opacity_entry_new (GObject *config,
"opacity-scale", GINT_TO_POINTER (TRUE)); "opacity-scale", GINT_TO_POINTER (TRUE));
g_signal_connect (adjustment, "value-changed", g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gimp_prop_adjustment_callback), G_CALLBACK (gimp_prop_adjustment_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_adjustment_notify), G_CALLBACK (gimp_prop_adjustment_notify),
@ -1479,10 +1479,10 @@ gimp_prop_adjustment_notify (GObject *config,
/*************/ /*************/
static void gimp_prop_memsize_callback (GimpMemsizeEntry *entry, static void gimp_prop_memsize_callback (GimpMemsizeEntry *entry,
GObject *config); GObject *config);
static void gimp_prop_memsize_notify (GObject *config, static void gimp_prop_memsize_notify (GObject *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GimpMemsizeEntry *entry); GimpMemsizeEntry *entry);
/** /**
* gimp_prop_memsize_entry_new: * gimp_prop_memsize_entry_new:
@ -1524,16 +1524,16 @@ gimp_prop_memsize_entry_new (GObject *config,
g_return_val_if_fail (uint64_spec->maximum <= GIMP_MAX_MEMSIZE, NULL); g_return_val_if_fail (uint64_spec->maximum <= GIMP_MAX_MEMSIZE, NULL);
entry = gimp_memsize_entry_new (value, entry = gimp_memsize_entry_new (value,
uint64_spec->minimum, uint64_spec->minimum,
uint64_spec->maximum); uint64_spec->maximum);
set_param_spec (G_OBJECT (entry), set_param_spec (G_OBJECT (entry),
GIMP_MEMSIZE_ENTRY (entry)->spinbutton, GIMP_MEMSIZE_ENTRY (entry)->spinbutton,
param_spec); param_spec);
g_signal_connect (entry, "value-changed", g_signal_connect (entry, "value-changed",
G_CALLBACK (gimp_prop_memsize_callback), G_CALLBACK (gimp_prop_memsize_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_memsize_notify), G_CALLBACK (gimp_prop_memsize_notify),
@ -1545,7 +1545,7 @@ gimp_prop_memsize_entry_new (GObject *config,
static void static void
gimp_prop_memsize_callback (GimpMemsizeEntry *entry, gimp_prop_memsize_callback (GimpMemsizeEntry *entry,
GObject *config) GObject *config)
{ {
GParamSpec *param_spec; GParamSpec *param_spec;
@ -1556,22 +1556,22 @@ gimp_prop_memsize_callback (GimpMemsizeEntry *entry,
g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec)); g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec));
g_object_set (config, g_object_set (config,
param_spec->name, gimp_memsize_entry_get_value (entry), param_spec->name, gimp_memsize_entry_get_value (entry),
NULL); NULL);
} }
static void static void
gimp_prop_memsize_notify (GObject *config, gimp_prop_memsize_notify (GObject *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GimpMemsizeEntry *entry) GimpMemsizeEntry *entry)
{ {
guint64 value; guint64 value;
g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec)); g_return_if_fail (G_IS_PARAM_SPEC_UINT64 (param_spec));
g_object_get (config, g_object_get (config,
param_spec->name, &value, param_spec->name, &value,
NULL); NULL);
if (entry->value != value) if (entry->value != value)
{ {
@ -1713,8 +1713,8 @@ gimp_prop_entry_new (GObject *config,
set_param_spec (G_OBJECT (entry), entry, param_spec); set_param_spec (G_OBJECT (entry), entry, param_spec);
g_signal_connect (entry, "changed", g_signal_connect (entry, "changed",
G_CALLBACK (gimp_prop_entry_callback), G_CALLBACK (gimp_prop_entry_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_entry_notify), G_CALLBACK (gimp_prop_entry_notify),
@ -1836,8 +1836,8 @@ gimp_prop_text_buffer_new (GObject *config,
set_param_spec (G_OBJECT (text_buffer), NULL, param_spec); set_param_spec (G_OBJECT (text_buffer), NULL, param_spec);
g_signal_connect (text_buffer, "changed", g_signal_connect (text_buffer, "changed",
G_CALLBACK (gimp_prop_text_buffer_callback), G_CALLBACK (gimp_prop_text_buffer_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_text_buffer_notify), G_CALLBACK (gimp_prop_text_buffer_notify),
@ -1984,8 +1984,8 @@ gimp_prop_file_entry_new (GObject *config,
param_spec); param_spec);
g_signal_connect (entry, "filename-changed", g_signal_connect (entry, "filename-changed",
G_CALLBACK (gimp_prop_file_entry_callback), G_CALLBACK (gimp_prop_file_entry_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_file_entry_notify), G_CALLBACK (gimp_prop_file_entry_notify),
@ -2131,8 +2131,8 @@ gimp_prop_file_chooser_button_new (GObject *config,
set_param_spec (G_OBJECT (button), widget, param_spec); set_param_spec (G_OBJECT (button), widget, param_spec);
g_signal_connect (button, "selection-changed", g_signal_connect (button, "selection-changed",
G_CALLBACK (gimp_prop_file_chooser_button_callback), G_CALLBACK (gimp_prop_file_chooser_button_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_file_chooser_button_notify), G_CALLBACK (gimp_prop_file_chooser_button_notify),
@ -2280,8 +2280,8 @@ gimp_prop_path_editor_new (GObject *config,
path_param_spec); path_param_spec);
g_signal_connect (editor, "path-changed", g_signal_connect (editor, "path-changed",
G_CALLBACK (gimp_prop_path_editor_path_callback), G_CALLBACK (gimp_prop_path_editor_path_callback),
config); config);
connect_notify (config, path_property_name, connect_notify (config, path_property_name,
G_CALLBACK (gimp_prop_path_editor_path_notify), G_CALLBACK (gimp_prop_path_editor_path_notify),
@ -2565,8 +2565,8 @@ gimp_prop_size_entry_new (GObject *config,
param_spec); param_spec);
g_signal_connect (sizeentry, "value-changed", g_signal_connect (sizeentry, "value-changed",
G_CALLBACK (gimp_prop_size_entry_callback), G_CALLBACK (gimp_prop_size_entry_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_size_entry_notify), G_CALLBACK (gimp_prop_size_entry_notify),
@ -2914,11 +2914,11 @@ gimp_prop_coordinates_connect (GObject *config,
} }
g_signal_connect (sizeentry, "value-changed", g_signal_connect (sizeentry, "value-changed",
G_CALLBACK (gimp_prop_coordinates_callback), G_CALLBACK (gimp_prop_coordinates_callback),
config); config);
g_signal_connect (sizeentry, "refval-changed", g_signal_connect (sizeentry, "refval-changed",
G_CALLBACK (gimp_prop_coordinates_callback), G_CALLBACK (gimp_prop_coordinates_callback),
config); config);
connect_notify (config, x_property_name, connect_notify (config, x_property_name,
G_CALLBACK (gimp_prop_coordinates_notify_x), G_CALLBACK (gimp_prop_coordinates_notify_x),
@ -3214,8 +3214,8 @@ gimp_prop_color_area_new (GObject *config,
set_param_spec (G_OBJECT (area), area, param_spec); set_param_spec (G_OBJECT (area), area, param_spec);
g_signal_connect (area, "color-changed", g_signal_connect (area, "color-changed",
G_CALLBACK (gimp_prop_color_area_callback), G_CALLBACK (gimp_prop_color_area_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_color_area_notify), G_CALLBACK (gimp_prop_color_area_notify),
@ -3280,10 +3280,10 @@ gimp_prop_color_area_notify (GObject *config,
/***************/ /***************/
static void gimp_prop_unit_menu_callback (GtkWidget *menu, static void gimp_prop_unit_menu_callback (GtkWidget *menu,
GObject *config); GObject *config);
static void gimp_prop_unit_menu_notify (GObject *config, static void gimp_prop_unit_menu_notify (GObject *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GtkWidget *menu); GtkWidget *menu);
/** /**
* gimp_prop_unit_menu_new: * gimp_prop_unit_menu_new:
@ -3301,8 +3301,8 @@ static void gimp_prop_unit_menu_notify (GObject *config,
*/ */
GtkWidget * GtkWidget *
gimp_prop_unit_menu_new (GObject *config, gimp_prop_unit_menu_new (GObject *config,
const gchar *property_name, const gchar *property_name,
const gchar *unit_format) const gchar *unit_format)
{ {
GParamSpec *param_spec; GParamSpec *param_spec;
GtkWidget *menu; GtkWidget *menu;
@ -3336,8 +3336,8 @@ gimp_prop_unit_menu_new (GObject *config,
set_param_spec (G_OBJECT (menu), menu, param_spec); set_param_spec (G_OBJECT (menu), menu, param_spec);
g_signal_connect (menu, "unit-changed", g_signal_connect (menu, "unit-changed",
G_CALLBACK (gimp_prop_unit_menu_callback), G_CALLBACK (gimp_prop_unit_menu_callback),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_unit_menu_notify), G_CALLBACK (gimp_prop_unit_menu_notify),
@ -3348,7 +3348,7 @@ gimp_prop_unit_menu_new (GObject *config,
static void static void
gimp_prop_unit_menu_callback (GtkWidget *menu, gimp_prop_unit_menu_callback (GtkWidget *menu,
GObject *config) GObject *config)
{ {
GParamSpec *param_spec; GParamSpec *param_spec;
GimpUnit unit; GimpUnit unit;
@ -3374,8 +3374,8 @@ gimp_prop_unit_menu_callback (GtkWidget *menu,
static void static void
gimp_prop_unit_menu_notify (GObject *config, gimp_prop_unit_menu_notify (GObject *config,
GParamSpec *param_spec, GParamSpec *param_spec,
GtkWidget *menu) GtkWidget *menu)
{ {
GimpUnit unit; GimpUnit unit;
@ -3521,8 +3521,8 @@ gimp_prop_expander_new (GObject *config,
set_param_spec (G_OBJECT (expander), expander, param_spec); set_param_spec (G_OBJECT (expander), expander, param_spec);
g_signal_connect (expander, "notify::expanded", g_signal_connect (expander, "notify::expanded",
G_CALLBACK (gimp_prop_expanded_notify), G_CALLBACK (gimp_prop_expanded_notify),
config); config);
connect_notify (config, property_name, connect_notify (config, property_name,
G_CALLBACK (gimp_prop_expander_notify), G_CALLBACK (gimp_prop_expander_notify),

View File

@ -57,17 +57,17 @@ struct _QueryBox
static QueryBox * create_query_box (const gchar *title, static QueryBox * create_query_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
GCallback response_callback, GCallback response_callback,
const gchar *stock_id, const gchar *stock_id,
const gchar *message, const gchar *message,
const gchar *ok_button, const gchar *ok_button,
const gchar *cancel_button, const gchar *cancel_button,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GCallback callback, GCallback callback,
gpointer callback_data); gpointer callback_data);
static void query_box_disconnect (QueryBox *query_box); static void query_box_disconnect (QueryBox *query_box);
@ -96,17 +96,17 @@ static void query_box_cancel_callback (QueryBox *query_box);
static QueryBox * static QueryBox *
create_query_box (const gchar *title, create_query_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
GCallback response_callback, GCallback response_callback,
const gchar *stock_id, const gchar *stock_id,
const gchar *message, const gchar *message,
const gchar *ok_button, const gchar *ok_button,
const gchar *cancel_button, const gchar *cancel_button,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GCallback callback, GCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
QueryBox *query_box; QueryBox *query_box;
GtkWidget *hbox = NULL; GtkWidget *hbox = NULL;
@ -122,12 +122,12 @@ create_query_box (const gchar *title,
query_box->qbox = gimp_dialog_new (title, "gimp-query-box", query_box->qbox = gimp_dialog_new (title, "gimp-query-box",
parent, 0, parent, 0,
help_func, help_id, help_func, help_id,
cancel_button, GTK_RESPONSE_CANCEL, cancel_button, GTK_RESPONSE_CANCEL,
ok_button, GTK_RESPONSE_OK, ok_button, GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (query_box->qbox), gtk_dialog_set_alternative_button_order (GTK_DIALOG (query_box->qbox),
GTK_RESPONSE_OK, GTK_RESPONSE_OK,
@ -140,8 +140,8 @@ create_query_box (const gchar *title,
query_box); query_box);
g_signal_connect (query_box->qbox, "destroy", g_signal_connect (query_box->qbox, "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
&query_box->qbox); &query_box->qbox);
/* if we are associated with an object, connect to the provided signal /* if we are associated with an object, connect to the provided signal
*/ */
@ -227,25 +227,25 @@ create_query_box (const gchar *title,
GtkWidget * GtkWidget *
gimp_query_string_box (const gchar *title, gimp_query_string_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
const gchar *initial, const gchar *initial,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryStringCallback callback, GimpQueryStringCallback callback,
gpointer data) gpointer data)
{ {
QueryBox *query_box; QueryBox *query_box;
GtkWidget *entry; GtkWidget *entry;
query_box = create_query_box (title, parent, help_func, help_id, query_box = create_query_box (title, parent, help_func, help_id,
G_CALLBACK (string_query_box_response), G_CALLBACK (string_query_box_response),
GTK_STOCK_DIALOG_QUESTION, GTK_STOCK_DIALOG_QUESTION,
message, message,
GTK_STOCK_OK, GTK_STOCK_CANCEL, GTK_STOCK_OK, GTK_STOCK_CANCEL,
object, signal, object, signal,
G_CALLBACK (callback), data); G_CALLBACK (callback), data);
if (! query_box) if (! query_box)
return NULL; return NULL;
@ -284,35 +284,35 @@ gimp_query_string_box (const gchar *title,
GtkWidget * GtkWidget *
gimp_query_int_box (const gchar *title, gimp_query_int_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
gint initial, gint initial,
gint lower, gint lower,
gint upper, gint upper,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryIntCallback callback, GimpQueryIntCallback callback,
gpointer data) gpointer data)
{ {
QueryBox *query_box; QueryBox *query_box;
GtkWidget *spinbutton; GtkWidget *spinbutton;
GtkObject *adjustment; GtkObject *adjustment;
query_box = create_query_box (title, parent, help_func, help_id, query_box = create_query_box (title, parent, help_func, help_id,
G_CALLBACK (int_query_box_response), G_CALLBACK (int_query_box_response),
GTK_STOCK_DIALOG_QUESTION, GTK_STOCK_DIALOG_QUESTION,
message, message,
GTK_STOCK_OK, GTK_STOCK_CANCEL, GTK_STOCK_OK, GTK_STOCK_CANCEL,
object, signal, object, signal,
G_CALLBACK (callback), data); G_CALLBACK (callback), data);
if (! query_box) if (! query_box)
return NULL; return NULL;
spinbutton = gimp_spin_button_new (&adjustment, spinbutton = gimp_spin_button_new (&adjustment,
initial, lower, upper, 1, 10, 0, initial, lower, upper, 1, 10, 0,
1, 0); 1, 0);
gtk_entry_set_activates_default (GTK_ENTRY (spinbutton), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (spinbutton), TRUE);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton); gtk_widget_grab_focus (spinbutton);
@ -346,36 +346,36 @@ gimp_query_int_box (const gchar *title,
GtkWidget * GtkWidget *
gimp_query_double_box (const gchar *title, gimp_query_double_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryDoubleCallback callback, GimpQueryDoubleCallback callback,
gpointer data) gpointer data)
{ {
QueryBox *query_box; QueryBox *query_box;
GtkWidget *spinbutton; GtkWidget *spinbutton;
GtkObject *adjustment; GtkObject *adjustment;
query_box = create_query_box (title, parent, help_func, help_id, query_box = create_query_box (title, parent, help_func, help_id,
G_CALLBACK (double_query_box_response), G_CALLBACK (double_query_box_response),
GTK_STOCK_DIALOG_QUESTION, GTK_STOCK_DIALOG_QUESTION,
message, message,
GTK_STOCK_OK, GTK_STOCK_CANCEL, GTK_STOCK_OK, GTK_STOCK_CANCEL,
object, signal, object, signal,
G_CALLBACK (callback), data); G_CALLBACK (callback), data);
if (! query_box) if (! query_box)
return NULL; return NULL;
spinbutton = gimp_spin_button_new (&adjustment, spinbutton = gimp_spin_button_new (&adjustment,
initial, lower, upper, 1, 10, 0, initial, lower, upper, 1, 10, 0,
1, digits); 1, digits);
gtk_entry_set_activates_default (GTK_ENTRY (spinbutton), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (spinbutton), TRUE);
gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (query_box->vbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_grab_focus (spinbutton); gtk_widget_grab_focus (spinbutton);
@ -416,45 +416,45 @@ gimp_query_double_box (const gchar *title,
GtkWidget * GtkWidget *
gimp_query_size_box (const gchar *title, gimp_query_size_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GimpUnit unit, GimpUnit unit,
gdouble resolution, gdouble resolution,
gboolean dot_for_dot, gboolean dot_for_dot,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQuerySizeCallback callback, GimpQuerySizeCallback callback,
gpointer data) gpointer data)
{ {
QueryBox *query_box; QueryBox *query_box;
GtkWidget *sizeentry; GtkWidget *sizeentry;
GtkWidget *spinbutton; GtkWidget *spinbutton;
query_box = create_query_box (title, parent, help_func, help_id, query_box = create_query_box (title, parent, help_func, help_id,
G_CALLBACK (size_query_box_response), G_CALLBACK (size_query_box_response),
GTK_STOCK_DIALOG_QUESTION, GTK_STOCK_DIALOG_QUESTION,
message, message,
GTK_STOCK_OK, GTK_STOCK_CANCEL, GTK_STOCK_OK, GTK_STOCK_CANCEL,
object, signal, object, signal,
G_CALLBACK (callback), data); G_CALLBACK (callback), data);
if (! query_box) if (! query_box)
return NULL; return NULL;
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 12, sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 12,
GIMP_SIZE_ENTRY_UPDATE_SIZE); GIMP_SIZE_ENTRY_UPDATE_SIZE);
if (dot_for_dot) if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
resolution, FALSE); resolution, FALSE);
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits); gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
lower, upper); lower, upper);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
spinbutton = gimp_size_entry_get_help_widget (GIMP_SIZE_ENTRY (sizeentry), 0); spinbutton = gimp_size_entry_get_help_widget (GIMP_SIZE_ENTRY (sizeentry), 0);
@ -494,26 +494,26 @@ gimp_query_size_box (const gchar *title,
GtkWidget * GtkWidget *
gimp_query_boolean_box (const gchar *title, gimp_query_boolean_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *stock_id, const gchar *stock_id,
const gchar *message, const gchar *message,
const gchar *true_button, const gchar *true_button,
const gchar *false_button, const gchar *false_button,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryBooleanCallback callback, GimpQueryBooleanCallback callback,
gpointer data) gpointer data)
{ {
QueryBox *query_box; QueryBox *query_box;
query_box = create_query_box (title, parent, help_func, help_id, query_box = create_query_box (title, parent, help_func, help_id,
G_CALLBACK (boolean_query_box_response), G_CALLBACK (boolean_query_box_response),
stock_id, stock_id,
message, message,
true_button, false_button, true_button, false_button,
object, signal, object, signal,
G_CALLBACK (callback), data); G_CALLBACK (callback), data);
if (! query_box) if (! query_box)
return NULL; return NULL;
@ -659,9 +659,9 @@ boolean_query_box_response (GtkWidget *widget,
/* Call the user defined callback */ /* Call the user defined callback */
(* (GimpQueryBooleanCallback) query_box->callback) (query_box->qbox, (* (GimpQueryBooleanCallback) query_box->callback) (query_box->qbox,
(response_id == (response_id ==
GTK_RESPONSE_OK), GTK_RESPONSE_OK),
query_box->callback_data); query_box->callback_data);
/* Destroy the box */ /* Destroy the box */
if (query_box->qbox) if (query_box->qbox)

View File

@ -30,25 +30,25 @@ G_BEGIN_DECLS
/* query box callback prototypes */ /* query box callback prototypes */
typedef void (* GimpQueryStringCallback) (GtkWidget *query_box, typedef void (* GimpQueryStringCallback) (GtkWidget *query_box,
const gchar *string, const gchar *string,
gpointer data); gpointer data);
typedef void (* GimpQueryIntCallback) (GtkWidget *query_box, typedef void (* GimpQueryIntCallback) (GtkWidget *query_box,
gint value, gint value,
gpointer data); gpointer data);
typedef void (* GimpQueryDoubleCallback) (GtkWidget *query_box, typedef void (* GimpQueryDoubleCallback) (GtkWidget *query_box,
gdouble value, gdouble value,
gpointer data); gpointer data);
typedef void (* GimpQuerySizeCallback) (GtkWidget *query_box, typedef void (* GimpQuerySizeCallback) (GtkWidget *query_box,
gdouble size, gdouble size,
GimpUnit unit, GimpUnit unit,
gpointer data); gpointer data);
typedef void (* GimpQueryBooleanCallback) (GtkWidget *query_box, typedef void (* GimpQueryBooleanCallback) (GtkWidget *query_box,
gboolean value, gboolean value,
gpointer data); gpointer data);
#define GIMP_QUERY_BOX_VBOX(qbox) g_object_get_data (G_OBJECT (qbox), \ #define GIMP_QUERY_BOX_VBOX(qbox) g_object_get_data (G_OBJECT (qbox), \
@ -58,71 +58,71 @@ typedef void (* GimpQueryBooleanCallback) (GtkWidget *query_box,
/* some simple query dialogs */ /* some simple query dialogs */
GtkWidget * gimp_query_string_box (const gchar *title, GtkWidget * gimp_query_string_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
const gchar *initial, const gchar *initial,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryStringCallback callback, GimpQueryStringCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_int_box (const gchar *title, GtkWidget * gimp_query_int_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
gint initial, gint initial,
gint lower, gint lower,
gint upper, gint upper,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryIntCallback callback, GimpQueryIntCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_double_box (const gchar *title, GtkWidget * gimp_query_double_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryDoubleCallback callback, GimpQueryDoubleCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_size_box (const gchar *title, GtkWidget * gimp_query_size_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *message, const gchar *message,
gdouble initial, gdouble initial,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gint digits, gint digits,
GimpUnit unit, GimpUnit unit,
gdouble resolution, gdouble resolution,
gboolean dot_for_dot, gboolean dot_for_dot,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQuerySizeCallback callback, GimpQuerySizeCallback callback,
gpointer data); gpointer data);
GtkWidget * gimp_query_boolean_box (const gchar *title, GtkWidget * gimp_query_boolean_box (const gchar *title,
GtkWidget *parent, GtkWidget *parent,
GimpHelpFunc help_func, GimpHelpFunc help_func,
const gchar *help_id, const gchar *help_id,
const gchar *stock_id, const gchar *stock_id,
const gchar *message, const gchar *message,
const gchar *true_button, const gchar *true_button,
const gchar *false_button, const gchar *false_button,
GObject *object, GObject *object,
const gchar *signal, const gchar *signal,
GimpQueryBooleanCallback callback, GimpQueryBooleanCallback callback,
gpointer data); gpointer data);
G_END_DECLS G_END_DECLS

View File

@ -106,13 +106,13 @@ struct _GimpResolutionEntryClass
GType gimp_resolution_entry_get_type (void) G_GNUC_CONST; GType gimp_resolution_entry_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_resolution_entry_new (const gchar *width_label, GtkWidget * gimp_resolution_entry_new (const gchar *width_label,
gdouble width, gdouble width,
const gchar *height_label, const gchar *height_label,
gdouble height, gdouble height,
GimpUnit size_unit, GimpUnit size_unit,
const gchar *x_label, const gchar *x_label,
gdouble initial_x, gdouble initial_x,
const gchar *y_label, const gchar *y_label,
gdouble initial_y, gdouble initial_y,
GimpUnit intial_unit, GimpUnit intial_unit,
gboolean independent, gboolean independent,

View File

@ -401,12 +401,12 @@ gimp_scrolled_preview_area_event (GtkWidget *area,
case GDK_MOTION_NOTIFY: case GDK_MOTION_NOTIFY:
if (priv->in_drag) if (priv->in_drag)
{ {
GtkAdjustment *hadj; GtkAdjustment *hadj;
GtkAdjustment *vadj; GtkAdjustment *vadj;
gint x, y; gint x, y;
hadj = gtk_range_get_adjustment (GTK_RANGE (preview->hscr)); hadj = gtk_range_get_adjustment (GTK_RANGE (preview->hscr));
vadj = gtk_range_get_adjustment (GTK_RANGE (preview->vscr)); vadj = gtk_range_get_adjustment (GTK_RANGE (preview->vscr));
gtk_widget_get_pointer (area, &x, &y); gtk_widget_get_pointer (area, &x, &y);

View File

@ -74,17 +74,17 @@ struct _GimpSizeEntryField
static void gimp_size_entry_finalize (GObject *object); static void gimp_size_entry_finalize (GObject *object);
static void gimp_size_entry_update_value (GimpSizeEntryField *gsef, static void gimp_size_entry_update_value (GimpSizeEntryField *gsef,
gdouble value); gdouble value);
static void gimp_size_entry_value_callback (GtkWidget *widget, static void gimp_size_entry_value_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void gimp_size_entry_update_refval (GimpSizeEntryField *gsef, static void gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
gdouble refval); gdouble refval);
static void gimp_size_entry_refval_callback (GtkWidget *widget, static void gimp_size_entry_refval_callback (GtkWidget *widget,
gpointer data); gpointer data);
static void gimp_size_entry_update_unit (GimpSizeEntry *gse, static void gimp_size_entry_update_unit (GimpSizeEntry *gse,
GimpUnit unit); GimpUnit unit);
static void gimp_size_entry_unit_callback (GtkWidget *widget, static void gimp_size_entry_unit_callback (GtkWidget *widget,
GimpSizeEntry *sizeentry); GimpSizeEntry *sizeentry);
G_DEFINE_TYPE (GimpSizeEntry, gimp_size_entry, GTK_TYPE_TABLE); G_DEFINE_TYPE (GimpSizeEntry, gimp_size_entry, GTK_TYPE_TABLE);
@ -101,30 +101,30 @@ gimp_size_entry_class_init (GimpSizeEntryClass *klass)
gimp_size_entry_signals[VALUE_CHANGED] = gimp_size_entry_signals[VALUE_CHANGED] =
g_signal_new ("value-changed", g_signal_new ("value-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpSizeEntryClass, value_changed), G_STRUCT_OFFSET (GimpSizeEntryClass, value_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
gimp_size_entry_signals[REFVAL_CHANGED] = gimp_size_entry_signals[REFVAL_CHANGED] =
g_signal_new ("refval-changed", g_signal_new ("refval-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpSizeEntryClass, refval_changed), G_STRUCT_OFFSET (GimpSizeEntryClass, refval_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
gimp_size_entry_signals[UNIT_CHANGED] = gimp_size_entry_signals[UNIT_CHANGED] =
g_signal_new ("unit-changed", g_signal_new ("unit-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpSizeEntryClass, unit_changed), G_STRUCT_OFFSET (GimpSizeEntryClass, unit_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
object_class->finalize = gimp_size_entry_finalize; object_class->finalize = gimp_size_entry_finalize;
@ -209,19 +209,19 @@ gimp_size_entry_finalize (GObject *object)
**/ **/
GtkWidget * GtkWidget *
gimp_size_entry_new (gint number_of_fields, gimp_size_entry_new (gint number_of_fields,
GimpUnit unit, GimpUnit unit,
const gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gboolean show_refval, gboolean show_refval,
gint spinbutton_width, gint spinbutton_width,
GimpSizeEntryUpdatePolicy update_policy) GimpSizeEntryUpdatePolicy update_policy)
{ {
GimpSizeEntry *gse; GimpSizeEntry *gse;
gint i; gint i;
g_return_val_if_fail ((number_of_fields >= 0) && (number_of_fields <= 16), g_return_val_if_fail ((number_of_fields >= 0) && (number_of_fields <= 16),
NULL); NULL);
gse = g_object_new (GIMP_TYPE_SIZE_ENTRY, NULL); gse = g_object_new (GIMP_TYPE_SIZE_ENTRY, NULL);
@ -231,8 +231,8 @@ gimp_size_entry_new (gint number_of_fields,
gse->update_policy = update_policy; gse->update_policy = update_policy;
gtk_table_resize (GTK_TABLE (gse), gtk_table_resize (GTK_TABLE (gse),
1 + gse->show_refval + 2, 1 + gse->show_refval + 2,
number_of_fields + 1 + 3); number_of_fields + 1 + 3);
/* show the 'pixels' menu entry only if we are a 'size' sizeentry and /* show the 'pixels' menu entry only if we are a 'size' sizeentry and
* don't have the reference value spinbutton * don't have the reference value spinbutton
@ -271,7 +271,7 @@ gimp_size_entry_new (gint number_of_fields,
gsef->min_refval = 0; gsef->min_refval = 0;
gsef->max_refval = SIZE_MAX_VALUE; gsef->max_refval = SIZE_MAX_VALUE;
gsef->refval_digits = gsef->refval_digits =
(update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) ? 0 : 3; (update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) ? 0 : 3;
gsef->stop_recursion = 0; gsef->stop_recursion = 0;
digits = ((unit == GIMP_UNIT_PIXEL) ? digits = ((unit == GIMP_UNIT_PIXEL) ?
@ -296,8 +296,8 @@ gimp_size_entry_new (gint number_of_fields,
} }
gtk_table_attach_defaults (GTK_TABLE (gse), gsef->value_spinbutton, gtk_table_attach_defaults (GTK_TABLE (gse), gsef->value_spinbutton,
i+1, i+2, i+1, i+2,
gse->show_refval+1, gse->show_refval+2); gse->show_refval+1, gse->show_refval+2);
g_signal_connect (gsef->value_adjustment, "value-changed", g_signal_connect (gsef->value_adjustment, "value-changed",
G_CALLBACK (gimp_size_entry_value_callback), G_CALLBACK (gimp_size_entry_value_callback),
gsef); gsef);
@ -305,38 +305,38 @@ gimp_size_entry_new (gint number_of_fields,
gtk_widget_show (gsef->value_spinbutton); gtk_widget_show (gsef->value_spinbutton);
if (gse->show_refval) if (gse->show_refval)
{ {
gsef->refval_spinbutton = gsef->refval_spinbutton =
gimp_spin_button_new (&gsef->refval_adjustment, gimp_spin_button_new (&gsef->refval_adjustment,
gsef->refval, gsef->refval,
gsef->min_refval, gsef->max_refval, gsef->min_refval, gsef->max_refval,
1.0, 10.0, 0.0, 1.0, gsef->refval_digits); 1.0, 10.0, 0.0, 1.0, gsef->refval_digits);
gtk_widget_set_size_request (gsef->refval_spinbutton, gtk_widget_set_size_request (gsef->refval_spinbutton,
spinbutton_width, -1); spinbutton_width, -1);
gtk_table_attach_defaults (GTK_TABLE (gse), gsef->refval_spinbutton, gtk_table_attach_defaults (GTK_TABLE (gse), gsef->refval_spinbutton,
i + 1, i + 2, 1, 2); i + 1, i + 2, 1, 2);
g_signal_connect (gsef->refval_adjustment, g_signal_connect (gsef->refval_adjustment,
"value-changed", "value-changed",
G_CALLBACK (gimp_size_entry_refval_callback), G_CALLBACK (gimp_size_entry_refval_callback),
gsef); gsef);
gtk_widget_show (gsef->refval_spinbutton); gtk_widget_show (gsef->refval_spinbutton);
} }
if (gse->menu_show_pixels && (unit == GIMP_UNIT_PIXEL) && if (gse->menu_show_pixels && (unit == GIMP_UNIT_PIXEL) &&
! gse->show_refval) ! gse->show_refval)
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
gsef->refval_digits); gsef->refval_digits);
} }
gse->unitmenu = gimp_unit_menu_new (unit_format, unit, gse->unitmenu = gimp_unit_menu_new (unit_format, unit,
gse->menu_show_pixels, gse->menu_show_pixels,
gse->menu_show_percent, TRUE); gse->menu_show_percent, TRUE);
gtk_table_attach (GTK_TABLE (gse), gse->unitmenu, gtk_table_attach (GTK_TABLE (gse), gse->unitmenu,
i+2, i+3, i+2, i+3,
gse->show_refval+1, gse->show_refval+2, gse->show_refval+1, gse->show_refval+2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
g_signal_connect (gse->unitmenu, "unit-changed", g_signal_connect (gse->unitmenu, "unit-changed",
G_CALLBACK (gimp_size_entry_unit_callback), G_CALLBACK (gimp_size_entry_unit_callback),
gse); gse);
@ -361,8 +361,8 @@ gimp_size_entry_new (gint number_of_fields,
**/ **/
void void
gimp_size_entry_add_field (GimpSizeEntry *gse, gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkSpinButton *value_spinbutton, GtkSpinButton *value_spinbutton,
GtkSpinButton *refval_spinbutton) GtkSpinButton *refval_spinbutton)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
gint digits; gint digits;
@ -404,7 +404,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
if (gse->show_refval) if (gse->show_refval)
{ {
gsef->refval_adjustment = gsef->refval_adjustment =
GTK_OBJECT (gtk_spin_button_get_adjustment (refval_spinbutton)); GTK_OBJECT (gtk_spin_button_get_adjustment (refval_spinbutton));
gsef->refval_spinbutton = GTK_WIDGET (refval_spinbutton); gsef->refval_spinbutton = GTK_WIDGET (refval_spinbutton);
g_signal_connect (gsef->refval_adjustment, "value-changed", g_signal_connect (gsef->refval_adjustment, "value-changed",
G_CALLBACK (gimp_size_entry_refval_callback), G_CALLBACK (gimp_size_entry_refval_callback),
@ -422,7 +422,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
(gse->unit == GIMP_UNIT_PIXEL)) (gse->unit == GIMP_UNIT_PIXEL))
{ {
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
gsef->refval_digits); gsef->refval_digits);
} }
} }
@ -440,10 +440,10 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
**/ **/
GtkWidget * GtkWidget *
gimp_size_entry_attach_label (GimpSizeEntry *gse, gimp_size_entry_attach_label (GimpSizeEntry *gse,
const gchar *text, const gchar *text,
gint row, gint row,
gint column, gint column,
gfloat alignment) gfloat alignment)
{ {
GtkWidget *label; GtkWidget *label;
@ -473,7 +473,7 @@ gimp_size_entry_attach_label (GimpSizeEntry *gse,
gtk_misc_set_alignment (GTK_MISC (label), alignment, 0.5); gtk_misc_set_alignment (GTK_MISC (label), alignment, 0.5);
gtk_table_attach (GTK_TABLE (gse), label, column, column+1, row, row+1, gtk_table_attach (GTK_TABLE (gse), label, column, column+1, row, row+1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label); gtk_widget_show (label);
return label; return label;
@ -498,9 +498,9 @@ gimp_size_entry_attach_label (GimpSizeEntry *gse,
**/ **/
void void
gimp_size_entry_set_resolution (GimpSizeEntry *gse, gimp_size_entry_set_resolution (GimpSizeEntry *gse,
gint field, gint field,
gdouble resolution, gdouble resolution,
gboolean keep_size) gboolean keep_size)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
gfloat val; gfloat val;
@ -517,7 +517,7 @@ gimp_size_entry_set_resolution (GimpSizeEntry *gse,
gsef->stop_recursion = 0; gsef->stop_recursion = 0;
gimp_size_entry_set_refval_boundaries (gse, field, gimp_size_entry_set_refval_boundaries (gse, field,
gsef->min_refval, gsef->max_refval); gsef->min_refval, gsef->max_refval);
if (! keep_size) if (! keep_size)
gimp_size_entry_set_value (gse, field, val); gimp_size_entry_set_value (gse, field, val);
@ -543,9 +543,9 @@ gimp_size_entry_set_resolution (GimpSizeEntry *gse,
**/ **/
void void
gimp_size_entry_set_size (GimpSizeEntry *gse, gimp_size_entry_set_size (GimpSizeEntry *gse,
gint field, gint field,
gdouble lower, gdouble lower,
gdouble upper) gdouble upper)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
@ -582,9 +582,9 @@ gimp_size_entry_set_size (GimpSizeEntry *gse,
**/ **/
void void
gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse, gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gint field, gint field,
gdouble lower, gdouble lower,
gdouble upper) gdouble upper)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
@ -610,39 +610,39 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
case GIMP_SIZE_ENTRY_UPDATE_SIZE: case GIMP_SIZE_ENTRY_UPDATE_SIZE:
switch (gse->unit) switch (gse->unit)
{ {
case GIMP_UNIT_PIXEL: case GIMP_UNIT_PIXEL:
gimp_size_entry_set_refval_boundaries (gse, field, gimp_size_entry_set_refval_boundaries (gse, field,
gsef->min_value, gsef->min_value,
gsef->max_value); gsef->max_value);
break; break;
case GIMP_UNIT_PERCENT: case GIMP_UNIT_PERCENT:
gimp_size_entry_set_refval_boundaries (gse, field, gimp_size_entry_set_refval_boundaries (gse, field,
gsef->lower + gsef->lower +
(gsef->upper - gsef->lower) * (gsef->upper - gsef->lower) *
gsef->min_value / 100, gsef->min_value / 100,
gsef->lower + gsef->lower +
(gsef->upper - gsef->lower) * (gsef->upper - gsef->lower) *
gsef->max_value / 100); gsef->max_value / 100);
break; break;
default: default:
gimp_size_entry_set_refval_boundaries (gse, field, gimp_size_entry_set_refval_boundaries (gse, field,
gsef->min_value * gsef->min_value *
gsef->resolution / gsef->resolution /
gimp_unit_get_factor (gse->unit), gimp_unit_get_factor (gse->unit),
gsef->max_value * gsef->max_value *
gsef->resolution / gsef->resolution /
gimp_unit_get_factor (gse->unit)); gimp_unit_get_factor (gse->unit));
break; break;
} }
break; break;
case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION: case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION:
gimp_size_entry_set_refval_boundaries (gse, field, gimp_size_entry_set_refval_boundaries (gse, field,
gsef->min_value * gsef->min_value *
gimp_unit_get_factor (gse->unit), gimp_unit_get_factor (gse->unit),
gsef->max_value * gsef->max_value *
gimp_unit_get_factor (gse->unit)); gimp_unit_get_factor (gse->unit));
break; break;
default: default:
@ -672,7 +672,7 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
**/ **/
gdouble gdouble
gimp_size_entry_get_value (GimpSizeEntry *gse, gimp_size_entry_get_value (GimpSizeEntry *gse,
gint field) gint field)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
@ -685,7 +685,7 @@ gimp_size_entry_get_value (GimpSizeEntry *gse,
static void static void
gimp_size_entry_update_value (GimpSizeEntryField *gsef, gimp_size_entry_update_value (GimpSizeEntryField *gsef,
gdouble value) gdouble value)
{ {
if (gsef->stop_recursion > 1) if (gsef->stop_recursion > 1)
return; return;
@ -699,34 +699,34 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
case GIMP_SIZE_ENTRY_UPDATE_SIZE: case GIMP_SIZE_ENTRY_UPDATE_SIZE:
switch (gsef->gse->unit) switch (gsef->gse->unit)
{ {
case GIMP_UNIT_PIXEL: case GIMP_UNIT_PIXEL:
gsef->refval = value; gsef->refval = value;
break; break;
case GIMP_UNIT_PERCENT: case GIMP_UNIT_PERCENT:
gsef->refval = gsef->refval =
CLAMP (gsef->lower + (gsef->upper - gsef->lower) * value / 100, CLAMP (gsef->lower + (gsef->upper - gsef->lower) * value / 100,
gsef->min_refval, gsef->max_refval); gsef->min_refval, gsef->max_refval);
break; break;
default: default:
gsef->refval = gsef->refval =
CLAMP (value * gsef->resolution / CLAMP (value * gsef->resolution /
gimp_unit_get_factor (gsef->gse->unit), gimp_unit_get_factor (gsef->gse->unit),
gsef->min_refval, gsef->max_refval); gsef->min_refval, gsef->max_refval);
break; break;
} }
if (gsef->gse->show_refval) if (gsef->gse->show_refval)
gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->refval_adjustment), gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->refval_adjustment),
gsef->refval); gsef->refval);
break; break;
case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION: case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION:
gsef->refval = gsef->refval =
CLAMP (value * gimp_unit_get_factor (gsef->gse->unit), CLAMP (value * gimp_unit_get_factor (gsef->gse->unit),
gsef->min_refval, gsef->max_refval); gsef->min_refval, gsef->max_refval);
if (gsef->gse->show_refval) if (gsef->gse->show_refval)
gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->refval_adjustment), gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->refval_adjustment),
gsef->refval); gsef->refval);
break; break;
default: default:
@ -754,8 +754,8 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
**/ **/
void void
gimp_size_entry_set_value (GimpSizeEntry *gse, gimp_size_entry_set_value (GimpSizeEntry *gse,
gint field, gint field,
gdouble value) gdouble value)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
@ -773,7 +773,7 @@ gimp_size_entry_set_value (GimpSizeEntry *gse,
static void static void
gimp_size_entry_value_callback (GtkWidget *widget, gimp_size_entry_value_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
gdouble new_value; gdouble new_value;
@ -834,39 +834,39 @@ gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
case GIMP_SIZE_ENTRY_UPDATE_SIZE: case GIMP_SIZE_ENTRY_UPDATE_SIZE:
switch (gse->unit) switch (gse->unit)
{ {
case GIMP_UNIT_PIXEL: case GIMP_UNIT_PIXEL:
gimp_size_entry_set_value_boundaries (gse, field, gimp_size_entry_set_value_boundaries (gse, field,
gsef->min_refval, gsef->min_refval,
gsef->max_refval); gsef->max_refval);
break; break;
case GIMP_UNIT_PERCENT: case GIMP_UNIT_PERCENT:
gimp_size_entry_set_value_boundaries (gse, field, gimp_size_entry_set_value_boundaries (gse, field,
100 * (gsef->min_refval - 100 * (gsef->min_refval -
gsef->lower) / gsef->lower) /
(gsef->upper - gsef->lower), (gsef->upper - gsef->lower),
100 * (gsef->max_refval - 100 * (gsef->max_refval -
gsef->lower) / gsef->lower) /
(gsef->upper - gsef->lower)); (gsef->upper - gsef->lower));
break; break;
default: default:
gimp_size_entry_set_value_boundaries (gse, field, gimp_size_entry_set_value_boundaries (gse, field,
gsef->min_refval * gsef->min_refval *
gimp_unit_get_factor (gse->unit) / gimp_unit_get_factor (gse->unit) /
gsef->resolution, gsef->resolution,
gsef->max_refval * gsef->max_refval *
gimp_unit_get_factor (gse->unit) / gimp_unit_get_factor (gse->unit) /
gsef->resolution); gsef->resolution);
break; break;
} }
break; break;
case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION: case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION:
gimp_size_entry_set_value_boundaries (gse, field, gimp_size_entry_set_value_boundaries (gse, field,
gsef->min_refval / gsef->min_refval /
gimp_unit_get_factor (gse->unit), gimp_unit_get_factor (gse->unit),
gsef->max_refval / gsef->max_refval /
gimp_unit_get_factor (gse->unit)); gimp_unit_get_factor (gse->unit));
break; break;
default: default:
@ -893,8 +893,8 @@ gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
**/ **/
void void
gimp_size_entry_set_refval_digits (GimpSizeEntry *gse, gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
gint field, gint field,
gint digits) gint digits)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
@ -908,11 +908,11 @@ gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE)
{ {
if (gse->show_refval) if (gse->show_refval)
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->refval_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->refval_spinbutton),
gsef->refval_digits); gsef->refval_digits);
else if (gse->unit == GIMP_UNIT_PIXEL) else if (gse->unit == GIMP_UNIT_PIXEL)
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
gsef->refval_digits); gsef->refval_digits);
} }
} }
@ -931,7 +931,7 @@ gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
**/ **/
gdouble gdouble
gimp_size_entry_get_refval (GimpSizeEntry *gse, gimp_size_entry_get_refval (GimpSizeEntry *gse,
gint field) gint field)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
@ -945,7 +945,7 @@ gimp_size_entry_get_refval (GimpSizeEntry *gse,
static void static void
gimp_size_entry_update_refval (GimpSizeEntryField *gsef, gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
gdouble refval) gdouble refval)
{ {
if (gsef->stop_recursion > 1) if (gsef->stop_recursion > 1)
return; return;
@ -959,32 +959,32 @@ gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
case GIMP_SIZE_ENTRY_UPDATE_SIZE: case GIMP_SIZE_ENTRY_UPDATE_SIZE:
switch (gsef->gse->unit) switch (gsef->gse->unit)
{ {
case GIMP_UNIT_PIXEL: case GIMP_UNIT_PIXEL:
gsef->value = refval; gsef->value = refval;
break; break;
case GIMP_UNIT_PERCENT: case GIMP_UNIT_PERCENT:
gsef->value = gsef->value =
CLAMP (100 * (refval - gsef->lower) / (gsef->upper - gsef->lower), CLAMP (100 * (refval - gsef->lower) / (gsef->upper - gsef->lower),
gsef->min_value, gsef->max_value); gsef->min_value, gsef->max_value);
break; break;
default: default:
gsef->value = gsef->value =
CLAMP (refval * gimp_unit_get_factor (gsef->gse->unit) / CLAMP (refval * gimp_unit_get_factor (gsef->gse->unit) /
gsef->resolution, gsef->resolution,
gsef->min_value, gsef->max_value); gsef->min_value, gsef->max_value);
break; break;
} }
gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->value_adjustment), gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->value_adjustment),
gsef->value); gsef->value);
break; break;
case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION: case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION:
gsef->value = gsef->value =
CLAMP (refval / gimp_unit_get_factor (gsef->gse->unit), CLAMP (refval / gimp_unit_get_factor (gsef->gse->unit),
gsef->min_value, gsef->max_value); gsef->min_value, gsef->max_value);
gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->value_adjustment), gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->value_adjustment),
gsef->value); gsef->value);
break; break;
default: default:
@ -1008,8 +1008,8 @@ gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
**/ **/
void void
gimp_size_entry_set_refval (GimpSizeEntry *gse, gimp_size_entry_set_refval (GimpSizeEntry *gse,
gint field, gint field,
gdouble refval) gdouble refval)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
@ -1029,7 +1029,7 @@ gimp_size_entry_set_refval (GimpSizeEntry *gse,
static void static void
gimp_size_entry_refval_callback (GtkWidget *widget, gimp_size_entry_refval_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
gdouble new_refval; gdouble new_refval;
@ -1062,7 +1062,7 @@ gimp_size_entry_get_unit (GimpSizeEntry *gse)
static void static void
gimp_size_entry_update_unit (GimpSizeEntry *gse, gimp_size_entry_update_unit (GimpSizeEntry *gse,
GimpUnit unit) GimpUnit unit)
{ {
GimpSizeEntryField *gsef; GimpSizeEntryField *gsef;
gint i; gint i;
@ -1077,24 +1077,24 @@ gimp_size_entry_update_unit (GimpSizeEntry *gse,
gsef = (GimpSizeEntryField *) g_slist_nth_data (gse->fields, i); gsef = (GimpSizeEntryField *) g_slist_nth_data (gse->fields, i);
if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE)
{ {
if (unit == GIMP_UNIT_PIXEL) if (unit == GIMP_UNIT_PIXEL)
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
gsef->refval_digits + digits); gsef->refval_digits + digits);
else if (unit == GIMP_UNIT_PERCENT) else if (unit == GIMP_UNIT_PERCENT)
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
2 + digits); 2 + digits);
else else
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
GIMP_SIZE_ENTRY_DIGITS (unit) + digits); GIMP_SIZE_ENTRY_DIGITS (unit) + digits);
} }
else if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) else if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION)
{ {
digits = (gimp_unit_get_digits (GIMP_UNIT_INCH) - digits = (gimp_unit_get_digits (GIMP_UNIT_INCH) -
gimp_unit_get_digits (unit)); gimp_unit_get_digits (unit));
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton), gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
MAX (3 + digits, 3)); MAX (3 + digits, 3));
} }
gsef->stop_recursion = 0; /* hack !!! */ gsef->stop_recursion = 0; /* hack !!! */
@ -1119,7 +1119,7 @@ gimp_size_entry_update_unit (GimpSizeEntry *gse,
**/ **/
void void
gimp_size_entry_set_unit (GimpSizeEntry *gse, gimp_size_entry_set_unit (GimpSizeEntry *gse,
GimpUnit unit) GimpUnit unit)
{ {
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse)); g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
g_return_if_fail (gse->menu_show_pixels || (unit != GIMP_UNIT_PIXEL)); g_return_if_fail (gse->menu_show_pixels || (unit != GIMP_UNIT_PIXEL));
@ -1131,7 +1131,7 @@ gimp_size_entry_set_unit (GimpSizeEntry *gse,
static void static void
gimp_size_entry_unit_callback (GtkWidget *widget, gimp_size_entry_unit_callback (GtkWidget *widget,
GimpSizeEntry *gse) GimpSizeEntry *gse)
{ {
GimpUnit new_unit; GimpUnit new_unit;

View File

@ -78,62 +78,62 @@ struct _GimpSizeEntryClass
GType gimp_size_entry_get_type (void) G_GNUC_CONST; GType gimp_size_entry_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_size_entry_new (gint number_of_fields, GtkWidget * gimp_size_entry_new (gint number_of_fields,
GimpUnit unit, GimpUnit unit,
const gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gboolean show_refval, gboolean show_refval,
gint spinbutton_width, gint spinbutton_width,
GimpSizeEntryUpdatePolicy update_policy); GimpSizeEntryUpdatePolicy update_policy);
void gimp_size_entry_add_field (GimpSizeEntry *gse, void gimp_size_entry_add_field (GimpSizeEntry *gse,
GtkSpinButton *value_spinbutton, GtkSpinButton *value_spinbutton,
GtkSpinButton *refval_spinbutton); GtkSpinButton *refval_spinbutton);
GtkWidget * gimp_size_entry_attach_label (GimpSizeEntry *gse, GtkWidget * gimp_size_entry_attach_label (GimpSizeEntry *gse,
const gchar *text, const gchar *text,
gint row, gint row,
gint column, gint column,
gfloat alignment); gfloat alignment);
void gimp_size_entry_set_resolution (GimpSizeEntry *gse, void gimp_size_entry_set_resolution (GimpSizeEntry *gse,
gint field, gint field,
gdouble resolution, gdouble resolution,
gboolean keep_size); gboolean keep_size);
void gimp_size_entry_set_size (GimpSizeEntry *gse, void gimp_size_entry_set_size (GimpSizeEntry *gse,
gint field, gint field,
gdouble lower, gdouble lower,
gdouble upper); gdouble upper);
void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse, void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gint field, gint field,
gdouble lower, gdouble lower,
gdouble upper); gdouble upper);
gdouble gimp_size_entry_get_value (GimpSizeEntry *gse, gdouble gimp_size_entry_get_value (GimpSizeEntry *gse,
gint field); gint field);
void gimp_size_entry_set_value (GimpSizeEntry *gse, void gimp_size_entry_set_value (GimpSizeEntry *gse,
gint field, gint field,
gdouble value); gdouble value);
void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse, void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
gint field, gint field,
gdouble lower, gdouble lower,
gdouble upper); gdouble upper);
void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse, void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
gint field, gint field,
gint digits); gint digits);
gdouble gimp_size_entry_get_refval (GimpSizeEntry *gse, gdouble gimp_size_entry_get_refval (GimpSizeEntry *gse,
gint field); gint field);
void gimp_size_entry_set_refval (GimpSizeEntry *gse, void gimp_size_entry_set_refval (GimpSizeEntry *gse,
gint field, gint field,
gdouble refval); gdouble refval);
GimpUnit gimp_size_entry_get_unit (GimpSizeEntry *gse); GimpUnit gimp_size_entry_get_unit (GimpSizeEntry *gse);
void gimp_size_entry_set_unit (GimpSizeEntry *gse, void gimp_size_entry_set_unit (GimpSizeEntry *gse,
GimpUnit unit); GimpUnit unit);
void gimp_size_entry_show_unit_menu (GimpSizeEntry *gse, void gimp_size_entry_show_unit_menu (GimpSizeEntry *gse,
gboolean show); gboolean show);

View File

@ -81,10 +81,10 @@ icon_set_from_inline (GtkIconSet *set,
static void static void
add_sized_with_same_fallback (GtkIconFactory *factory, add_sized_with_same_fallback (GtkIconFactory *factory,
const guchar *inline_data, const guchar *inline_data,
const guchar *inline_data_rtl, const guchar *inline_data_rtl,
GtkIconSize size, GtkIconSize size,
const gchar *stock_id) const gchar *stock_id)
{ {
GtkIconSet *set; GtkIconSet *set;
gboolean fallback = FALSE; gboolean fallback = FALSE;
@ -688,37 +688,37 @@ gimp_stock_init (void)
for (i = 0; i < G_N_ELEMENTS (gimp_stock_dialog_pixbufs); i++) for (i = 0; i < G_N_ELEMENTS (gimp_stock_dialog_pixbufs); i++)
{ {
add_sized_with_same_fallback (gimp_stock_factory, add_sized_with_same_fallback (gimp_stock_factory,
gimp_stock_dialog_pixbufs[i].inline_data, gimp_stock_dialog_pixbufs[i].inline_data,
NULL, NULL,
GTK_ICON_SIZE_DIALOG, GTK_ICON_SIZE_DIALOG,
gimp_stock_dialog_pixbufs[i].stock_id); gimp_stock_dialog_pixbufs[i].stock_id);
} }
for (i = 0; i < G_N_ELEMENTS (gimp_stock_dnd_pixbufs); i++) for (i = 0; i < G_N_ELEMENTS (gimp_stock_dnd_pixbufs); i++)
{ {
add_sized_with_same_fallback (gimp_stock_factory, add_sized_with_same_fallback (gimp_stock_factory,
gimp_stock_dnd_pixbufs[i].inline_data, gimp_stock_dnd_pixbufs[i].inline_data,
NULL, NULL,
GTK_ICON_SIZE_DND, GTK_ICON_SIZE_DND,
gimp_stock_dnd_pixbufs[i].stock_id); gimp_stock_dnd_pixbufs[i].stock_id);
} }
for (i = 0; i < G_N_ELEMENTS (gimp_stock_button_pixbufs); i++) for (i = 0; i < G_N_ELEMENTS (gimp_stock_button_pixbufs); i++)
{ {
add_sized_with_same_fallback (gimp_stock_factory, add_sized_with_same_fallback (gimp_stock_factory,
gimp_stock_button_pixbufs[i].inline_data, gimp_stock_button_pixbufs[i].inline_data,
NULL, NULL,
GTK_ICON_SIZE_BUTTON, GTK_ICON_SIZE_BUTTON,
gimp_stock_button_pixbufs[i].stock_id); gimp_stock_button_pixbufs[i].stock_id);
} }
for (i = 0; i < G_N_ELEMENTS (gimp_stock_menu_pixbufs); i++) for (i = 0; i < G_N_ELEMENTS (gimp_stock_menu_pixbufs); i++)
{ {
add_sized_with_same_fallback (gimp_stock_factory, add_sized_with_same_fallback (gimp_stock_factory,
gimp_stock_menu_pixbufs[i].inline_data, gimp_stock_menu_pixbufs[i].inline_data,
NULL, NULL,
GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_MENU,
gimp_stock_menu_pixbufs[i].stock_id); gimp_stock_menu_pixbufs[i].stock_id);
} }
for (i = 0; i < G_N_ELEMENTS (gimp_stock_direction_pixbufs); i++) for (i = 0; i < G_N_ELEMENTS (gimp_stock_direction_pixbufs); i++)

View File

@ -54,9 +54,9 @@ enum
static void gimp_unit_menu_finalize (GObject *object); static void gimp_unit_menu_finalize (GObject *object);
static const gchar * gimp_unit_menu_build_string (const gchar *format, static const gchar * gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit); GimpUnit unit);
static void gimp_unit_menu_callback (GtkWidget *widget, static void gimp_unit_menu_callback (GtkWidget *widget,
gpointer data); gpointer data);
G_DEFINE_TYPE (GimpUnitMenu, gimp_unit_menu, GTK_TYPE_OPTION_MENU); G_DEFINE_TYPE (GimpUnitMenu, gimp_unit_menu, GTK_TYPE_OPTION_MENU);
@ -79,12 +79,12 @@ gimp_unit_menu_class_init (GimpUnitMenuClass *klass)
**/ **/
gimp_unit_menu_signals[UNIT_CHANGED] = gimp_unit_menu_signals[UNIT_CHANGED] =
g_signal_new ("unit-changed", g_signal_new ("unit-changed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpUnitMenuClass, unit_changed), G_STRUCT_OFFSET (GimpUnitMenuClass, unit_changed),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
object_class->finalize = gimp_unit_menu_finalize; object_class->finalize = gimp_unit_menu_finalize;
@ -167,10 +167,10 @@ gimp_unit_menu_finalize (GObject *object)
**/ **/
GtkWidget * GtkWidget *
gimp_unit_menu_new (const gchar *format, gimp_unit_menu_new (const gchar *format,
GimpUnit unit, GimpUnit unit,
gboolean show_pixels, gboolean show_pixels,
gboolean show_percent, gboolean show_percent,
gboolean show_custom) gboolean show_custom)
{ {
GimpUnitMenu *unit_menu; GimpUnitMenu *unit_menu;
GtkWidget *menu; GtkWidget *menu;
@ -178,8 +178,8 @@ gimp_unit_menu_new (const gchar *format,
GimpUnit u; GimpUnit u;
g_return_val_if_fail (((unit >= GIMP_UNIT_PIXEL) && g_return_val_if_fail (((unit >= GIMP_UNIT_PIXEL) &&
(unit < gimp_unit_get_number_of_units ())) || (unit < gimp_unit_get_number_of_units ())) ||
(unit == GIMP_UNIT_PERCENT), NULL); (unit == GIMP_UNIT_PERCENT), NULL);
if ((unit >= gimp_unit_get_number_of_built_in_units ()) && if ((unit >= gimp_unit_get_number_of_built_in_units ()) &&
(unit != GIMP_UNIT_PERCENT)) (unit != GIMP_UNIT_PERCENT))
@ -198,33 +198,33 @@ gimp_unit_menu_new (const gchar *format,
{ {
/* special cases "pixels" and "percent" */ /* special cases "pixels" and "percent" */
if (u == GIMP_UNIT_INCH) if (u == GIMP_UNIT_INCH)
{ {
if (show_percent) if (show_percent)
{ {
menuitem = menuitem =
gtk_menu_item_new_with_label gtk_menu_item_new_with_label
(gimp_unit_menu_build_string (format, GIMP_UNIT_PERCENT)); (gimp_unit_menu_build_string (format, GIMP_UNIT_PERCENT));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu", g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu",
GINT_TO_POINTER (GIMP_UNIT_PERCENT)); GINT_TO_POINTER (GIMP_UNIT_PERCENT));
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",
G_CALLBACK (gimp_unit_menu_callback), G_CALLBACK (gimp_unit_menu_callback),
unit_menu); unit_menu);
} }
if (show_pixels || show_percent) if (show_pixels || show_percent)
{ {
menuitem = gtk_menu_item_new (); menuitem = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_set_sensitive (menuitem, FALSE); gtk_widget_set_sensitive (menuitem, FALSE);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
} }
} }
menuitem = menuitem =
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, u)); gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, u));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu", g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu",
GINT_TO_POINTER (u)); GINT_TO_POINTER (u));
@ -244,7 +244,7 @@ gimp_unit_menu_new (const gchar *format,
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
menuitem = menuitem =
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format, gtk_menu_item_new_with_label (gimp_unit_menu_build_string (format,
unit)); unit));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu", g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu",
@ -264,7 +264,7 @@ gimp_unit_menu_new (const gchar *format,
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
menuitem = menuitem =
gtk_menu_item_new_with_label (_("More...")); gtk_menu_item_new_with_label (_("More..."));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu", g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu",
GINT_TO_POINTER (GIMP_UNIT_PERCENT + 1)); GINT_TO_POINTER (GIMP_UNIT_PERCENT + 1));
@ -279,13 +279,13 @@ gimp_unit_menu_new (const gchar *format,
unit_menu->unit = unit; unit_menu->unit = unit;
gtk_option_menu_set_history (GTK_OPTION_MENU (unit_menu), gtk_option_menu_set_history (GTK_OPTION_MENU (unit_menu),
(unit == GIMP_UNIT_PIXEL) ? 0 : (unit == GIMP_UNIT_PIXEL) ? 0 :
((unit == GIMP_UNIT_PERCENT) ? ((unit == GIMP_UNIT_PERCENT) ?
(show_pixels ? 1 : 0) : (show_pixels ? 1 : 0) :
(((show_pixels || show_percent) ? 2 : 0) + (((show_pixels || show_percent) ? 2 : 0) +
((show_pixels && show_percent) ? 1 : 0) + ((show_pixels && show_percent) ? 1 : 0) +
((unit < GIMP_UNIT_END) ? ((unit < GIMP_UNIT_END) ?
(unit - 1) : GIMP_UNIT_END)))); (unit - 1) : GIMP_UNIT_END))));
return GTK_WIDGET (unit_menu); return GTK_WIDGET (unit_menu);
} }
@ -299,7 +299,7 @@ gimp_unit_menu_new (const gchar *format,
**/ **/
void void
gimp_unit_menu_set_unit (GimpUnitMenu *menu, gimp_unit_menu_set_unit (GimpUnitMenu *menu,
GimpUnit unit) GimpUnit unit)
{ {
GtkWidget *menuitem = NULL; GtkWidget *menuitem = NULL;
GList *items; GList *items;
@ -307,45 +307,45 @@ gimp_unit_menu_set_unit (GimpUnitMenu *menu,
g_return_if_fail (GIMP_IS_UNIT_MENU (menu)); g_return_if_fail (GIMP_IS_UNIT_MENU (menu));
g_return_if_fail (((unit >= GIMP_UNIT_PIXEL) && g_return_if_fail (((unit >= GIMP_UNIT_PIXEL) &&
((unit > GIMP_UNIT_PIXEL) || menu->show_pixels) && ((unit > GIMP_UNIT_PIXEL) || menu->show_pixels) &&
(unit < gimp_unit_get_number_of_units ())) || (unit < gimp_unit_get_number_of_units ())) ||
((unit == GIMP_UNIT_PERCENT) && menu->show_percent)); ((unit == GIMP_UNIT_PERCENT) && menu->show_percent));
if (unit == menu->unit) if (unit == menu->unit)
return; return;
items = GTK_MENU_SHELL (GTK_OPTION_MENU (menu)->menu)->children; items = GTK_MENU_SHELL (GTK_OPTION_MENU (menu)->menu)->children;
user_unit = (GIMP_UNIT_END + user_unit = (GIMP_UNIT_END +
(((menu->show_pixels || menu->show_percent) ? 2 : 0) + (((menu->show_pixels || menu->show_percent) ? 2 : 0) +
((menu->show_pixels && menu->show_percent) ? 1 : 0))); ((menu->show_pixels && menu->show_percent) ? 1 : 0)));
if ((unit >= GIMP_UNIT_END) && (unit != GIMP_UNIT_PERCENT)) if ((unit >= GIMP_UNIT_END) && (unit != GIMP_UNIT_PERCENT))
{ {
if ((g_list_length (items) - 3) >= user_unit) if ((g_list_length (items) - 3) >= user_unit)
{ {
gtk_widget_destroy (GTK_WIDGET (g_list_nth_data (items, gtk_widget_destroy (GTK_WIDGET (g_list_nth_data (items,
user_unit - 1))); user_unit - 1)));
gtk_widget_destroy (GTK_WIDGET (g_list_nth_data (items, gtk_widget_destroy (GTK_WIDGET (g_list_nth_data (items,
user_unit - 1))); user_unit - 1)));
} }
menuitem = gtk_menu_item_new (); menuitem = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (GTK_OPTION_MENU (menu)->menu), gtk_menu_shell_append (GTK_MENU_SHELL (GTK_OPTION_MENU (menu)->menu),
menuitem); menuitem);
gtk_widget_set_sensitive (menuitem, FALSE); gtk_widget_set_sensitive (menuitem, FALSE);
gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (menu)->menu), gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (menu)->menu),
menuitem, user_unit - 1); menuitem, user_unit - 1);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
menuitem = menuitem =
gtk_menu_item_new_with_label (gimp_unit_menu_build_string (menu->format, gtk_menu_item_new_with_label (gimp_unit_menu_build_string (menu->format,
unit)); unit));
gtk_menu_shell_append (GTK_MENU_SHELL (GTK_OPTION_MENU (menu)->menu), gtk_menu_shell_append (GTK_MENU_SHELL (GTK_OPTION_MENU (menu)->menu),
menuitem); menuitem);
g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu", g_object_set_data (G_OBJECT (menuitem), "gimp_unit_menu",
GINT_TO_POINTER (unit)); GINT_TO_POINTER (unit));
gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (menu)->menu), gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (menu)->menu),
menuitem, user_unit); menuitem, user_unit);
gtk_widget_show (menuitem); gtk_widget_show (menuitem);
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",
@ -355,15 +355,15 @@ gimp_unit_menu_set_unit (GimpUnitMenu *menu,
menu->unit = unit; menu->unit = unit;
gtk_option_menu_set_history (GTK_OPTION_MENU (menu), gtk_option_menu_set_history (GTK_OPTION_MENU (menu),
(unit == GIMP_UNIT_PIXEL) ? 0 : (unit == GIMP_UNIT_PIXEL) ? 0 :
((unit == GIMP_UNIT_PERCENT) ? ((unit == GIMP_UNIT_PERCENT) ?
(menu->show_pixels ? 1 : 0) : (menu->show_pixels ? 1 : 0) :
(((menu->show_pixels || (((menu->show_pixels ||
menu->show_percent) ? 2 : 0) + menu->show_percent) ? 2 : 0) +
((menu->show_pixels && ((menu->show_pixels &&
menu->show_percent) ? 1 : 0) + menu->show_percent) ? 1 : 0) +
((unit < GIMP_UNIT_END) ? ((unit < GIMP_UNIT_END) ?
(unit - 1) : GIMP_UNIT_END)))); (unit - 1) : GIMP_UNIT_END))));
g_signal_emit (menu, gimp_unit_menu_signals[UNIT_CHANGED], 0); g_signal_emit (menu, gimp_unit_menu_signals[UNIT_CHANGED], 0);
} }
@ -455,7 +455,7 @@ print (gchar *buf,
static const gchar * static const gchar *
gimp_unit_menu_build_string (const gchar *format, gimp_unit_menu_build_string (const gchar *format,
GimpUnit unit) GimpUnit unit)
{ {
static gchar buffer[64]; static gchar buffer[64];
gint i = 0; gint i = 0;
@ -463,56 +463,56 @@ gimp_unit_menu_build_string (const gchar *format,
while (i < (sizeof (buffer) - 1) && *format) while (i < (sizeof (buffer) - 1) && *format)
{ {
switch (*format) switch (*format)
{ {
case '%': case '%':
format++; format++;
switch (*format) switch (*format)
{ {
case 0: case 0:
g_warning ("%s: unit-menu-format string ended within %%-sequence", g_warning ("%s: unit-menu-format string ended within %%-sequence",
G_STRFUNC); G_STRFUNC);
break; break;
case '%': case '%':
buffer[i++] = '%'; buffer[i++] = '%';
break; break;
case 'f': /* factor (how many units make up an inch) */ case 'f': /* factor (how many units make up an inch) */
i += print (buffer, sizeof (buffer), i, "%f", i += print (buffer, sizeof (buffer), i, "%f",
gimp_unit_get_factor (unit)); gimp_unit_get_factor (unit));
break; break;
case 'y': /* symbol ("''" for inch) */ case 'y': /* symbol ("''" for inch) */
i += print (buffer, sizeof (buffer), i, "%s", i += print (buffer, sizeof (buffer), i, "%s",
gimp_unit_get_symbol (unit)); gimp_unit_get_symbol (unit));
break; break;
case 'a': /* abbreviation */ case 'a': /* abbreviation */
i += print (buffer, sizeof (buffer), i, "%s", i += print (buffer, sizeof (buffer), i, "%s",
gimp_unit_get_abbreviation (unit)); gimp_unit_get_abbreviation (unit));
break; break;
case 's': /* singular */ case 's': /* singular */
i += print (buffer, sizeof (buffer), i, "%s", i += print (buffer, sizeof (buffer), i, "%s",
gimp_unit_get_singular (unit)); gimp_unit_get_singular (unit));
break; break;
case 'p': /* plural */ case 'p': /* plural */
i += print (buffer, sizeof (buffer), i, "%s", i += print (buffer, sizeof (buffer), i, "%s",
gimp_unit_get_plural (unit)); gimp_unit_get_plural (unit));
break; break;
default: default:
g_warning ("%s: unit-menu-format contains unknown format " g_warning ("%s: unit-menu-format contains unknown format "
"sequence '%%%c'", G_STRFUNC, *format); "sequence '%%%c'", G_STRFUNC, *format);
break; break;
} }
break; break;
default: default:
buffer[i++] = *format; buffer[i++] = *format;
break; break;
} }
format++; format++;
} }
@ -554,9 +554,9 @@ gimp_unit_menu_selection_response (GtkWidget *widget,
static void static void
gimp_unit_menu_selection_row_activated_callback (GtkTreeView *tv, gimp_unit_menu_selection_row_activated_callback (GtkTreeView *tv,
GtkTreePath *path, GtkTreePath *path,
GtkTreeViewColumn *column, GtkTreeViewColumn *column,
GimpUnitMenu *menu) GimpUnitMenu *menu)
{ {
gtk_dialog_response (GTK_DIALOG (menu->selection), GTK_RESPONSE_OK); gtk_dialog_response (GTK_DIALOG (menu->selection), GTK_RESPONSE_OK);
} }
@ -609,26 +609,26 @@ gimp_unit_menu_create_selection (GimpUnitMenu *menu)
/* the selection list */ /* the selection list */
scrolled_win = gtk_scrolled_window_new (NULL, NULL); scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_SHADOW_ETCHED_IN); GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_ALWAYS); GTK_POLICY_ALWAYS);
gtk_container_add (GTK_CONTAINER (vbox), scrolled_win); gtk_container_add (GTK_CONTAINER (vbox), scrolled_win);
gtk_widget_show (scrolled_win); gtk_widget_show (scrolled_win);
list = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, list = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_INT); G_TYPE_INT);
menu->tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list)); menu->tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list));
g_object_unref (list); g_object_unref (list);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (menu->tv), gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (menu->tv),
-1, _("Unit"), -1, _("Unit"),
gtk_cell_renderer_text_new (), gtk_cell_renderer_text_new (),
"text", UNIT_COLUMN, NULL); "text", UNIT_COLUMN, NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (menu->tv), gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (menu->tv),
-1, _("Factor"), -1, _("Factor"),
gtk_cell_renderer_text_new (), gtk_cell_renderer_text_new (),
"text", FACTOR_COLUMN, NULL); "text", FACTOR_COLUMN, NULL);
/* the unit lines */ /* the unit lines */
num_units = gimp_unit_get_number_of_units (); num_units = gimp_unit_get_number_of_units ();
@ -636,13 +636,13 @@ gimp_unit_menu_create_selection (GimpUnitMenu *menu)
{ {
gtk_list_store_append (list, &iter); gtk_list_store_append (list, &iter);
gtk_list_store_set (list, &iter, gtk_list_store_set (list, &iter,
UNIT_COLUMN, UNIT_COLUMN,
gimp_unit_menu_build_string (menu->format, unit), gimp_unit_menu_build_string (menu->format, unit),
-1); -1);
gtk_list_store_set (list, &iter, gtk_list_store_set (list, &iter,
FACTOR_COLUMN, FACTOR_COLUMN,
gimp_unit_menu_build_string ("(%f)", unit), gimp_unit_menu_build_string ("(%f)", unit),
-1); -1);
gtk_list_store_set (list, &iter, DATA_COLUMN, unit, -1); gtk_list_store_set (list, &iter, DATA_COLUMN, unit, -1);
} }
@ -672,13 +672,13 @@ gimp_unit_menu_create_selection (GimpUnitMenu *menu)
gtk_tree_selection_select_path (sel, path); gtk_tree_selection_select_path (sel, path);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (menu->tv), path, NULL, gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (menu->tv), path, NULL,
FALSE, 0.0, 0.0); FALSE, 0.0, 0.0);
} }
} }
static void static void
gimp_unit_menu_callback (GtkWidget *widget, gimp_unit_menu_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpUnitMenu *menu = data; GimpUnitMenu *menu = data;
GimpUnit new_unit; GimpUnit new_unit;
@ -693,17 +693,17 @@ gimp_unit_menu_callback (GtkWidget *widget,
if (new_unit == (GIMP_UNIT_PERCENT + 1)) if (new_unit == (GIMP_UNIT_PERCENT + 1))
{ {
gtk_option_menu_set_history (GTK_OPTION_MENU (menu), gtk_option_menu_set_history (GTK_OPTION_MENU (menu),
(menu->unit == GIMP_UNIT_PIXEL) ? 0 : (menu->unit == GIMP_UNIT_PIXEL) ? 0 :
((menu->unit == GIMP_UNIT_PERCENT) ? ((menu->unit == GIMP_UNIT_PERCENT) ?
(menu->show_pixels ? 1 : 0) : (menu->show_pixels ? 1 : 0) :
((menu->show_pixels || ((menu->show_pixels ||
menu->show_percent ? 2 : 0) + menu->show_percent ? 2 : 0) +
(menu->show_pixels && (menu->show_pixels &&
menu->show_percent ? 1 : 0) + menu->show_percent ? 1 : 0) +
((menu->unit < GIMP_UNIT_END) ? ((menu->unit < GIMP_UNIT_END) ?
menu->unit - 1 : GIMP_UNIT_END)))); menu->unit - 1 : GIMP_UNIT_END))));
if (! menu->selection) if (! menu->selection)
gimp_unit_menu_create_selection (menu); gimp_unit_menu_create_selection (menu);
return; return;
} }
else if (menu->selection) else if (menu->selection)

View File

@ -55,18 +55,18 @@
**/ **/
GtkWidget * GtkWidget *
gimp_radio_group_new (gboolean in_frame, gimp_radio_group_new (gboolean in_frame,
const gchar *frame_title, const gchar *frame_title,
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* const gchar *label, * const gchar *label,
* GCallback callback, * GCallback callback,
* gpointer callback_data, * gpointer callback_data,
* gpointer item_data, * gpointer item_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
* gboolean active, * gboolean active,
*/ */
...) ...)
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *button; GtkWidget *button;
@ -98,9 +98,9 @@ gimp_radio_group_new (gboolean in_frame,
active = va_arg (args, gboolean); active = va_arg (args, gboolean);
if (label != (gpointer) 1) if (label != (gpointer) 1)
button = gtk_radio_button_new_with_mnemonic (group, label); button = gtk_radio_button_new_with_mnemonic (group, label);
else else
button = gtk_radio_button_new (group); button = gtk_radio_button_new (group);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -114,14 +114,14 @@ gimp_radio_group_new (gboolean in_frame,
} }
if (widget_ptr) if (widget_ptr)
*widget_ptr = button; *widget_ptr = button;
if (active) if (active)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
callback, callback,
callback_data); callback_data);
gtk_widget_show (button); gtk_widget_show (button);
@ -164,18 +164,18 @@ gimp_radio_group_new (gboolean in_frame,
**/ **/
GtkWidget * GtkWidget *
gimp_radio_group_new2 (gboolean in_frame, gimp_radio_group_new2 (gboolean in_frame,
const gchar *frame_title, const gchar *frame_title,
GCallback radio_button_callback, GCallback radio_button_callback,
gpointer callback_data, gpointer callback_data,
gpointer initial, /* item_data */ gpointer initial, /* item_data */
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* const gchar *label, * const gchar *label,
* gpointer item_data, * gpointer item_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *button; GtkWidget *button;
@ -202,9 +202,9 @@ gimp_radio_group_new2 (gboolean in_frame,
widget_ptr = va_arg (args, GtkWidget **); widget_ptr = va_arg (args, GtkWidget **);
if (label != (gpointer) 1) if (label != (gpointer) 1)
button = gtk_radio_button_new_with_mnemonic (group, label); button = gtk_radio_button_new_with_mnemonic (group, label);
else else
button = gtk_radio_button_new (group); button = gtk_radio_button_new (group);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -218,14 +218,14 @@ gimp_radio_group_new2 (gboolean in_frame,
} }
if (widget_ptr) if (widget_ptr)
*widget_ptr = button; *widget_ptr = button;
if (initial == item_data) if (initial == item_data)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
radio_button_callback, radio_button_callback,
callback_data); callback_data);
gtk_widget_show (button); gtk_widget_show (button);
@ -271,18 +271,18 @@ gimp_radio_group_new2 (gboolean in_frame,
**/ **/
GtkWidget * GtkWidget *
gimp_int_radio_group_new (gboolean in_frame, gimp_int_radio_group_new (gboolean in_frame,
const gchar *frame_title, const gchar *frame_title,
GCallback radio_button_callback, GCallback radio_button_callback,
gpointer callback_data, gpointer callback_data,
gint initial, /* item_data */ gint initial, /* item_data */
/* specify radio buttons as va_list: /* specify radio buttons as va_list:
* const gchar *label, * const gchar *label,
* gint item_data, * gint item_data,
* GtkWidget **widget_ptr, * GtkWidget **widget_ptr,
*/ */
...) ...)
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *button; GtkWidget *button;
@ -312,9 +312,9 @@ gimp_int_radio_group_new (gboolean in_frame,
item_ptr = GINT_TO_POINTER (item_data); item_ptr = GINT_TO_POINTER (item_data);
if (label != GINT_TO_POINTER (1)) if (label != GINT_TO_POINTER (1))
button = gtk_radio_button_new_with_mnemonic (group, label); button = gtk_radio_button_new_with_mnemonic (group, label);
else else
button = gtk_radio_button_new (group); button = gtk_radio_button_new (group);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -328,14 +328,14 @@ gimp_int_radio_group_new (gboolean in_frame,
} }
if (widget_ptr) if (widget_ptr)
*widget_ptr = button; *widget_ptr = button;
if (initial == item_data) if (initial == item_data)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
radio_button_callback, radio_button_callback,
callback_data); callback_data);
gtk_widget_show (button); gtk_widget_show (button);
@ -428,22 +428,22 @@ gimp_int_radio_group_set_active (GtkRadioButton *radio_button,
**/ **/
GtkWidget * GtkWidget *
gimp_spin_button_new (GtkObject **adjustment, /* return value */ gimp_spin_button_new (GtkObject **adjustment, /* return value */
gdouble value, gdouble value,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gdouble step_increment, gdouble step_increment,
gdouble page_increment, gdouble page_increment,
gdouble page_size, gdouble page_size,
gdouble climb_rate, gdouble climb_rate,
guint digits) guint digits)
{ {
GtkWidget *spinbutton; GtkWidget *spinbutton;
*adjustment = gtk_adjustment_new (value, lower, upper, *adjustment = gtk_adjustment_new (value, lower, upper,
step_increment, page_increment, page_size); step_increment, page_increment, page_size);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment), spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment),
climb_rate, digits); climb_rate, digits);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
@ -452,17 +452,17 @@ gimp_spin_button_new (GtkObject **adjustment, /* return value */
static void static void
gimp_scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment, gimp_scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment,
GtkAdjustment *other_adj) GtkAdjustment *other_adj)
{ {
g_signal_handlers_block_by_func (other_adj, g_signal_handlers_block_by_func (other_adj,
gimp_scale_entry_unconstrained_adjustment_callback, gimp_scale_entry_unconstrained_adjustment_callback,
adjustment); adjustment);
gtk_adjustment_set_value (other_adj, adjustment->value); gtk_adjustment_set_value (other_adj, adjustment->value);
g_signal_handlers_unblock_by_func (other_adj, g_signal_handlers_unblock_by_func (other_adj,
gimp_scale_entry_unconstrained_adjustment_callback, gimp_scale_entry_unconstrained_adjustment_callback,
adjustment); adjustment);
} }
static void static void
@ -567,24 +567,24 @@ gimp_scale_entry_new_internal (gboolean color_scale,
GtkObject *constrained_adj; GtkObject *constrained_adj;
constrained_adj = gtk_adjustment_new (value, lower, upper, constrained_adj = gtk_adjustment_new (value, lower, upper,
step_increment, page_increment, step_increment, page_increment,
0.0); 0.0);
spinbutton = gimp_spin_button_new (&adjustment, value, spinbutton = gimp_spin_button_new (&adjustment, value,
unconstrained_lower, unconstrained_lower,
unconstrained_upper, unconstrained_upper,
step_increment, page_increment, 0.0, step_increment, page_increment, 0.0,
1.0, digits); 1.0, digits);
g_signal_connect g_signal_connect
(G_OBJECT (constrained_adj), "value-changed", (G_OBJECT (constrained_adj), "value-changed",
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback), G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
adjustment); adjustment);
g_signal_connect g_signal_connect
(G_OBJECT (adjustment), "value-changed", (G_OBJECT (adjustment), "value-changed",
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback), G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
constrained_adj); constrained_adj);
return_adj = adjustment; return_adj = adjustment;
@ -593,8 +593,8 @@ gimp_scale_entry_new_internal (gboolean color_scale,
else else
{ {
spinbutton = gimp_spin_button_new (&adjustment, value, lower, upper, spinbutton = gimp_spin_button_new (&adjustment, value, lower, upper,
step_increment, page_increment, 0.0, step_increment, page_increment, 0.0,
1.0, digits); 1.0, digits);
return_adj = adjustment; return_adj = adjustment;
} }
@ -627,13 +627,13 @@ gimp_scale_entry_new_internal (gboolean color_scale,
gtk_scale_set_digits (GTK_SCALE (scale), digits); gtk_scale_set_digits (GTK_SCALE (scale), digits);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE); gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_table_attach (GTK_TABLE (table), scale, gtk_table_attach (GTK_TABLE (table), scale,
column + 1, column + 2, row, row + 1, column + 1, column + 2, row, row + 1,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_widget_show (scale); gtk_widget_show (scale);
gtk_table_attach (GTK_TABLE (table), spinbutton, gtk_table_attach (GTK_TABLE (table), spinbutton,
column + 2, column + 3, row, row + 1, column + 2, column + 3, row, row + 1,
GTK_SHRINK, GTK_SHRINK, 0, 0); GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (spinbutton); gtk_widget_show (spinbutton);
if (tooltip || help_id) if (tooltip || help_id)
@ -685,22 +685,22 @@ gimp_scale_entry_new_internal (gboolean color_scale,
**/ **/
GtkObject * GtkObject *
gimp_scale_entry_new (GtkTable *table, gimp_scale_entry_new (GtkTable *table,
gint column, gint column,
gint row, gint row,
const gchar *text, const gchar *text,
gint scale_width, gint scale_width,
gint spinbutton_width, gint spinbutton_width,
gdouble value, gdouble value,
gdouble lower, gdouble lower,
gdouble upper, gdouble upper,
gdouble step_increment, gdouble step_increment,
gdouble page_increment, gdouble page_increment,
guint digits, guint digits,
gboolean constrain, gboolean constrain,
gdouble unconstrained_lower, gdouble unconstrained_lower,
gdouble unconstrained_upper, gdouble unconstrained_upper,
const gchar *tooltip, const gchar *tooltip,
const gchar *help_id) const gchar *help_id)
{ {
return gimp_scale_entry_new_internal (FALSE, return gimp_scale_entry_new_internal (FALSE,
table, column, row, table, column, row,
@ -944,7 +944,7 @@ gimp_scale_entry_set_sensitive (GtkObject *adjustment,
static void static void
gimp_random_seed_update (GtkWidget *widget, gimp_random_seed_update (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GtkWidget *spinbutton = data; GtkWidget *spinbutton = data;
@ -1063,7 +1063,7 @@ typedef struct
static void static void
gimp_coordinates_callback (GtkWidget *widget, gimp_coordinates_callback (GtkWidget *widget,
GimpCoordinatesData *gcd) GimpCoordinatesData *gcd)
{ {
gdouble new_x; gdouble new_x;
gdouble new_y; gdouble new_y;
@ -1074,54 +1074,54 @@ gimp_coordinates_callback (GtkWidget *widget,
if (gimp_chain_button_get_active (gcd->chainbutton)) if (gimp_chain_button_get_active (gcd->chainbutton))
{ {
if (gcd->chain_constrains_ratio) if (gcd->chain_constrains_ratio)
{ {
if ((gcd->orig_x != 0) && (gcd->orig_y != 0)) if ((gcd->orig_x != 0) && (gcd->orig_y != 0))
{ {
if (new_x != gcd->last_x) if (new_x != gcd->last_x)
{ {
gcd->last_x = new_x; gcd->last_x = new_x;
new_y = (new_x * gcd->orig_y) / gcd->orig_x; new_y = (new_x * gcd->orig_y) / gcd->orig_x;
g_signal_stop_emission_by_name (widget, "value-changed"); g_signal_stop_emission_by_name (widget, "value-changed");
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1,
new_y); new_y);
gcd->last_y gcd->last_y
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1); = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
} }
else if (new_y != gcd->last_y) else if (new_y != gcd->last_y)
{ {
gcd->last_y = new_y; gcd->last_y = new_y;
new_x = (new_y * gcd->orig_x) / gcd->orig_y; new_x = (new_y * gcd->orig_x) / gcd->orig_y;
g_signal_stop_emission_by_name (widget, "value-changed"); g_signal_stop_emission_by_name (widget, "value-changed");
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0,
new_x); new_x);
gcd->last_x gcd->last_x
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0); = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
} }
} }
} }
else else
{ {
if (new_x != gcd->last_x) if (new_x != gcd->last_x)
{ {
new_y = new_x; new_y = new_x;
g_signal_stop_emission_by_name (widget, "value-changed"); g_signal_stop_emission_by_name (widget, "value-changed");
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, new_x); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, new_x);
gcd->last_y = gcd->last_x gcd->last_y = gcd->last_x
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1); = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
} }
else if (new_y != gcd->last_y) else if (new_y != gcd->last_y)
{ {
new_x = new_y; new_x = new_y;
g_signal_stop_emission_by_name (widget, "value-changed"); g_signal_stop_emission_by_name (widget, "value-changed");
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, new_y); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, new_y);
gcd->last_x = gcd->last_y gcd->last_x = gcd->last_y
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0); = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
} }
} }
} }
else else
{ {
@ -1172,30 +1172,30 @@ gimp_coordinates_callback (GtkWidget *widget,
**/ **/
GtkWidget * GtkWidget *
gimp_coordinates_new (GimpUnit unit, gimp_coordinates_new (GimpUnit unit,
const gchar *unit_format, const gchar *unit_format,
gboolean menu_show_pixels, gboolean menu_show_pixels,
gboolean menu_show_percent, gboolean menu_show_percent,
gint spinbutton_width, gint spinbutton_width,
GimpSizeEntryUpdatePolicy update_policy, GimpSizeEntryUpdatePolicy update_policy,
gboolean chainbutton_active, gboolean chainbutton_active,
gboolean chain_constrains_ratio, gboolean chain_constrains_ratio,
const gchar *xlabel, const gchar *xlabel,
gdouble x, gdouble x,
gdouble xres, gdouble xres,
gdouble lower_boundary_x, gdouble lower_boundary_x,
gdouble upper_boundary_x, gdouble upper_boundary_x,
gdouble xsize_0, /* % */ gdouble xsize_0, /* % */
gdouble xsize_100, /* % */ gdouble xsize_100, /* % */
const gchar *ylabel, const gchar *ylabel,
gdouble y, gdouble y,
gdouble yres, gdouble yres,
gdouble lower_boundary_y, gdouble lower_boundary_y,
gdouble upper_boundary_y, gdouble upper_boundary_y,
gdouble ysize_0, /* % */ gdouble ysize_0, /* % */
gdouble ysize_100 /* % */) gdouble ysize_100 /* % */)
{ {
GimpCoordinatesData *gcd; GimpCoordinatesData *gcd;
GtkObject *adjustment; GtkObject *adjustment;
@ -1214,11 +1214,11 @@ gimp_coordinates_new (GimpUnit unit,
} }
sizeentry = gimp_size_entry_new (1, unit, unit_format, sizeentry = gimp_size_entry_new (1, unit, unit_format,
menu_show_pixels, menu_show_pixels,
menu_show_percent, menu_show_percent,
FALSE, FALSE,
spinbutton_width, spinbutton_width,
update_policy); update_policy);
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 0, 4); gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 0, 4);
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 2, 4); gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 2, 4);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry), gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
@ -1227,23 +1227,23 @@ gimp_coordinates_new (GimpUnit unit,
gtk_widget_show (spinbutton); gtk_widget_show (spinbutton);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
(update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) || (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) ||
(menu_show_pixels == FALSE) ? (menu_show_pixels == FALSE) ?
GIMP_UNIT_INCH : GIMP_UNIT_PIXEL); GIMP_UNIT_INCH : GIMP_UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, xres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1, yres, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1, yres, TRUE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
lower_boundary_x, upper_boundary_x); lower_boundary_x, upper_boundary_x);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
lower_boundary_y, upper_boundary_y); lower_boundary_y, upper_boundary_y);
if (menu_show_percent) if (menu_show_percent)
{ {
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 0, gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 0,
xsize_0, xsize_100); xsize_0, xsize_100);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 1, gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 1,
ysize_0, ysize_100); ysize_0, ysize_100);
} }
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, x); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, x);
@ -1258,7 +1258,7 @@ gimp_coordinates_new (GimpUnit unit,
if (chainbutton_active) if (chainbutton_active)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE); gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE);
gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2, gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2,
GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (chainbutton); gtk_widget_show (chainbutton);
gcd = g_new (GimpCoordinatesData, 1); gcd = g_new (GimpCoordinatesData, 1);
@ -1270,12 +1270,12 @@ gimp_coordinates_new (GimpUnit unit,
gcd->last_y = y; gcd->last_y = y;
g_signal_connect_swapped (sizeentry, "destroy", g_signal_connect_swapped (sizeentry, "destroy",
G_CALLBACK (g_free), G_CALLBACK (g_free),
gcd); gcd);
g_signal_connect (sizeentry, "value-changed", g_signal_connect (sizeentry, "value-changed",
G_CALLBACK (gimp_coordinates_callback), G_CALLBACK (gimp_coordinates_callback),
gcd); gcd);
g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton); g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton);
@ -1295,7 +1295,7 @@ gimp_coordinates_new (GimpUnit unit,
**/ **/
GtkWidget * GtkWidget *
gimp_pixmap_button_new (gchar **xpm_data, gimp_pixmap_button_new (gchar **xpm_data,
const gchar *text) const gchar *text)
{ {
GtkWidget *button; GtkWidget *button;
GtkWidget *pixmap; GtkWidget *pixmap;
@ -1393,7 +1393,7 @@ gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
**/ **/
void void
gimp_toggle_button_update (GtkWidget *widget, gimp_toggle_button_update (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gint *toggle_val; gint *toggle_val;
@ -1417,7 +1417,7 @@ gimp_toggle_button_update (GtkWidget *widget,
**/ **/
void void
gimp_radio_button_update (GtkWidget *widget, gimp_radio_button_update (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gint *toggle_val; gint *toggle_val;
@ -1426,7 +1426,7 @@ gimp_radio_button_update (GtkWidget *widget,
toggle_val = (gint *) data; toggle_val = (gint *) data;
*toggle_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), *toggle_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
"gimp-item-data")); "gimp-item-data"));
} }
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget)); gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
@ -1443,7 +1443,7 @@ gimp_radio_button_update (GtkWidget *widget,
**/ **/
void void
gimp_int_adjustment_update (GtkAdjustment *adjustment, gimp_int_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
{ {
gint *val; gint *val;
@ -1462,7 +1462,7 @@ gimp_int_adjustment_update (GtkAdjustment *adjustment,
**/ **/
void void
gimp_uint_adjustment_update (GtkAdjustment *adjustment, gimp_uint_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
{ {
guint *val; guint *val;
@ -1478,7 +1478,7 @@ gimp_uint_adjustment_update (GtkAdjustment *adjustment,
**/ **/
void void
gimp_float_adjustment_update (GtkAdjustment *adjustment, gimp_float_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
{ {
gfloat *val; gfloat *val;
@ -1494,7 +1494,7 @@ gimp_float_adjustment_update (GtkAdjustment *adjustment,
**/ **/
void void
gimp_double_adjustment_update (GtkAdjustment *adjustment, gimp_double_adjustment_update (GtkAdjustment *adjustment,
gpointer data) gpointer data)
{ {
gdouble *val; gdouble *val;
@ -1518,7 +1518,7 @@ gimp_double_adjustment_update (GtkAdjustment *adjustment,
**/ **/
void void
gimp_unit_menu_update (GtkWidget *widget, gimp_unit_menu_update (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GimpUnit *val; GimpUnit *val;
GtkWidget *spinbutton; GtkWidget *spinbutton;
@ -1528,8 +1528,8 @@ gimp_unit_menu_update (GtkWidget *widget,
*val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget)); *val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
digits = ((*val == GIMP_UNIT_PIXEL) ? 0 : digits = ((*val == GIMP_UNIT_PIXEL) ? 0 :
((*val == GIMP_UNIT_PERCENT) ? 2 : ((*val == GIMP_UNIT_PERCENT) ? 2 :
(MIN (6, MAX (3, gimp_unit_get_digits (*val)))))); (MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget)); digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
@ -1600,14 +1600,14 @@ find_mnemonic_widget (GtkWidget *widget,
**/ **/
GtkWidget * GtkWidget *
gimp_table_attach_aligned (GtkTable *table, gimp_table_attach_aligned (GtkTable *table,
gint column, gint column,
gint row, gint row,
const gchar *label_text, const gchar *label_text,
gfloat xalign, gfloat xalign,
gfloat yalign, gfloat yalign,
GtkWidget *widget, GtkWidget *widget,
gint colspan, gint colspan,
gboolean left_align) gboolean left_align)
{ {
GtkWidget *label = NULL; GtkWidget *label = NULL;
@ -1619,9 +1619,9 @@ gimp_table_attach_aligned (GtkTable *table,
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign); gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_table_attach (table, label, gtk_table_attach (table, label,
column, column + 1, column, column + 1,
row, row + 1, row, row + 1,
GTK_FILL, GTK_FILL, 0, 0); GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label); gtk_widget_show (label);
mnemonic_widget = find_mnemonic_widget (widget, 0); mnemonic_widget = find_mnemonic_widget (widget, 0);
@ -1641,9 +1641,9 @@ gimp_table_attach_aligned (GtkTable *table,
} }
gtk_table_attach (table, widget, gtk_table_attach (table, widget,
column + 1, column + 1 + colspan, column + 1, column + 1 + colspan,
row, row + 1, row, row + 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (widget); gtk_widget_show (widget);

Some files were not shown because too many files have changed in this diff Show More