app/dialogs/image-merge-layers-dialog.c made them not resizable.

2004-10-23  Michael Natterer  <mitch@gimp.org>

	* app/dialogs/image-merge-layers-dialog.c
	* app/dialogs/layer-add-mask-dialog.c: made them not resizable.

	* app/dialogs/convert-dialog.c
	* app/dialogs/offset-dialog.c: renamed ugly variables.

	* app/dialogs/image-new-dialog.c
	* app/dialogs/stroke-dialog.c: irrelevant pedantic code reordering.
This commit is contained in:
Michael Natterer
2004-10-23 19:01:26 +00:00
committed by Michael Natterer
parent b408ac301e
commit a01c6883f6
7 changed files with 103 additions and 86 deletions

View File

@ -1,3 +1,14 @@
2004-10-23 Michael Natterer <mitch@gimp.org>
* app/dialogs/image-merge-layers-dialog.c
* app/dialogs/layer-add-mask-dialog.c: made them not resizable.
* app/dialogs/convert-dialog.c
* app/dialogs/offset-dialog.c: renamed ugly variables.
* app/dialogs/image-new-dialog.c
* app/dialogs/stroke-dialog.c: irrelevant pedantic code reordering.
2004-10-23 Michael Natterer <mitch@gimp.org> 2004-10-23 Michael Natterer <mitch@gimp.org>
* app/dialogs/Makefile.am * app/dialogs/Makefile.am

View File

@ -46,11 +46,10 @@
typedef struct typedef struct
{ {
GtkWidget *dialog;
GimpImage *gimage; GimpImage *gimage;
GimpProgress *progress; GimpProgress *progress;
GtkWidget *shell;
GimpContext *context; GimpContext *context;
GimpContainer *container; GimpContainer *container;
GimpPalette *custom_palette; GimpPalette *custom_palette;
@ -117,7 +116,7 @@ convert_dialog_new (GimpImage *gimage,
dialog->num_colors = saved_num_colors; dialog->num_colors = saved_num_colors;
dialog->palette_type = saved_palette_type; dialog->palette_type = saved_palette_type;
dialog->shell = dialog->dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("Indexed Color Conversion"), _("Indexed Color Conversion"),
"gimp-image-convert-indexed", "gimp-image-convert-indexed",
@ -132,29 +131,30 @@ convert_dialog_new (GimpImage *gimage,
NULL); NULL);
g_signal_connect (dialog->shell, "response", gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
g_object_weak_ref (G_OBJECT (dialog->dialog),
(GWeakNotify) g_free, dialog);
g_signal_connect (dialog->dialog, "response",
G_CALLBACK (convert_dialog_response), G_CALLBACK (convert_dialog_response),
dialog); dialog);
g_object_weak_ref (G_OBJECT (dialog->shell),
(GWeakNotify) g_free,
dialog);
palette_box = convert_dialog_palette_box (dialog); palette_box = convert_dialog_palette_box (dialog);
if (dialog->context) if (dialog->context)
g_object_weak_ref (G_OBJECT (dialog->shell), g_object_weak_ref (G_OBJECT (dialog->dialog),
(GWeakNotify) g_object_unref, (GWeakNotify) g_object_unref,
dialog->context); dialog->context);
if (dialog->container) if (dialog->container)
g_object_weak_ref (G_OBJECT (dialog->shell), g_object_weak_ref (G_OBJECT (dialog->dialog),
(GWeakNotify) g_object_unref, (GWeakNotify) g_object_unref,
dialog->container); dialog->container);
main_vbox = gtk_vbox_new (FALSE, 12); main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog->shell)->vbox), gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)->vbox),
main_vbox); main_vbox);
gtk_widget_show (main_vbox); gtk_widget_show (main_vbox);
@ -255,7 +255,7 @@ convert_dialog_new (GimpImage *gimage,
G_CALLBACK (gimp_toggle_button_update), G_CALLBACK (gimp_toggle_button_update),
&dialog->alpha_dither); &dialog->alpha_dither);
return dialog->shell; return dialog->dialog;
} }
@ -298,7 +298,7 @@ convert_dialog_response (GtkWidget *widget,
saved_palette = dialog->custom_palette; saved_palette = dialog->custom_palette;
} }
gtk_widget_destroy (dialog->shell); gtk_widget_destroy (dialog->dialog);
} }
static GtkWidget * static GtkWidget *

