Add to the PDB the right way!

This commit is contained in:
Adam D. Moss
1999-08-21 19:27:56 +00:00
parent 10fee11e15
commit abad4162a6
4 changed files with 176 additions and 93 deletions

View File

@ -63,8 +63,8 @@ static ProcRecord image_get_cmap_proc;
static ProcRecord image_set_cmap_proc; static ProcRecord image_set_cmap_proc;
static ProcRecord image_enable_undo_proc; static ProcRecord image_enable_undo_proc;
static ProcRecord image_disable_undo_proc; static ProcRecord image_disable_undo_proc;
static ProcRecord image_thaw_undo_proc;
static ProcRecord image_freeze_undo_proc; static ProcRecord image_freeze_undo_proc;
static ProcRecord image_thaw_undo_proc;
static ProcRecord image_clean_all_proc; static ProcRecord image_clean_all_proc;
static ProcRecord image_floating_selection_proc; static ProcRecord image_floating_selection_proc;
static ProcRecord image_floating_sel_attached_to_proc; static ProcRecord image_floating_sel_attached_to_proc;
@ -123,8 +123,8 @@ register_gimage_procs (void)
procedural_db_register (&image_set_cmap_proc); procedural_db_register (&image_set_cmap_proc);
procedural_db_register (&image_enable_undo_proc); procedural_db_register (&image_enable_undo_proc);
procedural_db_register (&image_disable_undo_proc); procedural_db_register (&image_disable_undo_proc);
procedural_db_register (&image_thaw_undo_proc);
procedural_db_register (&image_freeze_undo_proc); procedural_db_register (&image_freeze_undo_proc);
procedural_db_register (&image_thaw_undo_proc);
procedural_db_register (&image_clean_all_proc); procedural_db_register (&image_clean_all_proc);
procedural_db_register (&image_floating_selection_proc); procedural_db_register (&image_floating_selection_proc);
procedural_db_register (&image_floating_sel_attached_to_proc); procedural_db_register (&image_floating_sel_attached_to_proc);
@ -1910,7 +1910,6 @@ static ProcRecord image_set_cmap_proc =
{ { image_set_cmap_invoker } } { { image_set_cmap_invoker } }
}; };
static Argument * static Argument *
image_enable_undo_invoker (Argument *args) image_enable_undo_invoker (Argument *args)
{ {
@ -1967,64 +1966,6 @@ static ProcRecord image_enable_undo_proc =
{ { image_enable_undo_invoker } } { { image_enable_undo_invoker } }
}; };
static Argument *
image_thaw_undo_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
if (success)
success = gimage_thaw_undo (gimage);
return_args = procedural_db_return_args (&image_thaw_undo_proc, success);
if (success)
return_args[1].value.pdb_int = success ? TRUE : FALSE;
return return_args;
}
static ProcArg image_thaw_undo_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
}
};
static ProcArg image_thaw_undo_outargs[] =
{
{
PDB_INT32,
"thawed",
"True if the image undo has been thawed"
}
};
static ProcRecord image_thaw_undo_proc =
{
"gimp_image_thaw_undo",
"Thaw the image's undo stack.",
"This procedure thaws the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp_image_disable_freeze' to temporarily freeze an image undo stack. 'gimp_image_thaw_undo' does NOT free the undo stack as 'gimp_image_enable_undo' does, so is suited for situations where one wishes to leave the undo stack in the same state in which one found it despite non-destructively playing with the image in the meantime. An example would be in-situ plugin previews. Balancing freezes and thaws and ensuring image consistancy is the responsibility of the caller.",
"Adam D. Moss",
"Adam D. Moss",
"1999",
PDB_INTERNAL,
1,
image_thaw_undo_inargs,
1,
image_thaw_undo_outargs,
{ { image_thaw_undo_invoker } }
};
///////////////
static Argument * static Argument *
image_disable_undo_invoker (Argument *args) image_disable_undo_invoker (Argument *args)
{ {
@ -2137,6 +2078,62 @@ static ProcRecord image_freeze_undo_proc =
{ { image_freeze_undo_invoker } } { { image_freeze_undo_invoker } }
}; };
static Argument *
image_thaw_undo_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
GimpImage *gimage;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
success = FALSE;
if (success)
success = gimage_thaw_undo (gimage);
return_args = procedural_db_return_args (&image_thaw_undo_proc, success);
if (success)
return_args[1].value.pdb_int = success ? TRUE : FALSE;
return return_args;
}
static ProcArg image_thaw_undo_inargs[] =
{
{
PDB_IMAGE,
"image",
"The image"
}
};
static ProcArg image_thaw_undo_outargs[] =
{
{
PDB_INT32,
"thawed",
"True if the image undo has been thawed"
}
};
static ProcRecord image_thaw_undo_proc =
{
"gimp_image_thaw_undo",
"Thaw the image's undo stack.",
"This procedure thaws the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp_image_disable_freeze' to temporarily freeze an image undo stack. 'gimp_image_thaw_undo' does NOT free the undo stack as 'gimp_image_enable_undo' does, so is suited for situations where one wishes to leave the undo stack in the same state in which one found it despite non-destructively playing with the image in the meantime. An example would be in-situ plugin previews. Balancing freezes and thaws and ensuring image consistancy is the responsibility of the caller.",
"Adam D. Moss",
"Adam D. Moss",
"1999",
PDB_INTERNAL,
1,
image_thaw_undo_inargs,
1,
image_thaw_undo_outargs,
{ { image_thaw_undo_invoker } }
};
static Argument * static Argument *
image_clean_all_invoker (Argument *args) image_clean_all_invoker (Argument *args)
{ {

View File

@ -59,7 +59,7 @@ void register_tools_procs (void);
void register_undo_procs (void); void register_undo_procs (void);
void register_unit_procs (void); void register_unit_procs (void);
/* 308 procedures registered total */ /* 310 procedures registered total */
void void
internal_procs_init (void) internal_procs_init (void)
@ -73,87 +73,87 @@ internal_procs_init (void)
app_init_update_status (NULL, _("Channel"), 0.045); app_init_update_status (NULL, _("Channel"), 0.045);
register_channel_procs (); 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 (); register_channel_ops_procs ();
app_init_update_status (NULL, _("Color"), 0.097); app_init_update_status (NULL, _("Color"), 0.097);
register_color_procs (); register_color_procs ();
app_init_update_status (NULL, _("Convert"), 0.136); app_init_update_status (NULL, _("Convert"), 0.135);
register_convert_procs (); register_convert_procs ();
app_init_update_status (NULL, _("Drawable procedures"), 0.149); app_init_update_status (NULL, _("Drawable procedures"), 0.148);
register_drawable_procs (); register_drawable_procs ();
app_init_update_status (NULL, _("Edit procedures"), 0.221); app_init_update_status (NULL, _("Edit procedures"), 0.219);
register_edit_procs (); register_edit_procs ();
app_init_update_status (NULL, _("File Operations"), 0.24); app_init_update_status (NULL, _("File Operations"), 0.239);
register_fileops_procs (); register_fileops_procs ();
app_init_update_status (NULL, _("Floating selections"), 0.26); app_init_update_status (NULL, _("Floating selections"), 0.258);
register_floating_sel_procs (); register_floating_sel_procs ();
app_init_update_status (NULL, _("GDisplay procedures"), 0.279); app_init_update_status (NULL, _("GDisplay procedures"), 0.277);
register_gdisplay_procs (); register_gdisplay_procs ();
app_init_update_status (NULL, _("Image"), 0.289); app_init_update_status (NULL, _("Image"), 0.287);
register_gimage_procs (); register_gimage_procs ();
app_init_update_status (NULL, _("Image mask"), 0.464); app_init_update_status (NULL, _("Image mask"), 0.468);
register_gimage_mask_procs (); register_gimage_mask_procs ();
app_init_update_status (NULL, _("Gimprc procedures"), 0.519); app_init_update_status (NULL, _("Gimprc procedures"), 0.523);
register_gimprc_procs (); register_gimprc_procs ();
app_init_update_status (NULL, _("Gradients"), 0.529); app_init_update_status (NULL, _("Gradients"), 0.532);
register_gradient_procs (); register_gradient_procs ();
app_init_update_status (NULL, _("Gradient UI"), 0.545); app_init_update_status (NULL, _("Gradient UI"), 0.548);
register_gradient_select_procs (); register_gradient_select_procs ();
app_init_update_status (NULL, _("Guide procedures"), 0.558); app_init_update_status (NULL, _("Guide procedures"), 0.561);
register_guides_procs (); register_guides_procs ();
app_init_update_status (NULL, _("Interface"), 0.578); app_init_update_status (NULL, _("Interface"), 0.581);
register_interface_procs (); register_interface_procs ();
app_init_update_status (NULL, _("Layer"), 0.588); app_init_update_status (NULL, _("Layer"), 0.59);
register_layer_procs (); register_layer_procs ();
app_init_update_status (NULL, _("Miscellaneous"), 0.685); app_init_update_status (NULL, _("Miscellaneous"), 0.687);
register_misc_procs (); register_misc_procs ();
app_init_update_status (NULL, _("Palette"), 0.692); app_init_update_status (NULL, _("Palette"), 0.694);
register_palette_procs (); register_palette_procs ();
app_init_update_status (NULL, _("Parasite procedures"), 0.714); app_init_update_status (NULL, _("Parasite procedures"), 0.716);
register_parasite_procs (); register_parasite_procs ();
app_init_update_status (NULL, _("Paths"), 0.756); app_init_update_status (NULL, _("Paths"), 0.758);
register_paths_procs (); register_paths_procs ();
app_init_update_status (NULL, _("Pattern UI"), 0.789); app_init_update_status (NULL, _("Pattern UI"), 0.79);
register_pattern_select_procs (); register_pattern_select_procs ();
app_init_update_status (NULL, _("Patterns"), 0.799); app_init_update_status (NULL, _("Patterns"), 0.8);
register_patterns_procs (); 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 (); 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 (); 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 (); 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 (); register_tools_procs ();
app_init_update_status (NULL, _("Undo"), 0.958); app_init_update_status (NULL, _("Undo"), 0.958);
register_undo_procs (); register_undo_procs ();
app_init_update_status (NULL, _("Units"), 0.964); app_init_update_status (NULL, _("Units"), 0.965);
register_unit_procs (); register_unit_procs ();
} }

