Code review & cleanup:

2004-07-14  Michael Natterer  <mitch@gimp.org>

	Code review & cleanup:

	* app/config/gimpguiconfig.[ch]: removed transparency-size,
	transparency-type and snap-distance properties...

	* app/config/gimpdisplayconfig.[ch]: ...and added them here.

	* app/display/gimpdisplayshell.c
	* app/tools/gimpmovetool.c: changed accordingly.

	* app/core/gimpimage-scale.[ch] (gimp_layer_scale_check): added a
	"max_memsize" parameter instead of looking it up in GimpGuiConfig.

	* app/actions/image-commands.c: changed accordingly.

	* app/core/gimparea.c
	* app/core/gimpdrawable.c: converted tabs to spaces, cleanup.

	* app/core/gimpprojection.[ch]: renamed IdleRenderStruct to
	GimpProjectionIdleRender, reordered functions, cleanup.

	* app/display/gimpdisplay-handlers.c
	* app/display/gimpdisplay.c: removed unused #includes.

	* app/display/gimpdisplayshell.[ch]
	* app/display/gimpdisplayshell-close.c: renamed
	shell->warning_dialog to shell->close_dialog, some random
	cleanups.

	* app/display/gimpdisplayshell-handlers.c
	* app/widgets/gimpselectioneditor.c: minor coding style cleanup.
This commit is contained in:
Michael Natterer 2004-07-14 10:31:59 +00:00 committed by Michael Natterer
parent 53249872f6
commit fe9d9be66b
20 changed files with 357 additions and 332 deletions

View file

@ -1,3 +1,37 @@
2004-07-14 Michael Natterer <mitch@gimp.org>
Code review & cleanup:
* app/config/gimpguiconfig.[ch]: removed transparency-size,
transparency-type and snap-distance properties...
* app/config/gimpdisplayconfig.[ch]: ...and added them here.
* app/display/gimpdisplayshell.c
* app/tools/gimpmovetool.c: changed accordingly.
* app/core/gimpimage-scale.[ch] (gimp_layer_scale_check): added a
"max_memsize" parameter instead of looking it up in GimpGuiConfig.
* app/actions/image-commands.c: changed accordingly.
* app/core/gimparea.c
* app/core/gimpdrawable.c: converted tabs to spaces, cleanup.
* app/core/gimpprojection.[ch]: renamed IdleRenderStruct to
GimpProjectionIdleRender, reordered functions, cleanup.
* app/display/gimpdisplay-handlers.c
* app/display/gimpdisplay.c: removed unused #includes.
* app/display/gimpdisplayshell.[ch]
* app/display/gimpdisplayshell-close.c: renamed
shell->warning_dialog to shell->close_dialog, some random
cleanups.
* app/display/gimpdisplayshell-handlers.c
* app/widgets/gimpselectioneditor.c: minor coding style cleanup.
2004-07-13 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/core/gimpitem.c: added documentation comments to some

View file