View File

@ -69,6 +69,8 @@ image_merge_layers_dialog_new (GimpImage *image,
NULL); NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
g_object_weak_ref (G_OBJECT (dialog->dialog), g_object_weak_ref (G_OBJECT (dialog->dialog),
(GWeakNotify) g_free, dialog); (GWeakNotify) g_free, dialog);

View File

@ -103,17 +103,16 @@ image_new_dialog_new (Gimp *gimp)
NULL); NULL);
g_signal_connect (dialog->dialog, "response", gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
G_CALLBACK (image_new_response),
dialog);
g_object_set_data_full (G_OBJECT (dialog->dialog), g_object_set_data_full (G_OBJECT (dialog->dialog),
"gimp-image-new-dialog", dialog, "gimp-image-new-dialog", dialog,
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE); g_signal_connect (dialog->dialog, "response",
G_CALLBACK (image_new_response),
dialog);
/* vbox holding the rest of the dialog */
main_vbox = gtk_vbox_new (FALSE, 12); main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox), gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox),

View File

@ -71,6 +71,8 @@ layer_add_mask_dialog_new (GimpLayer *layer,
NULL); NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
g_object_weak_ref (G_OBJECT (dialog->dialog), g_object_weak_ref (G_OBJECT (dialog->dialog),
(GWeakNotify) g_free, dialog); (GWeakNotify) g_free, dialog);

View File

