[gimp] app: only resize the text layer if the rectangle size has actually changed
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: only resize the text layer if the rectangle size has actually changed
- Date: Fri, 19 Feb 2010 19:15:55 +0000 (UTC)
commit 21e2462b2ca91e6c7ec7fb9e911f255772bda96d
Author: Michael Natterer <mitch gimp org>
Date: Fri Feb 19 11:05:58 2010 +0100
app: only resize the text layer if the rectangle size has actually changed
Like when the user just clicked a handle and didn't actually move it.
app/tools/gimptexttool.c | 51 +++++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 23 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 74ca757..6740727 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -1164,46 +1164,51 @@ gimp_text_tool_rectangle_change_complete (GimpRectangleTool *rect_tool)
if (text_tool->handle_rectangle_change_complete)
{
- GimpText *text = text_tool->text;
GimpItem *item = GIMP_ITEM (text_tool->layer);
gint x1, y1;
gint x2, y2;
- g_object_get (rect_tool,
- "x1", &x1,
- "y1", &y1,
- "x2", &x2,
- "y2", &y2,
- NULL);
-
- text_tool->text_box_fixed = TRUE;
-
- if (! text || ! text->text || (text->text[0] == 0))
+ if (! item)
{
/* we can't set properties for the text layer, because it
* isn't created until some text has been inserted, so we
* need to make a special note that will remind us what to
* do when we actually create the layer
*/
+ text_tool->text_box_fixed = TRUE;
+
return TRUE;
}
- g_object_set (text_tool->proxy,
- "box-mode", GIMP_TEXT_BOX_FIXED,
- "box-width", (gdouble) (x2 - x1),
- "box-height", (gdouble) (y2 - y1),
+ g_object_get (rect_tool,
+ "x1", &x1,
+ "y1", &y1,
+ "x2", &x2,
+ "y2", &y2,
NULL);
- gimp_image_undo_group_start (text_tool->image, GIMP_UNDO_GROUP_TEXT,
- _("Reshape Text Layer"));
+ if (x1 != gimp_item_get_offset_x (item) ||
+ y1 != gimp_item_get_offset_y (item) ||
+ (x2 - x1) != gimp_item_get_width (item) ||
+ (y2 - y1) != gimp_item_get_height (item))
+ {
+ g_object_set (text_tool->proxy,
+ "box-mode", GIMP_TEXT_BOX_FIXED,
+ "box-width", (gdouble) (x2 - x1),
+ "box-height", (gdouble) (y2 - y1),
+ NULL);
- gimp_item_translate (item,
- x1 - gimp_item_get_offset_x (item),
- y1 - gimp_item_get_offset_y (item),
- TRUE);
- gimp_text_tool_apply (text_tool);
+ gimp_image_undo_group_start (text_tool->image, GIMP_UNDO_GROUP_TEXT,
+ _("Reshape Text Layer"));
- gimp_image_undo_group_end (text_tool->image);
+ gimp_item_translate (item,
+ x1 - gimp_item_get_offset_x (item),
+ y1 - gimp_item_get_offset_y (item),
+ TRUE);
+ gimp_text_tool_apply (text_tool);
+
+ gimp_image_undo_group_end (text_tool->image);
+ }
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]