fixed a typo spotted by Ed Halley <ed@halley.cc>.

2001-09-17  Sven Neumann  <sven@gimp.org>

	* app/gimprc.c (gimprc_init):
	fixed a typo spotted by Ed Halley <ed@halley.cc>.

	* app/pdb/gimprc_cmds.c
	* app/pdb/internal_procs.c
	* libgimp/gimpgimprc_pdb.[ch]: added new PDB function
	gimp_get_default_comment() that allows to access the default image
	comment as set in the preferences.

	* plug-ins/common/csource.c
	* plug-ins/common/gif.c
	* plug-ins/common/jpeg.c
	* plug-ins/common/tiff.c: use gimp_get_default_comment() instead of
	a hardcoded string.

	* plug-ins/common/uniteditor.c: replaced deprecated GDK function
	gdk_color_alloc().
This commit is contained in:
Sven Neumann 2001-09-17 18:11:15 +00:00 committed by Sven Neumann
parent d871f9035e
commit 525b013cb9
18 changed files with 210 additions and 84 deletions

View File

@ -1,4 +1,39 @@
2001-09-17 Sven Neumann <sven@gimp.org>
* app/gimprc.c (gimprc_init):
fixed a typo spotted by Ed Halley <ed@halley.cc>.
* app/pdb/gimprc_cmds.c
* app/pdb/internal_procs.c
* libgimp/gimpgimprc_pdb.[ch]: added new PDB function
gimp_get_default_comment() that allows to access the default image
comment as set in the preferences.
* plug-ins/common/csource.c
* plug-ins/common/gif.c
* plug-ins/common/jpeg.c
* plug-ins/common/tiff.c: use gimp_get_default_comment() instead of
a hardcoded string.
* plug-ins/common/uniteditor.c: replaced deprecated GDK function
gdk_color_alloc().
2001-09-17 Sven Neumann <sven@gimp.org>
* plug-ins/common/mail.c: resurrected mail plug-in. Thanks to
David Odin <dindinx@wanadoo.fr> for the patch.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: build mail, nlfilt and plugindetails
plug-ins again.
* tips/Makefile.am
* tips/gimp_conseils.fr.txt: removed ...
* tips/gimp_tips.fr.txt: ... and readded under this name.
2001-09-11 Nathan Summers <rock@gimp.org>
* all files: wilber cried.
2001-09-09 Sven Neumann <sven@gimp.org>

View File

@ -387,7 +387,7 @@ gimprc_init (Gimp *gimp)
base_funcs[2].val1p = &base_config->tile_cache_size;
base_funcs[3].val1p = &base_config->stingy_memory_use;
base_funcs[4].val1p = &base_config->interpolation_type;
base_funcs[4].val1p = &base_config->num_processors;
base_funcs[5].val1p = &base_config->num_processors;
core_funcs[0].val1p = &gimp->config->plug_in_path;
core_funcs[1].val1p = &gimp->config->module_path;

View File

@ -28,10 +28,14 @@
#include "pdb-types.h"
#include "procedural_db.h"
#include "app_procs.h"
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "gimprc.h"
static ProcRecord gimprc_query_proc;
static ProcRecord gimprc_set_proc;
static ProcRecord get_default_comment_proc;
static ProcRecord get_monitor_resolution_proc;
void
@ -39,6 +43,7 @@ register_gimprc_procs (Gimp *gimp)
{
procedural_db_register (gimp, &gimprc_query_proc);
procedural_db_register (gimp, &gimprc_set_proc);
procedural_db_register (gimp, &get_default_comment_proc);
procedural_db_register (gimp, &get_monitor_resolution_proc);
}
@ -93,7 +98,7 @@ static ProcRecord gimprc_query_proc =
{
"gimp_gimprc_query",
"Queries the gimprc file parser for information on a specified token.",
"This procedure is used to locate additional information contained in the gimprc file considered extraneous to the operation of the GIMP. Plug-ins that need configuration information can expect it will be stored in the user gimprc file and can use this procedure to retrieve it. This query procedure will return the value associated with the specified token. This corresponds _only_ to entries with the format: (<token> <value>). The value must be a string. Entries not corresponding to this format will cause warnings to be issued on gimprc parsing a nd will not be queryable.",
"This procedure is used to locate additional information contained in the gimprc file considered extraneous to the operation of the GIMP. Plug-ins that need configuration information can expect it will be stored in the user gimprc file and can use this procedure to retrieve it. This query procedure will return the value associated with the specified token. This corresponds _only_ to entries with the format: (<token> <value>). The value must be a string. Entries not corresponding to this format will cause warnings to be issued on gimprc parsing and will not be queryable.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997",
@ -157,6 +162,50 @@ static ProcRecord gimprc_set_proc =
{ { gimprc_set_invoker } }
};
static Argument *
get_default_comment_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *comment;
comment = the_gimp->config->default_comment;
success = TRUE;
return_args = procedural_db_return_args (&get_default_comment_proc, success);
if (success)
return_args[1].value.pdb_pointer = comment;
return return_args;
}
static ProcArg get_default_comment_outargs[] =
{
{
GIMP_PDB_STRING,
"comment",
"Default Image Comment"
}
};
static ProcRecord get_default_comment_proc =
{
"gimp_get_default_comment",
"Get the default image comment as specified in the Preferences.",
"Returns a copy of the default image comment.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
0,
NULL,
1,
get_default_comment_outargs,
{ { get_default_comment_invoker } }
};
static Argument *
get_monitor_resolution_invoker (Gimp *gimp,
Argument *args)

