Commit 2ce758b8 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Added nomis' favorite feature ;)

2003-09-17  Michael Natterer  <mitch@gimp.org>

	Added nomis' favorite feature ;)

	* app/paint/gimppaintcore.[ch]: added gimp_paint_core_cancel()
	which can be called instead of gimp_paint_core_finish().
	It simply copies core->undo_tiles back to the drawable instead of
	pushing them to the undo stack.

	* app/tools/gimppainttool.c (gimp_paint_core_button_release): call
	_cancel() instead of _finish() if the right mouse button is
	pressed.
parent 69e11c9a
2003-09-17 Michael Natterer <mitch@gimp.org>
Added nomis' favorite feature ;)
* app/paint/gimppaintcore.[ch]: added gimp_paint_core_cancel()
which can be called instead of gimp_paint_core_finish().
It simply copies core->undo_tiles back to the drawable instead of
pushing them to the undo stack.
* app/tools/gimppainttool.c (gimp_paint_core_button_release): call
_cancel() instead of _finish() if the right mouse button is
pressed.
2003-09-17 Michael Natterer <mitch@gimp.org>
* app/tools/gimpvectortool.[ch]: added "GimpVectorMode saved_mode"
......@@ -496,6 +496,70 @@ gimp_paint_core_finish (GimpPaintCore *core,
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gimage));
}
static void
gimp_paint_core_copy_valid_tiles (TileManager *src_tiles,
TileManager *dest_tiles,
gint x,
gint y,
gint w,
gint h)
{
Tile *src_tile;
gint i, j;
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
{
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
src_tile = tile_manager_get_tile (src_tiles,
j, i, FALSE, FALSE);
if (tile_is_valid (src_tile) == TRUE)
{
src_tile = tile_manager_get_tile (src_tiles,
j, i, TRUE, FALSE);
tile_manager_map_tile (dest_tiles, j, i, src_tile);
tile_release (src_tile, FALSE);
}
}
}
}
void
gimp_paint_core_cancel (GimpPaintCore *core,
GimpDrawable *drawable)
{
GimpImage *gimage;
g_return_if_fail (GIMP_IS_PAINT_CORE (core));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
g_return_if_fail (GIMP_IS_IMAGE (gimage));
/* Determine if any part of the image has been altered--
* if nothing has, then just return...
*/
if ((core->x2 == core->x1) || (core->y2 == core->y1))
return;
gimp_paint_core_copy_valid_tiles (core->undo_tiles,
gimp_drawable_data (drawable),
core->x1, core->y1,
core->x2 - core->x1,
core->y2 - core->y1);
tile_manager_unref (core->undo_tiles);
core->undo_tiles = NULL;
gimp_drawable_update (drawable,
core->x1, core->y1,
core->x2 - core->x1, core->y2 - core->y1);
}
void
gimp_paint_core_cleanup (GimpPaintCore *core)
{
......
......@@ -154,6 +154,8 @@ gboolean gimp_paint_core_start (GimpPaintCore *core,
GimpCoords *coords);
void gimp_paint_core_finish (GimpPaintCore *core,
GimpDrawable *drawable);
void gimp_paint_core_cancel (GimpPaintCore *core,
GimpDrawable *drawable);
void gimp_paint_core_cleanup (GimpPaintCore *core);
void gimp_paint_core_constrain (GimpPaintCore *core);
......
......@@ -463,7 +463,10 @@ gimp_paint_tool_button_release (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->button_release (tool,
coords, time, state, gdisp);
gimp_paint_core_finish (core, drawable);
if (state & GDK_BUTTON3_MASK)
gimp_paint_core_cancel (core, drawable);
else
gimp_paint_core_finish (core, drawable);
gimp_image_flush (gdisp->gimage);
}
......
......@@ -463,7 +463,10 @@ gimp_paint_tool_button_release (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->button_release (tool,
coords, time, state, gdisp);
gimp_paint_core_finish (core, drawable);
if (state & GDK_BUTTON3_MASK)
gimp_paint_core_cancel (core, drawable);
else
gimp_paint_core_finish (core, drawable);
gimp_image_flush (gdisp->gimage);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment