mirror of https://github.com/GNOME/gimp.git
Removed the obsolete drawable argument from layer_from_tiles.
The layer_type is now taken from the base_type of the image. Also changed the name to layer_new_from_tiles. --Sven
This commit is contained in:
parent
fa16d08f1f
commit
a34415cb7b
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
Sat Jan 1 18:54:13 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/disp_callbacks.c
|
||||
* app/gdisplay.c
|
||||
* app/gimage_mask.c
|
||||
* app/global_edit.c
|
||||
* app/interface.c
|
||||
* app/layer.c
|
||||
* app/layer.h
|
||||
* app/transform_core.c: Removed the obsolete drawable argument from
|
||||
layer_from_tiles. The layer_type is now taken from the base_type
|
||||
of the image. Also changed the name to layer_new_from_tiles.
|
||||
This simplifies some code and finally allows to paste into an empty
|
||||
image, so I've enabled this. Please test this heavily!!
|
||||
Should fix bug #4708.
|
||||
|
||||
* app/gdisplay_color.c: fixed a compiler warning
|
||||
|
||||
Sat Jan 1 17:10:31 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/sunras.c: small i18n fix
|
||||
|
|
|
@ -281,26 +281,35 @@ edit_paste (GImage *gimage,
|
|||
TileManager *paste,
|
||||
int paste_into)
|
||||
{
|
||||
Layer * float_layer;
|
||||
Layer * layer;
|
||||
int x1, y1, x2, y2;
|
||||
int cx, cy;
|
||||
|
||||
/* Make a new floating layer */
|
||||
float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
/* Make a new layer */
|
||||
layer = layer_new_from_tiles (gimage, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
if (float_layer)
|
||||
if (layer)
|
||||
{
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
drawable_offsets ( (drawable), &cx, &cy);
|
||||
drawable_mask_bounds ( (drawable), &x1, &y1, &x2, &y2);
|
||||
if (drawable != NULL)
|
||||
{
|
||||
drawable_offsets (drawable, &cx, &cy);
|
||||
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
GIMP_DRAWABLE(float_layer)->offset_x = cx - (GIMP_DRAWABLE(float_layer)->width >> 1);
|
||||
GIMP_DRAWABLE(float_layer)->offset_y = cy - (GIMP_DRAWABLE(float_layer)->height >> 1);
|
||||
GIMP_DRAWABLE(layer)->offset_x = cx - (GIMP_DRAWABLE(layer)->width >> 1);
|
||||
GIMP_DRAWABLE(layer)->offset_y = cy - (GIMP_DRAWABLE(layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
|
@ -309,13 +318,21 @@ edit_paste (GImage *gimage,
|
|||
if (! gimage_mask_is_empty (gimage) && !paste_into)
|
||||
channel_clear (gimage_get_mask (gimage));
|
||||
|
||||
/* add a new floating selection */
|
||||
floating_sel_attach (float_layer, drawable);
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimage_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return float_layer;
|
||||
return layer;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
@ -326,9 +343,7 @@ edit_paste_as_new (GImage *invoke,
|
|||
TileManager *paste)
|
||||
{
|
||||
GImage *gimage;
|
||||
GimpDrawable *drawable;
|
||||
Layer *layer;
|
||||
Layer *float_layer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (!global_buf)
|
||||
|
@ -336,26 +351,19 @@ edit_paste_as_new (GImage *invoke,
|
|||
|
||||
/* create a new image (always of type RGB) */
|
||||
gimage = gimage_new (paste->width, paste->height, RGB);
|
||||
gimage_disable_undo (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
||||
layer = layer_new (gimage, gimage->width, gimage->height, RGBA_GIMAGE,
|
||||
layer = layer_new_from_tiles (gimage, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* add the new layer to the image */
|
||||
gimage_disable_undo (gimage);
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimage_add_layer (gimage, layer, 0);
|
||||
drawable = gimage_active_drawable (gimage);
|
||||
drawable_fill (GIMP_DRAWABLE (drawable), TRANSPARENT_FILL);
|
||||
|
||||
/* make a new floating layer */
|
||||
float_layer = layer_from_tiles (gimage, drawable, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* add the new floating selection */
|
||||
floating_sel_attach (float_layer, drawable);
|
||||
floating_sel_anchor (float_layer);
|
||||
gimage_enable_undo (gimage);
|
||||
|
||||
gdisp = gdisplay_new (gimage, 0x0101);
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
|
@ -486,6 +494,7 @@ global_edit_paste (void *gdisp_ptr,
|
|||
else
|
||||
{
|
||||
/* flush the display */
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -281,26 +281,35 @@ edit_paste (GImage *gimage,
|
|||
TileManager *paste,
|
||||
int paste_into)
|
||||
{
|
||||
Layer * float_layer;
|
||||
Layer * layer;
|
||||
int x1, y1, x2, y2;
|
||||
int cx, cy;
|
||||
|
||||
/* Make a new floating layer */
|
||||
float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
/* Make a new layer */
|
||||
layer = layer_new_from_tiles (gimage, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
if (float_layer)
|
||||
if (layer)
|
||||
{
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
drawable_offsets ( (drawable), &cx, &cy);
|
||||
drawable_mask_bounds ( (drawable), &x1, &y1, &x2, &y2);
|
||||
if (drawable != NULL)
|
||||
{
|
||||
drawable_offsets (drawable, &cx, &cy);
|
||||
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
GIMP_DRAWABLE(float_layer)->offset_x = cx - (GIMP_DRAWABLE(float_layer)->width >> 1);
|
||||
GIMP_DRAWABLE(float_layer)->offset_y = cy - (GIMP_DRAWABLE(float_layer)->height >> 1);
|
||||
GIMP_DRAWABLE(layer)->offset_x = cx - (GIMP_DRAWABLE(layer)->width >> 1);
|
||||
GIMP_DRAWABLE(layer)->offset_y = cy - (GIMP_DRAWABLE(layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
|
@ -309,13 +318,21 @@ edit_paste (GImage *gimage,
|
|||
if (! gimage_mask_is_empty (gimage) && !paste_into)
|
||||
channel_clear (gimage_get_mask (gimage));
|
||||
|
||||
/* add a new floating selection */
|
||||
floating_sel_attach (float_layer, drawable);
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimage_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return float_layer;
|
||||
return layer;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
@ -326,9 +343,7 @@ edit_paste_as_new (GImage *invoke,
|
|||
TileManager *paste)
|
||||
{
|
||||
GImage *gimage;
|
||||
GimpDrawable *drawable;
|
||||
Layer *layer;
|
||||
Layer *float_layer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (!global_buf)
|
||||
|
@ -336,26 +351,19 @@ edit_paste_as_new (GImage *invoke,
|
|||
|
||||
/* create a new image (always of type RGB) */
|
||||
gimage = gimage_new (paste->width, paste->height, RGB);
|
||||
gimage_disable_undo (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
||||
layer = layer_new (gimage, gimage->width, gimage->height, RGBA_GIMAGE,
|
||||
layer = layer_new_from_tiles (gimage, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* add the new layer to the image */
|
||||
gimage_disable_undo (gimage);
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimage_add_layer (gimage, layer, 0);
|
||||
drawable = gimage_active_drawable (gimage);
|
||||
drawable_fill (GIMP_DRAWABLE (drawable), TRANSPARENT_FILL);
|
||||
|
||||
/* make a new floating layer */
|
||||
float_layer = layer_from_tiles (gimage, drawable, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* add the new floating selection */
|
||||
floating_sel_attach (float_layer, drawable);
|
||||
floating_sel_anchor (float_layer);
|
||||
gimage_enable_undo (gimage);
|
||||
|
||||
gdisp = gdisplay_new (gimage, 0x0101);
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
|
@ -486,6 +494,7 @@ global_edit_paste (void *gdisp_ptr,
|
|||
else
|
||||
{
|
||||
/* flush the display */
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -344,8 +344,8 @@ gimage_mask_float (GImage *gimage,
|
|||
tiles = gimage_mask_extract (gimage, drawable, TRUE, FALSE);
|
||||
|
||||
/* Create a new layer from the buffer */
|
||||
layer = layer_from_tiles (gimage, drawable, tiles, _("Floated Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
layer = layer_new_from_tiles (gimage, tiles,
|
||||
_("Floated Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* Set the offsets */
|
||||
GIMP_DRAWABLE(layer)->offset_x = tiles->x + off_x;
|
||||
|
|
|
@ -393,14 +393,12 @@ layer_copy (Layer *layer,
|
|||
}
|
||||
|
||||
Layer *
|
||||
layer_from_tiles (void *gimage_ptr,
|
||||
GimpDrawable *drawable,
|
||||
layer_new_from_tiles (GimpImage *gimage,
|
||||
TileManager *tiles,
|
||||
gchar *name,
|
||||
gint opacity,
|
||||
LayerModeEffects mode)
|
||||
{
|
||||
GImage * gimage;
|
||||
Layer * new_layer;
|
||||
GimpImageType layer_type;
|
||||
PixelRegion layerPR, bufPR;
|
||||
|
@ -410,13 +408,11 @@ layer_from_tiles (void *gimage_ptr,
|
|||
* the contents to meet the requirements of the target image type
|
||||
*/
|
||||
|
||||
/* If no tile manager, return NULL */
|
||||
if (!tiles)
|
||||
/* If no image or no tile manager, return NULL */
|
||||
if (!gimage || !tiles )
|
||||
return NULL;
|
||||
|
||||
gimage = (GImage *) gimage_ptr;
|
||||
|
||||
layer_type = drawable_type_with_alpha (drawable);
|
||||
layer_type = gimp_image_base_type_with_alpha (gimage);
|
||||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0, tiles->width, tiles->height,
|
||||
|
@ -424,7 +420,7 @@ layer_from_tiles (void *gimage_ptr,
|
|||
|
||||
if (!new_layer)
|
||||
{
|
||||
g_message ("layer_from_tiles: could not allocate new layer");
|
||||
g_message ("layer_new_from_tiles: could not allocate new layer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,8 @@ Layer * layer_copy (Layer *, gboolean);
|
|||
Layer * layer_ref (Layer *);
|
||||
void layer_unref (Layer *);
|
||||
|
||||
Layer * layer_from_tiles (void *, GimpDrawable *,
|
||||
TileManager *,
|
||||
gchar *, gint,
|
||||
LayerModeEffects);
|
||||
Layer * layer_new_from_tiles (GimpImage *, TileManager *,
|
||||
gchar *, gint, LayerModeEffects);
|
||||
LayerMask * layer_add_mask (Layer *, LayerMask *);
|
||||
LayerMask * layer_create_mask (Layer *, AddMaskType);
|
||||
Layer * layer_get_ID (gint);
|
||||
|
|
|
@ -633,7 +633,8 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
|
||||
|
||||
static void
|
||||
gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
||||
gdisplay_flush_whenever (GDisplay *gdisp,
|
||||
gboolean now)
|
||||
{
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
|
@ -699,7 +700,8 @@ gdisplay_flush_now (GDisplay *gdisp)
|
|||
}
|
||||
|
||||
/* Force all gdisplays to finish their idlerender projection */
|
||||
void gdisplays_finish_draw (void)
|
||||
void
|
||||
gdisplays_finish_draw (void)
|
||||
{
|
||||
GSList *list = display_list;
|
||||
GDisplay* gdisp;
|
||||
|
@ -1018,7 +1020,9 @@ gdisplay_draw_cursor (GDisplay *gdisp)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
|
||||
gdisplay_update_cursor (GDisplay *gdisp,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
int new_cursor;
|
||||
char buffer[CURSOR_STR_LENGTH];
|
||||
|
@ -1090,7 +1094,8 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
|
|||
|
||||
|
||||
void
|
||||
gdisplay_set_dot_for_dot (GDisplay *gdisp, int value)
|
||||
gdisplay_set_dot_for_dot (GDisplay *gdisp,
|
||||
int value)
|
||||
{
|
||||
if (value != gdisp->dot_for_dot)
|
||||
{
|
||||
|
@ -1649,12 +1654,8 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
|||
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
|
||||
SET_SENSITIVE ("Edit/Cut", lp);
|
||||
SET_SENSITIVE ("Edit/Copy", lp);
|
||||
SET_SENSITIVE ("Edit/Paste", lp);
|
||||
SET_SENSITIVE ("Edit/Paste Into", lp);
|
||||
SET_SENSITIVE ("Edit/Paste as New", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Copy Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Paste Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Clear", lp);
|
||||
SET_SENSITIVE ("Edit/Fill", lp);
|
||||
SET_SENSITIVE ("Edit/Stroke", lp);
|
||||
|
@ -2063,7 +2064,7 @@ gdisplays_nav_preview_resized (void)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplays_selection_visibility (GimpImage* gimage,
|
||||
gdisplays_selection_visibility (GimpImage *gimage,
|
||||
SelectionControl function)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
@ -2140,7 +2141,8 @@ gdisplays_delete (void)
|
|||
|
||||
|
||||
GDisplay *
|
||||
gdisplays_check_valid (GDisplay *gtest, GimpImage *gimage)
|
||||
gdisplays_check_valid (GDisplay *gtest,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
/* Give a gdisp check that it is still valid and points to the require
|
||||
* GimpImage. If not return the first gDisplay that does point to the
|
||||
|
@ -2217,7 +2219,8 @@ gdisplay_hash (GDisplay *display)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
|
||||
gdisplay_reconnect (GDisplay *gdisp,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
int instance;
|
||||
|
||||
|
@ -2252,7 +2255,8 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
|
|||
|
||||
/* Called whenever the underlying gimage is dirtied or cleaned */
|
||||
static void
|
||||
gdisplay_cleandirty_handler (GimpImage *gimage, void *data)
|
||||
gdisplay_cleandirty_handler (GimpImage *gimage,
|
||||
void *data)
|
||||
{
|
||||
GDisplay *gdisp = data;
|
||||
|
||||
|
|
|
@ -729,10 +729,8 @@ gdisplay_drag_drop (GtkWidget *widget,
|
|||
dest_height = dest_gimage->height;
|
||||
|
||||
new_layer =
|
||||
layer_from_tiles (dest_gimage,
|
||||
GIMP_DRAWABLE (gimage_get_active_layer (dest_gimage)),
|
||||
tiles, _("Pasted Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
layer_new_from_tiles (dest_gimage, tiles,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
tile_manager_destroy (tiles);
|
||||
|
||||
|
|
|
@ -729,10 +729,8 @@ gdisplay_drag_drop (GtkWidget *widget,
|
|||
dest_height = dest_gimage->height;
|
||||
|
||||
new_layer =
|
||||
layer_from_tiles (dest_gimage,
|
||||
GIMP_DRAWABLE (gimage_get_active_layer (dest_gimage)),
|
||||
tiles, _("Pasted Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
layer_new_from_tiles (dest_gimage, tiles,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
tile_manager_destroy (tiles);
|
||||
|
||||
|
|
|
@ -633,7 +633,8 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
|
||||
|
||||
static void
|
||||
gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
||||
gdisplay_flush_whenever (GDisplay *gdisp,
|
||||
gboolean now)
|
||||
{
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
|
@ -699,7 +700,8 @@ gdisplay_flush_now (GDisplay *gdisp)
|
|||
}
|
||||
|
||||
/* Force all gdisplays to finish their idlerender projection */
|
||||
void gdisplays_finish_draw (void)
|
||||
void
|
||||
gdisplays_finish_draw (void)
|
||||
{
|
||||
GSList *list = display_list;
|
||||
GDisplay* gdisp;
|
||||
|
@ -1018,7 +1020,9 @@ gdisplay_draw_cursor (GDisplay *gdisp)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
|
||||
gdisplay_update_cursor (GDisplay *gdisp,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
int new_cursor;
|
||||
char buffer[CURSOR_STR_LENGTH];
|
||||
|
@ -1090,7 +1094,8 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
|
|||
|
||||
|
||||
void
|
||||
gdisplay_set_dot_for_dot (GDisplay *gdisp, int value)
|
||||
gdisplay_set_dot_for_dot (GDisplay *gdisp,
|
||||
int value)
|
||||
{
|
||||
if (value != gdisp->dot_for_dot)
|
||||
{
|
||||
|
@ -1649,12 +1654,8 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
|||
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
|
||||
SET_SENSITIVE ("Edit/Cut", lp);
|
||||
SET_SENSITIVE ("Edit/Copy", lp);
|
||||
SET_SENSITIVE ("Edit/Paste", lp);
|
||||
SET_SENSITIVE ("Edit/Paste Into", lp);
|
||||
SET_SENSITIVE ("Edit/Paste as New", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Copy Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Paste Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Clear", lp);
|
||||
SET_SENSITIVE ("Edit/Fill", lp);
|
||||
SET_SENSITIVE ("Edit/Stroke", lp);
|
||||
|
@ -2063,7 +2064,7 @@ gdisplays_nav_preview_resized (void)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplays_selection_visibility (GimpImage* gimage,
|
||||
gdisplays_selection_visibility (GimpImage *gimage,
|
||||
SelectionControl function)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
@ -2140,7 +2141,8 @@ gdisplays_delete (void)
|
|||
|
||||
|
||||
GDisplay *
|
||||
gdisplays_check_valid (GDisplay *gtest, GimpImage *gimage)
|
||||
gdisplays_check_valid (GDisplay *gtest,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
/* Give a gdisp check that it is still valid and points to the require
|
||||
* GimpImage. If not return the first gDisplay that does point to the
|
||||
|
@ -2217,7 +2219,8 @@ gdisplay_hash (GDisplay *display)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
|
||||
gdisplay_reconnect (GDisplay *gdisp,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
int instance;
|
||||
|
||||
|
@ -2252,7 +2255,8 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
|
|||
|
||||
/* Called whenever the underlying gimage is dirtied or cleaned */
|
||||
static void
|
||||
gdisplay_cleandirty_handler (GimpImage *gimage, void *data)
|
||||
gdisplay_cleandirty_handler (GimpImage *gimage,
|
||||
void *data)
|
||||
{
|
||||
GDisplay *gdisp = data;
|
||||
|
||||
|
|
|
@ -729,10 +729,8 @@ gdisplay_drag_drop (GtkWidget *widget,
|
|||
dest_height = dest_gimage->height;
|
||||
|
||||
new_layer =
|
||||
layer_from_tiles (dest_gimage,
|
||||
GIMP_DRAWABLE (gimage_get_active_layer (dest_gimage)),
|
||||
tiles, _("Pasted Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
layer_new_from_tiles (dest_gimage, tiles,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
tile_manager_destroy (tiles);
|
||||
|
||||
|
|
|
@ -1164,7 +1164,7 @@ toolbox_drag_drop (GtkWidget *widget,
|
|||
|
||||
add_alpha_region (&srcPR, &destPR);
|
||||
|
||||
new_layer = layer_from_tiles (new_gimage, drawable, tiles,
|
||||
new_layer = layer_new_from_tiles (new_gimage, tiles,
|
||||
"", OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
tile_manager_destroy (tiles);
|
||||
|
|
|
@ -154,7 +154,7 @@ gdisplay_color_attach (GDisplay *gdisp,
|
|||
ColorDisplayInfo *info;
|
||||
ColorDisplayNode *node;
|
||||
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
g_return_val_if_fail (gdisp != NULL, NULL);
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, name)))
|
||||
{
|
||||
|
|
|
@ -1164,7 +1164,7 @@ toolbox_drag_drop (GtkWidget *widget,
|
|||
|
||||
add_alpha_region (&srcPR, &destPR);
|
||||
|
||||
new_layer = layer_from_tiles (new_gimage, drawable, tiles,
|
||||
new_layer = layer_new_from_tiles (new_gimage, tiles,
|
||||
"", OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
tile_manager_destroy (tiles);
|
||||
|
|
|
@ -633,7 +633,8 @@ gdisplay_flush_displays_only (GDisplay *gdisp)
|
|||
|
||||
|
||||
static void
|
||||
gdisplay_flush_whenever (GDisplay *gdisp, gboolean now)
|
||||
gdisplay_flush_whenever (GDisplay *gdisp,
|
||||
gboolean now)
|
||||
{
|
||||
GSList *list;
|
||||
GArea *ga;
|
||||
|
@ -699,7 +700,8 @@ gdisplay_flush_now (GDisplay *gdisp)
|
|||
}
|
||||
|
||||
/* Force all gdisplays to finish their idlerender projection */
|
||||
void gdisplays_finish_draw (void)
|
||||
void
|
||||
gdisplays_finish_draw (void)
|
||||
{
|
||||
GSList *list = display_list;
|
||||
GDisplay* gdisp;
|
||||
|
@ -1018,7 +1020,9 @@ gdisplay_draw_cursor (GDisplay *gdisp)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
|
||||
gdisplay_update_cursor (GDisplay *gdisp,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
int new_cursor;
|
||||
char buffer[CURSOR_STR_LENGTH];
|
||||
|
@ -1090,7 +1094,8 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
|
|||
|
||||
|
||||
void
|
||||
gdisplay_set_dot_for_dot (GDisplay *gdisp, int value)
|
||||
gdisplay_set_dot_for_dot (GDisplay *gdisp,
|
||||
int value)
|
||||
{
|
||||
if (value != gdisp->dot_for_dot)
|
||||
{
|
||||
|
@ -1649,12 +1654,8 @@ gdisplay_set_menu_sensitivity (GDisplay *gdisp)
|
|||
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
|
||||
SET_SENSITIVE ("Edit/Cut", lp);
|
||||
SET_SENSITIVE ("Edit/Copy", lp);
|
||||
SET_SENSITIVE ("Edit/Paste", lp);
|
||||
SET_SENSITIVE ("Edit/Paste Into", lp);
|
||||
SET_SENSITIVE ("Edit/Paste as New", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Copy Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Buffer/Paste Named...", lp);
|
||||
SET_SENSITIVE ("Edit/Clear", lp);
|
||||
SET_SENSITIVE ("Edit/Fill", lp);
|
||||
SET_SENSITIVE ("Edit/Stroke", lp);
|
||||
|
@ -2063,7 +2064,7 @@ gdisplays_nav_preview_resized (void)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplays_selection_visibility (GimpImage* gimage,
|
||||
gdisplays_selection_visibility (GimpImage *gimage,
|
||||
SelectionControl function)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
@ -2140,7 +2141,8 @@ gdisplays_delete (void)
|
|||
|
||||
|
||||
GDisplay *
|
||||
gdisplays_check_valid (GDisplay *gtest, GimpImage *gimage)
|
||||
gdisplays_check_valid (GDisplay *gtest,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
/* Give a gdisp check that it is still valid and points to the require
|
||||
* GimpImage. If not return the first gDisplay that does point to the
|
||||
|
@ -2217,7 +2219,8 @@ gdisplay_hash (GDisplay *display)
|
|||
}
|
||||
|
||||
void
|
||||
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
|
||||
gdisplay_reconnect (GDisplay *gdisp,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
int instance;
|
||||
|
||||
|
@ -2252,7 +2255,8 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
|
|||
|
||||
/* Called whenever the underlying gimage is dirtied or cleaned */
|
||||
static void
|
||||
gdisplay_cleandirty_handler (GimpImage *gimage, void *data)
|
||||
gdisplay_cleandirty_handler (GimpImage *gimage,
|
||||
void *data)
|
||||
{
|
||||
GDisplay *gdisp = data;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ gdisplay_color_attach (GDisplay *gdisp,
|
|||
ColorDisplayInfo *info;
|
||||
ColorDisplayNode *node;
|
||||
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
g_return_val_if_fail (gdisp != NULL, NULL);
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, name)))
|
||||
{
|
||||
|
|
|
@ -344,8 +344,8 @@ gimage_mask_float (GImage *gimage,
|
|||
tiles = gimage_mask_extract (gimage, drawable, TRUE, FALSE);
|
||||
|
||||
/* Create a new layer from the buffer */
|
||||
layer = layer_from_tiles (gimage, drawable, tiles, _("Floated Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
layer = layer_new_from_tiles (gimage, tiles,
|
||||
_("Floated Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* Set the offsets */
|
||||
GIMP_DRAWABLE(layer)->offset_x = tiles->x + off_x;
|
||||
|
|
|
@ -393,14 +393,12 @@ layer_copy (Layer *layer,
|
|||
}
|
||||
|
||||
Layer *
|
||||
layer_from_tiles (void *gimage_ptr,
|
||||
GimpDrawable *drawable,
|
||||
layer_new_from_tiles (GimpImage *gimage,
|
||||
TileManager *tiles,
|
||||
gchar *name,
|
||||
gint opacity,
|
||||
LayerModeEffects mode)
|
||||
{
|
||||
GImage * gimage;
|
||||
Layer * new_layer;
|
||||
GimpImageType layer_type;
|
||||
PixelRegion layerPR, bufPR;
|
||||
|
@ -410,13 +408,11 @@ layer_from_tiles (void *gimage_ptr,
|
|||
* the contents to meet the requirements of the target image type
|
||||
*/
|
||||
|
||||
/* If no tile manager, return NULL */
|
||||
if (!tiles)
|
||||
/* If no image or no tile manager, return NULL */
|
||||
if (!gimage || !tiles )
|
||||
return NULL;
|
||||
|
||||
gimage = (GImage *) gimage_ptr;
|
||||
|
||||
layer_type = drawable_type_with_alpha (drawable);
|
||||
layer_type = gimp_image_base_type_with_alpha (gimage);
|
||||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0, tiles->width, tiles->height,
|
||||
|
@ -424,7 +420,7 @@ layer_from_tiles (void *gimage_ptr,
|
|||
|
||||
if (!new_layer)
|
||||
{
|
||||
g_message ("layer_from_tiles: could not allocate new layer");
|
||||
g_message ("layer_new_from_tiles: could not allocate new layer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,8 @@ Layer * layer_copy (Layer *, gboolean);
|
|||
Layer * layer_ref (Layer *);
|
||||
void layer_unref (Layer *);
|
||||
|
||||
Layer * layer_from_tiles (void *, GimpDrawable *,
|
||||
TileManager *,
|
||||
gchar *, gint,
|
||||
LayerModeEffects);
|
||||
Layer * layer_new_from_tiles (GimpImage *, TileManager *,
|
||||
gchar *, gint, LayerModeEffects);
|
||||
LayerMask * layer_add_mask (Layer *, LayerMask *);
|
||||
LayerMask * layer_create_mask (Layer *, AddMaskType);
|
||||
Layer * layer_get_ID (gint);
|
||||
|
|
|
@ -281,26 +281,35 @@ edit_paste (GImage *gimage,
|
|||
TileManager *paste,
|
||||
int paste_into)
|
||||
{
|
||||
Layer * float_layer;
|
||||
Layer * layer;
|
||||
int x1, y1, x2, y2;
|
||||
int cx, cy;
|
||||
|
||||
/* Make a new floating layer */
|
||||
float_layer = layer_from_tiles (gimage, drawable, paste, _("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
/* Make a new layer */
|
||||
layer = layer_new_from_tiles (gimage, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
if (float_layer)
|
||||
if (layer)
|
||||
{
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
drawable_offsets ( (drawable), &cx, &cy);
|
||||
drawable_mask_bounds ( (drawable), &x1, &y1, &x2, &y2);
|
||||
if (drawable != NULL)
|
||||
{
|
||||
drawable_offsets (drawable, &cx, &cy);
|
||||
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
GIMP_DRAWABLE(float_layer)->offset_x = cx - (GIMP_DRAWABLE(float_layer)->width >> 1);
|
||||
GIMP_DRAWABLE(float_layer)->offset_y = cy - (GIMP_DRAWABLE(float_layer)->height >> 1);
|
||||
GIMP_DRAWABLE(layer)->offset_x = cx - (GIMP_DRAWABLE(layer)->width >> 1);
|
||||
GIMP_DRAWABLE(layer)->offset_y = cy - (GIMP_DRAWABLE(layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
|
@ -309,13 +318,21 @@ edit_paste (GImage *gimage,
|
|||
if (! gimage_mask_is_empty (gimage) && !paste_into)
|
||||
channel_clear (gimage_get_mask (gimage));
|
||||
|
||||
/* add a new floating selection */
|
||||
floating_sel_attach (float_layer, drawable);
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimage_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return float_layer;
|
||||
return layer;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
@ -326,9 +343,7 @@ edit_paste_as_new (GImage *invoke,
|
|||
TileManager *paste)
|
||||
{
|
||||
GImage *gimage;
|
||||
GimpDrawable *drawable;
|
||||
Layer *layer;
|
||||
Layer *float_layer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (!global_buf)
|
||||
|
@ -336,26 +351,19 @@ edit_paste_as_new (GImage *invoke,
|
|||
|
||||
/* create a new image (always of type RGB) */
|
||||
gimage = gimage_new (paste->width, paste->height, RGB);
|
||||
gimage_disable_undo (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
||||
layer = layer_new (gimage, gimage->width, gimage->height, RGBA_GIMAGE,
|
||||
layer = layer_new_from_tiles (gimage, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* add the new layer to the image */
|
||||
gimage_disable_undo (gimage);
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimage_add_layer (gimage, layer, 0);
|
||||
drawable = gimage_active_drawable (gimage);
|
||||
drawable_fill (GIMP_DRAWABLE (drawable), TRANSPARENT_FILL);
|
||||
|
||||
/* make a new floating layer */
|
||||
float_layer = layer_from_tiles (gimage, drawable, paste,
|
||||
_("Pasted Layer"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* add the new floating selection */
|
||||
floating_sel_attach (float_layer, drawable);
|
||||
floating_sel_anchor (float_layer);
|
||||
gimage_enable_undo (gimage);
|
||||
|
||||
gdisp = gdisplay_new (gimage, 0x0101);
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
|
@ -486,6 +494,7 @@ global_edit_paste (void *gdisp_ptr,
|
|||
else
|
||||
{
|
||||
/* flush the display */
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1164,7 +1164,7 @@ toolbox_drag_drop (GtkWidget *widget,
|
|||
|
||||
add_alpha_region (&srcPR, &destPR);
|
||||
|
||||
new_layer = layer_from_tiles (new_gimage, drawable, tiles,
|
||||
new_layer = layer_new_from_tiles (new_gimage, tiles,
|
||||
"", OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
tile_manager_destroy (tiles);
|
||||
|
|
14
app/layer.c
14
app/layer.c
|
@ -393,14 +393,12 @@ layer_copy (Layer *layer,
|
|||
}
|
||||
|
||||
Layer *
|
||||
layer_from_tiles (void *gimage_ptr,
|
||||
GimpDrawable *drawable,
|
||||
layer_new_from_tiles (GimpImage *gimage,
|
||||
TileManager *tiles,
|
||||
gchar *name,
|
||||
gint opacity,
|
||||
LayerModeEffects mode)
|
||||
{
|
||||
GImage * gimage;
|
||||
Layer * new_layer;
|
||||
GimpImageType layer_type;
|
||||
PixelRegion layerPR, bufPR;
|
||||
|
@ -410,13 +408,11 @@ layer_from_tiles (void *gimage_ptr,
|
|||
* the contents to meet the requirements of the target image type
|
||||
*/
|
||||
|
||||
/* If no tile manager, return NULL */
|
||||
if (!tiles)
|
||||
/* If no image or no tile manager, return NULL */
|
||||
if (!gimage || !tiles )
|
||||
return NULL;
|
||||
|
||||
gimage = (GImage *) gimage_ptr;
|
||||
|
||||
layer_type = drawable_type_with_alpha (drawable);
|
||||
layer_type = gimp_image_base_type_with_alpha (gimage);
|
||||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0, tiles->width, tiles->height,
|
||||
|
@ -424,7 +420,7 @@ layer_from_tiles (void *gimage_ptr,
|
|||
|
||||
if (!new_layer)
|
||||
{
|
||||
g_message ("layer_from_tiles: could not allocate new layer");
|
||||
g_message ("layer_new_from_tiles: could not allocate new layer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,8 @@ Layer * layer_copy (Layer *, gboolean);
|
|||
Layer * layer_ref (Layer *);
|
||||
void layer_unref (Layer *);
|
||||
|
||||
Layer * layer_from_tiles (void *, GimpDrawable *,
|
||||
TileManager *,
|
||||
gchar *, gint,
|
||||
LayerModeEffects);
|
||||
Layer * layer_new_from_tiles (GimpImage *, TileManager *,
|
||||
gchar *, gint, LayerModeEffects);
|
||||
LayerMask * layer_add_mask (Layer *, LayerMask *);
|
||||
LayerMask * layer_create_mask (Layer *, AddMaskType);
|
||||
Layer * layer_get_ID (gint);
|
||||
|
|
|
@ -1533,8 +1533,8 @@ transform_core_paste (GImage *gimage,
|
|||
|
||||
if (new_layer)
|
||||
{
|
||||
layer = layer_from_tiles (gimage, drawable, tiles, _("Transformation"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
layer = layer_new_from_tiles (gimage, tiles,
|
||||
_("Transformation"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
GIMP_DRAWABLE(layer)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE(layer)->offset_y = tiles->y;
|
||||
|
||||
|
|
|
@ -1533,8 +1533,8 @@ transform_core_paste (GImage *gimage,
|
|||
|
||||
if (new_layer)
|
||||
{
|
||||
layer = layer_from_tiles (gimage, drawable, tiles, _("Transformation"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
layer = layer_new_from_tiles (gimage, tiles,
|
||||
_("Transformation"), OPAQUE_OPACITY, NORMAL_MODE);
|
||||
GIMP_DRAWABLE(layer)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE(layer)->offset_y = tiles->y;
|
||||
|
||||
|
|
Loading…
Reference in New Issue