--- app/gdisplay.c~	Tue May  9 10:37:41 2000
+++ app/gdisplay.c	Sun Jun 18 23:16:11 2000
@@ -205,10 +205,11 @@
 		       gint      title_len)
 {
   GimpImage *gimage;
-  char *image_type_str;
-  int empty;
-  int i;
-  char *format;
+  char      *image_type_str;
+  int        empty;
+  int        i;
+  char      *format;
+  gchar      unit_format[6];
 
   gimage = gdisp->gimage;
 
@@ -233,83 +234,133 @@
   format = image_title_format;
 
   while (i < title_len && *format)
-  {
-    switch (*format) {
-    case '%':
-      format++;
-      switch (*format) {
-      case 0:
-	  g_warning ("image-title-format string ended within %%-sequence");
-	  break;
+    {
+      switch (*format)
+	{
+	case '%':
+	  format++;
+	  switch (*format)
+	    {
+	    case 0:
+	      g_warning ("image-title-format string ended within %%-sequence");
+	      break;
 
-      case '%':
-	  title[i++] = '%';
-	  break;
+	    case '%':
+	      title[i++] = '%';
+	      break;
 
-      case 'f': /* pruned filename */
-	  i += print (title, title_len, i,
-		      "%s", g_basename (gimage_filename (gimage)));
-	  break;
+	    case 'f': /* pruned filename */
+	      i += print (title, title_len, i,
+			  "%s", g_basename (gimage_filename (gimage)));
+	      break;
 
-      case 'F': /* full filename */
-	  i += print (title, title_len, i, "%s", gimage_filename (gimage));
-	  break;
+	    case 'F': /* full filename */
+	      i += print (title, title_len, i, "%s", gimage_filename (gimage));
+	      break;
 
-      case 'p': /* PDB id */
-	  i += print (title, title_len, i, "%d", pdb_image_to_id (gimage));
-	  break;
+	    case 'p': /* PDB id */
+	      i += print (title, title_len, i, "%d", pdb_image_to_id (gimage));
+	      break;
 
-      case 'i': /* instance */
-	  i += print (title, title_len, i, "%d", gdisp->instance);
-	  break;
+	    case 'i': /* instance */
+	      i += print (title, title_len, i, "%d", gdisp->instance);
+	      break;
 
-      case 't': /* type */
-	  i += print (title, title_len, i, "%s", image_type_str);
-	  break;
+	    case 't': /* type */
+	      i += print (title, title_len, i, "%s", image_type_str);
+	      break;
 
-      case 's': /* user source zoom factor */
-	  i += print (title, title_len, i, "%d", SCALESRC (gdisp));
-	  break;
+	    case 's': /* user source zoom factor */
+	      i += print (title, title_len, i, "%d", SCALESRC (gdisp));
+	      break;
 
-      case 'd': /* user destination zoom factor */
-	  i += print (title, title_len, i, "%d", SCALEDEST (gdisp));
-	  break;
+	    case 'd': /* user destination zoom factor */
+	      i += print (title, title_len, i, "%d", SCALEDEST (gdisp));
+	      break;
 
-      case 'z': /* user zoom factor (percentage) */
-	  i += print (title, title_len, i,
-		      "%d", 100 * SCALEDEST (gdisp) / SCALESRC (gdisp));
-	  break;
+	    case 'z': /* user zoom factor (percentage) */
+	      i += print (title, title_len, i,
+			  "%d", 100 * SCALEDEST (gdisp) / SCALESRC (gdisp));
+	      break;
 
-      case 'D': /* dirty flag */
-	  if (format[1] == 0)
-	  {
-	      g_warning("image-title-format string ended within %%D-sequence");
-	      break;
-	  }
-	  if (gimage->dirty)
-	      title[i++] = format[1];
-	  format++;
-	  break;
+	    case 'W': /* width in real-world units */
+	      if (gimage->unit != GIMP_UNIT_PIXEL)
+		{
+		  g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
+			      gimp_unit_get_digits (gimage->unit) + 1);
+		  i += print (title, title_len, i, unit_format,
+			      (gimage->width
+			       * gimp_unit_get_factor (gimage->unit)
+			       / gimage->xresolution));
+		  break;
+		}
+	      /* fallthrough */
+
+	    case 'w': /* width in pixels */
+	      i += print (title, title_len, i, "%d", gimage->width);
+	      break;
+
+	    case 'H': /* height in real-world units */
+	      if (gimage->unit != GIMP_UNIT_PIXEL)
+		{
+		  g_snprintf (unit_format, sizeof (unit_format), "%%.%df",
+			      gimp_unit_get_digits (gimage->unit) + 1);
+		  i += print (title, title_len, i, unit_format,
+			      (gimage->height
+			       * gimp_unit_get_factor (gimage->unit)
+			       / gimage->yresolution));
+		  break;
+		}
+	      /* fallthrough */
+
+	    case 'h': /* height in pixels */
+	      i += print (title, title_len, i, "%d", gimage->height);
+	      break;
+
+	    case 'u': /* unit symbol */
+	      i += print (title, title_len, i, "%s",
+			  gimp_unit_get_symbol (gimage->unit));
+	      break;
+
+	    case 'U': /* unit abbreviation */
+	      i += print (title, title_len, i, "%s",
+			  gimp_unit_get_abbreviation (gimage->unit));
+	      break;
+
+	    case 'D': /* dirty flag */
+	      if (format[1] == 0)
+		{
+		  g_warning ("image-title-format string ended within %%D-sequence");
+		  break;
+		}
+	      if (gimage->dirty)
+		title[i++] = format[1];
+	      format++;
+	      break;
 
-	  /* Other cool things to be added:
-	   * %m = memory used by picture
-	   * some kind of resolution / image size thing
-	   * people seem to want to know the active layer name
-	   */
+	      /* Other cool things to be added:
+	       * %m = memory used by picture
+	       * %l = number of layers (g_slist_length (gimage->layers)
+	       * %L = active layer name (get_layer_name (gimage->active_layer))
+	       * some kind of resolution / image size thing
+	       *
+	       * problem with %l and %L: we would have to update the title
+	       * every time the active layer is changed (even from scripts).
+	       */
 
-      default:
-	  g_warning ("image-title-format contains unknown format sequence '%%%c'", *format);
+	    default:
+	      g_warning ("image-title-format contains unknown format sequence '%%%c'", *format);
+	      break;
+	    }
 	  break;
-      }
-      break;
 
-    default:
-      title[i++] = *format;
-      break;
-    }
+	default:
+	  title[i++] = *format;
+	  break;
+	}
 
-    format++;
-  }
+      format++;
+    }
 
   title[MIN(i, title_len-1)] = 0;
 }