@ -478,13 +478,18 @@ image_scale_callback (GtkWidget *widget,
{
ImageResizeOptions *options = data;
GimpImageScaleCheckType scale_check;
gint64 max_memsize;
gint64 new_memsize;
gtk_widget_set_sensitive (options->dialog->shell, FALSE);
max_memsize =
GIMP_GUI_CONFIG (options->gimage->gimp->config)->max_new_image_size;
scale_check = gimp_image_scale_check (options->gimage,
options->dialog->width,
options->dialog->height,
max_memsize,
&new_memsize);
switch (scale_check)
{
@ -495,8 +500,7 @@ image_scale_callback (GtkWidget *widget,
gchar *warning_message;
size_str = gimp_memsize_to_string (new_memsize);
max_size_str = gimp_memsize_to_string
(GIMP_GUI_CONFIG (options->gimage->gimp->config)->max_new_image_size);
max_size_str = gimp_memsize_to_string (max_memsize);
warning_message = g_strdup_printf
(_("You are trying to create an image with a size of %s.\n\n"

View file

@ -70,6 +70,9 @@ static void gimp_display_config_fullscreen_notify (GObject *object,
enum
{
PROP_0,
PROP_TRANSPARENCY_SIZE,
PROP_TRANSPARENCY_TYPE,
PROP_SNAP_DISTANCE,
PROP_MARCHING_ANTS_SPEED,
PROP_RESIZE_WINDOWS_ON_ZOOM,
PROP_RESIZE_WINDOWS_ON_RESIZE,
@ -141,6 +144,18 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
gimp_rgba_set (&white, 1.0, 1.0, 1.0, 1.0);
gimp_rgba_set (&black, 0.0, 0.0, 0.0, 1.0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_SIZE,
"transparency-size", TRANSPARENCY_SIZE_BLURB,
GIMP_TYPE_CHECK_SIZE, GIMP_MEDIUM_CHECKS,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_TYPE,
"transparency-type", TRANSPARENCY_TYPE_BLURB,
GIMP_TYPE_CHECK_TYPE, GIMP_GRAY_CHECKS,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_SNAP_DISTANCE,
"snap-distance", DEFAULT_SNAP_DISTANCE_BLURB,
1, 255, 8,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MARCHING_ANTS_SPEED,
"marching-ants-speed",
MARCHING_ANTS_SPEED_BLURB,
@ -287,6 +302,15 @@ gimp_display_config_set_property (GObject *object,
switch (property_id)
{
case PROP_TRANSPARENCY_SIZE:
display_config->transparency_size = g_value_get_enum (value);
break;
case PROP_TRANSPARENCY_TYPE:
display_config->transparency_type = g_value_get_enum (value);
break;
case PROP_SNAP_DISTANCE:
display_config->snap_distance = g_value_get_int (value);
break;
case PROP_MARCHING_ANTS_SPEED:
display_config->marching_ants_speed = g_value_get_int (value);
break;
@ -371,6 +395,15 @@ gimp_display_config_get_property (GObject *object,
switch (property_id)
{
case PROP_TRANSPARENCY_SIZE:
g_value_set_enum (value, display_config->transparency_size);
break;
case PROP_TRANSPARENCY_TYPE:
g_value_set_enum (value, display_config->transparency_type);
break;
case PROP_SNAP_DISTANCE:
g_value_set_int (value, display_config->snap_distance);
break;
case PROP_MARCHING_ANTS_SPEED:
g_value_set_int (value, display_config->marching_ants_speed);
break;

View file

@ -40,6 +40,9 @@ struct _GimpDisplayConfig
{
GimpCoreConfig parent_instance;
GimpCheckSize transparency_size;
GimpCheckType transparency_type;
gint snap_distance;
gint marching_ants_speed;
gboolean resize_windows_on_zoom;
gboolean resize_windows_on_resize;

View file

@ -62,9 +62,6 @@ static void gimp_gui_config_get_property (GObject *object,
enum
{
PROP_0,
PROP_TRANSPARENCY_SIZE,
PROP_TRANSPARENCY_TYPE,
PROP_SNAP_DISTANCE,
PROP_DEFAULT_THRESHOLD,
PROP_INFO_WINDOW_PER_DISPLAY,
PROP_TRUST_DIRTY_FLAG,
@ -137,18 +134,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
object_class->set_property = gimp_gui_config_set_property;
object_class->get_property = gimp_gui_config_get_property;
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_SIZE,
"transparency-size", TRANSPARENCY_SIZE_BLURB,
GIMP_TYPE_CHECK_SIZE, GIMP_MEDIUM_CHECKS,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_TYPE,
"transparency-type", TRANSPARENCY_TYPE_BLURB,
GIMP_TYPE_CHECK_TYPE, GIMP_GRAY_CHECKS,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_SNAP_DISTANCE,
"snap-distance", DEFAULT_SNAP_DISTANCE_BLURB,
1, 255, 8,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_DEFAULT_THRESHOLD,
"default-threshold", DEFAULT_THRESHOLD_BLURB,
0, 255, 15,
@ -294,15 +279,6 @@ gimp_gui_config_set_property (GObject *object,
switch (property_id)
{
case PROP_TRANSPARENCY_SIZE:
gui_config->transparency_size = g_value_get_enum (value);
break;
case PROP_TRANSPARENCY_TYPE:
gui_config->transparency_type = g_value_get_enum (value);
break;
case PROP_SNAP_DISTANCE:
gui_config->snap_distance = g_value_get_int (value);
break;
case PROP_DEFAULT_THRESHOLD:
gui_config->default_threshold = g_value_get_int (value);
break;
@ -402,15 +378,6 @@ gimp_gui_config_get_property (GObject *object,
switch (property_id)
{
case PROP_TRANSPARENCY_SIZE:
g_value_set_enum (value, gui_config->transparency_size);
break;
case PROP_TRANSPARENCY_TYPE:
g_value_set_enum (value, gui_config->transparency_type);
break;
case PROP_SNAP_DISTANCE:
g_value_set_int (value, gui_config->snap_distance);
break;
case PROP_DEFAULT_THRESHOLD:
g_value_set_int (value, gui_config->default_threshold);
break;

View file

@ -40,9 +40,6 @@ struct _GimpGuiConfig
{
GimpDisplayConfig parent_instance;
GimpCheckSize transparency_size;
GimpCheckType transparency_type;
gint snap_distance;
gint default_threshold;
gboolean info_window_per_display;
gboolean trust_dirty_flag;

View file

@ -54,22 +54,21 @@ GSList *
gimp_area_list_process (GSList *list,
GimpArea *area)
{
GSList *new_list;
GSList *l;
gint area1, area2, area3;
GimpArea *ga2;
GSList *new_list;
GSList *l;
gint area1, area2, area3;
/* start new list off */
new_list = g_slist_prepend (NULL, area);
for (l = list; l; l = g_slist_next (l))
{
ga2 = (GimpArea *) l->data;
GimpArea *ga2 = l->data;
area1 = (area->x2 - area->x1) * (area->y2 - area->y1) + OVERHEAD;
area2 = (ga2->x2 - ga2->x1) * (ga2->y2 - ga2->y1) + OVERHEAD;
area3 = (MAX (ga2->x2, area->x2) - MIN (ga2->x1, area->x1)) *
(MAX (ga2->y2, area->y2) - MIN (ga2->y1, area->y1)) + OVERHEAD;
area3 = ((MAX (ga2->x2, area->x2) - MIN (ga2->x1, area->x1)) *
(MAX (ga2->y2, area->y2) - MIN (ga2->y1, area->y1)) + OVERHEAD);
if ((area1 + area2) < area3)
{

View file

@ -166,14 +166,14 @@ gimp_drawable_get_type (void)
static const GTypeInfo drawable_info =
{
sizeof (GimpDrawableClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_drawable_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDrawable),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_drawable_init,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_drawable_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDrawable),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_drawable_init,
};
static const GInterfaceInfo pickable_iface_info =
@ -184,8 +184,8 @@ gimp_drawable_get_type (void)
};
drawable_type = g_type_register_static (GIMP_TYPE_ITEM,
"GimpDrawable",
&drawable_info, 0);
"GimpDrawable",
&drawable_info, 0);
g_type_add_interface_static (drawable_type, GIMP_TYPE_PICKABLE,
&pickable_iface_info);
@ -197,39 +197,34 @@ gimp_drawable_get_type (void)
static void
gimp_drawable_class_init (GimpDrawableClass *klass)
{
GObjectClass *object_class;
GimpObjectClass *gimp_object_class;
GimpViewableClass *viewable_class;
GimpItemClass *item_class;
object_class = G_OBJECT_CLASS (klass);
gimp_object_class = GIMP_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
item_class = GIMP_ITEM_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
gimp_drawable_signals[UPDATE] =
g_signal_new ("update",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDrawableClass, update),
NULL, NULL,
gimp_marshal_VOID__INT_INT_INT_INT,
G_TYPE_NONE, 4,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT);
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDrawableClass, update),
NULL, NULL,
gimp_marshal_VOID__INT_INT_INT_INT,
G_TYPE_NONE, 4,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT);
gimp_drawable_signals[ALPHA_CHANGED] =
g_signal_new ("alpha_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDrawableClass, alpha_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDrawableClass, alpha_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_drawable_finalize;
@ -297,10 +292,8 @@ static gint64
gimp_drawable_get_memsize (GimpObject *object,
gint64 *gui_size)
{
GimpDrawable *drawable;
gint64 memsize = 0;
drawable = GIMP_DRAWABLE (object);
GimpDrawable *drawable = GIMP_DRAWABLE (object);
gint64 memsize = 0;
if (drawable->tiles)
memsize += tile_manager_get_memsize (drawable->tiles);
@ -315,13 +308,11 @@ gimp_drawable_get_memsize (GimpObject *object,
static void
gimp_drawable_invalidate_preview (GimpViewable *viewable)
{
GimpDrawable *drawable;
GimpDrawable *drawable = GIMP_DRAWABLE (viewable);
if (GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview)
GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview (viewable);
drawable = GIMP_DRAWABLE (viewable);
drawable->preview_valid = FALSE;
if (drawable->preview_cache)
@ -420,7 +411,7 @@ gimp_drawable_scale (GimpItem *item,
new_tiles = tile_manager_new (new_width, new_height, drawable->bytes);
pixel_region_init (&srcPR, drawable->tiles,
0, 0, item->width, item->height,
0, 0, item->width, item->height,
FALSE);
pixel_region_init (&destPR, new_tiles,
0, 0, new_width, new_height,
@ -615,8 +606,8 @@ gimp_drawable_transform (GimpItem *item,
static guchar *
gimp_drawable_get_color_at (GimpPickable *pickable,
gint x,
gint y)
gint x,
gint y)
{
GimpDrawable *drawable = GIMP_DRAWABLE (pickable);
GimpImage *gimage;
@ -636,7 +627,7 @@ gimp_drawable_get_color_at (GimpPickable *pickable,
dest = g_new (guchar, 5);
tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y,
TRUE, FALSE);
TRUE, FALSE);
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimp_image_get_color (gimage, gimp_drawable_type (drawable), src, dest);
@ -761,46 +752,46 @@ gimp_drawable_real_swap_pixels (GimpDrawable *drawable,
gint i, j;
for (i = y; i < (y + height); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
{
for (j = x; j < (x + width); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
{
for (j = x; j < (x + width); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
Tile *src_tile;
Tile *dest_tile;
src_tile = tile_manager_get_tile (tiles, j, i, FALSE, FALSE);
src_tile = tile_manager_get_tile (tiles, j, i, FALSE, FALSE);
if (tile_is_valid (src_tile))
{
/* swap tiles, not pixels! */
if (tile_is_valid (src_tile))
{
/* swap tiles, not pixels! */
src_tile = tile_manager_get_tile (tiles,
src_tile = tile_manager_get_tile (tiles,
j, i, TRUE, FALSE /*TRUE*/);
dest_tile = tile_manager_get_tile (gimp_drawable_data (drawable), j, i, TRUE, FALSE /* TRUE */);
dest_tile = tile_manager_get_tile (gimp_drawable_data (drawable), j, i, TRUE, FALSE /* TRUE */);
tile_manager_map_tile (tiles,
tile_manager_map_tile (tiles,
j, i, dest_tile);
tile_manager_map_tile (gimp_drawable_data (drawable),
tile_manager_map_tile (gimp_drawable_data (drawable),
j, i, src_tile);
#if 0
swap_pixels (tile_data_pointer (src_tile, 0, 0),
tile_data_pointer (dest_tile, 0, 0),
tile_size (src_tile));
swap_pixels (tile_data_pointer (src_tile, 0, 0),
tile_data_pointer (dest_tile, 0, 0),
tile_size (src_tile));
#endif
tile_release (dest_tile, FALSE /* TRUE */);
tile_release (src_tile, FALSE /* TRUE */);
}
}
}
tile_release (dest_tile, FALSE /* TRUE */);
tile_release (src_tile, FALSE /* TRUE */);
}
}
}
}
else
{
PixelRegion PR1, PR2;
pixel_region_init (&PR1, tiles,
0, 0, width, height, TRUE);
0, 0, width, height, TRUE);
pixel_region_init (&PR2, gimp_drawable_data (drawable),
x, y, width, height, TRUE);
x, y, width, height, TRUE);
swap_region (&PR1, &PR2);
}
@ -813,13 +804,13 @@ gimp_drawable_real_swap_pixels (GimpDrawable *drawable,
void
gimp_drawable_configure (GimpDrawable *drawable,
GimpImage *gimage,
GimpImage *gimage,
gint offset_x,
gint offset_y,
gint width,
gint height,
GimpImageType type,
const gchar *name)
gint width,
gint height,
GimpImageType type,
const gchar *name)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (GIMP_IS_IMAGE (gimage));
@ -844,10 +835,10 @@ gimp_drawable_configure (GimpDrawable *drawable,
void
gimp_drawable_update (GimpDrawable *drawable,
gint x,
gint y,
gint width,
gint height)
gint x,
gint y,
gint width,
gint height)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
@ -1067,12 +1058,12 @@ gimp_drawable_shadow (GimpDrawable *drawable)
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
return gimp_image_shadow (gimage, item->width, item->height,
drawable->bytes);
drawable->bytes);
}
void
gimp_drawable_merge_shadow (GimpDrawable *drawable,
gboolean push_undo,
gboolean push_undo,
const gchar *undo_desc)
{
GimpImage *gimage;
@ -1101,7 +1092,7 @@ gimp_drawable_merge_shadow (GimpDrawable *drawable,
void
gimp_drawable_fill (GimpDrawable *drawable,
const GimpRGB *color,
const GimpRGB *color,
const GimpPattern *pattern)
{
GimpItem *item;
@ -1159,15 +1150,15 @@ gimp_drawable_fill (GimpDrawable *drawable,
}
gimp_drawable_update (drawable,
0, 0,
gimp_item_width (item),
gimp_item_height (item));
0, 0,
gimp_item_width (item),
gimp_item_height (item));
}
void
gimp_drawable_fill_by_type (GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type)
GimpContext *context,
GimpFillType fill_type)
{
GimpRGB color;
GimpPattern *pattern = NULL;
@ -1209,10 +1200,10 @@ gimp_drawable_fill_by_type (GimpDrawable *drawable,
gboolean
gimp_drawable_mask_bounds (GimpDrawable *drawable,
gint *x1,
gint *y1,
gint *x2,
gint *y2)
gint *x1,
gint *y1,
gint *x2,
gint *y2)
{
GimpItem *item;
GimpImage *gimage;

View file

@ -33,8 +33,6 @@
#include "gimplayer.h"
#include "gimplist.h"
#include "config/gimpguiconfig.h"
#include "gimp-intl.h"
@ -190,6 +188,7 @@ gimp_image_scale (GimpImage *gimage,
* @gimage: A #GimpImage.
* @new_width: The new width.
* @new_height: The new height.
* @max_memsize: The maximum new memory size.
* @new_memsize: The new memory size.
*
* Inventory the layer list in gimage and check that it may be
@ -197,8 +196,7 @@ gimp_image_scale (GimpImage *gimage,
*
* Return value: #GIMP_IMAGE_SCALE_OK if scaling the image will shrink none
* of its layers completely away, and the new image size
* is smaller than the maximum specified in the
* preferences.
* is smaller than @max_memsize.
* #GIMP_IMAGE_SCALE_TOO_SMALL if scaling would remove some
* existing layers.
* #GIMP_IMAGE_SCALE_TOO_BIG if the new image size would
@ -208,6 +206,7 @@ GimpImageScaleCheckType
gimp_image_scale_check (const GimpImage *gimage,
gint new_width,
gint new_height,
gint64 max_memsize,
gint64 *new_memsize)
{
GList *list;
@ -244,8 +243,7 @@ gimp_image_scale_check (const GimpImage *gimage,
*new_memsize = new_size;
if (new_size > current_size &&
new_size > GIMP_GUI_CONFIG (gimage->gimp->config)->max_new_image_size)
if (new_size > current_size && new_size > max_memsize)
return GIMP_IMAGE_SCALE_TOO_BIG;
for (list = GIMP_LIST (gimage->layers)->list;

View file

@ -31,6 +31,7 @@ GimpImageScaleCheckType
gimp_image_scale_check (const GimpImage *gimage,
gint new_width,
gint new_height,
gint64 max_memsize,
gint64 *new_memsize);

View file

@ -57,10 +57,15 @@ static guchar * gimp_projection_get_color_at (GimpPickable *pickabl
gint y);
static void gimp_projection_alloc_tiles (GimpProjection *proj);
static void gimp_projection_add_update_area (GimpProjection *proj,
gint x,
gint y,
gint w,
gint h);
static void gimp_projection_flush_whenever (GimpProjection *proj,
gboolean now);
static void gimp_projection_idlerender_init (GimpProjection *proj);
static gboolean gimp_projection_idlerender_callback (gpointer data);
static void gimp_projection_idle_render_init (GimpProjection *proj);
static gboolean gimp_projection_idle_render_callback (gpointer data);
static gboolean gimp_projection_idle_render_next_area (GimpProjection *proj);
static void gimp_projection_paint_area (GimpProjection *proj,
gboolean now,
@ -197,7 +202,10 @@ gimp_projection_finalize (GObject *object)
}
gimp_area_list_free (proj->update_areas);
proj->update_areas = NULL;
gimp_area_list_free (proj->idle_render.update_areas);
proj->idle_render.update_areas = NULL;
if (proj->tiles)
{
@ -275,25 +283,6 @@ gimp_projection_new (GimpImage *gimage)
return proj;
}
void
gimp_projection_add_update_area (GimpProjection *proj,
gint x,
gint y,
gint w,
gint h)
{
GimpArea *area;
g_return_if_fail (GIMP_IS_PROJECTION (proj));
area = gimp_area_new (CLAMP (x, 0, proj->gimage->width),
CLAMP (y, 0, proj->gimage->height),
CLAMP (x + w, 0, proj->gimage->width),
CLAMP (y + h, 0, proj->gimage->height));
proj->update_areas = gimp_area_list_process (proj->update_areas, area);
}
TileManager *
gimp_projection_get_tiles (GimpProjection *proj)
{
@ -351,6 +340,20 @@ gimp_projection_flush_now (GimpProjection *proj)
gimp_projection_flush_whenever (proj, TRUE);
}
void
gimp_projection_finish_draw (GimpProjection *proj)
{
g_return_if_fail (GIMP_IS_PROJECTION (proj));
if (proj->idle_render.idle_id)
{
g_source_remove (proj->idle_render.idle_id);
proj->idle_render.idle_id = 0;
while (gimp_projection_idle_render_callback (proj));
}
}
/* private functions */
@ -409,6 +412,25 @@ gimp_projection_alloc_tiles (GimpProjection *proj)
}
}
static void
gimp_projection_add_update_area (GimpProjection *proj,
gint x,
gint y,
gint w,
gint h)
{
GimpArea *area;
g_return_if_fail (GIMP_IS_PROJECTION (proj));
area = gimp_area_new (CLAMP (x, 0, proj->gimage->width),
CLAMP (y, 0, proj->gimage->height),
CLAMP (x + w, 0, proj->gimage->width),
CLAMP (y + h, 0, proj->gimage->height));
proj->update_areas = gimp_area_list_process (proj->update_areas, area);
}
static void
gimp_projection_flush_whenever (GimpProjection *proj,
gboolean now)
@ -437,7 +459,7 @@ gimp_projection_flush_whenever (GimpProjection *proj,
}
else /* Asynchronous */
{
gimp_projection_idlerender_init (proj);
gimp_projection_idle_render_init (proj);
}
/* Free the update lists */
@ -445,22 +467,8 @@ gimp_projection_flush_whenever (GimpProjection *proj,
}
}
void
gimp_projection_finish_draw (GimpProjection *proj)
{
g_return_if_fail (GIMP_IS_PROJECTION (proj));
if (proj->idle_render.idle_id)
{
g_source_remove (proj->idle_render.idle_id);
proj->idle_render.idle_id = 0;
while (gimp_projection_idlerender_callback (proj));
}
}
static void
gimp_projection_idlerender_init (GimpProjection *proj)
gimp_projection_idle_render_init (GimpProjection *proj)
{
GSList *list;
GimpArea *area;
@ -484,12 +492,12 @@ gimp_projection_idlerender_init (GimpProjection *proj)
if (proj->idle_render.idle_id)
{
area =
gimp_area_new (proj->idle_render.basex,
gimp_area_new (proj->idle_render.base_x,
proj->idle_render.y,
proj->idle_render.basex + proj->idle_render.width,
proj->idle_render.base_x + proj->idle_render.width,
proj->idle_render.y + (proj->idle_render.height -
(proj->idle_render.y -
proj->idle_render.basey)));
proj->idle_render.base_y)));
proj->idle_render.update_areas =
gimp_area_list_process (proj->idle_render.update_areas, area);
@ -500,19 +508,18 @@ gimp_projection_idlerender_init (GimpProjection *proj)
{
if (proj->idle_render.update_areas == NULL)
{
g_warning ("Wanted to start idlerender thread with no update_areas. (+memleak)");
g_warning ("%s: wanted to start idle render with no update_areas",
G_STRFUNC);
return;
}
gimp_projection_idle_render_next_area (proj);
proj->idle_render.idle_id = g_idle_add_full (G_PRIORITY_LOW,
gimp_projection_idlerender_callback,
proj,
NULL);
proj->idle_render.idle_id =
g_idle_add_full (G_PRIORITY_LOW,
gimp_projection_idle_render_callback,
proj, NULL);
}
/* Caller frees proj->update_areas */
}
/* Unless specified otherwise, projection re-rendering is organised by
@ -522,41 +529,43 @@ gimp_projection_idlerender_init (GimpProjection *proj)
* operations. -- Adam
*/
static gboolean
gimp_projection_idlerender_callback (gpointer data)
gimp_projection_idle_render_callback (gpointer data)
{
const gint CHUNK_WIDTH = 256;
const gint CHUNK_HEIGHT = 128;
gint workx, worky, workw, workh;
GimpProjection *proj = data;
gint workx, worky;
gint workw, workh;
#define CHUNK_WIDTH 256
#define CHUNK_HEIGHT 128
workw = CHUNK_WIDTH;
workh = CHUNK_HEIGHT;
workx = proj->idle_render.x;
worky = proj->idle_render.y;
if (workx + workw > proj->idle_render.basex + proj->idle_render.width)
if (workx + workw > proj->idle_render.base_x + proj->idle_render.width)
{
workw = proj->idle_render.basex + proj->idle_render.width - workx;
workw = proj->idle_render.base_x + proj->idle_render.width - workx;
}
if (worky + workh > proj->idle_render.basey + proj->idle_render.height)
if (worky + workh > proj->idle_render.base_y + proj->idle_render.height)
{
workh = proj->idle_render.basey + proj->idle_render.height - worky;
workh = proj->idle_render.base_y + proj->idle_render.height - worky;
}
gimp_projection_paint_area (proj, TRUE, /* sic! */
gimp_projection_paint_area (proj, TRUE /* sic! */,
workx, worky, workw, workh);
proj->idle_render.x += CHUNK_WIDTH;
if (proj->idle_render.x >=
proj->idle_render.basex + proj->idle_render.width)
proj->idle_render.base_x + proj->idle_render.width)
{
proj->idle_render.x = proj->idle_render.basex;
proj->idle_render.x = proj->idle_render.base_x;
proj->idle_render.y += CHUNK_HEIGHT;
if (proj->idle_render.y >=
proj->idle_render.basey + proj->idle_render.height)
proj->idle_render.base_y + proj->idle_render.height)
{
if (! gimp_projection_idle_render_next_area (proj))
{
@ -585,8 +594,8 @@ gimp_projection_idle_render_next_area (GimpProjection *proj)
proj->idle_render.update_areas =
g_slist_remove (proj->idle_render.update_areas, area);
proj->idle_render.x = proj->idle_render.basex = area->x1;
proj->idle_render.y = proj->idle_render.basey = area->y1;
proj->idle_render.x = proj->idle_render.base_x = area->x1;
proj->idle_render.y = proj->idle_render.base_y = area->y1;
proj->idle_render.width = area->x2 - area->x1;
proj->idle_render.height = area->y2 - area->y1;

View file

@ -23,16 +23,16 @@
#include "gimpobject.h"
typedef struct _IdleRenderStruct IdleRenderStruct;
typedef struct _GimpProjectionIdleRender GimpProjectionIdleRender;
struct _IdleRenderStruct
struct _GimpProjectionIdleRender
{
gint width;
gint height;
gint x;
gint y;
gint basex;
gint basey;
gint base_x;
gint base_y;
guint idle_id;
GSList *update_areas; /* flushed update areas */
};
@ -50,18 +50,18 @@ typedef struct _GimpProjectionClass GimpProjectionClass;
struct _GimpProjection
{
GimpObject parent_instance;
GimpObject parent_instance;
GimpImage *gimage;
GimpImage *gimage;
GimpImageType type;
gint bytes;
TileManager *tiles;
GimpImageType type;
gint bytes;
TileManager *tiles;
GSList *update_areas;
IdleRenderStruct idle_render;
GSList *update_areas;
GimpProjectionIdleRender idle_render;
gboolean construct_flag;
gboolean construct_flag;
};
struct _GimpProjectionClass
@ -88,6 +88,7 @@ gdouble gimp_projection_get_opacity (const GimpProjection *proj);
void gimp_projection_flush (GimpProjection *proj);
void gimp_projection_flush_now (GimpProjection *proj);
void gimp_projection_finish_draw (GimpProjection *proj);
#endif /* __GIMP_PROJECTION_H__ */

View file

@ -26,7 +26,6 @@
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpprojection.h"
#include "gimpdisplay.h"
#include "gimpdisplay-handlers.h"

View file

@ -25,10 +25,8 @@
#include "core/gimp.h"
#include "core/gimparea.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "core/gimpprojection.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"

View file

@ -100,9 +100,9 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
gchar *title;
gchar *message;
if (shell->warning_dialog)
if (shell->close_dialog)
{
gtk_window_present (GTK_WINDOW (shell->warning_dialog));
gtk_window_present (GTK_WINDOW (shell->close_dialog));
return;
}
@ -110,7 +110,7 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
title = g_strdup_printf (_("Close %s?"), name);
shell->warning_dialog =
shell->close_dialog =
dialog = gimp_dialog_new (title,
"gimp-display-shell-close",
GTK_WIDGET (shell), 0,
@ -126,7 +126,7 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&shell->warning_dialog);
&shell->close_dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (gimp_display_shell_close_response),
@ -174,7 +174,7 @@ gimp_display_shell_close_response (GtkWidget *widget,
gint response_id,
GimpDisplayShell *shell)
{
gtk_widget_destroy (GTK_WIDGET (shell->warning_dialog));
gtk_widget_destroy (widget);
if (response_id == GTK_RESPONSE_OK)
gimp_display_delete (shell->gdisp);

View file

@ -157,8 +157,8 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
G_CALLBACK (gimp_display_shell_update_guide_handler),
shell);
g_signal_connect (gimage, "invalidate_preview",
G_CALLBACK (gimp_display_shell_invalidate_preview_handler),
shell);
G_CALLBACK (gimp_display_shell_invalidate_preview_handler),
shell);
shell->vectors_freeze_handler =
gimp_container_add_handler (gimage->vectors, "freeze",
@ -390,8 +390,8 @@ gimp_display_shell_size_changed_handler (GimpImage *gimage,
GimpDisplayShell *shell)
{
gimp_display_shell_scale_resize (shell,
GIMP_DISPLAY_CONFIG (gimage->gimp->config)->resize_windows_on_resize,
TRUE);
GIMP_DISPLAY_CONFIG (gimage->gimp->config)->resize_windows_on_resize,
TRUE);
}
static void
@ -622,9 +622,7 @@ gimp_display_shell_ants_speed_notify_handler (GObject *config,
static gboolean
gimp_display_shell_idle_update_icon (gpointer data)
{
GimpDisplayShell *shell;
shell = GIMP_DISPLAY_SHELL (data);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
shell->icon_idle_id = 0;

View file

@ -20,7 +20,6 @@
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "display-types.h"
@ -35,7 +34,6 @@
#include "config/gimpconfig-params.h"
#include "config/gimpconfig-utils.h"
#include "config/gimpdisplayconfig.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpbuffer.h"
@ -50,8 +48,6 @@
#include "core/gimpmarshal.h"
#include "core/gimppattern.h"
#include "file/file-utils.h"
#include "vectors/gimpvectors.h"
#include "vectors/gimpstroke.h"
@ -145,8 +141,8 @@ gimp_display_shell_get_type (void)
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_display_shell_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDisplayShell),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_display_shell_init,
@ -163,13 +159,9 @@ gimp_display_shell_get_type (void)
static void
gimp_display_shell_class_init (GimpDisplayShellClass *klass)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
gobject_class = G_OBJECT_CLASS (klass);
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -200,11 +192,11 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gobject_class->finalize = gimp_display_shell_finalize;
gobject_class->set_property = gimp_display_shell_set_property;
gobject_class->get_property = gimp_display_shell_get_property;
object_class->finalize = gimp_display_shell_finalize;
object_class->set_property = gimp_display_shell_set_property;
object_class->get_property = gimp_display_shell_get_property;
object_class->destroy = gimp_display_shell_destroy;
gtk_object_class->destroy = gimp_display_shell_destroy;
widget_class->screen_changed = gimp_display_shell_screen_changed;
widget_class->delete_event = gimp_display_shell_delete_event;
@ -214,11 +206,12 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
klass->scrolled = NULL;
klass->reconnect = NULL;
g_object_class_install_property (gobject_class, PROP_SCALE,
g_object_class_install_property (object_class, PROP_SCALE,
g_param_spec_double ("scale", NULL, NULL,
1.0 / 256, 256, 1.0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_UNIT,
g_object_class_install_property (object_class, PROP_UNIT,
gimp_param_spec_unit ("unit", NULL, NULL,
TRUE, FALSE,
GIMP_UNIT_PIXEL,
@ -294,7 +287,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->cursor_x = 0;
shell->cursor_y = 0;
shell->warning_dialog = NULL;
shell->close_dialog = NULL;
shell->info_dialog = NULL;
shell->scale_dialog = NULL;
shell->nav_popup = NULL;
@ -567,7 +560,6 @@ gimp_display_shell_new (GimpDisplay *gdisp,
{
GimpDisplayShell *shell;
GimpDisplayConfig *display_config;
GimpGuiConfig *gui_config;
GtkWidget *main_vbox;
GtkWidget *disp_vbox;
GtkWidget *upper_hbox;
@ -597,7 +589,6 @@ gimp_display_shell_new (GimpDisplay *gdisp,
image_height = gdisp->gimage->height;
display_config = GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config);
gui_config = GIMP_GUI_CONFIG (display_config);
shell->dot_for_dot = display_config->default_dot_for_dot;
@ -656,13 +647,13 @@ gimp_display_shell_new (GimpDisplay *gdisp,
else
{
/* Set up size like above, but do not zoom to fit.
Useful when working on large images. */
Useful when working on large images. */
if (n_width > s_width)
n_width = s_width;
n_width = s_width;
if (n_height > s_height)
n_height = s_height;
n_height = s_height;
}
shell->menubar_manager = gimp_menu_factory_manager_new (menu_factory,
@ -812,28 +803,28 @@ gimp_display_shell_new (GimpDisplay *gdisp,
/* the horizontal ruler */
shell->hrule = gtk_hruler_new ();
gtk_widget_set_events (GTK_WIDGET (shell->hrule),
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
g_signal_connect_swapped (shell->canvas, "motion_notify_event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->hrule)->motion_notify_event),
shell->hrule);
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->hrule)->motion_notify_event),
shell->hrule);
g_signal_connect (shell->hrule, "button_press_event",
G_CALLBACK (gimp_display_shell_hruler_button_press),
shell);
G_CALLBACK (gimp_display_shell_hruler_button_press),
shell);
gimp_help_set_help_data (shell->hrule, NULL, GIMP_HELP_IMAGE_WINDOW_RULER);
/* the vertical ruler */
shell->vrule = gtk_vruler_new ();
gtk_widget_set_events (GTK_WIDGET (shell->vrule),
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
g_signal_connect_swapped (shell->canvas, "motion_notify_event",
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->vrule)->motion_notify_event),
shell->vrule);
G_CALLBACK (GTK_WIDGET_GET_CLASS (shell->vrule)->motion_notify_event),
shell->vrule);
g_signal_connect (shell->vrule, "button_press_event",
G_CALLBACK (gimp_display_shell_vruler_button_press),
shell);
G_CALLBACK (gimp_display_shell_vruler_button_press),
shell);
gimp_help_set_help_data (shell->vrule, NULL, GIMP_HELP_IMAGE_WINDOW_RULER);
@ -849,18 +840,18 @@ gimp_display_shell_new (GimpDisplay *gdisp,
/* set the active display before doing any other canvas event processing */
g_signal_connect (shell->canvas, "event",
G_CALLBACK (gimp_display_shell_events),
shell);
G_CALLBACK (gimp_display_shell_events),
shell);
g_signal_connect (shell->canvas, "expose_event",
G_CALLBACK (gimp_display_shell_canvas_expose),
shell);
G_CALLBACK (gimp_display_shell_canvas_expose),
shell);
g_signal_connect (shell->canvas, "configure_event",
G_CALLBACK (gimp_display_shell_canvas_configure),
shell);
G_CALLBACK (gimp_display_shell_canvas_configure),
shell);
g_signal_connect (shell->canvas, "event",
G_CALLBACK (gimp_display_shell_canvas_tool_events),
shell);
G_CALLBACK (gimp_display_shell_canvas_tool_events),
shell);
/* create the contents of the right_vbox *********************************/
shell->zoom_button = gtk_check_button_new ();
@ -898,11 +889,11 @@ gimp_display_shell_new (GimpDisplay *gdisp,
GIMP_HELP_IMAGE_WINDOW_QMASK_BUTTON);
g_signal_connect (shell->qmask_button, "toggled",
G_CALLBACK (gimp_display_shell_qmask_toggled),
shell);
G_CALLBACK (gimp_display_shell_qmask_toggled),
shell);
g_signal_connect (shell->qmask_button, "button_press_event",
G_CALLBACK (gimp_display_shell_qmask_button_press),
shell);
G_CALLBACK (gimp_display_shell_qmask_button_press),
shell);
/* the navigation window button */
shell->nav_ebox = gtk_event_box_new ();
@ -912,8 +903,8 @@ gimp_display_shell_new (GimpDisplay *gdisp,
gtk_widget_show (image);
g_signal_connect (shell->nav_ebox, "button_press_event",
G_CALLBACK (gimp_display_shell_nav_button_press),
shell);
G_CALLBACK (gimp_display_shell_nav_button_press),
shell);
gimp_help_set_help_data (shell->nav_ebox, NULL,
GIMP_HELP_IMAGE_WINDOW_NAV_BUTTON);
@ -931,12 +922,12 @@ gimp_display_shell_new (GimpDisplay *gdisp,
gtk_table_attach (GTK_TABLE (inner_table), shell->origin_button, 0, 1, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (inner_table), shell->hrule, 1, 2, 0, 1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (inner_table), shell->vrule, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (inner_table), shell->canvas, 1, 2, 1, 2,
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
/* fill the right_vbox */
gtk_box_pack_start (GTK_BOX (right_vbox), shell->zoom_button, FALSE, FALSE, 0);
@ -1065,7 +1056,7 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell,
gint snap_distance;
snap_distance =
GIMP_GUI_CONFIG (shell->gdisp->gimage->gimp->config)->snap_distance;
GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config)->snap_distance;
if (snap_width > 0 && snap_height > 0)
{
@ -1129,23 +1120,23 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage),
x1, y1, x2, y2))
{
*x1 = off_x;
*y1 = off_y;
*x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
*y2 = off_y + gimp_item_height (GIMP_ITEM (layer));
}
x1, y1, x2, y2))
{
*x1 = off_x;
*y1 = off_y;
*x2 = off_x + gimp_item_width (GIMP_ITEM (layer));
*y2 = off_y + gimp_item_height (GIMP_ITEM (layer));
}
else
{
*x1 = MIN (off_x, *x1);
*y1 = MIN (off_y, *y1);
*x2 = MAX (off_x + gimp_item_width (GIMP_ITEM (layer)), *x2);
*y2 = MAX (off_y + gimp_item_height (GIMP_ITEM (layer)), *y2);
}
{
*x1 = MIN (off_x, *x1);
*y1 = MIN (off_y, *y1);
*x2 = MAX (off_x + gimp_item_width (GIMP_ITEM (layer)), *x2);
*y2 = MAX (off_y + gimp_item_height (GIMP_ITEM (layer)), *y2);
}
}
else if (! gimp_channel_bounds (gimp_image_get_mask (shell->gdisp->gimage),
x1, y1, x2, y2))
x1, y1, x2, y2))
{
return FALSE;
}
@ -1360,7 +1351,7 @@ gimp_display_shell_shrink_wrap (GimpDisplayShell *shell)
* 3/4 of the screen size, expand automagically
*/
else if ((width > disp_width || height > disp_height) &&
(disp_width < max_auto_width || disp_height < max_auto_height))
(disp_width < max_auto_width || disp_height < max_auto_height))
{
width = MIN (max_auto_width, width);
height = MIN (max_auto_height, height);
@ -1388,22 +1379,22 @@ gimp_display_shell_selection_visibility (GimpDisplayShell *shell,
if (shell->select)
{
switch (control)
{
case GIMP_SELECTION_OFF:
gimp_display_shell_selection_invis (shell->select);
break;
case GIMP_SELECTION_LAYER_OFF:
gimp_display_shell_selection_layer_invis (shell->select);
break;
case GIMP_SELECTION_ON:
gimp_display_shell_selection_start (shell->select, TRUE);
break;
case GIMP_SELECTION_PAUSE:
gimp_display_shell_selection_pause (shell->select);
break;
case GIMP_SELECTION_RESUME:
gimp_display_shell_selection_resume (shell->select);
break;
}
{
case GIMP_SELECTION_OFF:
gimp_display_shell_selection_invis (shell->select);
break;
case GIMP_SELECTION_LAYER_OFF:
gimp_display_shell_selection_layer_invis (shell->select);
break;
case GIMP_SELECTION_ON:
gimp_display_shell_selection_start (shell->select, TRUE);
break;
case GIMP_SELECTION_PAUSE:
gimp_display_shell_selection_pause (shell->select);
break;
case GIMP_SELECTION_RESUME:
gimp_display_shell_selection_resume (shell->select);
break;
}
}
}

View file

@ -135,15 +135,15 @@ struct _GimpDisplayShell
gint cursor_x; /* software cursor X value */
gint cursor_y; /* software cursor Y value */
GtkWidget *warning_dialog; /* close warning dialog */
GtkWidget *close_dialog; /* close dialog */
InfoDialog *info_dialog; /* image information dialog */
GtkWidget *scale_dialog; /* scale (zoom) dialog */
GtkWidget *nav_popup; /* navigation popup */
GtkWidget *grid_dialog; /* grid configuration dialog */
GimpColorDisplayStack *filter_stack; /* color display conversion stuff */
GimpColorDisplayStack *filter_stack; /* color display conversion stuff */
guint filter_idle_id;
GtkWidget *filters_dialog;/* color display filter dialog */
GtkWidget *filters_dialog; /* color display filter dialog */
gint paused_count;

View file

@ -24,7 +24,7 @@
#include "tools-types.h"
#include "config/gimpguiconfig.h"
#include "config/gimpdisplayconfig.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
@ -259,7 +259,7 @@ gimp_move_tool_button_press (GimpTool *tool,
gint snap_distance;
snap_distance =
GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
if (gimp_display_shell_get_show_guides (shell) &&
(guide = gimp_image_find_guide (gdisp->gimage,
@ -562,7 +562,9 @@ gimp_move_tool_oper_update (GimpTool *tool,
{
gint snap_distance;
snap_distance = GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
snap_distance =
GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y,
FUNSCALEX (shell, snap_distance),
FUNSCALEY (shell, snap_distance));
@ -631,7 +633,7 @@ gimp_move_tool_cursor_update (GimpTool *tool,
gint snap_distance;
snap_distance =
GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
if (gimp_display_shell_get_show_guides (shell) &&
(guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y,

View file

@ -87,14 +87,14 @@ gimp_selection_editor_get_type (void)
static const GTypeInfo editor_info =
{
sizeof (GimpSelectionEditorClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_selection_editor_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpSelectionEditor),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_selection_editor_init,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_selection_editor_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpSelectionEditor),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_selection_editor_init,
};
editor_type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR,
@ -211,8 +211,8 @@ gimp_selection_editor_set_image (GimpImageEditor *image_editor,
if (image_editor->gimage)
{
g_signal_handlers_disconnect_by_func (image_editor->gimage,
gimp_selection_editor_mask_changed,
editor);
gimp_selection_editor_mask_changed,
editor);
}
GIMP_IMAGE_EDITOR_CLASS (parent_class)->set_image (image_editor, gimage);
@ -220,8 +220,8 @@ gimp_selection_editor_set_image (GimpImageEditor *image_editor,
if (gimage)
{
g_signal_connect (gimage, "mask_changed",
G_CALLBACK (gimp_selection_editor_mask_changed),
editor);
G_CALLBACK (gimp_selection_editor_mask_changed),
editor);
gimp_preview_set_viewable (GIMP_PREVIEW (editor->preview),
GIMP_VIEWABLE (gimp_image_get_mask (gimage)));