Commit c28bd004 authored by Nate Summers's avatar Nate Summers
Browse files

added an "initialize from selection option to the new channel dialog



 	* app/dialogs/channel-options-dialog.[ch]: added an "initialize from
	selection option to the new channel dialog

 	* app/actions/channels-commands.c
	* app/actions/qmask-commands.c: modified accordingly
parent bbc1c947
......@@ -89,7 +89,8 @@ channels_edit_attributes_cmd_callback (GtkAction *action,
_("Edit Channel Attributes"),
GIMP_HELP_CHANNEL_EDIT,
_("Edit Channel Color"),
_("Fill Opacity:"));
_("Fill Opacity:"),
FALSE);
g_signal_connect (options->dialog, "response",
G_CALLBACK (channels_edit_channel_response),
......@@ -121,7 +122,8 @@ channels_new_cmd_callback (GtkAction *action,
_("New Channel Options"),
GIMP_HELP_CHANNEL_NEW,
_("New Channel Color"),
_("Fill Opacity:"));
_("Fill Opacity:"),
TRUE);
g_signal_connect (options->dialog, "response",
G_CALLBACK (channels_new_channel_response),
......@@ -333,15 +335,30 @@ channels_new_channel_response (GtkWidget *widget,
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&channel_color);
new_channel = gimp_channel_new (options->gimage,
options->gimage->width,
options->gimage->height,
channel_name,
&channel_color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
options->context,
GIMP_TRANSPARENT_FILL);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (options->save_sel_checkbutton)))
{
GimpChannel *selection;
selection = gimp_image_get_mask(options->gimage);
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
GIMP_TYPE_CHANNEL,
FALSE));
gimp_object_set_name (GIMP_OBJECT (new_channel), channel_name);
}
else
{
new_channel = gimp_channel_new (options->gimage,
options->gimage->width,
options->gimage->height,
channel_name,
&channel_color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
options->context,
GIMP_TRANSPARENT_FILL);
}
gimp_image_add_channel (options->gimage, new_channel, -1);
gimp_image_flush (options->gimage);
......
......@@ -109,7 +109,8 @@ qmask_configure_cmd_callback (GtkAction *action,
_("Edit Quick Mask Attributes"),
GIMP_HELP_QMASK_EDIT,
_("Edit Quick Mask Color"),
_("Mask Opacity:"));
_("Mask Opacity:"),
FALSE);
g_signal_connect (options->dialog, "response",
G_CALLBACK (qmask_configure_response),
......
......@@ -109,7 +109,8 @@ qmask_configure_cmd_callback (GtkAction *action,
_("Edit Quick Mask Attributes"),
GIMP_HELP_QMASK_EDIT,
_("Edit Quick Mask Color"),
_("Mask Opacity:"));
_("Mask Opacity:"),
FALSE);
g_signal_connect (options->dialog, "response",
G_CALLBACK (qmask_configure_response),
......
......@@ -60,7 +60,8 @@ channel_options_dialog_new (GimpImage *gimage,
const gchar *desc,
const gchar *help_id,
const gchar *color_label,
const gchar *opacity_label)
const gchar *opacity_label,
gboolean show_from_sel)
{
ChannelOptionsDialog *options;
GimpViewable *viewable;
......@@ -165,6 +166,16 @@ channel_options_dialog_new (GimpImage *gimage,
G_CALLBACK (channel_options_color_changed),
opacity_adj);
if (show_from_sel)
{
options->save_sel_checkbutton = gtk_check_button_new_with_mnemonic (_("_Initialize From Selection"));
gtk_box_pack_start (GTK_BOX (vbox), options->save_sel_checkbutton,
FALSE, FALSE, 0);
gtk_widget_show (options->save_sel_checkbutton);
}
else
options->save_sel_checkbutton = NULL;
return options;
}
......
......@@ -27,6 +27,7 @@ struct _ChannelOptionsDialog
GtkWidget *dialog;
GtkWidget *name_entry;
GtkWidget *color_panel;
GtkWidget *save_sel_checkbutton;
GimpImage *gimage;
GimpContext *context;
......@@ -46,7 +47,8 @@ ChannelOptionsDialog * channel_options_dialog_new (GimpImage *gimage,
const gchar *desc,
const gchar *help_id,
const gchar *color_label,
const gchar *opacity_label);
const gchar *opacity_label,
gboolean show_from_sel);
#endif /* __CHANNEL_OPTIONS_DIALOG_H__ */
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