--- gimprc.in~	Mon May  8 03:06:36 2000
+++ gimprc.in	Sun Jun 18 23:04:47 2000
@@ -274,6 +274,12 @@
 #   %z  zoom factor as a percentage
 #   %s  source scale factor
 #   %d  destination scale factor
+#   %w  image width in pixels
+#   %h  image height in pixels
+#   %W  image width in real-world units
+#   %H  image height in real-world units
+#   %u  unit symbol
+#   %U  unit abbreviation
 #   %Dx expands to x if the image is dirty
 # See gimprc(5) for further details.
 (image-title-format "%D*%f-%p.%i (%t) %z%%")
--- gimprc.5.in~	Sat Jan 15 19:13:12 2000
+++ gimprc.5.in	Sun Jun 18 23:21:46 2000
@@ -31,7 +31,10 @@
 .\" Wed Mar  3 13:09:52 MET 1999 Sven Neumann <sven@gimp.org>
 .\"   * reflect the changes that were made to the resolution stuff
 .\"
-.TH GIMPRC 5 "15 Jan 2000" "Version @GIMP_VERSION@"
+.\" Sun Jun 18 19:03:59 MET 2000 Raphael Quinet <quinet@gamers.org>
+.\"   * added new character sequences for the image-title-format
+.\"
+.TH GIMPRC 5 "18 Jun 2000" "Version @GIMP_VERSION@"
 .SH NAME
 gimprc \- gimp configuration file
 .SH DESCRIPTION
@@ -400,6 +403,18 @@
 %s  source scale factor
 .br
 %d  destination scale factor
+.br
+%w  image width in pixels
+.br
+%h  image height in pixels
+.br
+%W  image width in real-world units
+.br
+%H  image height in real-world units
+.br
+%u  unit symbol
+.br
+%U  unit abbreviation
 .br
 %Dx expands to x if the image is dirty, the empty string
 otherwise.  The x can be any character, eg %D*.
