Make it possible to refresh the preview of an undo step.

2004-03-20  Simon Budig  <simon@gimp.org>

	* app/core/gimpundo.[ch]: Make it possible to refresh the preview
	of an undo step.

	* app/tools/gimpeditselectiontool.c
	* app/widgets/gimpitemtreeview.c
	* app/widgets/gimplayertreeview.c: refresh the preview when
	compressing undos. This ensures that the last preview in the undo
	history always reflects the current state of the image.
This commit is contained in:
Simon Budig 2004-03-19 23:42:42 +00:00 committed by Simon Budig
parent 8214f17256
commit 5e47b5a0ed
5 changed files with 34 additions and 0 deletions

View file

@ -409,3 +409,19 @@ gimp_undo_create_preview_private (GimpUndo *undo)
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (undo));
}
void
gimp_undo_refresh_preview (GimpUndo *undo)
{
g_return_if_fail (GIMP_IS_UNDO (undo));
if (undo->preview_idle_id)
return;
if (undo->preview)
{
temp_buf_free (undo->preview);
undo->preview = NULL;
gimp_undo_create_preview (undo, FALSE);
}
}

View file

@ -93,6 +93,8 @@ void gimp_undo_free (GimpUndo *undo,
void gimp_undo_create_preview (GimpUndo *undo,
gboolean create_now);
void gimp_undo_refresh_preview (GimpUndo *undo);
#endif /* __GIMP_UNDO_H__ */

View file

@ -1239,6 +1239,7 @@ gimp_edit_selection_tool_arrow_key (GimpTool *tool,
undo = gimp_undo_stack_peek (gdisp->gimage->undo_stack);
/* compress undo */
if (! gimp_undo_stack_peek (gdisp->gimage->redo_stack) &&
GIMP_IS_UNDO_STACK (undo) && undo->undo_type == undo_type)
{
@ -1314,6 +1315,8 @@ gimp_edit_selection_tool_arrow_key (GimpTool *tool,
if (push_undo)
gimp_image_undo_group_end (gdisp->gimage);
else
gimp_undo_refresh_preview (undo);
gimp_image_flush (gdisp->gimage);
}

View file

@ -1493,6 +1493,10 @@ gimp_item_tree_view_toggle_clicked (GtkCellRendererToggle *toggle,
gimp_image_undo_group_end (gimage);
}
else
{
gimp_undo_refresh_preview (undo);
}
}
setter (item, TRUE, FALSE);
@ -1526,6 +1530,9 @@ gimp_item_tree_view_toggle_clicked (GtkCellRendererToggle *toggle,
push_undo = FALSE;
setter (item, ! active, push_undo);
if (!push_undo)
gimp_undo_refresh_preview (undo);
}
gimp_image_flush (gimage);

View file

@ -820,6 +820,9 @@ gimp_layer_tree_view_paint_mode_menu_callback (GtkWidget *widget,
UNBLOCK();
gimp_image_flush (gimage);
if (!push_undo)
gimp_undo_refresh_preview (undo);
}
}
}
@ -886,6 +889,9 @@ gimp_layer_tree_view_opacity_scale_changed (GtkAdjustment *adjustment,
UNBLOCK();
gimp_image_flush (gimage);
if (!push_undo)
gimp_undo_refresh_preview (undo);
}
}
}