[gimp] Save the "lock-content" property on layers and channels in the XCF



commit 03d00c5e0f5dabb659d6c04d8d03c3de3aed33dd
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 30 12:44:35 2009 +0200

    Save the "lock-content" property on layers and channels in the XCF
    
    Add XCF property PROP_LOCK_CONTENT and save/load it for all layers and
    channels. Vectors saving needs some refactoring here I'm afraid, so I
    ignored it for now.

 app/xcf/xcf-load.c    |   19 +++++++++++++++++++
 app/xcf/xcf-private.h |    3 ++-
 app/xcf/xcf-save.c    |   17 +++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 52a2d13..4c4c07b 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -668,6 +668,15 @@ xcf_load_layer_props (XcfInfo   *info,
           }
           break;
 
+        case PROP_LOCK_CONTENT:
+          {
+            gboolean lock_content;
+
+            info->cp += xcf_read_int32 (info->fp, (guint32 *) &lock_content, 1);
+            gimp_item_set_lock_content (GIMP_ITEM (layer), lock_content, FALSE);
+          }
+          break;
+
         case PROP_LOCK_ALPHA:
           {
             gboolean lock_alpha;
@@ -843,6 +852,16 @@ xcf_load_channel_props (XcfInfo      *info,
           }
           break;
 
+        case PROP_LOCK_CONTENT:
+          {
+            gboolean lock_content;
+
+            info->cp += xcf_read_int32 (info->fp, (guint32 *) &lock_content, 1);
+            gimp_item_set_lock_content (GIMP_ITEM (*channel),
+                                        lock_content ? TRUE : FALSE, FALSE);
+          }
+          break;
+
         case PROP_SHOW_MASKED:
           {
             gboolean show_masked;
diff --git a/app/xcf/xcf-private.h b/app/xcf/xcf-private.h
index 7129d9c..8fa9161 100644
--- a/app/xcf/xcf-private.h
+++ b/app/xcf/xcf-private.h
@@ -48,7 +48,8 @@ typedef enum
   PROP_USER_UNIT          = 24,
   PROP_VECTORS            = 25,
   PROP_TEXT_LAYER_FLAGS   = 26,
-  PROP_SAMPLE_POINTS      = 27
+  PROP_SAMPLE_POINTS      = 27,
+  PROP_LOCK_CONTENT       = 28
 } PropType;
 
 typedef enum
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 7c9ddb3..010b48c 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -477,6 +477,8 @@ xcf_save_layer_props (XcfInfo    *info,
                                   gimp_item_get_visible (GIMP_ITEM (layer))));
   xcf_check_error (xcf_save_prop (info, image, PROP_LINKED, error,
                                   gimp_item_get_linked (GIMP_ITEM (layer))));
+  xcf_check_error (xcf_save_prop (info, image, PROP_LOCK_CONTENT, error,
+                                  gimp_item_get_lock_content (GIMP_ITEM (layer))));
   xcf_check_error (xcf_save_prop (info, image, PROP_LOCK_ALPHA, error,
                                   gimp_layer_get_lock_alpha (layer)));
 
@@ -561,6 +563,8 @@ xcf_save_channel_props (XcfInfo      *info,
                                   gimp_item_get_visible (GIMP_ITEM (channel))));
   xcf_check_error (xcf_save_prop (info, image, PROP_LINKED, error,
                                   gimp_item_get_linked (GIMP_ITEM (channel))));
+  xcf_check_error (xcf_save_prop (info, image, PROP_LOCK_CONTENT, error,
+                                  gimp_item_get_lock_content (GIMP_ITEM (channel))));
   xcf_check_error (xcf_save_prop (info, image, PROP_SHOW_MASKED, error,
                                   gimp_channel_get_show_masked (channel)));
 
@@ -697,6 +701,19 @@ xcf_save_prop (XcfInfo    *info,
       }
       break;
 
+    case PROP_LOCK_CONTENT:
+      {
+        guint32 lock_content;
+
+        lock_content = 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_content, 1);
+      }
+      break;
+
     case PROP_LOCK_ALPHA:
       {
         guint32 lock_alpha;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]