version number bump; add check for standalone gtkxmhtml from Sesse

* configure.in: version number bump; add check for standalone
gtkxmhtml from Sesse

* app/gimppreviewcache.c: applied gimp-yasuhiro-19991122-1, prevents
div by zero error

* plug-ins/script-fu/script-fu-scripts.c: INIT_I18N_UI before
gtk_init, reported by yasuhiro

* plug-ins/common/mapcolor.c
* plug-ins/common/sunras.c
* plug-ins/fits/fits.c: applied gimpkirchgessner-991121-[0-2],
i18n and sundry bug fixes

-Yosh
This commit is contained in:
Manish Singh 1999-11-24 23:58:46 +00:00
parent 643e1b1a92
commit a111d2397b
11 changed files with 257 additions and 144 deletions

View File

@ -1,3 +1,19 @@
Wed Nov 24 15:26:21 PST 1999 Manish Singh <yosh@gimp.org>
* configure.in: version number bump; add check for standalone
gtkxmhtml from Sesse
* app/gimppreviewcache.c: applied gimp-yasuhiro-19991122-1, prevents
div by zero error
* plug-ins/script-fu/script-fu-scripts.c: INIT_I18N_UI before
gtk_init, reported by yasuhiro
* plug-ins/common/mapcolor.c
* plug-ins/common/sunras.c
* plug-ins/fits/fits.c: applied gimpkirchgessner-991121-[0-2],
i18n and sundry bug fixes
1999-11-24 Tuomas Kuosmanen <tigert@gimp.org>
* plug-ins/perl/examples/perlotine: Fixed some changed stuff,

View File

