mirror of https://github.com/GNOME/gimp.git
when moving layers/masks freeze the undo after the first move to avoid
* app/edit_selection.c: when moving layers/masks freeze the undo after the first move to avoid that each and every small movements puts an undo on the stack. Significantly speeds up layer moves and especially the undo of a layer move. * app/gdisplay.h: correct rounding errors * app/gimpimage.c: correctly display floating selections in the composite_preview instead of ignoring them * app/channels_dialog.c * app/layers_dialog.c * app/lc_dialog.c: s/gtk_widget_draw/gtk_widget_queue_draw/ --Sven
This commit is contained in:
parent
ff80bf7fdd
commit
558271ff3b
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
Fri Nov 5 15:32:15 MET 1999 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/edit_selection.c: when moving layers/masks freeze the undo
|
||||
after the first move to avoid that each and every small movements
|
||||
puts an undo on the stack. Significantly speeds up layer moves
|
||||
and especially the undo of a layer move.
|
||||
|
||||
* app/gdisplay.h: correct rounding errors
|
||||
|
||||
* app/gimpimage.c: correctly display floating selections in the
|
||||
composite_preview instead of ignoring them
|
||||
|
||||
* app/channels_dialog.c
|
||||
* app/layers_dialog.c
|
||||
* app/lc_dialog.c: s/gtk_widget_draw/gtk_widget_queue_draw/
|
||||
|
||||
Thu Nov 4 22:06:24 GMT 1999 Andy Thomas <alt@gimp.org>
|
||||
|
||||
* app/gradient_select_cmds.c
|
||||
|
@ -16,7 +32,7 @@ Thu Nov 4 20:46:25 MET 1999 Sven Neumann <sven.gimp.org>
|
|||
|
||||
* app/gimpbrushpipe.c
|
||||
* libgimp/parasiteio.c
|
||||
* libgimp/parasiteio.h: plugged another mem-leaks. At least
|
||||
* libgimp/parasiteio.h: plugged another mem-leak. At least
|
||||
The GIMP now starts without leaking memory...
|
||||
|
||||
Thu Nov 4 00:59:01 MET 1999 Sven Neumann <sven.gimp.org>
|
||||
|
|
|
@ -2324,7 +2324,7 @@ channel_widget_channel_flush (GtkWidget *widget,
|
|||
}
|
||||
|
||||
if (update_preview)
|
||||
gtk_widget_draw (channel_widget->channel_preview, NULL);
|
||||
gtk_widget_queue_draw (channel_widget->channel_preview);
|
||||
}
|
||||
|
||||
/**********************************/
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -46,12 +46,12 @@
|
|||
(SCALESRC(g) * g->gimage->yresolution))
|
||||
|
||||
/* scale values */
|
||||
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g)))
|
||||
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g)))
|
||||
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g) + 0.5))
|
||||
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g) + 0.5))
|
||||
|
||||
/* unscale values */
|
||||
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g)))
|
||||
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g)))
|
||||
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g) + 0.5))
|
||||
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g) + 0.5))
|
||||
/* (and float-returning versions) */
|
||||
#define FUNSCALEX(g,x) ((x / SCALEFACTOR_X(g)))
|
||||
#define FUNSCALEY(g,y) ((y / SCALEFACTOR_Y(g)))
|
||||
|
|
|
@ -46,12 +46,12 @@
|
|||
(SCALESRC(g) * g->gimage->yresolution))
|
||||
|
||||
/* scale values */
|
||||
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g)))
|
||||
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g)))
|
||||
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g) + 0.5))
|
||||
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g) + 0.5))
|
||||
|
||||
/* unscale values */
|
||||
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g)))
|
||||
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g)))
|
||||
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g) + 0.5))
|
||||
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g) + 0.5))
|
||||
/* (and float-returning versions) */
|
||||
#define FUNSCALEX(g,x) ((x / SCALEFACTOR_X(g)))
|
||||
#define FUNSCALEY(g,y) ((y / SCALEFACTOR_Y(g)))
|
||||
|
|
|
@ -57,6 +57,8 @@ struct _EditSelection
|
|||
gboolean old_scroll_lock; /* old value of scroll lock */
|
||||
gboolean old_auto_snap_to; /* old value of auto snap to */
|
||||
|
||||
gboolean first_move; /* we undo_freeze after the first */
|
||||
|
||||
guint context_id; /* for the statusbar */
|
||||
};
|
||||
|
||||
|
@ -137,6 +139,8 @@ init_edit_selection (Tool *tool,
|
|||
edit_select.old_scroll_lock = tool->scroll_lock;
|
||||
edit_select.old_auto_snap_to = tool->auto_snap_to;
|
||||
|
||||
edit_select.first_move = TRUE;
|
||||
|
||||
/* find the bounding box of the selection mask -
|
||||
* this is used for the case of a MaskToLayerTranslate,
|
||||
* where the translation will result in floating the selection
|
||||
|
@ -150,11 +154,11 @@ init_edit_selection (Tool *tool,
|
|||
|
||||
/* reset the function pointers on the selection tool */
|
||||
tool->button_release_func = edit_selection_button_release;
|
||||
tool->motion_func = edit_selection_motion;
|
||||
tool->control_func = edit_selection_control;
|
||||
tool->cursor_update_func = edit_selection_cursor_update;
|
||||
tool->scroll_lock = EDIT_SELECT_SCROLL_LOCK;
|
||||
tool->auto_snap_to = FALSE;
|
||||
tool->motion_func = edit_selection_motion;
|
||||
tool->control_func = edit_selection_control;
|
||||
tool->cursor_update_func = edit_selection_cursor_update;
|
||||
tool->scroll_lock = EDIT_SELECT_SCROLL_LOCK;
|
||||
tool->auto_snap_to = FALSE;
|
||||
|
||||
/* pause the current selection */
|
||||
selection_pause (gdisp->select);
|
||||
|
@ -284,10 +288,14 @@ edit_selection_button_release (Tool *tool,
|
|||
floating_sel_anchor (layer);
|
||||
}
|
||||
}
|
||||
|
||||
undo_push_group_end (gdisp->gimage);
|
||||
|
||||
#else
|
||||
|
||||
/* thaw the undo again */
|
||||
gimp_image_undo_thaw (gdisp->gimage);
|
||||
|
||||
if (edit_select.cumlx == 0 && edit_select.cumly == 0)
|
||||
{
|
||||
/* The user either didn't actually move the selection,
|
||||
|
@ -310,13 +318,13 @@ edit_selection_button_release (Tool *tool,
|
|||
{
|
||||
paths_transform_xy(gdisp->gimage,edit_select.cumlx,edit_select.cumly);
|
||||
}
|
||||
|
||||
|
||||
undo_push_group_end (gdisp->gimage);
|
||||
|
||||
if (bevent->state & GDK_BUTTON2_MASK) /* OPERATION CANCELLED */
|
||||
if (bevent->state & GDK_BUTTON3_MASK) /* OPERATION CANCELLED */
|
||||
{
|
||||
/* Operation cancelled - undo the undo-group! */
|
||||
undo_pop(gdisp->gimage);
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -347,8 +355,6 @@ edit_selection_motion (Tool *tool,
|
|||
|
||||
edit_selection_snap (gdisp, mevent->x, mevent->y);
|
||||
|
||||
|
||||
|
||||
/**********************************************adam hack*************/
|
||||
/********************************************************************/
|
||||
{
|
||||
|
@ -384,6 +390,11 @@ edit_selection_motion (Tool *tool,
|
|||
x,y,
|
||||
edit_select.x1,edit_select.y1,
|
||||
edit_select.x2,edit_select.y2);*/
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
edit_select.origx = x;
|
||||
edit_select.origy = y;
|
||||
break;
|
||||
|
@ -407,11 +418,22 @@ edit_selection_motion (Tool *tool,
|
|||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case MaskToLayerTranslate:
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
edit_select.edit_type = FloatingSelTranslate;
|
||||
|
||||
edit_select.origx -= edit_select.x1;
|
||||
|
@ -425,6 +447,11 @@ edit_selection_motion (Tool *tool,
|
|||
layer_translate (layer, xoffset, yoffset);
|
||||
floating_sel_rigor (layer, TRUE);
|
||||
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -436,8 +463,6 @@ edit_selection_motion (Tool *tool,
|
|||
}
|
||||
/********************************************************************/
|
||||
/********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
|
||||
|
@ -531,7 +556,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_segments (edit_select.core->win, edit_select.core->gc,
|
||||
select->segs_out, select->num_segs_out);
|
||||
|
||||
/* reset the the current selection */
|
||||
/* reset the current selection */
|
||||
seg = select->segs_in;
|
||||
for (i = 0; i < select->num_segs_in; i++)
|
||||
{
|
||||
|
@ -558,7 +583,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_rectangle (edit_select.core->win,
|
||||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
x2 - x1, y2 - y1);
|
||||
break;
|
||||
|
||||
case LayerTranslate:
|
||||
|
@ -596,7 +621,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_rectangle (edit_select.core->win,
|
||||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
x2 - x1, y2 - y1);
|
||||
break;
|
||||
|
||||
case FloatingSelTranslate:
|
||||
|
@ -789,7 +814,7 @@ edit_sel_arrow_keys_func (Tool *tool,
|
|||
if (inc_x == 0 && inc_y == 0 && mask_inc_x == 0 && mask_inc_y == 0)
|
||||
return;
|
||||
|
||||
undo_push_group_start (gdisp->gimage, MISC_UNDO);
|
||||
undo_push_group_start (gdisp->gimage, LAYER_DISPLACE_UNDO);
|
||||
|
||||
if (mask_inc_x != 0 || mask_inc_y != 0)
|
||||
gimage_mask_translate (gdisp->gimage, mask_inc_x, mask_inc_y);
|
||||
|
|
|
@ -46,12 +46,12 @@
|
|||
(SCALESRC(g) * g->gimage->yresolution))
|
||||
|
||||
/* scale values */
|
||||
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g)))
|
||||
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g)))
|
||||
#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g) + 0.5))
|
||||
#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g) + 0.5))
|
||||
|
||||
/* unscale values */
|
||||
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g)))
|
||||
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g)))
|
||||
#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g) + 0.5))
|
||||
#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g) + 0.5))
|
||||
/* (and float-returning versions) */
|
||||
#define FUNSCALEX(g,x) ((x / SCALEFACTOR_X(g)))
|
||||
#define FUNSCALEY(g,y) ((y / SCALEFACTOR_Y(g)))
|
||||
|
|
|
@ -3333,9 +3333,10 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Layer * layer;
|
||||
Layer *layer;
|
||||
Layer *floating_sel;
|
||||
PixelRegion src1PR, src2PR, maskPR;
|
||||
PixelRegion * mask;
|
||||
PixelRegion *mask;
|
||||
TempBuf *comp;
|
||||
TempBuf *layer_buf;
|
||||
TempBuf *mask_buf;
|
||||
|
@ -3369,13 +3370,25 @@ gimp_image_construct_composite_preview (GimpImage *gimage,
|
|||
comp = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
memset (temp_buf_data (comp), 0, comp->width * comp->height * comp->bytes);
|
||||
|
||||
floating_sel = NULL;
|
||||
while (list)
|
||||
{
|
||||
layer = (Layer *) list->data;
|
||||
|
||||
/* only add layers that are visible and not floating selections to the list */
|
||||
if (!layer_is_floating_sel (layer) && drawable_visible (GIMP_DRAWABLE(layer)))
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
/* only add layers that are visible to the list */
|
||||
if (drawable_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer they are attached to */
|
||||
if (layer_is_floating_sel (layer))
|
||||
floating_sel = layer;
|
||||
else
|
||||
{
|
||||
if (floating_sel && GIMP_LAYER (floating_sel)->fs.drawable == layer)
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
list = g_slist_next (list);
|
||||
}
|
||||
|
|
|
@ -2324,7 +2324,7 @@ channel_widget_channel_flush (GtkWidget *widget,
|
|||
}
|
||||
|
||||
if (update_preview)
|
||||
gtk_widget_draw (channel_widget->channel_preview, NULL);
|
||||
gtk_widget_queue_draw (channel_widget->channel_preview);
|
||||
}
|
||||
|
||||
/**********************************/
|
||||
|
|
|
@ -1238,7 +1238,7 @@ layers_dialog_add_layer_mask (Layer *layer)
|
|||
|
||||
layer_widget->active_preview = MASK_PREVIEW;
|
||||
|
||||
gtk_widget_draw (layer_widget->layer_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->layer_preview);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1259,7 +1259,7 @@ layers_dialog_remove_layer_mask (Layer *layer)
|
|||
|
||||
layer_widget->active_preview = LAYER_PREVIEW;
|
||||
|
||||
gtk_widget_draw (layer_widget->layer_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->layer_preview);
|
||||
}
|
||||
|
||||
/*****************************************************/
|
||||
|
@ -3190,9 +3190,9 @@ layer_widget_layer_flush (GtkWidget *widget,
|
|||
}
|
||||
|
||||
if (update_layer_preview)
|
||||
gtk_widget_draw (layer_widget->layer_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->layer_preview);
|
||||
if (update_mask_preview)
|
||||
gtk_widget_draw (layer_widget->mask_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->mask_preview);
|
||||
}
|
||||
|
||||
/********************************/
|
||||
|
|
|
@ -1238,7 +1238,7 @@ layers_dialog_add_layer_mask (Layer *layer)
|
|||
|
||||
layer_widget->active_preview = MASK_PREVIEW;
|
||||
|
||||
gtk_widget_draw (layer_widget->layer_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->layer_preview);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1259,7 +1259,7 @@ layers_dialog_remove_layer_mask (Layer *layer)
|
|||
|
||||
layer_widget->active_preview = LAYER_PREVIEW;
|
||||
|
||||
gtk_widget_draw (layer_widget->layer_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->layer_preview);
|
||||
}
|
||||
|
||||
/*****************************************************/
|
||||
|
@ -3190,9 +3190,9 @@ layer_widget_layer_flush (GtkWidget *widget,
|
|||
}
|
||||
|
||||
if (update_layer_preview)
|
||||
gtk_widget_draw (layer_widget->layer_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->layer_preview);
|
||||
if (update_mask_preview)
|
||||
gtk_widget_draw (layer_widget->mask_preview, NULL);
|
||||
gtk_widget_queue_draw (layer_widget->mask_preview);
|
||||
}
|
||||
|
||||
/********************************/
|
||||
|
|
|
@ -335,7 +335,7 @@ lc_dialog_image_menu_preview_update_callback (GtkWidget *widget,
|
|||
gimage,
|
||||
MENU_THUMBNAIL_WIDTH,
|
||||
MENU_THUMBNAIL_HEIGHT);
|
||||
gtk_widget_draw (GTK_WIDGET (menu_preview), NULL);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (menu_preview));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ struct _EditSelection
|
|||
gboolean old_scroll_lock; /* old value of scroll lock */
|
||||
gboolean old_auto_snap_to; /* old value of auto snap to */
|
||||
|
||||
gboolean first_move; /* we undo_freeze after the first */
|
||||
|
||||
guint context_id; /* for the statusbar */
|
||||
};
|
||||
|
||||
|
@ -137,6 +139,8 @@ init_edit_selection (Tool *tool,
|
|||
edit_select.old_scroll_lock = tool->scroll_lock;
|
||||
edit_select.old_auto_snap_to = tool->auto_snap_to;
|
||||
|
||||
edit_select.first_move = TRUE;
|
||||
|
||||
/* find the bounding box of the selection mask -
|
||||
* this is used for the case of a MaskToLayerTranslate,
|
||||
* where the translation will result in floating the selection
|
||||
|
@ -150,11 +154,11 @@ init_edit_selection (Tool *tool,
|
|||
|
||||
/* reset the function pointers on the selection tool */
|
||||
tool->button_release_func = edit_selection_button_release;
|
||||
tool->motion_func = edit_selection_motion;
|
||||
tool->control_func = edit_selection_control;
|
||||
tool->cursor_update_func = edit_selection_cursor_update;
|
||||
tool->scroll_lock = EDIT_SELECT_SCROLL_LOCK;
|
||||
tool->auto_snap_to = FALSE;
|
||||
tool->motion_func = edit_selection_motion;
|
||||
tool->control_func = edit_selection_control;
|
||||
tool->cursor_update_func = edit_selection_cursor_update;
|
||||
tool->scroll_lock = EDIT_SELECT_SCROLL_LOCK;
|
||||
tool->auto_snap_to = FALSE;
|
||||
|
||||
/* pause the current selection */
|
||||
selection_pause (gdisp->select);
|
||||
|
@ -284,10 +288,14 @@ edit_selection_button_release (Tool *tool,
|
|||
floating_sel_anchor (layer);
|
||||
}
|
||||
}
|
||||
|
||||
undo_push_group_end (gdisp->gimage);
|
||||
|
||||
#else
|
||||
|
||||
/* thaw the undo again */
|
||||
gimp_image_undo_thaw (gdisp->gimage);
|
||||
|
||||
if (edit_select.cumlx == 0 && edit_select.cumly == 0)
|
||||
{
|
||||
/* The user either didn't actually move the selection,
|
||||
|
@ -310,13 +318,13 @@ edit_selection_button_release (Tool *tool,
|
|||
{
|
||||
paths_transform_xy(gdisp->gimage,edit_select.cumlx,edit_select.cumly);
|
||||
}
|
||||
|
||||
|
||||
undo_push_group_end (gdisp->gimage);
|
||||
|
||||
if (bevent->state & GDK_BUTTON2_MASK) /* OPERATION CANCELLED */
|
||||
if (bevent->state & GDK_BUTTON3_MASK) /* OPERATION CANCELLED */
|
||||
{
|
||||
/* Operation cancelled - undo the undo-group! */
|
||||
undo_pop(gdisp->gimage);
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -347,8 +355,6 @@ edit_selection_motion (Tool *tool,
|
|||
|
||||
edit_selection_snap (gdisp, mevent->x, mevent->y);
|
||||
|
||||
|
||||
|
||||
/**********************************************adam hack*************/
|
||||
/********************************************************************/
|
||||
{
|
||||
|
@ -384,6 +390,11 @@ edit_selection_motion (Tool *tool,
|
|||
x,y,
|
||||
edit_select.x1,edit_select.y1,
|
||||
edit_select.x2,edit_select.y2);*/
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
edit_select.origx = x;
|
||||
edit_select.origy = y;
|
||||
break;
|
||||
|
@ -407,11 +418,22 @@ edit_selection_motion (Tool *tool,
|
|||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case MaskToLayerTranslate:
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
edit_select.edit_type = FloatingSelTranslate;
|
||||
|
||||
edit_select.origx -= edit_select.x1;
|
||||
|
@ -425,6 +447,11 @@ edit_selection_motion (Tool *tool,
|
|||
layer_translate (layer, xoffset, yoffset);
|
||||
floating_sel_rigor (layer, TRUE);
|
||||
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -436,8 +463,6 @@ edit_selection_motion (Tool *tool,
|
|||
}
|
||||
/********************************************************************/
|
||||
/********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
|
||||
|
@ -531,7 +556,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_segments (edit_select.core->win, edit_select.core->gc,
|
||||
select->segs_out, select->num_segs_out);
|
||||
|
||||
/* reset the the current selection */
|
||||
/* reset the current selection */
|
||||
seg = select->segs_in;
|
||||
for (i = 0; i < select->num_segs_in; i++)
|
||||
{
|
||||
|
@ -558,7 +583,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_rectangle (edit_select.core->win,
|
||||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
x2 - x1, y2 - y1);
|
||||
break;
|
||||
|
||||
case LayerTranslate:
|
||||
|
@ -596,7 +621,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_rectangle (edit_select.core->win,
|
||||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
x2 - x1, y2 - y1);
|
||||
break;
|
||||
|
||||
case FloatingSelTranslate:
|
||||
|
@ -789,7 +814,7 @@ edit_sel_arrow_keys_func (Tool *tool,
|
|||
if (inc_x == 0 && inc_y == 0 && mask_inc_x == 0 && mask_inc_y == 0)
|
||||
return;
|
||||
|
||||
undo_push_group_start (gdisp->gimage, MISC_UNDO);
|
||||
undo_push_group_start (gdisp->gimage, LAYER_DISPLACE_UNDO);
|
||||
|
||||
if (mask_inc_x != 0 || mask_inc_y != 0)
|
||||
gimage_mask_translate (gdisp->gimage, mask_inc_x, mask_inc_y);
|
||||
|
|
|
@ -57,6 +57,8 @@ struct _EditSelection
|
|||
gboolean old_scroll_lock; /* old value of scroll lock */
|
||||
gboolean old_auto_snap_to; /* old value of auto snap to */
|
||||
|
||||
gboolean first_move; /* we undo_freeze after the first */
|
||||
|
||||
guint context_id; /* for the statusbar */
|
||||
};
|
||||
|
||||
|
@ -137,6 +139,8 @@ init_edit_selection (Tool *tool,
|
|||
edit_select.old_scroll_lock = tool->scroll_lock;
|
||||
edit_select.old_auto_snap_to = tool->auto_snap_to;
|
||||
|
||||
edit_select.first_move = TRUE;
|
||||
|
||||
/* find the bounding box of the selection mask -
|
||||
* this is used for the case of a MaskToLayerTranslate,
|
||||
* where the translation will result in floating the selection
|
||||
|
@ -150,11 +154,11 @@ init_edit_selection (Tool *tool,
|
|||
|
||||
/* reset the function pointers on the selection tool */
|
||||
tool->button_release_func = edit_selection_button_release;
|
||||
tool->motion_func = edit_selection_motion;
|
||||
tool->control_func = edit_selection_control;
|
||||
tool->cursor_update_func = edit_selection_cursor_update;
|
||||
tool->scroll_lock = EDIT_SELECT_SCROLL_LOCK;
|
||||
tool->auto_snap_to = FALSE;
|
||||
tool->motion_func = edit_selection_motion;
|
||||
tool->control_func = edit_selection_control;
|
||||
tool->cursor_update_func = edit_selection_cursor_update;
|
||||
tool->scroll_lock = EDIT_SELECT_SCROLL_LOCK;
|
||||
tool->auto_snap_to = FALSE;
|
||||
|
||||
/* pause the current selection */
|
||||
selection_pause (gdisp->select);
|
||||
|
@ -284,10 +288,14 @@ edit_selection_button_release (Tool *tool,
|
|||
floating_sel_anchor (layer);
|
||||
}
|
||||
}
|
||||
|
||||
undo_push_group_end (gdisp->gimage);
|
||||
|
||||
#else
|
||||
|
||||
/* thaw the undo again */
|
||||
gimp_image_undo_thaw (gdisp->gimage);
|
||||
|
||||
if (edit_select.cumlx == 0 && edit_select.cumly == 0)
|
||||
{
|
||||
/* The user either didn't actually move the selection,
|
||||
|
@ -310,13 +318,13 @@ edit_selection_button_release (Tool *tool,
|
|||
{
|
||||
paths_transform_xy(gdisp->gimage,edit_select.cumlx,edit_select.cumly);
|
||||
}
|
||||
|
||||
|
||||
undo_push_group_end (gdisp->gimage);
|
||||
|
||||
if (bevent->state & GDK_BUTTON2_MASK) /* OPERATION CANCELLED */
|
||||
if (bevent->state & GDK_BUTTON3_MASK) /* OPERATION CANCELLED */
|
||||
{
|
||||
/* Operation cancelled - undo the undo-group! */
|
||||
undo_pop(gdisp->gimage);
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -347,8 +355,6 @@ edit_selection_motion (Tool *tool,
|
|||
|
||||
edit_selection_snap (gdisp, mevent->x, mevent->y);
|
||||
|
||||
|
||||
|
||||
/**********************************************adam hack*************/
|
||||
/********************************************************************/
|
||||
{
|
||||
|
@ -384,6 +390,11 @@ edit_selection_motion (Tool *tool,
|
|||
x,y,
|
||||
edit_select.x1,edit_select.y1,
|
||||
edit_select.x2,edit_select.y2);*/
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
edit_select.origx = x;
|
||||
edit_select.origy = y;
|
||||
break;
|
||||
|
@ -407,11 +418,22 @@ edit_selection_motion (Tool *tool,
|
|||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case MaskToLayerTranslate:
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
edit_select.edit_type = FloatingSelTranslate;
|
||||
|
||||
edit_select.origx -= edit_select.x1;
|
||||
|
@ -425,6 +447,11 @@ edit_selection_motion (Tool *tool,
|
|||
layer_translate (layer, xoffset, yoffset);
|
||||
floating_sel_rigor (layer, TRUE);
|
||||
|
||||
if (edit_select.first_move)
|
||||
{
|
||||
gimp_image_undo_freeze (gdisp->gimage);
|
||||
edit_select.first_move = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -436,8 +463,6 @@ edit_selection_motion (Tool *tool,
|
|||
}
|
||||
/********************************************************************/
|
||||
/********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
|
||||
|
@ -531,7 +556,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_segments (edit_select.core->win, edit_select.core->gc,
|
||||
select->segs_out, select->num_segs_out);
|
||||
|
||||
/* reset the the current selection */
|
||||
/* reset the current selection */
|
||||
seg = select->segs_in;
|
||||
for (i = 0; i < select->num_segs_in; i++)
|
||||
{
|
||||
|
@ -558,7 +583,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_rectangle (edit_select.core->win,
|
||||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
x2 - x1, y2 - y1);
|
||||
break;
|
||||
|
||||
case LayerTranslate:
|
||||
|
@ -596,7 +621,7 @@ edit_selection_draw (Tool *tool)
|
|||
gdk_draw_rectangle (edit_select.core->win,
|
||||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
x2 - x1, y2 - y1);
|
||||
break;
|
||||
|
||||
case FloatingSelTranslate:
|
||||
|
@ -789,7 +814,7 @@ edit_sel_arrow_keys_func (Tool *tool,
|
|||
if (inc_x == 0 && inc_y == 0 && mask_inc_x == 0 && mask_inc_y == 0)
|
||||
return;
|
||||
|
||||
undo_push_group_start (gdisp->gimage, MISC_UNDO);
|
||||
undo_push_group_start (gdisp->gimage, LAYER_DISPLACE_UNDO);
|
||||
|
||||
if (mask_inc_x != 0 || mask_inc_y != 0)
|
||||
gimage_mask_translate (gdisp->gimage, mask_inc_x, mask_inc_y);
|
||||
|
|
Loading…
Reference in New Issue