gdisplay_format_title now parses a format string set by the user to

Sat Feb  6 18:16:57 GMT 1999  Austin Donnelly  <austin@gimp.org>

	* app/gdisplay.c: gdisplay_format_title now parses a format string
	      set by the user to control what goes in the image window
	      titles.
	* app/gdisplay.h: gdisplay_update_title() prototype.
	* app/gimprc.c
	* app/gimprc.h: image-title-format added.
	* app/scale.c: update a display's title when zooming in/out

	* gimprc.in: sample image-title-format setting
This commit is contained in:
GMT 1999 Austin Donnelly 1999-02-06 18:31:33 +00:00 committed by Austin Donnelly
parent 21b8bcded7
commit 5d92f178c0
14 changed files with 442 additions and 102 deletions

View File

@ -1,3 +1,15 @@
Sat Feb 6 18:16:57 GMT 1999 Austin Donnelly <austin@gimp.org>
* app/gdisplay.c: gdisplay_format_title now parses a format string
set by the user to control what goes in the image window
titles.
* app/gdisplay.h: gdisplay_update_title() prototype.
* app/gimprc.c
* app/gimprc.h: image-title-format added.
* app/scale.c: update a display's title when zooming in/out
* gimprc.in: sample image-title-format setting
Sat Feb 6 16:22:36 GMT 1999 Andy Thomas <alt@picnic.demon.co.uk>
Changed:-

View File

@ -58,7 +58,7 @@ static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
/* Local functions */
static void gdisplay_format_title (GimpImage *, char *);
static void gdisplay_format_title (GDisplay *, char *, int);
static void gdisplay_delete (GDisplay *);
static GSList * gdisplay_free_area_list (GSList *);
static GSList * gdisplay_process_area_list(GSList *, GArea *);
@ -80,19 +80,11 @@ gdisplay_new (GimpImage *gimage,
{
GDisplay *gdisp;
char title [MAX_TITLE_BUF];
int instance;
/* If there isn't an interface, never create a gdisplay */
if (no_interface)
return NULL;
/* format the title */
gdisplay_format_title (gimage, title);
instance = gimage->instance_count;
gimage->instance_count++;
gimage->ref_count++;
/*
* Set all GDisplay parameters...
*/
@ -106,7 +98,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->depth = g_visual->depth;
gdisp->select = NULL;
gdisp->ID = display_num++;
gdisp->instance = instance;
gdisp->instance = gimage->instance_count;
gdisp->update_areas = NULL;
gdisp->display_areas = NULL;
gdisp->disp_xoffset = 0;
@ -127,6 +119,9 @@ gdisplay_new (GimpImage *gimage,
gdisp->idle_render.update_areas = NULL;
gdisp->idle_render.active = FALSE;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
/* add the new display to the list so that it isn't lost */
display_list = g_slist_append (display_list, (void *) gdisp);
@ -147,16 +142,45 @@ gdisplay_new (GimpImage *gimage,
/* set the current tool cursor */
gdisplay_install_tool_cursor (gdisp, default_gdisplay_cursor);
gimage->instance_count++;
gimage->ref_count++;
return gdisp;
}
static void
gdisplay_format_title (GimpImage *gimage,
char *title)
static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5);
static int
print (char *buf, int len, int start, const char *fmt, ...)
{
va_list args;
int printed;
va_start (args, fmt);
printed = g_vsnprintf (buf + start, len - start, fmt, args);
if (printed < 0)
printed = len - start;
va_end (args);
return printed;
}
static void
gdisplay_format_title (GDisplay *gdisp,
char *title,
int title_len)
{
GimpImage *gimage;
char *image_type_str;
int empty;
int i;
char *format;
gimage = gdisp->gimage;
empty = gimage_is_empty (gimage);
@ -175,11 +199,78 @@ gdisplay_format_title (GimpImage *gimage,
image_type_str = NULL;
}
g_snprintf (title, MAX_TITLE_BUF, "%s-%d.%d (%s)",
prune_filename (gimage_filename (gimage)),
pdb_image_to_id (gimage),
gimage->instance_count,
image_type_str);
i = 0;
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;
case '%':
title[i++] = '%';
break;
case 'f': /* pruned filename */
i += print (title, title_len, i,
"%s", prune_filename (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 '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 '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 'z': /* user zoom factor (percentage) */
i += print (title, title_len, i,
"%d", 100 * SCALEDEST (gdisp) / SCALESRC (gdisp));
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
*/
default:
g_warning (_("image-title-format contains unknown format sequence '%%%c'"), *format);
break;
}
break;
default:
title[i++] = *format;
break;
}
format++;
}
title[MIN(i, title_len)] = 0;
}
@ -1562,28 +1653,35 @@ gdisplay_get_ID (int ID)
}
void
gdisplay_update_title (GDisplay *gdisp)
{
char title [MAX_TITLE_BUF];
guint context_id;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
gdk_window_set_title (gdisp->shell->window, title);
/* update the statusbar */
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
}
void
gdisplays_update_title (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list = display_list;
char title [MAX_TITLE_BUF];
guint context_id;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
{
/* format the title */
gdisplay_format_title (gdisp->gimage, title);
gdk_window_set_title (gdisp->shell->window, title);
/* update the statusbar */
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
}
gdisplay_update_title (gdisp);
list = g_slist_next (list);
}
@ -1600,9 +1698,7 @@ gdisplays_resize_cursor_label (GimpImage *gimage)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
{
gdisplay_resize_cursor_label(gdisp);
}
list = g_slist_next (list);
}
@ -1902,7 +1998,6 @@ gdisplay_hash (GDisplay *display)
void
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
{
char title [MAX_TITLE_BUF];
int instance;
if (gdisp->idle_render.active)
@ -1920,7 +2015,6 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
gdisp->gimage = gimage;
gdisp->instance = instance;
gdisplay_format_title (gimage, title);
gdisplays_update_title (gimage);
gdisplay_expose_full (gdisp);

View File

@ -183,6 +183,7 @@ void gdisplay_resize_cursor_label (GDisplay *);
GDisplay * gdisplay_active (void);
GDisplay * gdisplay_get_ID (int);
void gdisplay_update_title (GDisplay*);
void gdisplays_update_title (GimpImage*);
void gdisplays_resize_cursor_label (GimpImage*);
void gdisplays_update_area (GimpImage*, int, int, int, int);

View File

@ -155,6 +155,9 @@ change_scale (GDisplay *gdisp,
resize_display (gdisp, allow_resize_windows, TRUE);
}
/* title may have changed if it includes the zoom ratio */
gdisplay_update_title (gdisp);
}