@ -237,8 +237,14 @@ gimp_preview_cache_get(GSList **plist,
pc->preview = temp_buf_new(width,height,pn.pc->preview->bytes,0,0,NULL);
/* preview from nearest bigger one */
if (width)
x_ratio = (gdouble)pwidth/(gdouble)width;
else
x_ratio = 0.0;
if (height)
y_ratio = (gdouble)pheight/(gdouble)height;
else
y_ratio = 0.0;
src_data = temp_buf_data(pn.pc->preview);
dest_data = temp_buf_data(pc->preview);

View File

@ -61,6 +61,7 @@ static ProcRecord image_active_drawable_proc;
static ProcRecord image_base_type_proc;
static ProcRecord image_get_cmap_proc;
static ProcRecord image_set_cmap_proc;
static ProcRecord image_undo_is_enabled_proc;
static ProcRecord image_undo_enable_proc;
static ProcRecord image_undo_disable_proc;
static ProcRecord image_undo_freeze_proc;
@ -121,6 +122,7 @@ register_gimage_procs (void)
procedural_db_register (&image_base_type_proc);
procedural_db_register (&image_get_cmap_proc);
procedural_db_register (&image_set_cmap_proc);
procedural_db_register (&image_undo_is_enabled_proc);
procedural_db_register (&image_undo_enable_proc);
procedural_db_register (&image_undo_disable_proc);
procedural_db_register (&image_undo_freeze_proc);
@ -1910,6 +1912,63 @@ static ProcRecord image_set_cmap_proc =
{ { image_set_cmap_invoker } }
};
static Argument *
image_undo_is_enabled_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gboolean enabled;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
if (success)
enabled = gimp_image_undo_is_enabled (gimage);
return_args = procedural_db_return_args (&image_undo_is_enabled_proc, success);
if (success)
return_args[1].value.pdb_int = enabled;
return return_args;
}
static ProcArg image_undo_is_enabled_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
}
};
static ProcArg image_undo_is_enabled_outargs[] =
{
{
PDB_INT32,
"enabled",
"True if undo is enabled for this image"
}
};
static ProcRecord image_undo_is_enabled_proc =
{
"gimp_image_undo_is_enabled",
"Check if the image's undo stack is enabled.",
"This procedure checks if the image's undo stack is currently enabled or disabled. This is useful when several plugins or scripts call each other and want to check if their caller has already used 'gimp_image_undo_disable' or 'gimp_image_undo_freeze'.",
"Raphael Quinet",
"Raphael Quinet",
"1999",
PDB_INTERNAL,
1,
image_undo_is_enabled_inargs,
1,
image_undo_is_enabled_outargs,
{ { image_undo_is_enabled_invoker } }
};
static Argument *
image_undo_enable_invoker (Argument *args)
{

View File

@ -237,8 +237,14 @@ gimp_preview_cache_get(GSList **plist,
pc->preview = temp_buf_new(width,height,pn.pc->preview->bytes,0,0,NULL);
/* preview from nearest bigger one */
if (width)
x_ratio = (gdouble)pwidth/(gdouble)width;
else
x_ratio = 0.0;
if (height)
y_ratio = (gdouble)pheight/(gdouble)height;
else
y_ratio = 0.0;
src_data = temp_buf_data(pn.pc->preview);
dest_data = temp_buf_data(pc->preview);

View File

@ -59,7 +59,7 @@ void register_tools_procs (void);
void register_undo_procs (void);
void register_unit_procs (void);
/* 309 procedures registered total */
/* 310 procedures registered total */
void
internal_procs_init (void)
@ -73,87 +73,87 @@ internal_procs_init (void)
app_init_update_status (NULL, _("Channel"), 0.045);
register_channel_procs ();
app_init_update_status (NULL, _("Channel Ops"), 0.091);
app_init_update_status (NULL, _("Channel Ops"), 0.09);
register_channel_ops_procs ();
app_init_update_status (NULL, _("Color"), 0.097);
register_color_procs ();
app_init_update_status (NULL, _("Convert"), 0.136);
app_init_update_status (NULL, _("Convert"), 0.135);
register_convert_procs ();
app_init_update_status (NULL, _("Drawable procedures"), 0.146);
app_init_update_status (NULL, _("Drawable procedures"), 0.145);
register_drawable_procs ();
app_init_update_status (NULL, _("Edit procedures"), 0.217);
app_init_update_status (NULL, _("Edit procedures"), 0.216);
register_edit_procs ();
app_init_update_status (NULL, _("File Operations"), 0.236);
app_init_update_status (NULL, _("File Operations"), 0.235);
register_fileops_procs ();
app_init_update_status (NULL, _("Floating selections"), 0.256);
app_init_update_status (NULL, _("Floating selections"), 0.255);
register_floating_sel_procs ();
app_init_update_status (NULL, _("GDisplay procedures"), 0.275);
app_init_update_status (NULL, _("GDisplay procedures"), 0.274);
register_gdisplay_procs ();
app_init_update_status (NULL, _("Image"), 0.285);
app_init_update_status (NULL, _("Image"), 0.284);
register_gimage_procs ();
app_init_update_status (NULL, _("Image mask"), 0.466);
app_init_update_status (NULL, _("Image mask"), 0.468);
register_gimage_mask_procs ();
app_init_update_status (NULL, _("Gimprc procedures"), 0.521);
app_init_update_status (NULL, _("Gimprc procedures"), 0.523);
register_gimprc_procs ();
app_init_update_status (NULL, _("Gradients"), 0.531);
app_init_update_status (NULL, _("Gradients"), 0.532);
register_gradient_procs ();
app_init_update_status (NULL, _("Gradient UI"), 0.547);
app_init_update_status (NULL, _("Gradient UI"), 0.548);
register_gradient_select_procs ();
app_init_update_status (NULL, _("Guide procedures"), 0.56);
app_init_update_status (NULL, _("Guide procedures"), 0.561);
register_guides_procs ();
app_init_update_status (NULL, _("Interface"), 0.579);
app_init_update_status (NULL, _("Interface"), 0.581);
register_interface_procs ();
app_init_update_status (NULL, _("Layer"), 0.589);
app_init_update_status (NULL, _("Layer"), 0.59);
register_layer_procs ();
app_init_update_status (NULL, _("Miscellaneous"), 0.686);
app_init_update_status (NULL, _("Miscellaneous"), 0.687);
register_misc_procs ();
app_init_update_status (NULL, _("Palette"), 0.693);
app_init_update_status (NULL, _("Palette"), 0.694);
register_palette_procs ();
app_init_update_status (NULL, _("Parasite procedures"), 0.715);
app_init_update_status (NULL, _("Parasite procedures"), 0.716);
register_parasite_procs ();
app_init_update_status (NULL, _("Paths"), 0.757);
app_init_update_status (NULL, _("Paths"), 0.758);
register_paths_procs ();
app_init_update_status (NULL, _("Pattern UI"), 0.79);
register_pattern_select_procs ();
app_init_update_status (NULL, _("Patterns"), 0.799);
app_init_update_status (NULL, _("Patterns"), 0.8);
register_patterns_procs ();
app_init_update_status (NULL, _("Plug-in"), 0.812);
app_init_update_status (NULL, _("Plug-in"), 0.813);
register_plug_in_procs ();
app_init_update_status (NULL, _("Procedural database"), 0.825);
app_init_update_status (NULL, _("Procedural database"), 0.826);
register_procedural_db_procs ();
app_init_update_status (NULL, _("Text procedures"), 0.851);
app_init_update_status (NULL, _("Text procedures"), 0.852);
register_text_tool_procs ();
app_init_update_status (NULL, _("Tool procedures"), 0.864);
app_init_update_status (NULL, _("Tool procedures"), 0.865);
register_tools_procs ();
app_init_update_status (NULL, _("Undo"), 0.958);
register_undo_procs ();
app_init_update_status (NULL, _("Units"), 0.964);
app_init_update_status (NULL, _("Units"), 0.965);
register_unit_procs ();
}

View File

@ -4,7 +4,7 @@ AC_INIT(gimprc.in)
dnl Initialize automake stuff
GIMP_MAJOR_VERSION=1
GIMP_MINOR_VERSION=1
GIMP_MICRO_VERSION=11
GIMP_MICRO_VERSION=12
GIMP_INTERFACE_AGE=0
GIMP_BINARY_AGE=0
GIMP_VERSION=$GIMP_MAJOR_VERSION.$GIMP_MINOR_VERSION.$GIMP_MICRO_VERSION
@ -512,6 +512,12 @@ dnl This is for the help browser
AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
if test "$GNOME_CONFIG" = "no"; then
HELPBROWSER=
dnl Test for standalone GtkXMHTML widget
AC_CHECK_LIB(gtkxmhtml, gtk_xmhtml_new,
GTKXMHTML_CFLAGS=$GLIB_CFLAGS
GTKXMHTML_LIBS="$GLIB_LIBS -lgtkxmhtml"
HELPBROWSER=helpbrowser,
AC_MSG_WARN(*** Help browser plug-in will not be built (GtkXMHTML library not found) ***))
else
GTKXMHTML_CFLAGS=`$GNOME_CONFIG --cflags gnomeui`
GTKXMHTML_LIBS=`$GNOME_CONFIG --libs gtkxmhtml`

View File

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* mapcolor plugin
* Copyright (C) 1998 Peter Kirchgessner
* (email: pkirchg@aol.com, WWW: http://members.aol.com/pkirchg)
* email: peter@kirchgessner.net, WWW: http://www.kirchgessner.net)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,10 +22,12 @@
/* Event history:
* V 1.00, PK, 26-Oct-98: Creation.
* V 1.01, PK, 21-Nov-99: Fix problem with working on layered images
* Internationalization
*/
#define VERSIO 1.00
static char dversio[] = "v1.00 26-Oct-98";
static char ident[] = "@(#) GIMP mapcolor plug-in v1.00 26-Oct-98";
#define VERSIO 1.01
static char dversio[] = "v1.01 21-Nov-99";
static char ident[] = "@(#) GIMP mapcolor plug-in v1.01 21-Nov-99";
#include "config.h"
#include <stdio.h>
@ -131,6 +133,8 @@ query (void)
};
static int nmap_args = sizeof (map_args) / sizeof (map_args[0]);
INIT_I18N ();
gimp_install_procedure ("plug_in_color_adjust",
_("Adjust current foreground/background color in the\
drawable to black/white"),
@ -176,13 +180,13 @@ run (char *name,
guchar *c = (guchar *)ident;
int j;
INIT_I18N_UI();
l_run_mode = run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
INIT_I18N_UI();
values[0].type = PARAM_STATUS;
values[0].data.d_status = status;
@ -268,7 +272,7 @@ run (char *name,
}
if (run_mode != RUN_NONINTERACTIVE)
gimp_progress_init ("Mapping colors");
gimp_progress_init (_("Mapping colors"));
color_mapping (drawable);
@ -319,7 +323,7 @@ dialog ()
gtk_widget_set_default_colormap(gtk_preview_get_cmap());
dlg = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (dlg), "Map colors");
gtk_window_set_title (GTK_WINDOW (dlg), _("Map colors"));
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
(GtkSignalFunc) mapcolor_close_callback,
@ -478,7 +482,7 @@ color_mapping (GDrawable *drawable)
{
int processed, total;
gint x, y, xmin, xmax, ymin, ymax;
gint x, y, xmin, xmax, ymin, ymax, bpp = (gint)drawable->bpp;
unsigned char *src, *dest;
GPixelRgn src_rgn, dest_rgn;
gpointer pr;
@ -521,8 +525,9 @@ color_mapping (GDrawable *drawable)
dest[0] = redmap[src[0]];
dest[1] = greenmap[src[1]];
dest[2] = bluemap[src[2]];
src += drawable->bpp;
dest += drawable->bpp;
if (bpp > 3) dest[3] = src[3];
src += bpp;
dest += bpp;
processed++;
}
}

View File

@ -1,7 +1,7 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* SUN raster reading and writing code Copyright (C) 1996 Peter Kirchgessner
* (email: pkirchg@aol.com, WWW: http://members.aol.com/pkirchg)
* (email: peter@kirchgessner.net, WWW: http://www.kirchgessner.net)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@
/* This program was written using pages 625-629 of the book
* "Encyclopedia of Graphics File Formats", Murray/van Ryper,
* O'Reilly & Associates Inc.
* Bug reports or suggestions should be e-mailed to Pkirchg@aol.com
* Bug reports or suggestions should be e-mailed to peter@kirchgessner.net
*/
/* Event history:
@ -33,8 +33,9 @@
* V 1.93, PK, 05-Oct-97: Parse rc file
* V 1.94, PK, 12-Oct-97: No progress bars for non-interactive mode
* V 1.95, nn, 20-Dec-97: Initialize some variable
* V 1.96, PK, 21-Nov-99: Internationalization
*/
static char ident[] = "@(#) GIMP SunRaster file-plugin v1.95 20-Dec-97";
static char ident[] = "@(#) GIMP SunRaster file-plugin v1.96 21-Nov-99";
#include "config.h"
@ -48,6 +49,7 @@ static char ident[] = "@(#) GIMP SunRaster file-plugin v1.95 20-Dec-97";
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "libgimp/stdplugins-intl.h"
typedef int WRITE_FUN(void*,size_t,size_t,FILE*);
@ -214,9 +216,11 @@ query (void)
};
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
INIT_I18N();
gimp_install_procedure ("file_sunras_load",
"load file of the SunRaster file format",
"load file of the SunRaster file format",
_("load file of the SunRaster file format"),
_("load file of the SunRaster file format"),
"Peter Kirchgessner",
"Peter Kirchgessner",
"1996",
@ -227,9 +231,9 @@ query (void)
load_args, load_return_vals);
gimp_install_procedure ("file_sunras_save",
"save file in the SunRaster file format",
"SUNRAS saving handles all image types except \
those with alpha channels.",
_("save file in the SunRaster file format"),
_("SUNRAS saving handles all image types except \
those with alpha channels."),
"Peter Kirchgessner",
"Peter Kirchgessner",
"1996",
@ -274,6 +278,8 @@ run (char *name,
if (strcmp (name, "file_sunras_load") == 0)
{
INIT_I18N_UI();
image_ID = load_image (param[1].data.d_string);
*nreturn_vals = 2;
@ -284,6 +290,8 @@ run (char *name,
}
else if (strcmp (name, "file_sunras_save") == 0)
{
INIT_I18N_UI();
image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_int32;
@ -371,7 +379,7 @@ load_image (char *filename)
ifp = fopen (filename, "rb");
if (!ifp)
{
show_message ("can't open file for reading");
show_message (_("cant open file for reading"));
return (-1);
}
@ -380,14 +388,14 @@ load_image (char *filename)
read_sun_header (ifp, &sunhdr);
if (sunhdr.l_ras_magic != RAS_MAGIC)
{
show_message("can't open file as SUN-raster-file");
show_message(_("cant open file as SUN-raster-file"));
fclose (ifp);
return (-1);
}
if ((sunhdr.l_ras_type < 0) || (sunhdr.l_ras_type > 5))
{
show_message ("the type of this SUN-rasterfile\nis not supported");
show_message (_("the type of this SUN-rasterfile is not supported"));
fclose (ifp);
return (-1);
}
@ -422,15 +430,15 @@ load_image (char *filename)
}
else if (sunhdr.l_ras_maplength > 0)
{
show_message ("type of colourmap not supported");
show_message (_("type of colourmap not supported"));
fseek (ifp, (sizeof (L_SUNFILEHEADER)/sizeof (L_CARD32))
*4 + sunhdr.l_ras_maplength, SEEK_SET);
}
if (l_run_mode != RUN_NONINTERACTIVE)
{
temp = g_malloc (strlen (filename) + 11);
sprintf (temp, "Loading %s:", filename);
temp = g_malloc (strlen (filename) + 64);
sprintf (temp, _("Loading %s:"), filename);
gimp_progress_init (temp);
g_free (temp);
}
@ -464,7 +472,7 @@ load_image (char *filename)
if (image_ID == -1)
{
show_message ("this image depth is not supported");
show_message (_("this image depth is not supported"));
return (-1);
}
@ -488,7 +496,7 @@ save_image (char *filename,
/* Make sure we're not saving an image with an alpha channel */
if (gimp_drawable_has_alpha (drawable_ID))
{
show_message ("SUNRAS save cannot handle images with alpha channels");
show_message (_("SUNRAS save cannot handle images with alpha channels"));
return FALSE;
}
@ -499,7 +507,7 @@ save_image (char *filename,
case RGB_IMAGE:
break;
default:
show_message ("cannot operate on unknown image types");
show_message (_("cant operate on unknown image types"));
return (FALSE);
break;
}
@ -508,14 +516,14 @@ save_image (char *filename,
ofp = fopen (filename, "wb");
if (!ofp)
{
show_message ("cant open file for writing");
show_message (_("cant open file for writing"));
return (FALSE);
}
if (l_run_mode != RUN_NONINTERACTIVE)
{
temp = g_malloc (strlen (filename) + 11);
sprintf (temp, "Saving %s:", filename);
temp = g_malloc (strlen (filename) + 64);
sprintf (temp, _("Saving %s:"), filename);
gimp_progress_init (temp);
g_free (temp);
}
@ -921,7 +929,7 @@ create_new_image (char *filename,
image_ID = gimp_image_new (width, height, type);
gimp_image_set_filename (image_ID, filename);
*layer_ID = gimp_layer_new (image_ID, "Background", width, height,
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
gdtype, 100, NORMAL_MODE);
gimp_image_add_layer (image_ID, *layer_ID, 0);
@ -1029,7 +1037,7 @@ load_sun_d1 (char *filename,
g_free (data);
if (err)
show_message ("EOF encountered on reading");
show_message (_("EOF encountered on reading"));
gimp_drawable_flush (drawable);
@ -1121,7 +1129,7 @@ load_sun_d8 (char *filename,
g_free (data);
if (err)
show_message ("EOF encountered on reading");
show_message (_("EOF encountered on reading"));
gimp_drawable_flush (drawable);
@ -1203,7 +1211,7 @@ load_sun_d24 (char *filename,
g_free (data);
if (err)
show_message ("EOF encountered on reading");
show_message (_("EOF encountered on reading"));
gimp_drawable_flush (drawable);
@ -1299,7 +1307,7 @@ load_sun_d32 (char *filename,
g_free (data);
if (err)
show_message ("EOF encountered on reading");
show_message (_("EOF encountered on reading"));
gimp_drawable_flush (drawable);
@ -1455,7 +1463,7 @@ save_index (FILE *ofp,
if (ferror (ofp))
{
show_message ("write error occured");
show_message (_("write error occured"));
return (FALSE);
}
return (TRUE);
@ -1564,7 +1572,7 @@ save_rgb (FILE *ofp,
if (ferror (ofp))
{
show_message ("write error occured");
show_message (_("write error occured"));
return (FALSE);
}
return (TRUE);
@ -1603,14 +1611,14 @@ save_dialog (void)
gint use_std = (psvals.rle == FALSE);
dlg = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (dlg), "Save as SUNRAS");
gtk_window_set_title (GTK_WINDOW (dlg), _("Save as SUNRAS"));
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
(GtkSignalFunc) save_close_callback,
NULL);
/* Action area */
button = gtk_button_new_with_label ("OK");
button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) save_ok_callback,
@ -1620,7 +1628,7 @@ save_dialog (void)
gtk_widget_grab_default (button);
gtk_widget_show (button);
button = gtk_button_new_with_label ("Cancel");
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_widget_destroy,
@ -1630,7 +1638,7 @@ save_dialog (void)
gtk_widget_show (button);
/* file save type */
frame = gtk_frame_new ("Data Formatting");
frame = gtk_frame_new (_("Data Formatting"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_container_border_width (GTK_CONTAINER (frame), 10);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, FALSE, TRUE, 0);
@ -1639,7 +1647,7 @@ save_dialog (void)
gtk_container_add (GTK_CONTAINER (frame), toggle_vbox);
group = NULL;
toggle = gtk_radio_button_new_with_label (group, "RLE");
toggle = gtk_radio_button_new_with_label (group, _("RunLengthEncoded"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
@ -1648,7 +1656,7 @@ save_dialog (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), use_rle);
gtk_widget_show (toggle);
toggle = gtk_radio_button_new_with_label (group, "Standard");
toggle = gtk_radio_button_new_with_label (group, _("Standard"));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
@ -1715,7 +1723,7 @@ show_message (char *message)
if (l_run_mode == RUN_INTERACTIVE)
gimp_message (message);
else
fprintf (stderr, "sunras: %s\n", message);
fprintf (stderr, _("sunras: %s\n"), message);
}
static int

View File

@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* FITS file plugin
* reading and writing code Copyright (C) 1997 Peter Kirchgessner
* e-mail: pkirchg@aol.com, WWW: http://members.aol.com/pkirchg
* e-mail: peter@kirchgessner.net, WWW: http://www.kirchgessner.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,8 +27,11 @@
* V 1.03, PK, 05-Oct-97: Parse rc-file
* V 1.04, PK, 12-Oct-97: No progress bars for non-interactive mode
* V 1.05, nn, 20-Dec-97: Initialize image_ID in run()
* V 1.06, PK, 21-Nov-99: Internationalization
* Fix bug with gimp_export_image()
* (moved it from load to save)
*/
static char ident[] = "@(#) GIMP FITS file-plugin v1.05 20-Dec-97";
static char ident[] = "@(#) GIMP FITS file-plugin v1.06 21-Nov-99";
#include <stdio.h>
#include <stdlib.h>
@ -36,6 +39,7 @@ static char ident[] = "@(#) GIMP FITS file-plugin v1.05 20-Dec-97";
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "libgimp/stdplugins-intl.h"
#include "fitsrw.h"
/* Load info */
@ -174,12 +178,14 @@ query (void)
};
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
INIT_I18N();
gimp_install_procedure ("file_fits_load",
"load file of the FITS file format",
"load file of the FITS file format (Flexible Image\
Transport System)",
_("load file of the FITS file format"),
_("load file of the FITS file format (Flexible Image\
Transport System)"),
"Peter Kirchgessner",
"Peter Kirchgessner (pkirchg@aol.com)",
"Peter Kirchgessner (peter@kirchgessner.net)",
"1997",
"<Load>/FITS",
NULL,
@ -188,11 +194,11 @@ query (void)
load_args, load_return_vals);
gimp_install_procedure ("file_fits_save",
"save file in the FITS file format",
"FITS saving handles all image types except \
those with alpha channels.",
_("save file in the FITS file format"),
_("FITS saving handles all image types except \
those with alpha channels."),
"Peter Kirchgessner",
"Peter Kirchgessner (pkirchg@aol.com)",
"Peter Kirchgessner (peter@kirchgessner.net)",
"1997",
"<Save>/FITS",
"RGB, GRAY, INDEXED",
@ -220,7 +226,6 @@ run (char *name,
GStatusType status = STATUS_SUCCESS;
gint32 image_ID;
gint32 drawable_ID;
GimpExportReturnType export = EXPORT_CANCEL;
/* initialize */
@ -235,29 +240,12 @@ run (char *name,
if (strcmp (name, "file_fits_load") == 0)
{
INIT_I18N_UI();
*nreturn_vals = 2;
values[1].type = PARAM_IMAGE;
values[1].data.d_image = -1;
/* eventually export the image */
switch (run_mode)
{
case RUN_INTERACTIVE:
case RUN_WITH_LAST_VALS:
init_gtk ();
export = gimp_export_image (&image_ID, &drawable_ID, "FITS",
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED));
if (export == EXPORT_CANCEL)
{
*nreturn_vals = 1;
values[0].data.d_status = STATUS_EXECUTION_ERROR;
return;
}
break;
default:
break;
}
switch (run_mode)
{
case RUN_INTERACTIVE:
@ -301,10 +289,33 @@ run (char *name,
}
else if (strcmp (name, "file_fits_save") == 0)
{
GimpExportReturnType export = EXPORT_CANCEL;
INIT_I18N_UI();
image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_int32;
*nreturn_vals = 1;
/* eventually export the image */
switch (run_mode)
{
case RUN_INTERACTIVE:
case RUN_WITH_LAST_VALS:
init_gtk ();
export = gimp_export_image (&image_ID, &drawable_ID, "FITS",
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED));
if (export == EXPORT_CANCEL)
{
*nreturn_vals = 1;
values[0].data.d_status = STATUS_EXECUTION_ERROR;
return;
}
break;
default:
break;
}
switch (run_mode)
{
case RUN_INTERACTIVE:
@ -348,7 +359,7 @@ load_image (char *filename)
fp = fopen (filename, "rb");
if (!fp)
{
show_message ("can't open file for reading");
show_message (_("can't open file for reading"));
return (-1);
}
fclose (fp);
@ -356,12 +367,12 @@ load_image (char *filename)
ifp = fits_open (filename, "r");
if (ifp == NULL)
{
show_message ("error during open of FITS file");
show_message (_("error during open of FITS file"));
return (-1);
}
if (ifp->n_pic <= 0)
{
show_message ("FITS file keeps no displayable images");
show_message (_("FITS file keeps no displayable images"));
fits_close (ifp);
return (-1);
}
@ -369,7 +380,7 @@ load_image (char *filename)
image_list = (gint32 *)g_malloc (10 * sizeof (gint32));
if (image_list == NULL)
{
show_message ("out of memory");
show_message (_("out of memory"));
return (-1);
}
n_images = 0;
@ -446,7 +457,7 @@ save_image (char *filename,
/* Make sure we're not saving an image with an alpha channel */
if (gimp_drawable_has_alpha (drawable_ID))
{
show_message ("FITS save cannot handle images with alpha channels");
show_message (_("FITS save cannot handle images with alpha channels"));
return FALSE;
}
@ -457,7 +468,7 @@ save_image (char *filename,
case RGB_IMAGE: case RGBA_IMAGE:
break;
default:
show_message ("cannot operate on unknown image types");
show_message (_("cannot operate on unknown image types"));
return (FALSE);
break;
}
@ -466,14 +477,14 @@ save_image (char *filename,
ofp = fits_open (filename, "w");
if (!ofp)
{
show_message ("cant open file for writing");
show_message (_("cant open file for writing"));
return (FALSE);
}
if (l_run_mode != RUN_NONINTERACTIVE)
{
temp = g_malloc (strlen (filename) + 11);
sprintf (temp, "Saving %s:", filename);
temp = g_malloc (strlen (filename) + 64);
sprintf (temp, _("Saving %s:"), filename);
gimp_progress_init (temp);
g_free (temp);
}
@ -514,7 +525,7 @@ create_new_image (char *filename,
char *tmp;
image_ID = gimp_image_new (width, height, itype);
if ((tmp = g_malloc (strlen (filename) + 32)) != NULL)
if ((tmp = g_malloc (strlen (filename) + 64)) != NULL)
{
sprintf (tmp, "%s-img%ld", filename, (long)pagenum);
gimp_image_set_filename (image_ID, tmp);
@ -523,7 +534,7 @@ create_new_image (char *filename,
else
gimp_image_set_filename (image_ID, filename);
*layer_ID = gimp_layer_new (image_ID, "Background", width, height,
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
dtype, 100, NORMAL_MODE);
gimp_image_add_layer (image_ID, *layer_ID, 0);
@ -688,7 +699,7 @@ load_fits (char *filename,
g_free (data);
if (err)
show_message ("EOF encountered on reading");
show_message (_("EOF encountered on reading"));
gimp_drawable_flush (drawable);
@ -743,11 +754,11 @@ create_fits_header (FITS_FILE *ofp,
"HISTORY THIS FITS FILE WAS GENERATED BY GIMP USING FITSRW");
fits_add_card (hdulist, "");
fits_add_card (hdulist,
"COMMENT FitsRW is (C) Peter Kirchgessner (pkirchg@aol.com), but available");
"COMMENT FitsRW is (C) Peter Kirchgessner (peter@kirchgessner.net), but available");
fits_add_card (hdulist,
"COMMENT under the GNU general public licence."),
fits_add_card (hdulist,
"COMMENT For sources see ftp://members.aol.com/pkirchg/pub/gimp");
"COMMENT For sources see http://www.kirchgessner.net");
fits_add_card (hdulist, "");
fits_add_card (hdulist, ctype3_card[bpp*3]);
if (ctype3_card[bpp*3+1] != NULL)
@ -839,7 +850,7 @@ save_direct (FITS_FILE *ofp,
if (ferror (ofp->fp))
{
show_message ("write error occured");
show_message (_("write error occured"));
return (FALSE);
}
return (TRUE);
@ -960,7 +971,7 @@ save_index (FITS_FILE *ofp,
if (ferror (ofp->fp))
{
show_message ("write error occured");
show_message (_("write error occured"));
return (FALSE);
}
return (TRUE);
@ -998,9 +1009,9 @@ load_dialog (void)
gint k, j;
char **textptr;
static char *toggle_text[] = {
"BLANK/NaN pixel replacement", "Black", "White",
"Pixel value scaling", "Automatic", "by DATAMIN/DATAMAX",
"Image composing", "None", "NAXIS=3, NAXIS3=2,...,4"
N_("BLANK/NaN pixel replacement"), N_("Black"), N_("White"),
N_("Pixel value scaling"), N_("Automatic"), N_("by DATAMIN/DATAMAX"),
N_("Image composing"), N_("None"), "NAXIS=3, NAXIS3=2,...,4"
};
init_gtk ();
@ -1015,14 +1026,14 @@ load_dialog (void)
vals->toggle_val[5] = !(vals->toggle_val[4]);
vals->dialog = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (vals->dialog), "Load FITS");
gtk_window_set_title (GTK_WINDOW (vals->dialog), _("Load FITS File"));
gtk_window_position (GTK_WINDOW (vals->dialog), GTK_WIN_POS_MOUSE);
gtk_signal_connect (GTK_OBJECT (vals->dialog), "destroy",
(GtkSignalFunc) load_close_callback,
NULL);
/* Action area */
button = gtk_button_new_with_label ("OK");
button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) load_ok_callback,
@ -1032,7 +1043,7 @@ load_dialog (void)
gtk_widget_grab_default (button);
gtk_widget_show (button);
button = gtk_button_new_with_label ("Cancel");
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gtk_widget_destroy,
@ -1044,7 +1055,8 @@ load_dialog (void)
textptr = toggle_text;
for (k = 0; k < LOAD_FITS_TOGGLES; k++)
{
frame = gtk_frame_new (*(textptr++));
frame = gtk_frame_new (gettext (*textptr));
textptr++;
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_container_border_width (GTK_CONTAINER (frame), 10);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (vals->dialog)->vbox),
@ -1056,7 +1068,8 @@ load_dialog (void)
group = NULL;
for (j = 0; j < 2; j++)
{
toggle = gtk_radio_button_new_with_label (group, *(textptr++));
toggle = gtk_radio_button_new_with_label (group, gettext (*textptr));
textptr++;
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toggle));
gtk_box_pack_start (GTK_BOX (toggle_vbox), toggle, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",

View File

@ -1088,15 +1088,12 @@ script_fu_interface (SFScript *script)
if (!gtk_initted)
{
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("script-fu");
INIT_I18N_UI();
gtk_init (&argc, &argv);
g_set_prgname ("script-fu");
gtk_rc_parse (gimp_gtkrc ());
INIT_I18N_UI();
gdk_set_use_xshm (gimp_use_xshm ());
gtk_preview_set_gamma (gimp_gamma ());

View File

@ -1088,15 +1088,12 @@ script_fu_interface (SFScript *script)
if (!gtk_initted)
{
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("script-fu");
INIT_I18N_UI();
gtk_init (&argc, &argv);
g_set_prgname ("script-fu");
gtk_rc_parse (gimp_gtkrc ());
INIT_I18N_UI();
gdk_set_use_xshm (gimp_use_xshm ());
gtk_preview_set_gamma (gimp_gamma ());