[gimp] Bug 769738 - Add color tags/labels for layers/channels/paths



commit 4f9095798d0911c646589ae3180215c8314abe83
Author: Michael Natterer <mitch gimp org>
Date:   Mon Nov 14 23:02:43 2016 +0100

    Bug 769738 - Add color tags/labels for layers/channels/paths
    
    Forgot to add XCF saving and loading of color tags.

 app/xcf/xcf-load.c    |   18 ++++++++++++++++++
 app/xcf/xcf-private.h |    3 ++-
 app/xcf/xcf-save.c    |   17 +++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 25b71cf..08c6018 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -1019,6 +1019,15 @@ xcf_load_layer_props (XcfInfo    *info,
           }
           break;
 
+        case PROP_COLOR_TAG:
+          {
+            GimpColorTag color_tag;
+
+            info->cp += xcf_read_int32 (info->input, (guint32 *) &color_tag, 1);
+            gimp_item_set_color_tag (GIMP_ITEM (*layer), color_tag, FALSE);
+          }
+          break;
+
         case PROP_LOCK_CONTENT:
           {
             gboolean lock_content;
@@ -1295,6 +1304,15 @@ xcf_load_channel_props (XcfInfo      *info,
           }
           break;
 
+        case PROP_COLOR_TAG:
+          {
+            GimpColorTag color_tag;
+
+            info->cp += xcf_read_int32 (info->input, (guint32 *) &color_tag, 1);
+            gimp_item_set_color_tag (GIMP_ITEM (*channel), color_tag, FALSE);
+          }
+          break;
+
         case PROP_LINKED:
           {
             gboolean linked;
diff --git a/app/xcf/xcf-private.h b/app/xcf/xcf-private.h
index 5653339..cc21d48 100644
--- a/app/xcf/xcf-private.h
+++ b/app/xcf/xcf-private.h
@@ -57,7 +57,8 @@ typedef enum
   PROP_ITEM_PATH          = 30,
   PROP_GROUP_ITEM_FLAGS   = 31,
   PROP_LOCK_POSITION      = 32,
-  PROP_FLOAT_OPACITY      = 33
+  PROP_FLOAT_OPACITY      = 33,
+  PROP_COLOR_TAG          = 34,
 } PropType;
 
 typedef enum
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 8f33568..49c267f 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -500,6 +500,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_COLOR_TAG, error,
+                                  gimp_item_get_color_tag (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,
@@ -596,6 +598,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_COLOR_TAG, error,
+                                  gimp_item_get_color_tag (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_LOCK_POSITION, error,
@@ -757,6 +761,19 @@ xcf_save_prop (XcfInfo    *info,
       }
       break;
 
+    case PROP_COLOR_TAG:
+      {
+        gint32 color_tag;
+
+        color_tag = va_arg (args, gint32);
+        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, &color_tag, 1);
+      }
+      break;
+
     case PROP_LOCK_CONTENT:
       {
         guint32 lock_content;


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