Commit e3da6be9 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

removed the "wrap" from gimp_progress_set_text() so it shows up as libgimp

2005-09-29  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/progress.pdb: removed the "wrap" from
	gimp_progress_set_text() so it shows up as libgimp function again.

	* libgimp/gimpprogress_pdb.[ch]: regenerated.

	* libgimp/gimpprogress.[ch]: changed the old
	gimp_progress_set_text() to gimp_progress_set_text_printf() and
	added gimp_progress_init_printf(). (did this because the method of
	calling init(NULL) followed by set_text("foo") caused popup
	progress windows to be resized after they were shown).

	* libgimp/gimp.def: changed accordingly.

	* plug-ins/*/*.c: use gimp_progress_init_printf() instead of
	init(NULL) plus set_text(foo) and changed users of set_text() to
	use set_text_printf().
parent eb454588
2005-09-29 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/progress.pdb: removed the "wrap" from
gimp_progress_set_text() so it shows up as libgimp function again.
* libgimp/gimpprogress_pdb.[ch]: regenerated.
* libgimp/gimpprogress.[ch]: changed the old
gimp_progress_set_text() to gimp_progress_set_text_printf() and
added gimp_progress_init_printf(). (did this because the method of
calling init(NULL) followed by set_text("foo") caused popup
progress windows to be resized after they were shown).
* libgimp/gimp.def: changed accordingly.
* plug-ins/*/*.c: use gimp_progress_init_printf() instead of
init(NULL) plus set_text(foo) and changed users of set_text() to
use set_text_printf().
2005-09-29 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu-interface.c: removed the frame
......
......@@ -504,10 +504,12 @@ EXPORTS
gimp_procedural_db_temp_name
gimp_progress_cancel
gimp_progress_init
gimp_progress_init_printf
gimp_progress_install
gimp_progress_install_vtable
gimp_progress_pulse
gimp_progress_set_text
gimp_progress_set_text_printf
gimp_progress_get_window_handle
gimp_progress_uninstall
gimp_progress_update
......
......@@ -215,7 +215,42 @@ gimp_progress_uninstall (const gchar *progress_callback)
}
/**
* gimp_progress_set_text:
* gimp_progress_init_printf:
* @format: a standard printf() format string
* @Varargs: arguments for @format
*
* Initializes the progress bar for the current plug-in.
*
* Initializes the progress bar for the current plug-in. It is only
* valid to call this procedure from a plug-in.
*
* Returns: %TRUE on success.
*
* Since: GIMP 2.4
**/
gboolean
gimp_progress_init_printf (const gchar *format,
...)
{
gchar *text;
gboolean retval;
va_list args;
g_return_val_if_fail (format != NULL, FALSE);
va_start (args, format);
text = g_strdup_vprintf (format, args);
va_end (args);
retval = gimp_progress_init (text);
g_free (text);
return retval;
}
/**
* gimp_progress_set_text_printf:
* @format: a standard printf() format string
* @Varargs: arguments for @format
*
......@@ -230,8 +265,8 @@ gimp_progress_uninstall (const gchar *progress_callback)
* Since: GIMP 2.4
**/
gboolean
gimp_progress_set_text (const gchar *format,
...)
gimp_progress_set_text_printf (const gchar *format,
...)
{
gchar *text;
gboolean retval;
......@@ -243,7 +278,7 @@ gimp_progress_set_text (const gchar *format,
text = g_strdup_vprintf (format, args);
va_end (args);
retval = _gimp_progress_set_text (text);
retval = gimp_progress_set_text (text);
g_free (text);
......
......@@ -53,12 +53,14 @@ struct _GimpProgressVtable
};
const gchar * gimp_progress_install_vtable (const GimpProgressVtable *vtable,
gpointer user_data);
gpointer gimp_progress_uninstall (const gchar *progress_callback);
gboolean gimp_progress_set_text (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
const gchar * gimp_progress_install_vtable (const GimpProgressVtable *vtable,
gpointer user_data);
gpointer gimp_progress_uninstall (const gchar *progress_callback);
gboolean gimp_progress_init_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
gboolean gimp_progress_set_text_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
#ifndef GIMP_DISABLE_DEPRECATED
......
......@@ -121,7 +121,7 @@ gimp_progress_pulse (void)
}
/**
* _gimp_progress_set_text:
* gimp_progress_set_text:
* @message: Message to use in the progress dialog.
*
* Changes the text in the progress bar for the current plug-in.
......@@ -135,7 +135,7 @@ gimp_progress_pulse (void)
* Since: GIMP 2.4
*/
gboolean
_gimp_progress_set_text (const gchar *message)
gimp_progress_set_text (const gchar *message)
{
GimpParam *return_vals;
gint nreturn_vals;
......
......@@ -32,7 +32,7 @@ G_BEGIN_DECLS
gboolean gimp_progress_init (const gchar *message);
gboolean gimp_progress_update (gdouble percentage);
gboolean gimp_progress_pulse (void);
gboolean _gimp_progress_set_text (const gchar *message);
gboolean gimp_progress_set_text (const gchar *message);
gint gimp_progress_get_window_handle (void);
gboolean _gimp_progress_install (const gchar *progress_callback);
gboolean _gimp_progress_uninstall (const gchar *progress_callback);
......
......@@ -154,9 +154,8 @@ ReadBMP (const gchar *name)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (name));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (name));
/* It is a File. Now is it a Bitmap? Read the shortest possible header */
......
......@@ -111,7 +111,6 @@ WriteBMP (const gchar *filename,
gint rows, cols, Spcols, channels, MapSize, SpZeile;
glong BitsPerPixel;
gint colors;
gchar *temp_buf;
guchar *pixels;
GimpPixelRgn pixel_rgn;
GimpDrawable *drawable;
......@@ -209,10 +208,8 @@ WriteBMP (const gchar *filename,
0, 0, drawable->width, drawable->height);
/* And let's begin the progress */
temp_buf = g_strdup_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp_buf);
g_free (temp_buf);
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
cur_progress = 0;
max_progress = drawable->height;
......
......@@ -350,9 +350,8 @@ load_image (const gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
if (read (fd, &bh, sizeof (BrushHeader)) != sizeof (BrushHeader))
{
......@@ -607,9 +606,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
drawable = gimp_drawable_get (drawable_ID);
......
......@@ -869,7 +869,6 @@ save_image (const gchar *filename,
guint rows, cols;
gint BitsPerPixel, liberalBPP=0, useBPP=0;
gint colors;
gchar *temp_buf;
gint i;
gint transparent;
gint offset_x, offset_y;
......@@ -1005,10 +1004,8 @@ save_image (const gchar *filename,
/* init the progress meter */
temp_buf = g_strdup_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp_buf);
g_free (temp_buf);
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
/* write the GIFheader */
......
......@@ -280,17 +280,16 @@ static gint32 ReadImage (FILE *, const gchar *,
static gint32
load_image (const gchar *filename)
{
FILE *fd;
char * name_buf;
unsigned char buf[16];
unsigned char c;
CMap localColorMap;
int grayScale;
int useGlobalColormap;
int bitPixel;
int imageCount = 0;
char version[4];
gint32 image_ID = -1;
FILE *fd;
guchar buf[16];
guchar c;
CMap localColorMap;
gint grayScale;
gint useGlobalColormap;
gint bitPixel;
gint imageCount = 0;
gchar version[4];
gint32 image_ID = -1;
fd = g_fopen (filename, "rb");
if (!fd)
......@@ -300,10 +299,8 @@ load_image (const gchar *filename)
return -1;
}
name_buf = g_strdup_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
if (!ReadOK (fd, buf, 6))
{
......
......@@ -651,9 +651,8 @@ gih_load_image (const gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
/* The file format starts with a painfully simple text header */
......@@ -1238,7 +1237,7 @@ gih_save_image (const gchar *filename,
GimpPixelRgn pixel_rgn;
GimpParasite *pipe_parasite;
gchar *header;
gchar *msg, *parstring;
gchar *parstring;
gint32 *layer_ID;
gint fd;
gint nlayers, layer, row, col;
......@@ -1261,10 +1260,8 @@ gih_save_image (const gchar *filename,
return FALSE;
}
msg = g_strdup_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (msg);
g_free (msg);
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
parstring = gimp_pixpipe_params_build (&gihparams);
......
......@@ -242,9 +242,8 @@ save_image (const gchar *filename,
fprintf (fp, "<CAPTION>%s</CAPTION>\n",
gtmvals.captiontxt);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_pixel_rgn_init (&pixel_rgn, drawable,
0, 0, drawable->width, drawable->height,
......
......@@ -788,8 +788,8 @@ iwarp (void)
destdrawable = gimp_drawable_get (animlayers[i]);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Warping Frame No. %d..."), frame_number);
gimp_progress_init_printf (_("Warping Frame No. %d..."),
frame_number);
if (animate_deform_value > 0.0)
iwarp_frame ();
......
......@@ -323,9 +323,8 @@ load_image (const gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
if (read (fd, &ph, sizeof (PatternHeader)) != sizeof (PatternHeader))
{
......@@ -454,9 +453,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
drawable = gimp_drawable_get (drawable_ID);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
......
......@@ -311,9 +311,8 @@ load_image (const gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
if (fread (&pcx_header, 128, 1, fd) == 0)
{
......@@ -548,9 +547,8 @@ save_image (const gchar *filename,
height = drawable->height;
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
pcx_header.manufacturer = 0x0a;
pcx_header.version = 5;
......
......@@ -331,9 +331,8 @@ load_image (const gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
/* Read header information */
width = get_short (file);
......@@ -511,9 +510,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
/* Write the image header */
PIX_DEBUG_PRINT ("Width %hu\n", drawable->width);
......
......@@ -724,9 +724,8 @@ load_image (const gchar *filename,
png_init_io (pp, fp);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
/*
* Get the image dimensions and create the image...
......@@ -1226,9 +1225,8 @@ save_image (const gchar *filename,
png_init_io (pp, fp);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
/*
* Get the drawable for the current image...
......
......@@ -444,9 +444,8 @@ load_image (const gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
/* allocate the necessary structures */
pnminfo = g_new (PNMInfo, 1);
......@@ -792,7 +791,6 @@ save_image (const gchar *filename,
unsigned char *data, *d;
char *rowbuf;
char buf[BUFLEN];
char *temp;
int np = 0;
int xres, yres;
int ypos, yend;
......@@ -821,10 +819,8 @@ save_image (const gchar *filename,
return FALSE;
}
temp = g_strdup_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
xres = drawable->width;
yres = drawable->height;
......
......@@ -460,9 +460,8 @@ load_image (PopplerDocument *doc,
if (target == GIMP_PAGE_SELECTOR_TARGET_IMAGES)
images = g_new0 (gint32, pages->n_pages);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
scale = resolution / gimp_unit_get_factor (GIMP_UNIT_POINT);
......
......@@ -1014,9 +1014,8 @@ load_image (const gchar *filename)
}
fclose (ifp);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
ifp = ps_open (filename, &plvals, &llx, &lly, &urx, &ury, &is_epsf,
&ChildPid);
......@@ -1187,9 +1186,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
save_ps_header (ofp, filename);
......
......@@ -1882,9 +1882,8 @@ load_image (const gchar *name)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (name));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (name));
read_whole_file (fd);
......
......@@ -1351,9 +1351,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
IFDBG g_print (" File \"%s\" has been opened\n",
gimp_filename_to_utf8 (filename));
......
......@@ -386,10 +386,9 @@ run (const gchar *name,
case RNDM_SLUR: rndm_type_str = "slur"; break;
}
gimp_progress_init (NULL);
gimp_progress_set_text ("%s (%s)...",
gettext (RNDM_VERSION[rndm_type - 1]),
gettext (rndm_type_str));
gimp_progress_init_printf ("%s (%s)...",
gettext (RNDM_VERSION[rndm_type - 1]),
gettext (rndm_type_str));
gimp_tile_cache_ntiles (2 *
(drawable->width / gimp_tile_width () + 1));
/*
......
......@@ -649,9 +649,8 @@ load_image (gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
size = get_file_info (filename);
......
......@@ -430,9 +430,8 @@ load_image (const gchar *filename)
*4 + sunhdr.l_ras_maplength, SEEK_SET);
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
switch (sunhdr.l_ras_depth)
{
......@@ -510,9 +509,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
if (drawable_type == GIMP_INDEXED_IMAGE)
retval = save_index (ofp,image_ID, drawable_ID, 0, (int)psvals.rle);
......
......@@ -416,9 +416,8 @@ load_image (const gchar *filename)
return -1;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
if (!fseek (fp, -26L, SEEK_END)) { /* Is file big enough for a footer? */
if (fread (footer, sizeof (footer), 1, fp) != 1)
......@@ -1029,9 +1028,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
header[0] = 0; /* No image identifier / description */
......
......@@ -532,9 +532,8 @@ load_image (const gchar *filename)
gimp_quit ();
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
/* We will loop through the all pages in case of multipage TIFF
and load every page as a separate layer. */
......@@ -1923,9 +1922,8 @@ save_image (const gchar *filename,
return FALSE;
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
drawable = gimp_drawable_get (layer);
drawable_type = gimp_drawable_type (layer);
......
......@@ -949,9 +949,8 @@ load_image (const gchar *filename)
gimp_quit ();
}
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init_printf (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
image = gimp_image_new (width, height, GIMP_RGB);
gimp_image_set_filename (image, filename);
......