[gimp] Bug 735894 - Option to display the image ICC profile...



commit 53f4dda3b4be25edb4df2592290f7f48f752a830
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 3 22:20:36 2014 +0200

    Bug 735894 - Option to display the image ICC profile...
    
    ...on the title bar and status bar
    
    Implement %o for the title and status format strings, which expands
    to the image profile's label.

 app/config/gimpconfig-dump.c         |    3 ++-
 app/display/gimpdisplayshell-title.c |   30 +++++++++++++++++++++++-------
 2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/app/config/gimpconfig-dump.c b/app/config/gimpconfig-dump.c
index 41b5cb0..38b050f 100644
--- a/app/config/gimpconfig-dump.c
+++ b/app/config/gimpconfig-dump.c
@@ -335,7 +335,8 @@ static const gchar display_format_description[] =
 "%x  the width of the active layer/channel in pixels\n"
 "%X  the width of the active layer/channel in real-world units\n"
 "%y  the height of the active layer/channel in pixels\n"
-"%Y  the height of the active layer/channel in real-world units\n\n";
+"%Y  the height of the active layer/channel in real-world units\n"
+"%o  the name of the image's color profile\n\n";
 
 
 static gchar *
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index 1857cfd..6ff4e3f 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -19,10 +19,13 @@
 
 #include <string.h>
 
+#include <lcms2.h>
+
 #include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
+#include "libgimpcolor/gimpcolor.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "libgimpbase/gimpbase.h"
@@ -36,6 +39,7 @@
 #include "core/gimpcontainer.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpimage.h"
+#include "core/gimpimage-profile.h"
 #include "core/gimpitem.h"
 
 #include "gimpdisplay.h"
@@ -450,23 +454,35 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
                             gimp_item_get_height (GIMP_ITEM (drawable)));
               break;
 
+            case 'o': /* image's color profile name */
+              {
+                GimpColorProfile *profile = gimp_image_get_profile (image, NULL);
+
+                if (! profile)
+                  profile = gimp_lcms_create_srgb_profile ();
+
+                i += print (title, title_len, i, "%s",
+                            gimp_lcms_profile_get_label (profile));
+
+                cmsCloseProfile (profile);
+              }
+              break;
+
             case '\xc3': /* utf-8 extended char */
               {
                 format ++;
                 switch (*format)
                   {
                   case '\xbe':
-                      {
-                        /* line actually written at 23:55 on an Easter Sunday */
-                        i+= print(title, title_len, i, "42");
-                      }
-                      break;
+                    /* line actually written at 23:55 on an Easter Sunday */
+                    i += print (title, title_len, i, "42");
+                    break;
 
                   default:
                     /* in the case of an unhandled utf-8 extended char format
                      * leave the format string parsing as it was
                     */
-                    format --;
+                    format--;
                     break;
                   }
               }
@@ -476,7 +492,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
                * %r = xresolution
                * %R = yresolution
                * %� = image's fractal dimension
-               * # %� = the answer to everything - (implemented)
+               * %� = the answer to everything - (implemented)
                */
 
             default:


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