View File

@ -58,7 +58,7 @@ static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
/* Local functions */
static void gdisplay_format_title (GimpImage *, char *);
static void gdisplay_format_title (GDisplay *, char *, int);
static void gdisplay_delete (GDisplay *);
static GSList * gdisplay_free_area_list (GSList *);
static GSList * gdisplay_process_area_list(GSList *, GArea *);
@ -80,19 +80,11 @@ gdisplay_new (GimpImage *gimage,
{
GDisplay *gdisp;
char title [MAX_TITLE_BUF];
int instance;
/* If there isn't an interface, never create a gdisplay */
if (no_interface)
return NULL;
/* format the title */
gdisplay_format_title (gimage, title);
instance = gimage->instance_count;
gimage->instance_count++;
gimage->ref_count++;
/*
* Set all GDisplay parameters...
*/
@ -106,7 +98,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->depth = g_visual->depth;
gdisp->select = NULL;
gdisp->ID = display_num++;
gdisp->instance = instance;
gdisp->instance = gimage->instance_count;
gdisp->update_areas = NULL;
gdisp->display_areas = NULL;
gdisp->disp_xoffset = 0;
@ -127,6 +119,9 @@ gdisplay_new (GimpImage *gimage,
gdisp->idle_render.update_areas = NULL;
gdisp->idle_render.active = FALSE;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
/* add the new display to the list so that it isn't lost */
display_list = g_slist_append (display_list, (void *) gdisp);
@ -147,16 +142,45 @@ gdisplay_new (GimpImage *gimage,
/* set the current tool cursor */
gdisplay_install_tool_cursor (gdisp, default_gdisplay_cursor);
gimage->instance_count++;
gimage->ref_count++;
return gdisp;
}
static void
gdisplay_format_title (GimpImage *gimage,
char *title)
static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5);
static int
print (char *buf, int len, int start, const char *fmt, ...)
{
va_list args;
int printed;
va_start (args, fmt);
printed = g_vsnprintf (buf + start, len - start, fmt, args);
if (printed < 0)
printed = len - start;
va_end (args);
return printed;
}
static void
gdisplay_format_title (GDisplay *gdisp,
char *title,
int title_len)
{
GimpImage *gimage;
char *image_type_str;
int empty;
int i;
char *format;
gimage = gdisp->gimage;
empty = gimage_is_empty (gimage);
@ -175,11 +199,78 @@ gdisplay_format_title (GimpImage *gimage,
image_type_str = NULL;
}
g_snprintf (title, MAX_TITLE_BUF, "%s-%d.%d (%s)",
prune_filename (gimage_filename (gimage)),
pdb_image_to_id (gimage),
gimage->instance_count,
image_type_str);
i = 0;
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;
case '%':
title[i++] = '%';
break;
case 'f': /* pruned filename */
i += print (title, title_len, i,
"%s", prune_filename (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 '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 '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 'z': /* user zoom factor (percentage) */
i += print (title, title_len, i,
"%d", 100 * SCALEDEST (gdisp) / SCALESRC (gdisp));
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
*/
default:
g_warning (_("image-title-format contains unknown format sequence '%%%c'"), *format);
break;
}
break;
default:
title[i++] = *format;
break;
}
format++;
}
title[MIN(i, title_len)] = 0;
}
@ -1562,28 +1653,35 @@ gdisplay_get_ID (int ID)
}
void
gdisplay_update_title (GDisplay *gdisp)
{
char title [MAX_TITLE_BUF];
guint context_id;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
gdk_window_set_title (gdisp->shell->window, title);
/* update the statusbar */
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
}
void
gdisplays_update_title (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list = display_list;
char title [MAX_TITLE_BUF];
guint context_id;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
{
/* format the title */
gdisplay_format_title (gdisp->gimage, title);
gdk_window_set_title (gdisp->shell->window, title);
/* update the statusbar */
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
}
gdisplay_update_title (gdisp);
list = g_slist_next (list);
}
@ -1600,9 +1698,7 @@ gdisplays_resize_cursor_label (GimpImage *gimage)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
{
gdisplay_resize_cursor_label(gdisp);
}
list = g_slist_next (list);
}
@ -1902,7 +1998,6 @@ gdisplay_hash (GDisplay *display)
void
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
{
char title [MAX_TITLE_BUF];
int instance;
if (gdisp->idle_render.active)
@ -1920,7 +2015,6 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
gdisp->gimage = gimage;
gdisp->instance = instance;
gdisplay_format_title (gimage, title);
gdisplays_update_title (gimage);
gdisplay_expose_full (gdisp);

View File

@ -183,6 +183,7 @@ void gdisplay_resize_cursor_label (GDisplay *);
GDisplay * gdisplay_active (void);
GDisplay * gdisplay_get_ID (int);
void gdisplay_update_title (GDisplay*);
void gdisplays_update_title (GimpImage*);
void gdisplays_resize_cursor_label (GimpImage*);
void gdisplays_update_area (GimpImage*, int, int, int, int);

View File

@ -155,6 +155,9 @@ change_scale (GDisplay *gdisp,
resize_display (gdisp, allow_resize_windows, TRUE);
}
/* title may have changed if it includes the zoom ratio */
gdisplay_update_title (gdisp);
}

View File

@ -58,7 +58,7 @@ static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
/* Local functions */
static void gdisplay_format_title (GimpImage *, char *);
static void gdisplay_format_title (GDisplay *, char *, int);
static void gdisplay_delete (GDisplay *);
static GSList * gdisplay_free_area_list (GSList *);
static GSList * gdisplay_process_area_list(GSList *, GArea *);
@ -80,19 +80,11 @@ gdisplay_new (GimpImage *gimage,
{
GDisplay *gdisp;
char title [MAX_TITLE_BUF];
int instance;
/* If there isn't an interface, never create a gdisplay */
if (no_interface)
return NULL;
/* format the title */
gdisplay_format_title (gimage, title);
instance = gimage->instance_count;
gimage->instance_count++;
gimage->ref_count++;
/*
* Set all GDisplay parameters...
*/
@ -106,7 +98,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->depth = g_visual->depth;
gdisp->select = NULL;
gdisp->ID = display_num++;
gdisp->instance = instance;
gdisp->instance = gimage->instance_count;
gdisp->update_areas = NULL;
gdisp->display_areas = NULL;
gdisp->disp_xoffset = 0;
@ -127,6 +119,9 @@ gdisplay_new (GimpImage *gimage,
gdisp->idle_render.update_areas = NULL;
gdisp->idle_render.active = FALSE;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
/* add the new display to the list so that it isn't lost */
display_list = g_slist_append (display_list, (void *) gdisp);
@ -147,16 +142,45 @@ gdisplay_new (GimpImage *gimage,
/* set the current tool cursor */
gdisplay_install_tool_cursor (gdisp, default_gdisplay_cursor);
gimage->instance_count++;
gimage->ref_count++;
return gdisp;
}
static void
gdisplay_format_title (GimpImage *gimage,
char *title)
static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5);
static int
print (char *buf, int len, int start, const char *fmt, ...)
{
va_list args;
int printed;
va_start (args, fmt);
printed = g_vsnprintf (buf + start, len - start, fmt, args);
if (printed < 0)
printed = len - start;
va_end (args);
return printed;
}
static void
gdisplay_format_title (GDisplay *gdisp,
char *title,
int title_len)
{
GimpImage *gimage;
char *image_type_str;
int empty;
int i;
char *format;
gimage = gdisp->gimage;
empty = gimage_is_empty (gimage);
@ -175,11 +199,78 @@ gdisplay_format_title (GimpImage *gimage,
image_type_str = NULL;
}
g_snprintf (title, MAX_TITLE_BUF, "%s-%d.%d (%s)",
prune_filename (gimage_filename (gimage)),
pdb_image_to_id (gimage),
gimage->instance_count,
image_type_str);
i = 0;
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;
case '%':
title[i++] = '%';
break;
case 'f': /* pruned filename */
i += print (title, title_len, i,
"%s", prune_filename (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 '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 '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 'z': /* user zoom factor (percentage) */
i += print (title, title_len, i,
"%d", 100 * SCALEDEST (gdisp) / SCALESRC (gdisp));
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
*/
default:
g_warning (_("image-title-format contains unknown format sequence '%%%c'"), *format);
break;
}
break;
default:
title[i++] = *format;
break;
}
format++;
}
title[MIN(i, title_len)] = 0;
}
@ -1562,28 +1653,35 @@ gdisplay_get_ID (int ID)
}
void
gdisplay_update_title (GDisplay *gdisp)
{
char title [MAX_TITLE_BUF];
guint context_id;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
gdk_window_set_title (gdisp->shell->window, title);
/* update the statusbar */
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
}
void
gdisplays_update_title (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list = display_list;
char title [MAX_TITLE_BUF];
guint context_id;
/* traverse the linked list of displays, handling each one */
while (list)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
{
/* format the title */
gdisplay_format_title (gdisp->gimage, title);
gdk_window_set_title (gdisp->shell->window, title);
/* update the statusbar */
context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
}
gdisplay_update_title (gdisp);
list = g_slist_next (list);
}
@ -1600,9 +1698,7 @@ gdisplays_resize_cursor_label (GimpImage *gimage)
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
{
gdisplay_resize_cursor_label(gdisp);
}
list = g_slist_next (list);
}
@ -1902,7 +1998,6 @@ gdisplay_hash (GDisplay *display)
void
gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
{
char title [MAX_TITLE_BUF];
int instance;
if (gdisp->idle_render.active)
@ -1920,7 +2015,6 @@ gdisplay_reconnect (GDisplay *gdisp, GimpImage *gimage)
gdisp->gimage = gimage;
gdisp->instance = instance;
gdisplay_format_title (gimage, title);
gdisplays_update_title (gimage);
gdisplay_expose_full (gdisp);

View File

@ -183,6 +183,7 @@ void gdisplay_resize_cursor_label (GDisplay *);
GDisplay * gdisplay_active (void);
GDisplay * gdisplay_get_ID (int);
void gdisplay_update_title (GDisplay*);
void gdisplays_update_title (GimpImage*);
void gdisplays_resize_cursor_label (GimpImage*);
void gdisplays_update_area (GimpImage*, int, int, int, int);

View File

@ -135,6 +135,7 @@ float monitor_xres = 72.0;
float monitor_yres = 72.0;
int using_xserver_resolution = FALSE;
int num_processors = 1;
char * image_title_format = NULL;
static int get_next_token (void);
static int peek_next_token (void);
@ -255,9 +256,10 @@ static ParseFunc funcs[] =
{ "menu-path", TT_XMENUPATH, NULL, NULL },
{ "device", TT_XDEVICE, NULL, NULL },
{ "session-info", TT_XSESSIONINFO, NULL, NULL},
{ "monitor-xresolution", TT_FLOAT, &monitor_xres, NULL },
{ "monitor-yresolution", TT_FLOAT, &monitor_yres, NULL },
{ "num-processors", TT_INT, &num_processors, NULL }
{ "monitor-xresolution", TT_FLOAT, &monitor_xres, NULL },
{ "monitor-yresolution", TT_FLOAT, &monitor_yres, NULL },
{ "num-processors", TT_INT, &num_processors, NULL },
{ "image-title-format", TT_STRING, &image_title_format, NULL },
};
static int nfuncs = sizeof (funcs) / sizeof (funcs[0]);
@ -281,6 +283,8 @@ extern char* alternate_system_gimprc;
#define MAX_GIMPDIR_LEN 500
#define DEFAULT_IMAGE_TITLE_FORMAT "%f-%p.%i (%t)"
char *
gimp_directory ()
{
@ -374,6 +378,9 @@ parse_gimprc ()
}
parse_gimprc_file (filename);
}
if (!image_title_format)
image_title_format = DEFAULT_IMAGE_TITLE_FORMAT;
}
void