@ -51,7 +51,7 @@ typedef struct _OffsetDialog OffsetDialog;
struct _OffsetDialog struct _OffsetDialog
{ {
GtkWidget *dlg; GtkWidget *dialog;
GtkWidget *off_se; GtkWidget *off_se;
GimpOffsetType fill_type; GimpOffsetType fill_type;
@ -64,9 +64,9 @@ struct _OffsetDialog
static void offset_response (GtkWidget *widget, static void offset_response (GtkWidget *widget,
gint response_id, gint response_id,
OffsetDialog *off_d); OffsetDialog *dialog);
static void offset_halfheight_callback (GtkWidget *widget, static void offset_halfheight_callback (GtkWidget *widget,
OffsetDialog *off_d); OffsetDialog *dialog);
/* public functions */ /* public functions */
@ -75,7 +75,7 @@ GtkWidget *
offset_dialog_new (GimpDrawable *drawable, offset_dialog_new (GimpDrawable *drawable,
GtkWidget *parent) GtkWidget *parent)
{ {
OffsetDialog *off_d; OffsetDialog *dialog;
GtkWidget *main_vbox; GtkWidget *main_vbox;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
@ -89,10 +89,10 @@ offset_dialog_new (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
off_d = g_new0 (OffsetDialog, 1); dialog = g_new0 (OffsetDialog, 1);
off_d->fill_type = gimp_drawable_has_alpha (drawable) | WRAP_AROUND; dialog->fill_type = gimp_drawable_has_alpha (drawable) | WRAP_AROUND;
off_d->gimage = gimp_item_get_image (GIMP_ITEM (drawable)); dialog->gimage = gimp_item_get_image (GIMP_ITEM (drawable));
if (GIMP_IS_LAYER (drawable)) if (GIMP_IS_LAYER (drawable))
title = _("Offset Layer"); title = _("Offset Layer");
@ -103,30 +103,33 @@ offset_dialog_new (GimpDrawable *drawable,
else else
g_warning ("%s: unexpected drawable type", G_STRFUNC); g_warning ("%s: unexpected drawable type", G_STRFUNC);
off_d->dlg = gimp_viewable_dialog_new (GIMP_VIEWABLE (drawable), dialog->dialog =
_("Offset"), "gimp-drawable-offset", gimp_viewable_dialog_new (GIMP_VIEWABLE (drawable),
GIMP_STOCK_TOOL_MOVE, _("Offset"), "gimp-drawable-offset",
title, GIMP_STOCK_TOOL_MOVE,
parent, title,
gimp_standard_help_func, parent,
GIMP_HELP_LAYER_OFFSET, gimp_standard_help_func,
GIMP_HELP_LAYER_OFFSET,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL); NULL);
gtk_window_set_resizable (GTK_WINDOW (off_d->dlg), FALSE); gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
g_object_weak_ref (G_OBJECT (off_d->dlg), (GWeakNotify) g_free, off_d); g_object_weak_ref (G_OBJECT (dialog->dialog),
(GWeakNotify) g_free, dialog);
g_signal_connect (off_d->dlg, "response", g_signal_connect (dialog->dialog, "response",
G_CALLBACK (offset_response), G_CALLBACK (offset_response),
off_d); dialog);
main_vbox = gtk_vbox_new (FALSE, 12); main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (off_d->dlg)->vbox), main_vbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)->vbox),
main_vbox);
gtk_widget_show (main_vbox); gtk_widget_show (main_vbox);
/* The offset frame */ /* The offset frame */
@ -147,49 +150,49 @@ offset_dialog_new (GimpDrawable *drawable,
1, 2); 1, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10); gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
off_d->off_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a", dialog->off_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
TRUE, TRUE, FALSE, 10, TRUE, TRUE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_SIZE); GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (off_d->off_se), 0, 4); gtk_table_set_col_spacing (GTK_TABLE (dialog->off_se), 0, 4);
gtk_table_set_col_spacing (GTK_TABLE (off_d->off_se), 1, 4); gtk_table_set_col_spacing (GTK_TABLE (dialog->off_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (off_d->off_se), 0, 2); gtk_table_set_row_spacing (GTK_TABLE (dialog->off_se), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (off_d->off_se), gimp_size_entry_add_field (GIMP_SIZE_ENTRY (dialog->off_se),
GTK_SPIN_BUTTON (spinbutton), NULL); GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (off_d->off_se), spinbutton, gtk_table_attach_defaults (GTK_TABLE (dialog->off_se), spinbutton,
1, 2, 0, 1); 1, 2, 0, 1);
gtk_widget_show (spinbutton); gtk_widget_show (spinbutton);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (off_d->off_se), gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (dialog->off_se),
_("_X:"), 0, 0, 0.0); _("_X:"), 0, 0, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (off_d->off_se), gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (dialog->off_se),
_("_Y:"), 1, 0, 0.0); _("_Y:"), 1, 0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox), off_d->off_se, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), dialog->off_se, FALSE, FALSE, 0);
gtk_widget_show (off_d->off_se); gtk_widget_show (dialog->off_se);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (dialog->off_se), GIMP_UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (off_d->off_se), 0, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (dialog->off_se), 0,
off_d->gimage->xresolution, FALSE); dialog->gimage->xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (off_d->off_se), 1, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (dialog->off_se), 1,
off_d->gimage->yresolution, FALSE); dialog->gimage->yresolution, FALSE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (off_d->off_se), 0, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (dialog->off_se), 0,
-off_d->gimage->width, -dialog->gimage->width,
off_d->gimage->width); dialog->gimage->width);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (off_d->off_se), 1, gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (dialog->off_se), 1,
-off_d->gimage->height, -dialog->gimage->height,
off_d->gimage->height); dialog->gimage->height);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (off_d->off_se), 0, gimp_size_entry_set_size (GIMP_SIZE_ENTRY (dialog->off_se), 0,
0, off_d->gimage->width); 0, dialog->gimage->width);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (off_d->off_se), 1, gimp_size_entry_set_size (GIMP_SIZE_ENTRY (dialog->off_se), 1,
0, off_d->gimage->height); 0, dialog->gimage->height);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), 0, 0); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se), 0, 0);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), 1, 0); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se), 1, 0);
button = gtk_button_new_with_mnemonic (_("Offset by x/_2, y/2")); button = gtk_button_new_with_mnemonic (_("Offset by x/_2, y/2"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -197,12 +200,12 @@ offset_dialog_new (GimpDrawable *drawable,
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (offset_halfheight_callback), G_CALLBACK (offset_halfheight_callback),
off_d); dialog);
/* The edge behaviour frame */ /* The edge behaviour frame */
frame = gimp_int_radio_group_new (TRUE, _("Edge Behaviour"), frame = gimp_int_radio_group_new (TRUE, _("Edge Behaviour"),
G_CALLBACK (gimp_radio_button_update), G_CALLBACK (gimp_radio_button_update),
&off_d->fill_type, off_d->fill_type, &dialog->fill_type, dialog->fill_type,
_("_Wrap around"), _("_Wrap around"),
WRAP_AROUND, NULL, WRAP_AROUND, NULL,
@ -220,7 +223,7 @@ offset_dialog_new (GimpDrawable *drawable,
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame); gtk_widget_show (frame);
return off_d->dlg; return dialog->dialog;
} }
@ -229,7 +232,7 @@ offset_dialog_new (GimpDrawable *drawable,
static void static void
offset_response (GtkWidget *widget, offset_response (GtkWidget *widget,
gint response_id, gint response_id,
OffsetDialog *off_d) OffsetDialog *dialog)
{ {
if (response_id == GTK_RESPONSE_OK) if (response_id == GTK_RESPONSE_OK)
{ {
@ -238,37 +241,37 @@ offset_response (GtkWidget *widget,
gint offset_x; gint offset_x;
gint offset_y; gint offset_y;
if ((gimage = off_d->gimage) != NULL) if ((gimage = dialog->gimage) != NULL)
{ {
drawable = gimp_image_active_drawable (gimage); drawable = gimp_image_active_drawable (gimage);
offset_x = offset_x =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (off_d->off_se), RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (dialog->off_se),
0)); 0));
offset_y = offset_y =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (off_d->off_se), RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (dialog->off_se),
1)); 1));
gimp_drawable_offset (drawable, gimp_drawable_offset (drawable,
gimp_get_user_context (gimage->gimp), gimp_get_user_context (gimage->gimp),
off_d->fill_type & WRAP_AROUND ? TRUE : FALSE, dialog->fill_type & WRAP_AROUND ? TRUE : FALSE,
off_d->fill_type & FILL_MASK, dialog->fill_type & FILL_MASK,
offset_x, offset_y); offset_x, offset_y);
gimp_image_flush (gimage); gimp_image_flush (gimage);
} }
} }
gtk_widget_destroy (off_d->dlg); gtk_widget_destroy (dialog->dialog);
} }
static void static void
offset_halfheight_callback (GtkWidget *widget, offset_halfheight_callback (GtkWidget *widget,
OffsetDialog *off_d) OffsetDialog *dialog)
{ {
GimpImage *gimage = off_d->gimage; GimpImage *gimage = dialog->gimage;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se),
0, gimage->width / 2); 0, gimage->width / 2);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (off_d->off_se), gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (dialog->off_se),
1, gimage->height / 2); 1, gimage->height / 2);
} }

View File

@ -112,6 +112,8 @@ stroke_dialog_new (GimpItem *item,
NULL); NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (stroke_dialog_response), G_CALLBACK (stroke_dialog_response),
dialog); dialog);
@ -120,8 +122,6 @@ stroke_dialog_new (GimpItem *item,
g_object_set_data_full (G_OBJECT (dialog), "gimp-stroke-desc", desc, g_object_set_data_full (G_OBJECT (dialog), "gimp-stroke-desc", desc,
(GDestroyNotify) g_object_unref); (GDestroyNotify) g_object_unref);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
main_vbox = gtk_vbox_new (FALSE, 12); main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);