app: add "lock visibility" to the layer,channel,path property dialogs

and make the lock toggles use the same icons as in in the popover in
the dockable dialogs.

Fixes #9306
This commit is contained in:
Michael Natterer 2023-05-26 02:46:53 +02:00
parent b48846c752
commit 58c40a1871
12 changed files with 101 additions and 23 deletions

View File

@ -71,6 +71,7 @@ static void channels_new_callback (GtkWidget *dialog,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
gpointer user_data);
static void channels_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
@ -83,6 +84,7 @@ static void channels_edit_attributes_callback (GtkWidget *dialog,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
gpointer user_data);
@ -130,6 +132,7 @@ channels_edit_attributes_cmd_callback (GimpAction *action,
gimp_item_get_color_tag (item),
gimp_item_get_lock_content (item),
gimp_item_get_lock_position (item),
gimp_item_get_lock_visibility (item),
channels_edit_attributes_callback,
NULL);
@ -175,6 +178,7 @@ channels_new_cmd_callback (GimpAction *action,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
FALSE,
channels_new_callback,
NULL);
@ -615,6 +619,7 @@ channels_new_callback (GtkWidget *dialog,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
gpointer user_data)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
@ -651,6 +656,7 @@ channels_new_callback (GtkWidget *dialog,
gimp_item_set_color_tag (GIMP_ITEM (channel), channel_color_tag, FALSE);
gimp_item_set_lock_content (GIMP_ITEM (channel), channel_lock_content, FALSE);
gimp_item_set_lock_position (GIMP_ITEM (channel), channel_lock_position, FALSE);
gimp_item_set_lock_visibility (GIMP_ITEM (channel), channel_lock_visibility, FALSE);
gimp_image_add_channel (image, channel,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
@ -671,6 +677,7 @@ channels_edit_attributes_callback (GtkWidget *dialog,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
gpointer user_data)
{
GimpItem *item = GIMP_ITEM (channel);
@ -680,7 +687,8 @@ channels_edit_attributes_callback (GtkWidget *dialog,
channel_visible != gimp_item_get_visible (item) ||
channel_color_tag != gimp_item_get_color_tag (item) ||
channel_lock_content != gimp_item_get_lock_content (item) ||
channel_lock_position != gimp_item_get_lock_position (item))
channel_lock_position != gimp_item_get_lock_position (item) ||
channel_lock_visibility != gimp_item_get_lock_visibility (item))
{
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
@ -704,6 +712,9 @@ channels_edit_attributes_callback (GtkWidget *dialog,
if (channel_lock_position != gimp_item_get_lock_position (item))
gimp_item_set_lock_position (item, channel_lock_position, TRUE);
if (channel_lock_visibility != gimp_item_get_lock_visibility (item))
gimp_item_set_lock_visibility (item, channel_lock_visibility, TRUE);
gimp_image_undo_group_end (image);
gimp_image_flush (image);

View File

@ -108,6 +108,7 @@ static void layers_new_callback (GtkWidget *dialog,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_visibility,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data);
@ -130,6 +131,7 @@ static void layers_edit_attributes_callback (GtkWidget *dialog,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_visibility,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data);
@ -294,6 +296,7 @@ layers_edit_attributes_cmd_callback (GimpAction *action,
gimp_item_get_color_tag (item),
gimp_item_get_lock_content (item),
gimp_item_get_lock_position (item),
gimp_item_get_lock_visibility (item),
gimp_layer_get_lock_alpha (layer),
layers_edit_attributes_callback,
NULL);
@ -379,6 +382,7 @@ layers_new_cmd_callback (GimpAction *action,
FALSE,
FALSE,
FALSE,
FALSE,
layers_new_callback,
NULL);
g_free (desc);
@ -2172,6 +2176,7 @@ layers_new_callback (GtkWidget *dialog,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_visibility,
gboolean layer_lock_alpha,
gboolean rename_text_layer, /* unused */
gpointer user_data)
@ -2241,6 +2246,8 @@ layers_new_callback (GtkWidget *dialog,
FALSE);
gimp_item_set_lock_position (GIMP_ITEM (layer), layer_lock_position,
FALSE);
gimp_item_set_lock_visibility (GIMP_ITEM (layer), layer_lock_visibility,
FALSE);
gimp_layer_set_lock_alpha (layer, layer_lock_alpha, FALSE);
gimp_layer_set_blend_space (layer, layer_blend_space, FALSE);
gimp_layer_set_composite_space (layer, layer_composite_space, FALSE);
@ -2285,6 +2292,7 @@ layers_edit_attributes_callback (GtkWidget *dialog,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_visibility,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data)
@ -2303,6 +2311,7 @@ layers_edit_attributes_callback (GtkWidget *dialog,
layer_color_tag != gimp_item_get_color_tag (item) ||
layer_lock_pixels != gimp_item_get_lock_content (item) ||
layer_lock_position != gimp_item_get_lock_position (item) ||
layer_lock_visibility != gimp_item_get_lock_visibility (item) ||
layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
{
gimp_image_undo_group_start (image,
@ -2358,6 +2367,9 @@ layers_edit_attributes_callback (GtkWidget *dialog,
if (layer_lock_position != gimp_item_get_lock_position (item))
gimp_item_set_lock_position (item, layer_lock_position, TRUE);
if (layer_lock_visibility != gimp_item_get_lock_visibility (item))
gimp_item_set_lock_visibility (item, layer_lock_visibility, TRUE);
if (layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
gimp_layer_set_lock_alpha (layer, layer_lock_alpha, TRUE);

View File

@ -58,6 +58,7 @@ static void quick_mask_configure_callback (GtkWidget *dialog,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
gpointer user_data);
@ -137,6 +138,7 @@ quick_mask_configure_cmd_callback (GimpAction *action,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
FALSE,
quick_mask_configure_callback,
NULL);
@ -163,6 +165,7 @@ quick_mask_configure_callback (GtkWidget *dialog,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
gpointer user_data)
{
GimpRGB old_color;

View File

@ -80,6 +80,7 @@ static void vectors_new_callback (GtkWidget *dialog,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gboolean vectors_lock_visibility,
gpointer user_data);
static void vectors_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
@ -90,6 +91,7 @@ static void vectors_edit_attributes_callback (GtkWidget *dialog,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gboolean vectors_lock_visibility,
gpointer user_data);
static void vectors_import_callback (GtkWidget *dialog,
GimpImage *image,
@ -178,6 +180,7 @@ vectors_edit_attributes_cmd_callback (GimpAction *action,
gimp_item_get_color_tag (item),
gimp_item_get_lock_content (item),
gimp_item_get_lock_position (item),
gimp_item_get_lock_visibility (item),
vectors_edit_attributes_callback,
NULL);
@ -219,6 +222,7 @@ vectors_new_cmd_callback (GimpAction *action,
GIMP_COLOR_TAG_NONE,
FALSE,
FALSE,
FALSE,
vectors_new_callback,
NULL);
@ -823,6 +827,7 @@ vectors_new_callback (GtkWidget *dialog,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gboolean vectors_lock_visibility,
gpointer user_data)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
@ -836,6 +841,7 @@ vectors_new_callback (GtkWidget *dialog,
gimp_item_set_color_tag (GIMP_ITEM (vectors), vectors_color_tag, FALSE);
gimp_item_set_lock_content (GIMP_ITEM (vectors), vectors_lock_content, FALSE);
gimp_item_set_lock_position (GIMP_ITEM (vectors), vectors_lock_position, FALSE);
gimp_item_set_lock_visibility (GIMP_ITEM (vectors), vectors_lock_visibility, FALSE);
gimp_image_add_vectors (image, vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
@ -854,6 +860,7 @@ vectors_edit_attributes_callback (GtkWidget *dialog,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gboolean vectors_lock_visibility,
gpointer user_data)
{
GimpItem *item = GIMP_ITEM (vectors);
@ -862,7 +869,8 @@ vectors_edit_attributes_callback (GtkWidget *dialog,
vectors_visible != gimp_item_get_visible (item) ||
vectors_color_tag != gimp_item_get_color_tag (item) ||
vectors_lock_content != gimp_item_get_lock_content (item) ||
vectors_lock_position != gimp_item_get_lock_position (item))
vectors_lock_position != gimp_item_get_lock_position (item) ||
vectors_lock_visibility != gimp_item_get_lock_visibility (item))
{
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
@ -883,6 +891,9 @@ vectors_edit_attributes_callback (GtkWidget *dialog,
if (vectors_lock_position != gimp_item_get_lock_position (item))
gimp_item_set_lock_position (item, vectors_lock_position, TRUE);
if (vectors_lock_visibility != gimp_item_get_lock_visibility (item))
gimp_item_set_lock_visibility (item, vectors_lock_visibility, TRUE);
gimp_image_undo_group_end (image);
gimp_image_flush (image);

View File

@ -62,6 +62,7 @@ static void channel_options_dialog_callback (GtkWidget *dialog,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
gpointer user_data);
static void channel_options_opacity_changed (GtkAdjustment *adjustment,
GimpColorButton *color_button);
@ -90,6 +91,7 @@ channel_options_dialog_new (GimpImage *image,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
GimpChannelOptionsCallback callback,
gpointer user_data)
{
@ -121,14 +123,16 @@ channel_options_dialog_new (GimpImage *image,
parent, title, role,
icon_name, desc, help_id,
channel_name ? _("Channel _name:") : NULL,
GIMP_ICON_TOOL_PAINTBRUSH,
GIMP_ICON_LOCK_CONTENT,
_("Lock _pixels"),
_("Lock position and _size"),
_("Lock visivility"),
channel_name,
channel_visible,
channel_color_tag,
channel_lock_content,
channel_lock_position,
channel_lock_visibility,
channel_options_dialog_callback,
private);
@ -191,6 +195,7 @@ channel_options_dialog_callback (GtkWidget *dialog,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
gpointer user_data)
{
ChannelOptionsDialog *private = user_data;
@ -215,6 +220,7 @@ channel_options_dialog_callback (GtkWidget *dialog,
item_color_tag,
item_lock_content,
item_lock_position,
item_lock_visibility,
private->user_data);
}

View File

@ -30,6 +30,7 @@ typedef void (* GimpChannelOptionsCallback) (GtkWidget *dialog,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
gpointer user_data);
@ -51,6 +52,7 @@ GtkWidget * channel_options_dialog_new (GimpImage *image,
GimpColorTag channel_color_tag,
gboolean channel_lock_content,
gboolean channel_lock_position,
gboolean channel_lock_visibility,
GimpChannelOptionsCallback callback,
gpointer user_data);

View File

@ -51,6 +51,7 @@ struct _ItemOptionsDialog
GimpColorTag color_tag;
gboolean lock_content;
gboolean lock_position;
gboolean lock_visibility;
GimpItemOptionsCallback callback;
gpointer user_data;
@ -91,11 +92,13 @@ item_options_dialog_new (GimpImage *image,
const gchar *lock_content_icon_name,
const gchar *lock_content_label,
const gchar *lock_position_label,
const gchar *lock_visibility_label,
const gchar *item_name,
gboolean item_visible,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
GimpItemOptionsCallback callback,
gpointer user_data)
{
@ -126,6 +129,7 @@ item_options_dialog_new (GimpImage *image,
private->color_tag = item_color_tag;
private->lock_content = item_lock_content;
private->lock_position = item_lock_position;
private->lock_visibility = item_lock_visibility;
private->callback = callback;
private->user_data = user_data;
@ -275,7 +279,7 @@ item_options_dialog_new (GimpImage *image,
&private->lock_content);
button = check_button_with_icon_new (lock_position_label,
GIMP_ICON_TOOL_MOVE,
GIMP_ICON_LOCK_POSITION,
GTK_BOX (private->right_vbox));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
private->lock_position);
@ -285,6 +289,15 @@ item_options_dialog_new (GimpImage *image,
private->lock_position_toggle = button;
button = check_button_with_icon_new (lock_visibility_label,
GIMP_ICON_LOCK_VISIBILITY,
GTK_BOX (private->right_vbox));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
private->lock_visibility);
g_signal_connect (button, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&private->lock_visibility);
return dialog;
}
@ -439,6 +452,7 @@ item_options_dialog_response (GtkWidget *dialog,
private->color_tag,
private->lock_content,
private->lock_position,
private->lock_visibility,
private->user_data);
}
else

View File

@ -28,6 +28,7 @@ typedef void (* GimpItemOptionsCallback) (GtkWidget *dialog,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
gpointer user_data);
@ -44,11 +45,13 @@ GtkWidget * item_options_dialog_new (GimpImage *image,
const gchar *lock_content_icon_name,
const gchar *lock_content_label,
const gchar *lock_position_label,
const gchar *lock_visibility_label,
const gchar *item_name,
gboolean item_visible,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
GimpItemOptionsCallback callback,
gpointer user_data);

View File

@ -83,6 +83,7 @@ static void layer_options_dialog_callback (GtkWidget *dialog,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
gpointer user_data);
static void
layer_options_dialog_update_mode_sensitivity (LayerOptionsDialog *private);
@ -116,6 +117,7 @@ layer_options_dialog_new (GimpImage *image,
GimpColorTag layer_color_tag,
gboolean layer_lock_content,
gboolean layer_lock_position,
gboolean layer_lock_visibility,
gboolean layer_lock_alpha,
GimpLayerOptionsCallback callback,
gpointer user_data)
@ -161,14 +163,16 @@ layer_options_dialog_new (GimpImage *image,
parent, title, role,
icon_name, desc, help_id,
_("Layer _name:"),
GIMP_ICON_TOOL_PAINTBRUSH,
GIMP_ICON_LOCK_CONTENT,
_("Lock _pixels"),
_("Lock position and _size"),
_("Lock visibility"),
layer_name,
layer_visible,
layer_color_tag,
layer_lock_content,
layer_lock_position,
layer_lock_visibility,
layer_options_dialog_callback,
private);
@ -411,7 +415,7 @@ layer_options_dialog_new (GimpImage *image,
G_BINDING_INVERT_BOOLEAN);
button = item_options_dialog_add_switch (dialog,
GIMP_ICON_TRANSPARENCY,
GIMP_ICON_LOCK_ALPHA,
_("Lock _alpha"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
private->lock_alpha);
@ -458,6 +462,7 @@ layer_options_dialog_callback (GtkWidget *dialog,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
gpointer user_data)
{
LayerOptionsDialog *private = user_data;
@ -502,6 +507,7 @@ layer_options_dialog_callback (GtkWidget *dialog,
item_color_tag,
item_lock_content,
item_lock_position,
item_lock_visibility,
private->lock_alpha,
private->rename_text_layers,
private->user_data);

View File

@ -38,6 +38,7 @@ typedef void (* GimpLayerOptionsCallback) (GtkWidget *dialog,
GimpColorTag layer_color_tag,
gboolean layer_lock_content,
gboolean layer_lock_position,
gboolean layer_lock_visibility,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data);
@ -63,6 +64,7 @@ GtkWidget * layer_options_dialog_new (GimpImage *image,
GimpColorTag layer_color_tag,
gboolean layer_lock_content,
gboolean layer_lock_position,
gboolean layer_lock_visibility,
gboolean layer_lock_alpha,
GimpLayerOptionsCallback callback,
gpointer user_data);

View File

@ -56,6 +56,7 @@ static void vectors_options_dialog_callback (GtkWidget *dialog,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
gpointer user_data);
@ -76,6 +77,7 @@ vectors_options_dialog_new (GimpImage *image,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gboolean vectors_lock_visibility,
GimpVectorsOptionsCallback callback,
gpointer user_data)
{
@ -102,14 +104,16 @@ vectors_options_dialog_new (GimpImage *image,
parent, title, role,
icon_name, desc, help_id,
_("Path _name:"),
GIMP_ICON_TOOL_PATH,
GIMP_ICON_LOCK_CONTENT,
_("Lock path _strokes"),
_("Lock path _position"),
_("Lock path _visibility"),
vectors_name,
vectors_visible,
vectors_color_tag,
vectors_lock_content,
vectors_lock_position,
vectors_lock_visibility,
vectors_options_dialog_callback,
private);
@ -138,6 +142,7 @@ vectors_options_dialog_callback (GtkWidget *dialog,
GimpColorTag item_color_tag,
gboolean item_lock_content,
gboolean item_lock_position,
gboolean item_lock_visibility,
gpointer user_data)
{
VectorsOptionsDialog *private = user_data;
@ -151,5 +156,6 @@ vectors_options_dialog_callback (GtkWidget *dialog,
item_color_tag,
item_lock_content,
item_lock_position,
item_lock_visibility,
private->user_data);
}

View File

@ -28,6 +28,7 @@ typedef void (* GimpVectorsOptionsCallback) (GtkWidget *dialog,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gboolean vectors_lock_visibility,
gpointer user_data);
@ -45,6 +46,7 @@ GtkWidget * vectors_options_dialog_new (GimpImage *image,
GimpColorTag vectors_color_tag,
gboolean vectors_lock_content,
gboolean vectors_lock_position,
gboolean vectors_lock_visibility,
GimpVectorsOptionsCallback callback,
gpointer user_data);