mirror of https://github.com/GNOME/gimp.git
app: remove definitions of gimp_image_[gs]et_active_(layer|channel|vectors).
These are not used anymore anywhere in our codebase! I'm sure some issues still
exist in various places, yet we can now consider that the multi-item awareness
project is finally over! Wouhou! 🥳
One big question which remains is whether I want to get back to the old naming
of "active" items, rather than "selected" items. The main reason to change the
wording globally was to be able to easily find remnants of non-multi-item aware
code. Now that it's all gone, I could very simply revert to the old naming.
This is in particular a big question for the public API for plug-ins, as the
"active" wording has been used for decades litterally. The only difference now
with how it used to be is that we could have several active items at once.
This commit is contained in:
parent
06413174ee
commit
71605b092c
|
@ -4680,99 +4680,6 @@ gimp_image_get_vectors_list (GimpImage *image)
|
|||
|
||||
/* active drawable, layer, channel, vectors */
|
||||
|
||||
GimpLayer *
|
||||
gimp_image_get_active_layer (GimpImage *image)
|
||||
{
|
||||
GList *layers;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
layers = gimp_image_get_selected_layers (image);
|
||||
if (g_list_length (layers) == 1)
|
||||
return layers->data;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GimpChannel *
|
||||
gimp_image_get_active_channel (GimpImage *image)
|
||||
{
|
||||
GimpImagePrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
private = GIMP_IMAGE_GET_PRIVATE (image);
|
||||
|
||||
return GIMP_CHANNEL (gimp_item_tree_get_active_item (private->channels));
|
||||
}
|
||||
|
||||
GimpVectors *
|
||||
gimp_image_get_active_vectors (GimpImage *image)
|
||||
{
|
||||
GimpImagePrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
private = GIMP_IMAGE_GET_PRIVATE (image);
|
||||
|
||||
return GIMP_VECTORS (gimp_item_tree_get_active_item (private->vectors));
|
||||
}
|
||||
|
||||
GimpLayer *
|
||||
gimp_image_set_active_layer (GimpImage *image,
|
||||
GimpLayer *layer)
|
||||
{
|
||||
GList *layers = NULL;
|
||||
GimpLayer *active_layer;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (layer == NULL || GIMP_IS_LAYER (layer), NULL);
|
||||
g_return_val_if_fail (layer == NULL ||
|
||||
(gimp_item_is_attached (GIMP_ITEM (layer)) &&
|
||||
gimp_item_get_image (GIMP_ITEM (layer)) == image),
|
||||
NULL);
|
||||
if (layer)
|
||||
layers = g_list_prepend (NULL, layer);
|
||||
|
||||
gimp_image_set_selected_layers (image, layers);
|
||||
g_list_free (layers);
|
||||
|
||||
layers = gimp_image_get_selected_layers (image);
|
||||
active_layer = g_list_length (layers) == 1 ? layers->data : NULL;
|
||||
|
||||
return active_layer;
|
||||
}
|
||||
|
||||
GimpChannel *
|
||||
gimp_image_set_active_channel (GimpImage *image,
|
||||
GimpChannel *channel)
|
||||
{
|
||||
GimpChannel *active_channel;
|
||||
GList *channels = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (channel == NULL || GIMP_IS_CHANNEL (channel), NULL);
|
||||
g_return_val_if_fail (channel == NULL ||
|
||||
(gimp_item_is_attached (GIMP_ITEM (channel)) &&
|
||||
gimp_item_get_image (GIMP_ITEM (channel)) == image),
|
||||
NULL);
|
||||
|
||||
/* Not if there is a floating selection */
|
||||
if (channel && gimp_image_get_floating_selection (image))
|
||||
return NULL;
|
||||
|
||||
if (channel)
|
||||
channels = g_list_prepend (NULL, channel);
|
||||
|
||||
gimp_image_set_selected_channels (image, channels);
|
||||
g_list_free (channels);
|
||||
|
||||
channels = gimp_image_get_selected_channels (image);
|
||||
active_channel = g_list_length (channels) == 1 ? channels->data : NULL;
|
||||
|
||||
return active_channel;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_unset_selected_channels (GimpImage *image)
|
||||
{
|
||||
|
@ -4794,31 +4701,6 @@ gimp_image_unset_selected_channels (GimpImage *image)
|
|||
}
|
||||
}
|
||||
|
||||
GimpVectors *
|
||||
gimp_image_set_active_vectors (GimpImage *image,
|
||||
GimpVectors *vectors)
|
||||
{
|
||||
GList *all_vectors = NULL;
|
||||
GimpVectors *active_vectors;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (vectors == NULL || GIMP_IS_VECTORS (vectors), NULL);
|
||||
g_return_val_if_fail (vectors == NULL ||
|
||||
(gimp_item_is_attached (GIMP_ITEM (vectors)) &&
|
||||
gimp_item_get_image (GIMP_ITEM (vectors)) == image),
|
||||
NULL);
|
||||
if (vectors)
|
||||
all_vectors = g_list_prepend (NULL, vectors);
|
||||
|
||||
gimp_image_set_selected_vectors (image, all_vectors);
|
||||
g_list_free (all_vectors);
|
||||
|
||||
all_vectors = gimp_image_get_selected_vectors (image);
|
||||
active_vectors = (g_list_length (all_vectors) == 1 ? all_vectors->data : NULL);
|
||||
|
||||
return active_vectors;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_image_is_selected_drawable:
|
||||
* @image:
|
||||
|
@ -6038,6 +5920,7 @@ gimp_image_add_vectors (GimpImage *image,
|
|||
gboolean push_undo)
|
||||
{
|
||||
GimpImagePrivate *private;
|
||||
GList *list = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
|
||||
|
@ -6059,7 +5942,12 @@ gimp_image_add_vectors (GimpImage *image,
|
|||
gimp_item_tree_add_item (private->vectors, GIMP_ITEM (vectors),
|
||||
GIMP_ITEM (parent), position);
|
||||
|
||||
gimp_image_set_active_vectors (image, vectors);
|
||||
if (vectors != NULL)
|
||||
list = g_list_prepend (NULL, vectors);
|
||||
|
||||
gimp_image_set_selected_vectors (image, list);
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -372,17 +372,7 @@ GList * gimp_image_get_layer_list (GimpImage *image);
|
|||
GList * gimp_image_get_channel_list (GimpImage *image);
|
||||
GList * gimp_image_get_vectors_list (GimpImage *image);
|
||||
|
||||
GimpLayer * gimp_image_get_active_layer (GimpImage *image);
|
||||
GimpChannel * gimp_image_get_active_channel (GimpImage *image);
|
||||
GimpVectors * gimp_image_get_active_vectors (GimpImage *image);
|
||||
|
||||
GimpLayer * gimp_image_set_active_layer (GimpImage *image,
|
||||
GimpLayer *layer);
|
||||
GimpChannel * gimp_image_set_active_channel (GimpImage *image,
|
||||
GimpChannel *channel);
|
||||
void gimp_image_unset_selected_channels (GimpImage *image);
|
||||
GimpVectors * gimp_image_set_active_vectors (GimpImage *image,
|
||||
GimpVectors *vectors);
|
||||
|
||||
gboolean gimp_image_is_selected_drawable (GimpImage *image,
|
||||
GimpDrawable *drawable);
|
||||
|
|
|
@ -471,7 +471,12 @@ gimp_vector_tool_path_changed (GimpToolWidget *path,
|
|||
gimp_vector_tool_set_vectors (vector_tool, vectors);
|
||||
|
||||
if (vectors)
|
||||
gimp_image_set_active_vectors (image, vectors);
|
||||
{
|
||||
GList *list = g_list_prepend (NULL, vectors);
|
||||
|
||||
gimp_image_set_selected_vectors (image, list);
|
||||
g_list_free (list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3594,7 +3594,11 @@ xcf_load_old_paths (XcfInfo *info,
|
|||
last_selected_row));
|
||||
|
||||
if (active_vectors)
|
||||
gimp_image_set_active_vectors (image, active_vectors);
|
||||
{
|
||||
GList *list = g_list_prepend (NULL, active_vectors);
|
||||
gimp_image_set_selected_vectors (image, list);
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3741,7 +3745,11 @@ xcf_load_old_vectors (XcfInfo *info,
|
|||
active_index));
|
||||
|
||||
if (active_vectors)
|
||||
gimp_image_set_active_vectors (image, active_vectors);
|
||||
{
|
||||
GList *list = g_list_prepend (NULL, active_vectors);
|
||||
gimp_image_set_selected_vectors (image, list);
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
#ifdef GIMP_XCF_PATH_DEBUG
|
||||
g_printerr ("xcf_load_old_vectors: loaded %d bytes\n", info->cp - base);
|
||||
|
|
Loading…
Reference in New Issue