mirror of https://github.com/GNOME/gimp.git
Bug 794469 - Shift-click to create layer/channel/path...
...should really use last values When creating a layer or channel "from last values", really use the values last set be the user in the respective dialogs. In particular, don't use properties of the active layer or channel. I have no idea what we were thinking when adding that obscure logic.
This commit is contained in:
parent
8f07d76786
commit
1b623a99c8
|
@ -182,44 +182,24 @@ channels_new_last_vals_cmd_callback (GtkAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpChannel *new_channel;
|
||||
gint width, height;
|
||||
GimpRGB color;
|
||||
GimpChannel *channel;
|
||||
GimpDialogConfig *config;
|
||||
return_if_no_image (image, data);
|
||||
|
||||
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||
|
||||
if (GIMP_IS_CHANNEL (GIMP_ACTION (action)->viewable))
|
||||
{
|
||||
GimpChannel *template = GIMP_CHANNEL (GIMP_ACTION (action)->viewable);
|
||||
channel = gimp_channel_new (image,
|
||||
gimp_image_get_width (image),
|
||||
gimp_image_get_height (image),
|
||||
config->channel_new_name,
|
||||
&config->channel_new_color);
|
||||
|
||||
width = gimp_item_get_width (GIMP_ITEM (template));
|
||||
height = gimp_item_get_height (GIMP_ITEM (template));
|
||||
color = template->color;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gimp_image_get_width (image);
|
||||
height = gimp_image_get_height (image);
|
||||
color = config->channel_new_color;
|
||||
}
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
_("New Channel"));
|
||||
|
||||
new_channel = gimp_channel_new (image, width, height,
|
||||
config->channel_new_name, &color);
|
||||
|
||||
gimp_drawable_fill (GIMP_DRAWABLE (new_channel),
|
||||
gimp_drawable_fill (GIMP_DRAWABLE (channel),
|
||||
action_data_get_context (data),
|
||||
GIMP_FILL_TRANSPARENT);
|
||||
|
||||
gimp_image_add_channel (image, new_channel,
|
||||
gimp_image_add_channel (image, channel,
|
||||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
|
|
@ -358,11 +358,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
|
|||
{
|
||||
GimpImage *image;
|
||||
GtkWidget *widget;
|
||||
GimpLayer *floating_sel;
|
||||
GimpLayer *new_layer;
|
||||
gint width, height;
|
||||
gint off_x, off_y;
|
||||
gdouble opacity;
|
||||
GimpLayer *layer;
|
||||
GimpDialogConfig *config;
|
||||
|
||||
return_if_no_image (image, data);
|
||||
|
@ -373,48 +369,31 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
|
|||
/* If there is a floating selection, the new command transforms
|
||||
* the current fs into a new layer
|
||||
*/
|
||||
if ((floating_sel = gimp_image_get_floating_selection (image)))
|
||||
if (gimp_image_get_floating_selection (image))
|
||||
{
|
||||
layers_new_cmd_callback (action, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GIMP_IS_LAYER (GIMP_ACTION (action)->viewable))
|
||||
{
|
||||
GimpLayer *template = GIMP_LAYER (GIMP_ACTION (action)->viewable);
|
||||
layer = gimp_layer_new (image,
|
||||
gimp_image_get_width (image),
|
||||
gimp_image_get_height (image),
|
||||
gimp_image_get_layer_format (image, TRUE),
|
||||
config->layer_new_name,
|
||||
config->layer_new_opacity,
|
||||
config->layer_new_mode);
|
||||
|
||||
gimp_item_get_offset (GIMP_ITEM (template), &off_x, &off_y);
|
||||
width = gimp_item_get_width (GIMP_ITEM (template));
|
||||
height = gimp_item_get_height (GIMP_ITEM (template));
|
||||
opacity = gimp_layer_get_opacity (template);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gimp_image_get_width (image);
|
||||
height = gimp_image_get_height (image);
|
||||
off_x = 0;
|
||||
off_y = 0;
|
||||
opacity = 1.0;
|
||||
}
|
||||
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
_("New Layer"));
|
||||
|
||||
new_layer = gimp_layer_new (image, width, height,
|
||||
gimp_image_get_layer_format (image, TRUE),
|
||||
config->layer_new_name,
|
||||
opacity, config->layer_new_mode);
|
||||
|
||||
gimp_drawable_fill (GIMP_DRAWABLE (new_layer),
|
||||
gimp_drawable_fill (GIMP_DRAWABLE (layer),
|
||||
action_data_get_context (data),
|
||||
config->layer_new_fill_type);
|
||||
gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE);
|
||||
|
||||
gimp_image_add_layer (image, new_layer,
|
||||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
gimp_layer_set_blend_space (layer,
|
||||
config->layer_new_blend_space, FALSE);
|
||||
gimp_layer_set_composite_space (layer,
|
||||
config->layer_new_composite_space, FALSE);
|
||||
gimp_layer_set_composite_mode (layer,
|
||||
config->layer_new_composite_mode, FALSE);
|
||||
|
||||
gimp_image_add_layer (image, layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue