Commit 8183459c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

added new PDB function gimp_image_is_dirty() on request of Wolfgang Hofer

2002-12-13  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/image.pdb: added new PDB function
	gimp_image_is_dirty() on request of Wolfgang Hofer (#77508).

	* app/pdb/image_cmds.c
	* app/pdb/internal_procs.c
	* libgimp/gimpimage_pdb.h: regenerated.
parent 2ebf3fe6
2002-12-13 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/image.pdb: added new PDB function
gimp_image_is_dirty() on request of Wolfgang Hofer (#77508).
* app/pdb/image_cmds.c
* app/pdb/internal_procs.c
* libgimp/gimpimage_pdb.h: regenerated.
2002-12-12 Maurits Rijk <lpeek.mrijk@consunet.nl>
 
* plug-ins/gimpressionist/color.c
......
......@@ -87,6 +87,7 @@ static ProcRecord image_undo_disable_proc;
static ProcRecord image_undo_freeze_proc;
static ProcRecord image_undo_thaw_proc;
static ProcRecord image_clean_all_proc;
static ProcRecord image_is_dirty_proc;
static ProcRecord image_floating_selection_proc;
static ProcRecord image_floating_sel_attached_to_proc;
static ProcRecord image_thumbnail_proc;
......@@ -153,6 +154,7 @@ register_image_procs (Gimp *gimp)
procedural_db_register (gimp, &image_undo_freeze_proc);
procedural_db_register (gimp, &image_undo_thaw_proc);
procedural_db_register (gimp, &image_clean_all_proc);
procedural_db_register (gimp, &image_is_dirty_proc);
procedural_db_register (gimp, &image_floating_selection_proc);
procedural_db_register (gimp, &image_floating_sel_attached_to_proc);
procedural_db_register (gimp, &image_thumbnail_proc);
......@@ -2408,6 +2410,64 @@ static ProcRecord image_clean_all_proc =
{ { image_clean_all_invoker } }
};
static Argument *
image_is_dirty_invoker (Gimp *gimp,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gboolean dirty = FALSE;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
if (success)
dirty = (gimage->dirty != 0);
return_args = procedural_db_return_args (&image_is_dirty_proc, success);
if (success)
return_args[1].value.pdb_int = dirty;
return return_args;
}
static ProcArg image_is_dirty_inargs[] =
{
{
GIMP_PDB_IMAGE,
"image",
"The image"
}
};
static ProcArg image_is_dirty_outargs[] =
{
{
GIMP_PDB_INT32,
"dirty",
"True if the image has unsaved changed."
}
};
static ProcRecord image_is_dirty_proc =
{
"gimp_image_is_dirty",
"Checks if the image has unsaved changes.",
"This procedure checks the specified image's dirty count to see if it needs to be saved.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
GIMP_INTERNAL,
1,
image_is_dirty_inargs,
1,
image_is_dirty_outargs,
{ { image_is_dirty_invoker } }
};
static Argument *
image_floating_selection_invoker (Gimp *gimp,
Argument *args)
......
......@@ -67,7 +67,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 338 procedures registered total */
/* 339 procedures registered total */
void
internal_procs_init (Gimp *gimp,
......@@ -85,7 +85,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Channel"), 0.041);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.089);
(* status_callback) (NULL, _("Color"), 0.088);
register_color_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.124);
......@@ -97,61 +97,61 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Drawable procedures"), 0.145);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.213);
(* status_callback) (NULL, _("Edit procedures"), 0.212);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.231);
(* status_callback) (NULL, _("File Operations"), 0.23);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.254);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.272);
(* status_callback) (NULL, _("Gimprc procedures"), 0.271);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.284);
(* status_callback) (NULL, _("Gradient UI"), 0.283);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.293);
(* status_callback) (NULL, _("Gradients"), 0.292);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.314);
(* status_callback) (NULL, _("Guide procedures"), 0.313);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.331);
(* status_callback) (NULL, _("Help procedures"), 0.33);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.334);
(* status_callback) (NULL, _("Image"), 0.333);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.518);
(* status_callback) (NULL, _("Layer"), 0.519);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.612);
(* status_callback) (NULL, _("Message procedures"), 0.614);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.621);
(* status_callback) (NULL, _("Miscellaneous"), 0.622);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.627);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.628);
register_misc_tools_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.636);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.637);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.68);
(* status_callback) (NULL, _("Palette"), 0.681);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.698);
(* status_callback) (NULL, _("Palette UI"), 0.699);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.707);
(* status_callback) (NULL, _("Palettes"), 0.708);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.722);
(* status_callback) (NULL, _("Parasite procedures"), 0.723);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.757);
(* status_callback) (NULL, _("Paths"), 0.758);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.796);
......@@ -163,7 +163,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Plug-in"), 0.82);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.837);
(* status_callback) (NULL, _("Procedural database"), 0.838);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.861);
......@@ -181,7 +181,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Undo"), 0.959);
register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.964);
(* status_callback) (NULL, _("Units"), 0.965);
register_unit_procs (gimp);
}
2002-12-13 Sven Neumann <sven@gimp.org>
* libgimp/libgimp-sections.txt
* libgimp/tmp/gimpimage.sgml: updated for new PDB function.
2002-12-03 Sven Neumann <sven@gimp.org>
* libgimp/libgimp-sections.txt
......
......@@ -309,6 +309,7 @@ gimp_image_undo_disable
gimp_image_undo_freeze
gimp_image_undo_thaw
gimp_image_clean_all
gimp_image_is_dirty
gimp_image_floating_selection
gimp_image_floating_sel_attached_to
gimp_image_set_tattoo_state
......
......@@ -366,6 +366,15 @@ and operations involving multiple layers.
@Returns:
<!-- ##### FUNCTION gimp_image_is_dirty ##### -->
<para>
</para>
@image_ID:
@Returns:
<!-- ##### FUNCTION gimp_image_floating_selection ##### -->
<para>
......
......@@ -1357,6 +1357,37 @@ gimp_image_clean_all (gint32 image_ID)
return success;
}
/**
* gimp_image_is_dirty:
* @image_ID: The image.
*
* Checks if the image has unsaved changes.
*
* This procedure checks the specified image's dirty count to see if it
* needs to be saved.
*
* Returns: True if the image has unsaved changed.
*/
gboolean
gimp_image_is_dirty (gint32 image_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean dirty = FALSE;
return_vals = gimp_run_procedure ("gimp_image_is_dirty",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
dirty = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return dirty;
}
/**
* gimp_image_floating_selection:
* @image_ID: The image.
......
......@@ -103,6 +103,7 @@ gboolean gimp_image_undo_disable (gint32 image
gboolean gimp_image_undo_freeze (gint32 image_ID);
gboolean gimp_image_undo_thaw (gint32 image_ID);
gboolean gimp_image_clean_all (gint32 image_ID);
gboolean gimp_image_is_dirty (gint32 image_ID);
gint32 gimp_image_floating_selection (gint32 image_ID);
gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
gboolean _gimp_image_thumbnail (gint32 image_ID,
......
......@@ -1020,6 +1020,26 @@ HELP
%invoke = ( code => 'gimp_image_clean_all (gimage);' );
}
sub image_is_dirty {
$blurb = 'Checks if the image has unsaved changes.';
$help = <<'HELP';
This procedure checks the specified image's dirty count to see if it needs
to be saved.
HELP
&std_pdb_misc;
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'dirty', type => 'boolean', init => 1,
desc => 'True if the image has unsaved changed.' }
);
%invoke = ( code => 'dirty = (gimage->dirty != 0);' );
}
sub image_floating_selection {
$blurb = 'Return the floating selection of the image.';
......@@ -1580,7 +1600,7 @@ unshift @procs, qw(image_list image_new image_delete image_base_type
image_get_cmap image_set_cmap
image_undo_is_enabled image_undo_enable
image_undo_disable image_undo_freeze image_undo_thaw
image_clean_all image_floating_selection
image_clean_all image_is_dirty image_floating_selection
image_floating_sel_attached_to image_thumbnail
image_set_tattoo_state image_get_tattoo_state
image_duplicate);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment