[gimp] Bug 678358 - Add option to skip text layers when resizing the image
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 678358 - Add option to skip text layers when resizing the image
- Date: Wed, 5 Sep 2012 21:28:28 +0000 (UTC)
commit d7588ba45c8ac1f431c8f7df8b72afd7273b94a3
Author: Michael Natterer <mitch gimp org>
Date: Wed Sep 5 23:26:54 2012 +0200
Bug 678358 - Add option to skip text layers when resizing the image
Add a "Resize text layers" toggle to the canvas size dialog, and
default to FALSE because this seems the desired behavior in most
cases.
app/actions/image-commands.c | 3 +++
app/core/gimpimage-resize.c | 8 +++++++-
app/core/gimpimage-resize.h | 1 +
app/dialogs/resize-dialog.c | 33 +++++++++++++++++++++++++--------
app/dialogs/resize-dialog.h | 1 +
5 files changed, 37 insertions(+), 9 deletions(-)
---
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 27aabcc..83df4fc 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -85,6 +85,7 @@ static void image_resize_callback (GtkWidget *dialog,
gint offset_x,
gint offset_y,
GimpItemSet layer_set,
+ gboolean resize_text_layers,
gpointer data);
static void image_resize_options_free (ImageResizeOptions *options);
@@ -586,6 +587,7 @@ image_resize_callback (GtkWidget *dialog,
gint offset_x,
gint offset_y,
GimpItemSet layer_set,
+ gboolean resize_text_layers,
gpointer data)
{
ImageResizeOptions *options = data;
@@ -612,6 +614,7 @@ image_resize_callback (GtkWidget *dialog,
context,
width, height, offset_x, offset_y,
layer_set,
+ resize_text_layers,
progress);
if (progress)
diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c
index 2ed9df7..3a3c231 100644
--- a/app/core/gimpimage-resize.c
+++ b/app/core/gimpimage-resize.c
@@ -39,6 +39,8 @@
#include "gimpprogress.h"
#include "gimpsamplepoint.h"
+#include "text/gimptextlayer.h"
+
#include "gimp-intl.h"
@@ -53,7 +55,7 @@ gimp_image_resize (GimpImage *image,
{
gimp_image_resize_with_layers (image, context,
new_width, new_height, offset_x, offset_y,
- GIMP_ITEM_SET_NONE,
+ GIMP_ITEM_SET_NONE, TRUE,
progress);
}
@@ -65,6 +67,7 @@ gimp_image_resize_with_layers (GimpImage *image,
gint offset_x,
gint offset_y,
GimpItemSet layer_set,
+ gboolean resize_text_layers,
GimpProgress *progress)
{
GList *list;
@@ -171,6 +174,9 @@ gimp_image_resize_with_layers (GimpImage *image,
if (gimp_viewable_get_children (GIMP_VIEWABLE (item)))
continue;
+ if (! resize_text_layers && gimp_item_is_text_layer (item))
+ continue;
+
gimp_item_get_offset (item, &old_offset_x, &old_offset_y);
gimp_item_resize (item, context,
diff --git a/app/core/gimpimage-resize.h b/app/core/gimpimage-resize.h
index 8912b86..7edd646 100644
--- a/app/core/gimpimage-resize.h
+++ b/app/core/gimpimage-resize.h
@@ -34,6 +34,7 @@ void gimp_image_resize_with_layers (GimpImage *image,
gint offset_x,
gint offset_y,
GimpItemSet layer_set,
+ gboolean resize_text_layers,
GimpProgress *progress);
void gimp_image_resize_to_layers (GimpImage *image,
diff --git a/app/dialogs/resize-dialog.c b/app/dialogs/resize-dialog.c
index 6e92a73..b11b4de 100644
--- a/app/dialogs/resize-dialog.c
+++ b/app/dialogs/resize-dialog.c
@@ -53,6 +53,7 @@ typedef struct
GtkWidget *offset;
GtkWidget *area;
GimpItemSet layer_set;
+ gboolean resize_text_layers;
GimpResizeCallback callback;
gpointer user_data;
} ResizeDialog;
@@ -158,13 +159,14 @@ resize_dialog_new (GimpViewable *viewable,
g_object_weak_ref (G_OBJECT (dialog),
(GWeakNotify) resize_dialog_free, private);
- private->viewable = viewable;
- private->old_width = width;
- private->old_height = height;
- private->old_unit = unit;
- private->layer_set = GIMP_ITEM_SET_NONE;
- private->callback = callback;
- private->user_data = user_data;
+ private->viewable = viewable;
+ private->old_width = width;
+ private->old_height = height;
+ private->old_unit = unit;
+ private->layer_set = GIMP_ITEM_SET_NONE;
+ private->resize_text_layers = FALSE;
+ private->callback = callback;
+ private->user_data = user_data;
gimp_image_get_resolution (image, &xres, &yres);
@@ -288,8 +290,12 @@ resize_dialog_new (GimpViewable *viewable,
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+ gtk_widget_show (vbox);
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new_with_mnemonic (_("Resize _layers:"));
@@ -306,6 +312,16 @@ resize_dialog_new (GimpViewable *viewable,
private->layer_set,
G_CALLBACK (gimp_int_combo_box_get_active),
&private->layer_set);
+
+ button = gtk_check_button_new_with_mnemonic (_("Resize _text layers"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
+ private->resize_text_layers);
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
+ g_signal_connect (button, "toggled",
+ G_CALLBACK (gimp_toggle_button_update),
+ &private->resize_text_layers);
}
return dialog;
@@ -342,6 +358,7 @@ resize_dialog_response (GtkWidget *dialog,
gimp_size_entry_get_refval (entry, 0),
gimp_size_entry_get_refval (entry, 1),
private->layer_set,
+ private->resize_text_layers,
private->user_data);
break;
diff --git a/app/dialogs/resize-dialog.h b/app/dialogs/resize-dialog.h
index 2f15576..be44564 100644
--- a/app/dialogs/resize-dialog.h
+++ b/app/dialogs/resize-dialog.h
@@ -27,6 +27,7 @@ typedef void (* GimpResizeCallback) (GtkWidget *dialog,
gint offset_x,
gint offset_y,
GimpItemSet layer_set,
+ gboolean resize_text_layers,
gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]