View File

@ -62,7 +62,7 @@ void register_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 325 procedures registered total */
/* 326 procedures registered total */
void
internal_procs_init (Gimp *gimp)
@ -85,70 +85,70 @@ internal_procs_init (Gimp *gimp)
app_init_update_status (NULL, _("GDisplay procedures"), 0.138);
register_display_procs (gimp);
app_init_update_status (NULL, _("Drawable procedures"), 0.148);
app_init_update_status (NULL, _("Drawable procedures"), 0.147);
register_drawable_procs (gimp);
app_init_update_status (NULL, _("Edit procedures"), 0.218);
register_edit_procs (gimp);
app_init_update_status (NULL, _("File Operations"), 0.237);
app_init_update_status (NULL, _("File Operations"), 0.236);
register_fileops_procs (gimp);
app_init_update_status (NULL, _("Floating selections"), 0.262);
app_init_update_status (NULL, _("Floating selections"), 0.261);
register_floating_sel_procs (gimp);
app_init_update_status (NULL, _("Gimprc procedures"), 0.28);
app_init_update_status (NULL, _("Gimprc procedures"), 0.279);
register_gimprc_procs (gimp);
app_init_update_status (NULL, _("Gradients"), 0.289);
app_init_update_status (NULL, _("Gradients"), 0.291);
register_gradients_procs (gimp);
app_init_update_status (NULL, _("Gradient UI"), 0.305);
app_init_update_status (NULL, _("Gradient UI"), 0.307);
register_gradient_select_procs (gimp);
app_init_update_status (NULL, _("Guide procedures"), 0.317);
app_init_update_status (NULL, _("Guide procedures"), 0.319);
register_guides_procs (gimp);
app_init_update_status (NULL, _("Help procedures"), 0.335);
app_init_update_status (NULL, _("Help procedures"), 0.337);
register_help_procs (gimp);
app_init_update_status (NULL, _("Image"), 0.338);
app_init_update_status (NULL, _("Image"), 0.34);
register_image_procs (gimp);
app_init_update_status (NULL, _("Layer"), 0.526);
app_init_update_status (NULL, _("Layer"), 0.528);
register_layer_procs (gimp);
app_init_update_status (NULL, _("Interface"), 0.622);
app_init_update_status (NULL, _("Interface"), 0.623);
register_message_procs (gimp);
app_init_update_status (NULL, _("Miscellaneous"), 0.631);
app_init_update_status (NULL, _("Miscellaneous"), 0.632);
register_misc_procs (gimp);
app_init_update_status (NULL, _("Palette"), 0.637);
app_init_update_status (NULL, _("Palette"), 0.638);
register_palette_procs (gimp);
app_init_update_status (NULL, _("Parasite procedures"), 0.658);
app_init_update_status (NULL, _("Parasite procedures"), 0.66);
register_parasite_procs (gimp);
app_init_update_status (NULL, _("Paths"), 0.695);
app_init_update_status (NULL, _("Paths"), 0.696);
register_paths_procs (gimp);
app_init_update_status (NULL, _("Pattern UI"), 0.735);
app_init_update_status (NULL, _("Pattern UI"), 0.736);
register_pattern_select_procs (gimp);
app_init_update_status (NULL, _("Patterns"), 0.745);
register_patterns_procs (gimp);
app_init_update_status (NULL, _("Plug-in"), 0.757);
app_init_update_status (NULL, _("Plug-in"), 0.758);
register_plug_in_procs (gimp);
app_init_update_status (NULL, _("Procedural database"), 0.775);
app_init_update_status (NULL, _("Procedural database"), 0.776);
register_procedural_db_procs (gimp);
app_init_update_status (NULL, _("Image mask"), 0.8);
app_init_update_status (NULL, _("Image mask"), 0.801);
register_selection_procs (gimp);
app_init_update_status (NULL, _("Text procedures"), 0.855);
app_init_update_status (NULL, _("Text procedures"), 0.856);
register_text_tool_procs (gimp);
app_init_update_status (NULL, _("Tool procedures"), 0.868);

