[gimp] Add %T which expends to the active drawable's type



commit 13ac22d8005b7fb1cb1eb801c87e47d2849a9968
Author: Michael Natterer <mitch gimp org>
Date:   Tue Sep 8 15:23:57 2009 +0200

    Add %T which expends to the active drawable's type
    
    This is not really generally useful, but I needed it for debugging and
    it doesn't hurt.

 app/display/gimpdisplayshell-title.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index babf493..b38e8e8 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -31,6 +31,7 @@
 #include "config/gimpdisplayconfig.h"
 
 #include "core/gimpcontainer.h"
+#include "core/gimpdrawable.h"
 #include "core/gimpimage.h"
 #include "core/gimpitem.h"
 #include "core/gimpunit.h"
@@ -138,6 +139,17 @@ gimp_display_shell_title_image_type (GimpImage *image)
   return name;
 }
 
+static const gchar *
+gimp_display_shell_title_drawable_type (GimpDrawable *drawable)
+{
+  const gchar *name = "";
+
+  gimp_enum_get_value (GIMP_TYPE_IMAGE_TYPE,
+                       gimp_drawable_type (drawable), NULL, NULL, &name, NULL);
+
+  return name;
+}
+
 static gint print (gchar       *buf,
                    gint         len,
                    gint         start,
@@ -233,11 +245,21 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
               i += print (title, title_len, i, "%d", shell->display->instance);
               break;
 
-            case 't': /* type */
+            case 't': /* image type */
               i += print (title, title_len, i, "%s",
                           gimp_display_shell_title_image_type (image));
               break;
 
+            case 'T': /* drawable type */
+              {
+                GimpDrawable *drawable = gimp_image_get_active_drawable (image);
+
+                if (drawable)
+                  i += print (title, title_len, i, "%s",
+                              gimp_display_shell_title_drawable_type (drawable));
+              }
+              break;
+
             case 's': /* user source zoom factor */
               i += print (title, title_len, i, "%d", denom);
               break;



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