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.
This commit is contained in:
Michael Natterer 2012-09-05 23:26:54 +02:00
parent dc00fb57a0
commit d7588ba45c
5 changed files with 37 additions and 9 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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,

View File

@ -53,6 +53,7 @@ typedef struct
GtkWidget *offset;
GtkWidget *area;
GimpItemSet layer_set;
gboolean resize_text_layers;
GimpResizeCallback callback;
gpointer user_data;
} ResizeDialog;
@ -163,6 +164,7 @@ resize_dialog_new (GimpViewable *viewable,
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;
@ -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;

View File

@ -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);