View File

@ -864,6 +864,48 @@ HELP
%invoke = ( code => 'success = gimage_disable_undo (gimage);' ); %invoke = ( code => 'success = gimage_disable_undo (gimage);' );
} }
sub image_thaw_undo {
$blurb = "Thaw the image's undo stack.";
$author = $copyright = 'Adam D. Moss';
$date = '1999';
$help = <<'HELP';
This procedure thaws the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp_image_disable_freeze' to temporarily freeze an image undo stack. 'gimp_image_thaw_undo' does NOT free the undo stack as 'gimp_image_enable_undo' does, so is suited for situations where one wishes to leave the undo stack in the same state in which one found it despite non-destructively playing with the image in the meantime. An example would be in-situ plugin previews. Balancing freezes and thaws and ensuring image consistancy is the responsibility of the caller.
HELP
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'thawed', type => 'boolean',
desc => 'True if the image undo has been thawed',
alias => 'success ? TRUE : FALSE', no_declare => 1 }
);
%invoke = ( code => 'success = gimage_thaw_undo (gimage);' );
}
sub image_freeze_undo {
$blurb = "Freeze the image's undo stack.";
$author = $copyright = 'Adam D. Moss';
$date = '1999';
$help = <<'HELP';
This procedure freezes the image's undo stack, allowing subsequent operations to ignore their undo steps. This is generally called in conjunction with 'gimp_image_thaw_undo' to temporarily disable an image undo stack. This is advantageous because saving undo steps can be time and memory intensive. 'gimp_image_{freeze,thaw}_undo' and 'gimp_image_{disable,enable}_undo' differ in that the former does not free up all undo steps when undo is thawed, so is more suited to interactive in-situ previews. It is important in this case that the image is back to the same state it was frozen in before thawing, else 'undo' behaviour is undefined.
HELP
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'frozen', type => 'boolean',
desc => 'True if the image undo has been frozen',
alias => 'success ? TRUE : FALSE', no_declare => 1 }
);
%invoke = ( code => 'success = gimage_freeze_undo (gimage);' );
}
sub image_clean_all { sub image_clean_all {
$blurb = 'Set the image dirty count to 0.'; $blurb = 'Set the image dirty count to 0.';
@ -1282,8 +1324,9 @@ unshift @procs, qw(list_images image_new image_resize image_scale image_delete
image_lower_channel image_add_channel image_remove_channel image_lower_channel image_add_channel image_remove_channel
image_active_drawable image_base_type image_get_cmap image_active_drawable image_base_type image_get_cmap
image_set_cmap image_enable_undo image_disable_undo image_set_cmap image_enable_undo image_disable_undo
image_clean_all image_floating_selection image_freeze_undo image_thaw_undo image_clean_all
image_floating_sel_attached_to image_thumbnail); image_floating_selection image_floating_sel_attached_to
image_thumbnail);
%exports = (app => [@procs]); %exports = (app => [@procs]);
$desc = 'Image'; $desc = 'Image';

View File

@ -864,6 +864,48 @@ HELP
%invoke = ( code => 'success = gimage_disable_undo (gimage);' ); %invoke = ( code => 'success = gimage_disable_undo (gimage);' );
} }
sub image_thaw_undo {
$blurb = "Thaw the image's undo stack.";
$author = $copyright = 'Adam D. Moss';
$date = '1999';
$help = <<'HELP';
This procedure thaws the image's undo stack, allowing subsequent operations to store their undo steps. This is generally called in conjunction with 'gimp_image_disable_freeze' to temporarily freeze an image undo stack. 'gimp_image_thaw_undo' does NOT free the undo stack as 'gimp_image_enable_undo' does, so is suited for situations where one wishes to leave the undo stack in the same state in which one found it despite non-destructively playing with the image in the meantime. An example would be in-situ plugin previews. Balancing freezes and thaws and ensuring image consistancy is the responsibility of the caller.
HELP
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'thawed', type => 'boolean',
desc => 'True if the image undo has been thawed',
alias => 'success ? TRUE : FALSE', no_declare => 1 }
);
%invoke = ( code => 'success = gimage_thaw_undo (gimage);' );
}
sub image_freeze_undo {
$blurb = "Freeze the image's undo stack.";
$author = $copyright = 'Adam D. Moss';
$date = '1999';
$help = <<'HELP';
This procedure freezes the image's undo stack, allowing subsequent operations to ignore their undo steps. This is generally called in conjunction with 'gimp_image_thaw_undo' to temporarily disable an image undo stack. This is advantageous because saving undo steps can be time and memory intensive. 'gimp_image_{freeze,thaw}_undo' and 'gimp_image_{disable,enable}_undo' differ in that the former does not free up all undo steps when undo is thawed, so is more suited to interactive in-situ previews. It is important in this case that the image is back to the same state it was frozen in before thawing, else 'undo' behaviour is undefined.
HELP
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'frozen', type => 'boolean',
desc => 'True if the image undo has been frozen',
alias => 'success ? TRUE : FALSE', no_declare => 1 }
);
%invoke = ( code => 'success = gimage_freeze_undo (gimage);' );
}
sub image_clean_all { sub image_clean_all {
$blurb = 'Set the image dirty count to 0.'; $blurb = 'Set the image dirty count to 0.';
@ -1282,8 +1324,9 @@ unshift @procs, qw(list_images image_new image_resize image_scale image_delete
image_lower_channel image_add_channel image_remove_channel image_lower_channel image_add_channel image_remove_channel
image_active_drawable image_base_type image_get_cmap image_active_drawable image_base_type image_get_cmap
image_set_cmap image_enable_undo image_disable_undo image_set_cmap image_enable_undo image_disable_undo
image_clean_all image_floating_selection image_freeze_undo image_thaw_undo image_clean_all
image_floating_sel_attached_to image_thumbnail); image_floating_selection image_floating_sel_attached_to
image_thumbnail);
%exports = (app => [@procs]); %exports = (app => [@procs]);
$desc = 'Image'; $desc = 'Image';