Commit cbbe4f38 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

don't exchange the text_layer's text object but sync it with the text

2004-03-20  Sven Neumann  <sven@gimp.org>

	* app/core/gimpimage-undo-push.c (undo_pop_text_layer): don't
	exchange the text_layer's text object but sync it with the text
	object from the undo step.

	* app/text/gimptextlayer.c (gimp_text_layer_set): in case the
	layer has a mask, push an undo group around the text modifications.

	* app/tools/gimptexttool.c (gimp_text_tool_idle_apply): push a
	text layer undo before applying the text changes.
parent 5e8b6171
2004-03-20 Sven Neumann <sven@gimp.org>
* app/core/gimpimage-undo-push.c (undo_pop_text_layer): don't
exchange the text_layer's text object but sync it with the text
object from the undo step.
* app/text/gimptextlayer.c (gimp_text_layer_set): in case the
layer has a mask, push an undo group around the text modifications.
* app/tools/gimptexttool.c (gimp_text_tool_idle_apply): push a
text layer undo before applying the text changes.
2004-03-19 Sven Neumann <sven@gimp.org>
* plug-ins/common/spread.c: don't call g_rand_int_range() with
......@@ -1801,7 +1801,10 @@ undo_pop_text_layer (GimpUndo *undo,
text = (layer->text ?
gimp_config_duplicate (GIMP_CONFIG (layer->text)) : NULL);
gimp_text_layer_set_text (layer, tu->text);
if (layer->text)
gimp_config_sync (GIMP_CONFIG (tu->text), GIMP_CONFIG (layer->text), 0);
else
gimp_text_layer_set_text (layer, tu->text);
if (tu->text)
g_object_unref (tu->text);
......
......@@ -40,6 +40,7 @@
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
#include "core/gimpparasitelist.h"
......@@ -479,8 +480,9 @@ gimp_text_layer_set (GimpTextLayer *layer,
const gchar *first_property_name,
...)
{
GimpText *text;
va_list var_args;
GimpImage *image;
GimpText *text;
va_list var_args;
g_return_if_fail (gimp_drawable_is_text_layer ((GimpDrawable *) layer));
......@@ -488,14 +490,24 @@ gimp_text_layer_set (GimpTextLayer *layer,
if (! text)
return;
gimp_image_undo_push_text_layer (gimp_item_get_image (GIMP_ITEM (layer)),
undo_desc, layer);
image = gimp_item_get_image (GIMP_ITEM (layer));
/* If the layer contains a mask,
* gimp_text_layer_render() might have to resize it.
*/
if (GIMP_LAYER (layer)->mask)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TEXT, NULL);
gimp_image_undo_push_text_layer (image, undo_desc, layer);
va_start (var_args, first_property_name);
g_object_set_valist (G_OBJECT (text), first_property_name, var_args);
va_end (var_args);
if (GIMP_LAYER (layer)->mask)
gimp_image_undo_group_end (image);
}
/**
......
......@@ -34,6 +34,7 @@
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimptoolinfo.h"
......@@ -452,9 +453,11 @@ gimp_text_tool_idle_apply (GimpTextTool *text_tool)
static void
gimp_text_tool_apply (GimpTextTool *text_tool)
{
GObject *src;
GObject *dest;
GList *list;
GimpImage *image;
GimpTextLayer *text_layer;
GObject *src;
GObject *dest;
GList *list;
if (text_tool->idle_id)
{
......@@ -465,6 +468,21 @@ gimp_text_tool_apply (GimpTextTool *text_tool)
g_return_if_fail (text_tool->text != NULL);
g_return_if_fail (text_tool->layer != NULL);
image = gimp_item_get_image (GIMP_ITEM (text_tool->layer));
text_layer = GIMP_TEXT_LAYER (text_tool->layer);
g_return_if_fail (text_layer->text == text_tool->text);
gimp_tool_control_set_preserve (GIMP_TOOL (text_tool)->control, TRUE);
/* If the layer contains a mask,
* gimp_text_layer_render() might have to resize it.
*/
if (text_tool->layer->mask)
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TEXT, NULL);
gimp_image_undo_push_text_layer (image, NULL, text_layer);
src = G_OBJECT (text_tool->proxy);
dest = G_OBJECT (text_tool->text);
......@@ -490,13 +508,18 @@ gimp_text_tool_apply (GimpTextTool *text_tool)
g_value_unset (&value);
}
g_list_free (text_tool->pending);
text_tool->pending = NULL;
g_object_thaw_notify (dest);
g_signal_handlers_unblock_by_func (dest,
gimp_text_tool_text_notify, text_tool);
g_list_free (text_tool->pending);
text_tool->pending = NULL;
if (text_tool->layer->mask)
gimp_image_undo_group_end (image);
gimp_tool_control_set_preserve (GIMP_TOOL (text_tool)->control, FALSE);
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (text_tool->layer)));
}
......
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