View File

@ -37,7 +37,7 @@
* with the specified token. This corresponds _only_ to entries with
* the format: (<token> <value>). The value must be a string. Entries
* not corresponding to this format will cause warnings to be issued on
* gimprc parsing a nd will not be queryable.
* gimprc parsing and will not be queryable.
*
* Returns: The value associated with the queried token.
*/
@ -101,6 +101,34 @@ gimp_gimprc_set (gchar *token,
return success;
}
/**
* gimp_get_default_comment:
*
* Get the default image comment as specified in the Preferences.
*
* Returns a copy of the default image comment.
*
* Returns: Default Image Comment.
*/
gchar *
gimp_get_default_comment (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar *comment = NULL;
return_vals = gimp_run_procedure ("gimp_get_default_comment",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
comment = g_strdup (return_vals[1].data.d_string);
gimp_destroy_params (return_vals, nreturn_vals);
return comment;
}
/**
* gimp_get_monitor_resolution:
* @xres: X resolution.

View File

@ -34,6 +34,7 @@ extern "C" {
gchar* gimp_gimprc_query (gchar *token);
gboolean gimp_gimprc_set (gchar *token,
gchar *value);
gchar* gimp_get_default_comment (void);
gboolean gimp_get_monitor_resolution (gdouble *xres,
gdouble *yres);

View File

@ -33,8 +33,6 @@
#include "libgimp/stdplugins-intl.h"
#define DEFAULT_COMMENT "Created with The GIMP"
typedef struct
{
gchar *file_name;
@ -167,7 +165,7 @@ run (gchar *name,
x = config.comment;
if (!config.comment)
config.comment = g_strdup (DEFAULT_COMMENT);
config.comment = gimp_get_default_comment ();
gimp_ui_init ("csource", FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, "C Source",
@ -377,7 +375,7 @@ save_image (Config *config,
gint32 image_ID,
gint32 drawable_ID)
{
GimpDrawable *drawable = gimp_drawable_get (drawable_ID);
GimpDrawable *drawable = gimp_drawable_get (drawable_ID);
GimpImageType drawable_type = gimp_drawable_type (drawable_ID);
GimpPixelRgn pixel_rgn;
gchar *s_uint_8, *s_uint_32, *s_uint, *s_char, *s_null;

View File

@ -997,7 +997,7 @@ save_image (gchar *filename,
GIFEncodeLoopExt (outfile, 0);
/* Write comment extension - mustn't be written before the looping ext. */
if (gsvals.save_comment)
if (gsvals.save_comment && globalcomment)
{
GIFEncodeCommentExt (outfile, globalcomment);
}
@ -1208,6 +1208,7 @@ save_dialog (gint32 image_ID)
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *align;
GtkWidget *disposal_option_menu;
GtkWidget *scrolled_window;
#ifdef FACEHUGGERS
@ -1259,8 +1260,12 @@ save_dialog (gint32 image_ID)
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
align = gtk_alignment_new (0.0, 0.0, 0, 0);
gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0);
gtk_widget_show (align);
toggle = gtk_check_button_new_with_label (_("GIF Comment:"));
gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (align), toggle);
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
&gsvals.save_comment);
@ -1300,9 +1305,7 @@ save_dialog (gint32 image_ID)
else
{
#endif
/* globalcomment = g_malloc(1+strlen(_("Made with GIMP")));
strcpy(globalcomment, _("Made with GIMP")); */
globalcomment = NULL;
globalcomment = gimp_get_default_comment ();
#ifdef FACEHUGGERS
}
gimp_parasite_free (GIF2_CMNT);
@ -2450,21 +2453,22 @@ comment_entry_callback (GtkTextBuffer *buffer)
text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
if (strlen (text) > 240)
{
g_message (_("The default comment is limited to %d characters."), 240);
gtk_text_buffer_get_iter_at_offset (buffer, &start_iter, 240 - 1);
gtk_text_buffer_get_end_iter (buffer, &end_iter);
/* this calls us recursivaly, but in the else branch
*/
gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
} else
{
if (globalcomment != NULL) g_free (globalcomment);
globalcomment = g_strdup(text);
comment_was_edited = TRUE;
}
{
g_message (_("The default comment is limited to %d characters."), 240);
gtk_text_buffer_get_iter_at_offset (buffer, &start_iter, 240 - 1);
gtk_text_buffer_get_end_iter (buffer, &end_iter);
/* this calls us recursivaly, but in the else branch
*/
gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
}
else
{
g_free (globalcomment);
globalcomment = g_strdup (text);
comment_was_edited = TRUE;
}
g_free (text);
}