View File

@ -71,6 +71,7 @@ extern float monitor_xres;
extern float monitor_yres;
extern int using_xserver_resolution;
extern int num_processors;
extern char * image_title_format;
/* function prototypes */

View File

@ -155,6 +155,9 @@ change_scale (GDisplay *gdisp,
resize_display (gdisp, allow_resize_windows, TRUE);
}
/* title may have changed if it includes the zoom ratio */
gdisplay_update_title (gdisp);
}

View File

@ -224,4 +224,17 @@
# gfig pattern directory
(gfig-path "${gimp_dir}/gfig:${gimp_data_dir}/gfig")
# This string sets how image window titles are formatted.
# The following percent expansions are performed:
# %% literal percent sign
# %f bare filename, or "Untiltled"
# %F full path to file
# %p PDB image id
# %i view instance number
# %t image type (RGB, indexed, greyscale)
# %z zoom factor as a percentage
# %s source scale factor
# %d destination scale factor
(image-title-format "%f-%p.%i (%t) %z%%")
# [end of file]

View File

@ -224,4 +224,17 @@
# gfig pattern directory
(gfig-path "${gimp_dir}/gfig:${gimp_data_dir}/gfig")
# This string sets how image window titles are formatted.
# The following percent expansions are performed:
# %% literal percent sign
# %f bare filename, or "Untiltled"
# %F full path to file
# %p PDB image id
# %i view instance number
# %t image type (RGB, indexed, greyscale)
# %z zoom factor as a percentage
# %s source scale factor
# %d destination scale factor
(image-title-format "%f-%p.%i (%t) %z%%")
# [end of file]