[gimp] Issue #7864: store and load "lock visibility" flag on items.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #7864: store and load "lock visibility" flag on items.
- Date: Tue, 15 Feb 2022 21:08:35 +0000 (UTC)
commit 957b547facdd774498558a537451d6b73ec43005
Author: Jehan <jehan girinstud io>
Date: Tue Feb 15 14:44:11 2022 +0100
Issue #7864: store and load "lock visibility" flag on items.
This was just completely forgotten!
app/xcf/xcf-load.c | 25 +++++++++++++++++++++++++
app/xcf/xcf-private.h | 1 +
app/xcf/xcf-save.c | 17 +++++++++++++++++
devel-docs/specifications/xcf.txt | 19 +++++++++++++++----
4 files changed, 58 insertions(+), 4 deletions(-)
---
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 2a30ba9222..e1bfd5c2ce 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -1438,6 +1438,18 @@ xcf_load_layer_props (XcfInfo *info,
}
break;
+ case PROP_LOCK_VISIBILITY:
+ {
+ gboolean lock_visibility;
+
+ xcf_read_int32 (info, (guint32 *) &lock_visibility, 1);
+
+ if (gimp_item_can_lock_visibility (GIMP_ITEM (*layer)))
+ gimp_item_set_lock_visibility (GIMP_ITEM (*layer),
+ lock_visibility, FALSE);
+ }
+ break;
+
case PROP_APPLY_MASK:
xcf_read_int32 (info, (guint32 *) apply_mask, 1);
break;
@@ -1787,6 +1799,7 @@ xcf_check_layer_props (XcfInfo *info,
case PROP_LOCK_CONTENT:
case PROP_LOCK_ALPHA:
case PROP_LOCK_POSITION:
+ case PROP_LOCK_VISIBILITY:
case PROP_APPLY_MASK:
case PROP_EDIT_MASK:
case PROP_SHOW_MASK:
@@ -1946,6 +1959,18 @@ xcf_load_channel_props (XcfInfo *info,
}
break;
+ case PROP_LOCK_VISIBILITY:
+ {
+ gboolean lock_visibility;
+
+ xcf_read_int32 (info, (guint32 *) &lock_visibility, 1);
+
+ if (gimp_item_can_lock_visibility (GIMP_ITEM (*channel)))
+ gimp_item_set_lock_visibility (GIMP_ITEM (*channel),
+ lock_visibility, FALSE);
+ }
+ break;
+
case PROP_SHOW_MASKED:
{
gboolean show_masked;
diff --git a/app/xcf/xcf-private.h b/app/xcf/xcf-private.h
index f371dac15d..7b8001d98e 100644
--- a/app/xcf/xcf-private.h
+++ b/app/xcf/xcf-private.h
@@ -67,6 +67,7 @@ typedef enum
PROP_SAMPLE_POINTS = 39,
PROP_ITEM_SET = 40,
PROP_ITEM_SET_ITEM = 41,
+ PROP_LOCK_VISIBILITY = 42,
} PropType;
typedef enum
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 56b773788b..e268abe15e 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -549,6 +549,8 @@ xcf_save_layer_props (XcfInfo *info,
gimp_layer_get_lock_alpha (layer)));
xcf_check_error (xcf_save_prop (info, image, PROP_LOCK_POSITION, error,
gimp_item_get_lock_position (GIMP_ITEM (layer))));
+ xcf_check_error (xcf_save_prop (info, image, PROP_LOCK_VISIBILITY, error,
+ gimp_item_get_lock_visibility (GIMP_ITEM (layer))));
if (gimp_layer_get_mask (layer))
{
@@ -668,6 +670,8 @@ xcf_save_channel_props (XcfInfo *info,
gimp_item_get_lock_content (GIMP_ITEM (channel))));
xcf_check_error (xcf_save_prop (info, image, PROP_LOCK_POSITION, error,
gimp_item_get_lock_position (GIMP_ITEM (channel))));
+ xcf_check_error (xcf_save_prop (info, image, PROP_LOCK_VISIBILITY, error,
+ gimp_item_get_lock_visibility (GIMP_ITEM (channel))));
xcf_check_error (xcf_save_prop (info, image, PROP_SHOW_MASKED, error,
gimp_channel_get_show_masked (channel)));
xcf_check_error (xcf_save_prop (info, image, PROP_COLOR, error,
@@ -957,6 +961,19 @@ xcf_save_prop (XcfInfo *info,
}
break;
+ case PROP_LOCK_VISIBILITY:
+ {
+ guint32 lock_visibility = va_arg (args, guint32);
+
+ size = 4;
+
+ xcf_write_prop_type_check_error (info, prop_type);
+ xcf_write_int32_check_error (info, &size, 1);
+
+ xcf_write_int32_check_error (info, &lock_visibility, 1);
+ }
+ break;
+
case PROP_APPLY_MASK:
{
guint32 apply_mask = va_arg (args, guint32);
diff --git a/devel-docs/specifications/xcf.txt b/devel-docs/specifications/xcf.txt
index faf5125a02..9b17f92739 100644
--- a/devel-docs/specifications/xcf.txt
+++ b/devel-docs/specifications/xcf.txt
@@ -670,6 +670,15 @@ PROP_LOCK_POSITION (since GIMP 2.10.0, commit d4933b30526, editing state)
PROP_LOCK_POSITION specifies whether the layer, channel or path's
position is locked, i.e. cannot be transformed (translation, etc.).
+PROP_LOCK_VISIBILITY (since version 3, editing state)
+ uint32 42 Type identification
+ uint32 4 Four bytes of payload
+ uint32 locked 1 if visibility is locked; 0 if not
+
+ PROP_LOCK_VISIBILITY prevents the visibility to be switched (either
+ explicitly for the item or when using features changing visibility to
+ a range of items).
+
PROP_OPACITY (essential)
uint32 6 Type identification
uint32 4 Four bytes of payload
@@ -1109,8 +1118,9 @@ Channel properties
The following properties are found only in the property list of
channel structures. Additionally the list can also contain the
properties: PROP_COLOR_TAG, PROP_END, PROP_FLOAT_OPACITY, PROP_LINKED,
-PROP_LOCK_CONTENT, PROP_LOCK_POSITION, PROP_OPACITY, PROP_PARASITES,
-PROP_TATTOO and PROP_VISIBLE, defined in chapter 2.
+PROP_LOCK_CONTENT, PROP_LOCK_POSITION, PROP_LOCK_VISIBILITY,
+PROP_OPACITY, PROP_PARASITES, PROP_TATTOO and PROP_VISIBLE, defined in
+chapter 2.
PROP_ACTIVE_CHANNEL (editing state)
uint32 3 Type identification
@@ -1205,8 +1215,9 @@ Layer properties
The following properties are found only in the property list of layer
structures. Additionally the list can also contain the properties:
PROP_COLOR_TAG, PROP_END, PROP_FLOAT_OPACITY, PROP_LINKED,
-PROP_LOCK_CONTENT, PROP_LOCK_POSITION, PROP_OPACITY, PROP_PARASITES,
-PROP_TATTOO and PROP_VISIBLE, defined in chapter 2.
+PROP_LOCK_CONTENT, PROP_LOCK_POSITION, PROP_LOCK_VISIBILITY,
+PROP_OPACITY, PROP_PARASITES, PROP_TATTOO and PROP_VISIBLE, defined in
+chapter 2.
PROP_ACTIVE_LAYER (editing state)
uint32 2 Type identification
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]