View File

@ -168,8 +168,6 @@
#define DEFAULT_DCT 0
#define DEFAULT_PREVIEW 1
#define DEFAULT_COMMENT "Created with The GIMP"
/* sg - these should not be global... */
static gint32 volatile image_ID_global = -1;
static gint32 orig_image_ID_global = -1;
@ -440,8 +438,8 @@ run (gchar *name,
gimp_parasite_free (parasite);
}
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
if (!image_comment)
image_comment = gimp_get_default_comment ();
jsvals.quality = DEFAULT_QUALITY;
jsvals.smoothing = DEFAULT_SMOOTHING;

View File

@ -149,7 +149,6 @@ static void save_ok_callback (GtkWidget *widget,
static void comment_entry_callback (GtkWidget *widget,
gpointer data);
#define DEFAULT_COMMENT "Created with The GIMP"
GimpPlugInInfo PLUG_IN_INFO =
{
@ -281,7 +280,7 @@ run (gchar *name,
drawable = param[2].data.d_int32;
/* Do this right this time, if POSSIBLE query for parasites, otherwise
or if there isn't one, choose the DEFAULT_COMMENT */
or if there isn't one, choose the default comment from the gimprc. */
/* eventually export the image */
switch (run_mode)
@ -311,7 +310,7 @@ run (gchar *name,
gimp_parasite_free (parasite);
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
image_comment = gimp_get_default_comment ();
switch (run_mode)
{
@ -1440,7 +1439,7 @@ save_image (gchar *filename,
/* do we have a comment? If so, create a new parasite to hold it,
* and attach it to the image. The attach function automatically
* detaches a previous incarnation of the parasite. */
if (image_comment && *image_comment != '\000')
if (image_comment && *image_comment)
{
GimpParasite *parasite;

View File

@ -609,7 +609,8 @@ unit_editor_dialog (void)
color.green = 50000;
color.blue = 50000;
gdk_color_alloc (gtk_widget_get_colormap (main_dialog), &color);
gdk_colormap_alloc_color (gtk_widget_get_colormap (main_dialog),
&color, FALSE, TRUE);
clist_init ();

View File

@ -168,8 +168,6 @@
#define DEFAULT_DCT 0
#define DEFAULT_PREVIEW 1
#define DEFAULT_COMMENT "Created with The GIMP"
/* sg - these should not be global... */
static gint32 volatile image_ID_global = -1;
static gint32 orig_image_ID_global = -1;
@ -440,8 +438,8 @@ run (gchar *name,
gimp_parasite_free (parasite);
}
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
if (!image_comment)
image_comment = gimp_get_default_comment ();
jsvals.quality = DEFAULT_QUALITY;
jsvals.smoothing = DEFAULT_SMOOTHING;

View File

@ -168,8 +168,6 @@
#define DEFAULT_DCT 0
#define DEFAULT_PREVIEW 1
#define DEFAULT_COMMENT "Created with The GIMP"
/* sg - these should not be global... */
static gint32 volatile image_ID_global = -1;
static gint32 orig_image_ID_global = -1;
@ -440,8 +438,8 @@ run (gchar *name,
gimp_parasite_free (parasite);
}
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
if (!image_comment)
image_comment = gimp_get_default_comment ();
jsvals.quality = DEFAULT_QUALITY;
jsvals.smoothing = DEFAULT_SMOOTHING;

View File

@ -168,8 +168,6 @@
#define DEFAULT_DCT 0
#define DEFAULT_PREVIEW 1
#define DEFAULT_COMMENT "Created with The GIMP"
/* sg - these should not be global... */
static gint32 volatile image_ID_global = -1;
static gint32 orig_image_ID_global = -1;
@ -440,8 +438,8 @@ run (gchar *name,
gimp_parasite_free (parasite);
}
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
if (!image_comment)
image_comment = gimp_get_default_comment ();
jsvals.quality = DEFAULT_QUALITY;
jsvals.smoothing = DEFAULT_SMOOTHING;

View File

@ -168,8 +168,6 @@
#define DEFAULT_DCT 0
#define DEFAULT_PREVIEW 1
#define DEFAULT_COMMENT "Created with The GIMP"
/* sg - these should not be global... */
static gint32 volatile image_ID_global = -1;
static gint32 orig_image_ID_global = -1;
@ -440,8 +438,8 @@ run (gchar *name,
gimp_parasite_free (parasite);
}
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
if (!image_comment)
image_comment = gimp_get_default_comment ();
jsvals.quality = DEFAULT_QUALITY;
jsvals.smoothing = DEFAULT_SMOOTHING;

View File

@ -168,8 +168,6 @@
#define DEFAULT_DCT 0
#define DEFAULT_PREVIEW 1
#define DEFAULT_COMMENT "Created with The GIMP"
/* sg - these should not be global... */
static gint32 volatile image_ID_global = -1;
static gint32 orig_image_ID_global = -1;
@ -440,8 +438,8 @@ run (gchar *name,
gimp_parasite_free (parasite);
}
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
if (!image_comment)
image_comment = gimp_get_default_comment ();
jsvals.quality = DEFAULT_QUALITY;
jsvals.smoothing = DEFAULT_SMOOTHING;

View File

@ -168,8 +168,6 @@
#define DEFAULT_DCT 0
#define DEFAULT_PREVIEW 1
#define DEFAULT_COMMENT "Created with The GIMP"
/* sg - these should not be global... */
static gint32 volatile image_ID_global = -1;
static gint32 orig_image_ID_global = -1;
@ -440,8 +438,8 @@ run (gchar *name,
gimp_parasite_free (parasite);
}
if (!image_comment)
image_comment = g_strdup (DEFAULT_COMMENT);
if (!image_comment)
image_comment = gimp_get_default_comment ();
jsvals.quality = DEFAULT_QUALITY;
jsvals.smoothing = DEFAULT_SMOOTHING;

View File

@ -34,7 +34,7 @@ file and can use this procedure to retrieve it. This query procedure will
return the value associated with the specified token. This corresponds _only_
to entries with the format: (<token> <value>). The value must be a string.
Entries not corresponding to this format will cause warnings to be issued on
gimprc parsing a nd will not be queryable.
gimprc parsing and will not be queryable.
HELP
&std_pdb_misc;
@ -124,9 +124,34 @@ CODE
);
}
@headers = qw("gimprc.h");
sub get_default_comment {
$blurb = 'Get the default image comment as specified in the Preferences.';
@procs = qw(gimprc_query gimprc_set get_monitor_resolution);
$help = 'Returns a copy of the default image comment.';
&std_pdb_misc;
@inargs = ( );
@outargs = (
{ name => 'comment', type => 'string',
desc => 'Default Image Comment' },
);
%invoke = (
code => <<'CODE'
{
comment = the_gimp->config->default_comment;
success = TRUE;
}
CODE
);
}
@headers = qw("core/gimp.h" "core/gimpcoreconfig.h" "app_procs.h" "gimprc.h");
@procs = qw(gimprc_query gimprc_set
get_default_comment get_monitor_resolution);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Gimprc procedures';