From 02d2b990f54b92c3c07a8a740352ad3bf40027c2 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 10 Aug 2004 18:47:21 +0000 Subject: [PATCH] Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer Redid the whole internal progress stuff: don't pass around progress_callback and progress_data; instead, provide a pointer to a GimpProgressInterface which can be implemented by a variety of backends. Addresses (but not yet fixes) bugs #6010, #97266 and #135185. * app/display/Makefile.am * app/display/gimpprogress.[ch]: removed the old progress hack. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpprogress.[ch]: implement GimpProgressInterface. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpprogressdialog.[ch]: the standalone progress dialog as widget implementing GimpProgressInterface. * app/display/gimpdisplay.c * app/display/gimpstatusbar.[ch] * app/widgets/gimpfiledialog.[ch] * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface implementation to these classes. * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c: replaced the old progress vtable entries by two new to create and destroy a GimpProgressDialog in case no other progress is available. * app/pdb/procedural_db.[ch] * app/plug-in/plug-in-run.[ch] * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and all plug-ins. * app/plug-in/plug-in.[ch] * app/plug-in/plug-ins.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c: handle the case there the plug-in was crated with a progress as well as the case where it wasn't. * app/app_procs.c * app/batch.c * app/xcf/xcf.c * app/file/file-open.[ch] * app/file/file-save.[ch] * app/widgets/gimphelp.c * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: changed accordingly. * app/core/gimpimagefile.[ch] * app/display/gimpdisplayshell-dnd.c * app/gui/file-open-dialog.c * app/gui/file-open-location-dialog.c * app/gui/file-save-dialog.c * app/widgets/gimplayertreeview.c * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file related functions. Embed the progress in the file dialog where possible. * app/core/gimpdrawable-blend.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-convert.[ch] * app/core/gimpimage-flip.[ch] * app/core/gimpimage-resize.[ch] * app/core/gimpimage-rotate.[ch] * app/core/gimpimage-scale.[ch] * app/core/gimpitem-linked.[ch] * app/core/gimpitem.[ch] * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimplayer.c * app/core/gimpselection.c * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. * app/tools/gimpblendtool.c * app/tools/gimptransformtool.c * app/gui/convert-dialog.c * app/actions/documents-commands.c * app/actions/file-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/plug-in-commands.c * app/actions/vectors-commands.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. * app/pdb/*_cmds.c: regenerated. --- ChangeLog | 97 +++++ app/actions/documents-commands.c | 4 +- app/actions/file-commands.c | 12 +- app/actions/image-commands.c | 42 +-- app/actions/layers-commands.c | 12 +- app/actions/plug-in-commands.c | 14 +- app/actions/vectors-commands.c | 2 + app/app_procs.c | 1 + app/batch.c | 4 +- app/core/Makefile.am | 2 + app/core/core-types.h | 2 +- app/core/gimp-gui.c | 57 +-- app/core/gimp-gui.h | 32 +- app/core/gimp-transform-region.c | 13 +- app/core/gimpchannel.c | 18 +- app/core/gimpdrawable-blend.c | 50 +-- app/core/gimpdrawable-blend.h | 3 +- app/core/gimpdrawable-transform.c | 13 +- app/core/gimpdrawable-transform.h | 3 +- app/core/gimpdrawable.c | 19 +- app/core/gimpimage-convert.c | 176 +++++---- app/core/gimpimage-convert.h | 7 +- app/core/gimpimage-flip.c | 25 +- app/core/gimpimage-flip.h | 3 +- app/core/gimpimage-resize.c | 39 +- app/core/gimpimage-resize.h | 15 +- app/core/gimpimage-rotate.c | 25 +- app/core/gimpimage-rotate.h | 3 +- app/core/gimpimage-scale.c | 33 +- app/core/gimpimage-scale.h | 3 +- app/core/gimpimagefile.c | 7 +- app/core/gimpimagefile.h | 1 + app/core/gimpitem-linked.c | 8 +- app/core/gimpitem-linked.h | 3 +- app/core/gimpitem.c | 39 +- app/core/gimpitem.h | 20 +- app/core/gimplayer.c | 24 +- app/core/gimpprogress.c | 196 ++++++++++ app/core/gimpprogress.h | 76 ++++ app/core/gimpselection.c | 9 +- app/dialogs/convert-dialog.c | 43 +-- app/dialogs/file-open-dialog.c | 10 +- app/dialogs/file-open-location-dialog.c | 5 +- app/dialogs/file-save-dialog.c | 2 + app/display/Makefile.am | 2 - app/display/gimpdisplay.c | 129 ++++++- app/display/gimpdisplayshell-dnd.c | 5 +- app/display/gimpprogress.c | 455 ------------------------ app/display/gimpprogress.h | 43 --- app/display/gimpstatusbar.c | 168 ++++++++- app/display/gimpstatusbar.h | 4 +- app/file/file-open.c | 17 +- app/file/file-open.h | 4 + app/file/file-save.c | 13 +- app/file/file-save.h | 2 + app/gui/convert-dialog.c | 43 +-- app/gui/file-open-dialog.c | 10 +- app/gui/file-open-location-dialog.c | 5 +- app/gui/file-save-dialog.c | 2 + app/gui/gui-vtable.c | 62 +--- app/pdb/brush_select_cmds.c | 21 +- app/pdb/brushes_cmds.c | 77 ++-- app/pdb/channel_cmds.c | 63 ++-- app/pdb/color_cmds.c | 91 +++-- app/pdb/convert_cmds.c | 28 +- app/pdb/display_cmds.c | 28 +- app/pdb/drawable_cmds.c | 224 +++++++----- app/pdb/edit_cmds.c | 58 +-- app/pdb/fileops_cmds.c | 69 ++-- app/pdb/floating_sel_cmds.c | 42 ++- app/pdb/font_select_cmds.c | 21 +- app/pdb/fonts_cmds.c | 14 +- app/pdb/gimp-pdb.c | 26 +- app/pdb/gimp-pdb.h | 9 +- app/pdb/gimppdb.c | 26 +- app/pdb/gimppdb.h | 9 +- app/pdb/gimpprocedure.c | 26 +- app/pdb/gimpprocedure.h | 9 +- app/pdb/gimprc_cmds.c | 42 ++- app/pdb/gradient_edit_cmds.c | 161 +++++---- app/pdb/gradient_select_cmds.c | 21 +- app/pdb/gradients_cmds.c | 77 ++-- app/pdb/guides_cmds.c | 42 ++- app/pdb/help_cmds.c | 7 +- app/pdb/image_cmds.c | 435 ++++++++++++---------- app/pdb/layer_cmds.c | 184 ++++++---- app/pdb/message_cmds.c | 21 +- app/pdb/misc_cmds.c | 14 +- app/pdb/paint_tools_cmds.c | 105 +++--- app/pdb/palette_cmds.c | 42 ++- app/pdb/palette_select_cmds.c | 21 +- app/pdb/palettes_cmds.c | 35 +- app/pdb/parasite_cmds.c | 84 +++-- app/pdb/paths_cmds.c | 105 +++--- app/pdb/pattern_select_cmds.c | 21 +- app/pdb/patterns_cmds.c | 35 +- app/pdb/plug_in_cmds.c | 49 +-- app/pdb/procedural_db.c | 26 +- app/pdb/procedural_db.h | 9 +- app/pdb/procedural_db_cmds.c | 63 ++-- app/pdb/selection_cmds.c | 126 ++++--- app/pdb/selection_tools_cmds.c | 35 +- app/pdb/text_tool_cmds.c | 28 +- app/pdb/transform_tools_cmds.c | 42 ++- app/pdb/undo_cmds.c | 49 +-- app/pdb/unit_cmds.c | 84 +++-- app/plug-in/gimpplugin-message.c | 1 + app/plug-in/gimpplugin-progress.c | 61 +++- app/plug-in/gimpplugin.c | 11 + app/plug-in/gimpplugin.h | 2 + app/plug-in/gimppluginmanager-call.c | 58 +-- app/plug-in/gimppluginmanager-call.h | 30 +- app/plug-in/gimppluginmanager-run.c | 58 +-- app/plug-in/gimppluginmanager-run.h | 30 +- app/plug-in/gimppluginmanager.c | 4 +- app/plug-in/plug-in-message.c | 1 + app/plug-in/plug-in-progress.c | 61 +++- app/plug-in/plug-in-run.c | 58 +-- app/plug-in/plug-in-run.h | 30 +- app/plug-in/plug-in.c | 11 + app/plug-in/plug-in.h | 2 + app/plug-in/plug-ins.c | 4 +- app/tools/gimpblendtool.c | 12 +- app/tools/gimptransformtool.c | 14 +- app/vectors/gimpvectors.c | 15 +- app/widgets/Makefile.am | 2 + app/widgets/gimpbrushselect.c | 1 + app/widgets/gimpfiledialog.c | 180 ++++++++-- app/widgets/gimpfiledialog.h | 3 + app/widgets/gimpfontselect.c | 1 + app/widgets/gimpgradientselect.c | 1 + app/widgets/gimphelp.c | 5 +- app/widgets/gimplayertreeview.c | 5 +- app/widgets/gimppaletteselect.c | 1 + app/widgets/gimppatternselect.c | 1 + app/widgets/gimpprogressdialog.c | 251 +++++++++++++ app/widgets/gimpprogressdialog.h | 62 ++++ app/widgets/gimpthumbbox.c | 146 +++++++- app/widgets/gimpthumbbox.h | 3 + app/widgets/gimptoolbox-dnd.c | 2 +- app/widgets/widgets-types.h | 1 + app/xcf/xcf.c | 30 +- tools/pdbgen/app.pl | 11 +- tools/pdbgen/pdb/convert.pdb | 5 +- tools/pdbgen/pdb/edit.pdb | 2 +- tools/pdbgen/pdb/image.pdb | 8 +- tools/pdbgen/pdb/layer.pdb | 2 +- 147 files changed, 3609 insertions(+), 2517 deletions(-) create mode 100644 app/core/gimpprogress.c create mode 100644 app/core/gimpprogress.h delete mode 100644 app/display/gimpprogress.c delete mode 100644 app/display/gimpprogress.h create mode 100644 app/widgets/gimpprogressdialog.c create mode 100644 app/widgets/gimpprogressdialog.h diff --git a/ChangeLog b/ChangeLog index ec8a3ceec5..aad28c6a06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,100 @@ +2004-08-10 Michael Natterer + + Redid the whole internal progress stuff: don't pass around + progress_callback and progress_data; instead, provide a + pointer to a GimpProgressInterface which can be implemented + by a variety of backends. + + Addresses (but not yet fixes) bugs #6010, #97266 and #135185. + + * app/display/Makefile.am + * app/display/gimpprogress.[ch]: removed the old progress hack. + + * app/core/Makefile.am + * app/core/core-types.h + * app/core/gimpprogress.[ch]: implement GimpProgressInterface. + + * app/widgets/Makefile.am + * app/widgets/widgets-types.h + * app/widgets/gimpprogressdialog.[ch]: the standalone progress + dialog as widget implementing GimpProgressInterface. + + * app/display/gimpdisplay.c + * app/display/gimpstatusbar.[ch] + * app/widgets/gimpfiledialog.[ch] + * app/widgets/gimpthumbbox.[ch]: added GimpProgressInterface + implementation to these classes. + + * app/core/gimp-gui.[ch] + * app/gui/gui-vtable.c: replaced the old progress vtable entries + by two new to create and destroy a GimpProgressDialog in case + no other progress is available. + + * app/pdb/procedural_db.[ch] + * app/plug-in/plug-in-run.[ch] + * tools/pdbgen/app.pl: pass a GimpProgress to all PDB wrappers and + all plug-ins. + + * app/plug-in/plug-in.[ch] + * app/plug-in/plug-ins.c + * app/plug-in/plug-in-message.c + * app/plug-in/plug-in-progress.c: handle the case there the + plug-in was crated with a progress as well as the case where it + wasn't. + + * app/app_procs.c + * app/batch.c + * app/xcf/xcf.c + * app/file/file-open.[ch] + * app/file/file-save.[ch] + * app/widgets/gimphelp.c + * app/widgets/gimpbrushselect.c + * app/widgets/gimpfontselect.c + * app/widgets/gimpgradientselect.c + * app/widgets/gimppaletteselect.c + * app/widgets/gimppatternselect.c: changed accordingly. + + * app/core/gimpimagefile.[ch] + * app/display/gimpdisplayshell-dnd.c + * app/gui/file-open-dialog.c + * app/gui/file-open-location-dialog.c + * app/gui/file-save-dialog.c + * app/widgets/gimplayertreeview.c + * app/widgets/gimptoolbox-dnd.c: pass a GimpProgress to all file + related functions. Embed the progress in the file dialog where + possible. + + * app/core/gimpdrawable-blend.[ch] + * app/core/gimpdrawable-transform.[ch] + * app/core/gimpimage-convert.[ch] + * app/core/gimpimage-flip.[ch] + * app/core/gimpimage-resize.[ch] + * app/core/gimpimage-rotate.[ch] + * app/core/gimpimage-scale.[ch] + * app/core/gimpitem-linked.[ch] + * app/core/gimpitem.[ch] + * app/core/gimpchannel.c + * app/core/gimpdrawable.c + * app/core/gimplayer.c + * app/core/gimpselection.c + * app/vectors/gimpvectors.c: replaced callback/data by GimpProgress. + + * app/tools/gimpblendtool.c + * app/tools/gimptransformtool.c + * app/gui/convert-dialog.c + * app/actions/documents-commands.c + * app/actions/file-commands.c + * app/actions/image-commands.c + * app/actions/layers-commands.c + * app/actions/plug-in-commands.c + * app/actions/vectors-commands.c + * tools/pdbgen/pdb/convert.pdb + * tools/pdbgen/pdb/edit.pdb + * tools/pdbgen/pdb/image.pdb + * tools/pdbgen/pdb/layer.pdb: changed callers accordingly. + + * app/pdb/*_cmds.c: regenerated. + 2004-08-10 DindinX * plug-ins/common/blinds.c: GimpPreviewArea-ified. diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index d957aaaebc..c6e5ffee01 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -196,7 +196,7 @@ documents_recreate_preview_cmd_callback (GtkAction *action, preview_size = gimp_container_view_get_preview_size (editor->view, NULL); - gimp_imagefile_create_thumbnail (imagefile, context, preview_size); + gimp_imagefile_create_thumbnail (imagefile, context, NULL, preview_size); } } @@ -253,7 +253,7 @@ documents_open_image (GimpContext *context, uri = gimp_object_get_name (GIMP_OBJECT (imagefile)); - gimage = file_open_with_display (context->gimp, context, + gimage = file_open_with_display (context->gimp, context, NULL, uri, &status, &error); if (! gimage && status != GIMP_PDB_CANCEL) diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c index 620be3395d..7f8325bd46 100644 --- a/app/actions/file-commands.c +++ b/app/actions/file-commands.c @@ -32,6 +32,7 @@ #include "core/gimpcontainer.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" +#include "core/gimpprogress.h" #include "core/gimptemplate.h" #include "file/file-open.h" @@ -131,6 +132,7 @@ file_last_opened_cmd_callback (GtkAction *action, GError *error = NULL; gimage = file_open_with_display (gimp, action_data_get_context (data), + NULL, GIMP_OBJECT (imagefile)->name, &status, &error); @@ -177,6 +179,7 @@ file_save_cmd_callback (GtkAction *action, GError *error = NULL; status = file_save (gdisp->gimage, action_data_get_context (data), + GIMP_PROGRESS (gdisp), GIMP_RUN_WITH_LAST_VALS, &error); if (status != GIMP_PDB_SUCCESS && @@ -278,10 +281,9 @@ file_revert_cmd_callback (GtkAction *action, GIMP_STOCK_QUESTION, text, GTK_STOCK_YES, GTK_STOCK_NO, - G_OBJECT (gdisp->gimage), - "disconnect", + G_OBJECT (gdisp), "disconnect", file_revert_confirm_callback, - gdisp->gimage); + gdisp); g_free (text); @@ -340,7 +342,8 @@ file_revert_confirm_callback (GtkWidget *widget, gboolean revert, gpointer data) { - GimpImage *old_gimage = GIMP_IMAGE (data); + GimpDisplay *gdisp = GIMP_DISPLAY (data); + GimpImage *old_gimage = gdisp->gimage; g_object_set_data (G_OBJECT (old_gimage), REVERT_DATA_KEY, NULL); @@ -357,6 +360,7 @@ file_revert_confirm_callback (GtkWidget *widget, uri = gimp_object_get_name (GIMP_OBJECT (old_gimage)); new_gimage = file_open_image (gimp, gimp_get_user_context (gimp), + GIMP_PROGRESS (gdisp), uri, uri, NULL, GIMP_RUN_INTERACTIVE, &status, NULL, &error); diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index 9395f47877..4b7fc5ce46 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -41,6 +41,7 @@ #include "core/gimpimage-rotate.h" #include "core/gimpimage-scale.h" #include "core/gimpimage-undo.h" +#include "core/gimpprogress.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpdock.h" @@ -49,7 +50,6 @@ #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" -#include "display/gimpprogress.h" #include "gui/convert-dialog.h" #include "gui/dialogs.h" @@ -160,7 +160,7 @@ image_convert_cmd_callback (GtkAction *action, case GIMP_RGB: case GIMP_GRAY: gimp_image_convert (gimage, (GimpImageBaseType) value, - 0, 0, FALSE, FALSE, 0, NULL, NULL, NULL); + 0, 0, FALSE, FALSE, 0, NULL, NULL); gimp_image_flush (gimage); break; @@ -259,13 +259,14 @@ image_flip_cmd_callback (GtkAction *action, GimpProgress *progress; return_if_no_display (gdisp, data); - progress = gimp_progress_start (gdisp, _("Flipping..."), TRUE, NULL, NULL); + progress = gimp_progress_start (GIMP_PROGRESS (gdisp), + _("Flipping..."), FALSE); gimp_image_flip (gdisp->gimage, action_data_get_context (data), - (GimpOrientationType) value, - gimp_progress_update_and_flush, progress); + (GimpOrientationType) value, progress); - gimp_progress_end (progress); + if (progress) + gimp_progress_end (progress); gimp_image_flush (gdisp->gimage); } @@ -279,13 +280,14 @@ image_rotate_cmd_callback (GtkAction *action, GimpProgress *progress; return_if_no_display (gdisp, data); - progress = gimp_progress_start (gdisp, _("Rotating..."), TRUE, NULL, NULL); + progress = gimp_progress_start (GIMP_PROGRESS (gdisp), + _("Rotating..."), FALSE); gimp_image_rotate (gdisp->gimage, action_data_get_context (data), - (GimpRotationType) value, - gimp_progress_update_and_flush, progress); + (GimpRotationType) value, progress); - gimp_progress_end (progress); + if (progress) + gimp_progress_end (progress); gimp_image_flush (gdisp->gimage); } @@ -449,9 +451,8 @@ image_resize_callback (GtkWidget *widget, { GimpProgress *progress; - progress = gimp_progress_start (options->gdisp, - _("Resizing..."), - TRUE, NULL, NULL); + progress = gimp_progress_start (GIMP_PROGRESS (options->gdisp), + _("Resizing..."), FALSE); gimp_image_resize (options->gimage, options->context, @@ -459,9 +460,10 @@ image_resize_callback (GtkWidget *widget, options->dialog->height, options->dialog->offset_x, options->dialog->offset_y, - gimp_progress_update_and_flush, progress); + progress); - gimp_progress_end (progress); + if (progress) + gimp_progress_end (progress); gimp_image_flush (options->gimage); } @@ -605,17 +607,17 @@ image_scale_implement (ImageResizeOptions *options) { GimpProgress *progress; - progress = gimp_progress_start (options->gdisp, - _("Scaling..."), - TRUE, NULL, NULL); + progress = gimp_progress_start (GIMP_PROGRESS (options->gdisp), + _("Scaling..."), FALSE); gimp_image_scale (gimage, options->dialog->width, options->dialog->height, options->dialog->interpolation, - gimp_progress_update_and_flush, progress); + progress); - gimp_progress_end (progress); + if (progress) + gimp_progress_end (progress); } else { diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 00f60c2cf1..aeeecd6255 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -41,6 +41,7 @@ #include "core/gimplist.h" #include "core/gimptoolinfo.h" #include "core/gimpundostack.h" +#include "core/gimpprogress.h" #include "text/gimptext.h" #include "text/gimptextlayer.h" @@ -56,7 +57,6 @@ #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" -#include "display/gimpprogress.h" #include "tools/gimptexttool.h" #include "tools/tool_manager.h" @@ -1087,18 +1087,18 @@ scale_layer_query_ok_callback (GtkWidget *widget, gtk_widget_set_sensitive (options->dialog->shell, FALSE); - progress = gimp_progress_start (options->gdisp, - _("Scaling..."), - TRUE, NULL, NULL); + progress = gimp_progress_start (GIMP_PROGRESS (options->gdisp), + _("Scaling..."), FALSE); gimp_item_scale_by_origin (GIMP_ITEM (layer), options->dialog->width, options->dialog->height, options->dialog->interpolation, - gimp_progress_update_and_flush, progress, + progress, TRUE); - gimp_progress_end (progress); + if (progress) + gimp_progress_end (progress); gimp_image_flush (gimage); diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 0c7218bec7..d04ecf7030 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -28,6 +28,7 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpitem.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -61,6 +62,7 @@ plug_in_run_cmd_callback (GtkAction *action, Gimp *gimp; ProcRecord *proc_rec; Argument *args; + GimpDisplay *gdisp = NULL; gint gdisp_ID = -1; gint i; gint argc; @@ -93,13 +95,13 @@ plug_in_run_cmd_callback (GtkAction *action, if (proc_rec->num_args >= 2 && proc_rec->args[1].arg_type == GIMP_PDB_IMAGE) { - GimpDisplay *gdisplay = action_data_get_display (data); + gdisp = action_data_get_display (data); - if (gdisplay) + if (gdisp) { - gdisp_ID = gimp_display_get_ID (gdisplay); + gdisp_ID = gimp_display_get_ID (gdisp); - args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage); + args[1].value.pdb_int = gimp_image_get_ID (gdisp->gimage); argc++; if (proc_rec->num_args >= 2 && @@ -107,7 +109,7 @@ plug_in_run_cmd_callback (GtkAction *action, { GimpDrawable *drawable; - drawable = gimp_image_active_drawable (gdisplay->gimage); + drawable = gimp_image_active_drawable (gdisp->gimage); if (drawable) { @@ -136,6 +138,7 @@ plug_in_run_cmd_callback (GtkAction *action, /* run the plug-in procedure */ plug_in_run (gimp, gimp_get_user_context (gimp), + gdisp ? GIMP_PROGRESS (gdisp) : NULL, proc_rec, args, argc, FALSE, TRUE, gdisp_ID); /* remember only "standard" plug-ins */ @@ -171,6 +174,7 @@ plug_in_repeat_cmd_callback (GtkAction *action, plug_in_repeat (gdisp->gimage->gimp, gimp_get_user_context (gdisp->gimage->gimp), + GIMP_PROGRESS (gdisp), gimp_display_get_ID (gdisp), gimp_image_get_ID (gdisp->gimage), gimp_item_get_ID (GIMP_ITEM (drawable)), diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index 9b68f4874d..9c9099971b 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -33,6 +33,7 @@ #include "core/gimpcontext.h" #include "core/gimpimage.h" #include "core/gimpimage-merge.h" +#include "core/gimpprogress.h" #include "core/gimptoolinfo.h" #include "pdb/procedural_db.h" @@ -255,6 +256,7 @@ vectors_selection_to_vectors_cmd_callback (GtkAction *action, args[2].value.pdb_int = -1; /* unused */ plug_in_run (gimage->gimp, action_data_get_context (data), + gdisp ? GIMP_PROGRESS (gdisp) : NULL, proc_rec, args, 3, FALSE, TRUE, gdisp ? gdisp->ID : 0); diff --git a/app/app_procs.c b/app/app_procs.c index 62c34892be..74c30d5c7e 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -334,6 +334,7 @@ app_run (const gchar *full_prog_name, gimage = file_open_with_display (gimp, gimp_get_user_context (gimp), + NULL, uri, &status, &error); diff --git a/app/batch.c b/app/batch.c index cd8f669dec..b9a6f45118 100644 --- a/app/batch.c +++ b/app/batch.c @@ -132,7 +132,7 @@ batch_run_cmd (Gimp *gimp, args[0].value.pdb_int = GIMP_RUN_NONINTERACTIVE; args[1].value.pdb_pointer = (gpointer) cmd; - vals = procedural_db_execute (gimp, gimp_get_user_context (gimp), + vals = procedural_db_execute (gimp, gimp_get_user_context (gimp), NULL, "plug_in_script_fu_eval", args); switch (vals[0].value.pdb_int) @@ -184,7 +184,7 @@ batch_perl_server (Gimp *gimp, args[1].value.pdb_int = flags; args[2].value.pdb_int = extra; - vals = procedural_db_execute (gimp, gimp_get_user_context (gimp), + vals = procedural_db_execute (gimp, gimp_get_user_context (gimp), NULL, "extension_perl_server", args); switch (vals[0].value.pdb_int) diff --git a/app/core/Makefile.am b/app/core/Makefile.am index cc4fb28353..10f31dff77 100644 --- a/app/core/Makefile.am +++ b/app/core/Makefile.am @@ -188,6 +188,8 @@ libappcore_a_sources = \ gimppickable.h \ gimppreviewcache.c \ gimppreviewcache.h \ + gimpprogress.c \ + gimpprogress.h \ gimpprojection.c \ gimpprojection.h \ gimpprojection-construct.c \ diff --git a/app/core/core-types.h b/app/core/core-types.h index da6613b65b..791423fc8c 100644 --- a/app/core/core-types.h +++ b/app/core/core-types.h @@ -121,6 +121,7 @@ typedef struct _GimpProjection GimpProjection; /* interfaces */ typedef struct _GimpPickable GimpPickable; /* dummy typedef */ +typedef struct _GimpProgress GimpProgress; /* dummy typedef */ /* non-object types */ @@ -129,7 +130,6 @@ typedef struct _GimpArea GimpArea; typedef struct _GimpCoords GimpCoords; typedef struct _GimpGradientSegment GimpGradientSegment; typedef struct _GimpGuide GimpGuide; -typedef struct _GimpProgress GimpProgress; typedef guint32 GimpTattoo; typedef struct _GimpPaletteEntry GimpPaletteEntry; typedef struct _GimpPlugInDebug GimpPlugInDebug; diff --git a/app/core/gimp-gui.c b/app/core/gimp-gui.c index fe395c323e..0fa0077671 100644 --- a/app/core/gimp-gui.c +++ b/app/core/gimp-gui.c @@ -27,6 +27,7 @@ #include "gimpcontainer.h" #include "gimpcontext.h" #include "gimpimage.h" +#include "gimpprogress.h" #include "gimp-intl.h" @@ -53,10 +54,8 @@ gimp_gui_init (Gimp *gimp) gimp->gui.menus_init = NULL; gimp->gui.menus_create = NULL; gimp->gui.menus_delete = NULL; - gimp->gui.progress_start = NULL; - gimp->gui.progress_restart = NULL; - gimp->gui.progress_update = NULL; - gimp->gui.progress_end = NULL; + gimp->gui.progress_new = NULL; + gimp->gui.progress_free = NULL; gimp->gui.pdb_dialog_set = NULL; gimp->gui.pdb_dialog_close = NULL; gimp->gui.pdb_dialogs_check = NULL; @@ -320,59 +319,25 @@ gimp_menus_delete_entry (Gimp *gimp, } GimpProgress * -gimp_start_progress (Gimp *gimp, - gint gdisp_ID, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data) +gimp_new_progress (Gimp *gimp) { g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); - if (gimp->gui.progress_start) - return gimp->gui.progress_start (gimp, gdisp_ID, message, - cancel_cb, cancel_data); - - return NULL; -} - -GimpProgress * -gimp_restart_progress (Gimp *gimp, - GimpProgress *progress, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data) -{ - g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); - g_return_val_if_fail (progress != NULL, NULL); - - if (gimp->gui.progress_restart) - return gimp->gui.progress_restart (gimp, progress, message, - cancel_cb, cancel_data); + if (gimp->gui.progress_new) + return gimp->gui.progress_new (gimp); return NULL; } void -gimp_update_progress (Gimp *gimp, - GimpProgress *progress, - gdouble percentage) +gimp_free_progress (Gimp *gimp, + GimpProgress *progress) { g_return_if_fail (GIMP_IS_GIMP (gimp)); - g_return_if_fail (progress != NULL); + g_return_if_fail (GIMP_IS_PROGRESS (progress)); - if (gimp->gui.progress_update) - gimp->gui.progress_update (gimp, progress, percentage); -} - -void -gimp_end_progress (Gimp *gimp, - GimpProgress *progress) -{ - g_return_if_fail (GIMP_IS_GIMP (gimp)); - g_return_if_fail (progress != NULL); - - if (gimp->gui.progress_end) - gimp->gui.progress_end (gimp, progress); + if (gimp->gui.progress_free) + gimp->gui.progress_free (gimp, progress); } gboolean diff --git a/app/core/gimp-gui.h b/app/core/gimp-gui.h index 3fc6bb1988..c8ca7ef420 100644 --- a/app/core/gimp-gui.h +++ b/app/core/gimp-gui.h @@ -62,20 +62,8 @@ struct _GimpGui void (* menus_delete) (Gimp *gimp, PlugInProcDef *proc_def); - GimpProgress * (* progress_start) (Gimp *gimp, - gint gdisp_ID, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data); - GimpProgress * (* progress_restart) (Gimp *gimp, - GimpProgress *progress, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data); - void (* progress_update) (Gimp *gimp, - GimpProgress *progress, - gdouble percentage); - void (* progress_end) (Gimp *gimp, + GimpProgress * (* progress_new) (Gimp *gimp); + void (* progress_free) (Gimp *gimp, GimpProgress *progress); gboolean (* pdb_dialog_new) (Gimp *gimp, @@ -135,20 +123,8 @@ void gimp_menus_create_entry (Gimp *gimp, void gimp_menus_delete_entry (Gimp *gimp, PlugInProcDef *proc_def); -GimpProgress * gimp_start_progress (Gimp *gimp, - gint gdisp_ID, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data); -GimpProgress * gimp_restart_progress (Gimp *gimp, - GimpProgress *progress, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data); -void gimp_update_progress (Gimp *gimp, - GimpProgress *progress, - gdouble percentage); -void gimp_end_progress (Gimp *gimp, +GimpProgress * gimp_new_progress (Gimp *gimp); +void gimp_free_progress (Gimp *gimp, GimpProgress *progress); const gchar * gimp_get_program_class (Gimp *gimp); diff --git a/app/core/gimp-transform-region.c b/app/core/gimp-transform-region.c index a89f4c56eb..816fa2735b 100644 --- a/app/core/gimp-transform-region.c +++ b/app/core/gimp-transform-region.c @@ -44,6 +44,7 @@ #include "gimpimage-undo-push.h" #include "gimplayer.h" #include "gimplayer-floating-sel.h" +#include "gimpprogress.h" #include "gimpselection.h" #include "gimp-intl.h" @@ -110,8 +111,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpImage *gimage; PixelRegion destPR; @@ -148,6 +148,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (orig_tiles != NULL, NULL); g_return_val_if_fail (matrix != NULL, NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); gimage = gimp_item_get_image (GIMP_ITEM (drawable)); @@ -302,8 +303,10 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, for (y = y1; y < y2; y++) { - if (progress_callback && !(y & 0xf)) - (* progress_callback) (y1, y2, y, progress_data); + if (progress && !(y & 0xf)) + gimp_progress_set_value (progress, + (gdouble) (y - y1) / + (gdouble) (y2 - y1)); /* set up inverse transform steps */ tu[0] = uinc * x1 + m.coeff[0][1] * y + m.coeff[0][2]; @@ -887,7 +890,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable, supersample, recursion_level, FALSE, - NULL, NULL); + NULL); /* Free the cut/copied buffer */ tile_manager_unref (orig_tiles); diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index 16c723c9d1..4e914c0166 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -85,8 +85,7 @@ static void gimp_channel_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interp_type, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static void gimp_channel_resize (GimpItem *item, GimpContext *context, gint new_width, @@ -112,8 +111,7 @@ static void gimp_channel_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static gboolean gimp_channel_stroke (GimpItem *item, GimpDrawable *drawable, GimpContext *context, @@ -510,8 +508,7 @@ gimp_channel_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation_type, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL) { @@ -521,8 +518,7 @@ gimp_channel_scale (GimpItem *item, GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height, new_offset_x, new_offset_y, - interpolation_type, - progress_callback, progress_data); + interpolation_type, progress); } static void @@ -581,8 +577,7 @@ gimp_channel_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL) clip_result = TRUE; @@ -590,8 +585,7 @@ gimp_channel_transform (GimpItem *item, GIMP_ITEM_CLASS (parent_class)->transform (item, context, matrix, direction, interpolation_type, supersample, recursion_level, - clip_result, - progress_callback, progress_data); + clip_result, progress); } static gboolean diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index 347333214d..ccf8db1ac2 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -40,6 +40,7 @@ #include "gimpdrawable-blend.h" #include "gimpgradient.h" #include "gimpimage.h" +#include "gimpprogress.h" #include "gimp-intl.h" @@ -117,8 +118,7 @@ static void gradient_precalc_shapeburst (GimpImage *gimage, GimpDrawable *drawable, PixelRegion *PR, gdouble dist, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static void gradient_render_pixel (gdouble x, gdouble y, @@ -148,8 +148,7 @@ static void gradient_fill_region (GimpImage *gimage, gdouble sy, gdouble ex, gdouble ey, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); /* variables for the shapeburst algs */ @@ -186,8 +185,7 @@ gimp_drawable_blend (GimpDrawable *drawable, gdouble starty, gdouble endx, gdouble endy, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpImage *gimage; TileManager *buf_tiles; @@ -197,6 +195,7 @@ gimp_drawable_blend (GimpDrawable *drawable, g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); gimage = gimp_item_get_image (GIMP_ITEM (drawable)); @@ -223,7 +222,7 @@ gimp_drawable_blend (GimpDrawable *drawable, supersample, max_depth, threshold, dither, (startx - x1), (starty - y1), (endx - x1), (endy - y1), - progress_callback, progress_data); + progress); if (distR.tiles) { @@ -572,12 +571,11 @@ gradient_calc_shapeburst_dimpled_factor (gdouble x, } static void -gradient_precalc_shapeburst (GimpImage *gimage, - GimpDrawable *drawable, - PixelRegion *PR, - gdouble dist, - GimpProgressFunc progress_callback, - gpointer progress_data) +gradient_precalc_shapeburst (GimpImage *gimage, + GimpDrawable *drawable, + PixelRegion *PR, + gdouble dist, + GimpProgress *progress) { GimpChannel *mask; PixelRegion tempR; @@ -634,7 +632,10 @@ gradient_precalc_shapeburst (GimpImage *gimage, pixel_region_init (&tempR, tempR.tiles, 0, 0, PR->w, PR->h, TRUE); pixel_region_init (&distR, distR.tiles, 0, 0, PR->w, PR->h, TRUE); - max_iteration = shapeburst_region (&tempR, &distR, progress_callback, progress_data); + max_iteration = shapeburst_region (&tempR, &distR, + progress ? + gimp_progress_update_and_flush : NULL, + progress); /* normalize the shapeburst with the max iteration */ if (max_iteration > 0) @@ -903,8 +904,7 @@ gradient_fill_region (GimpImage *gimage, gdouble sy, gdouble ex, gdouble ey, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { RenderBlendData rbd; gint x, y; @@ -986,8 +986,7 @@ gradient_fill_region (GimpImage *gimage, case GIMP_GRADIENT_SHAPEBURST_SPHERICAL: case GIMP_GRADIENT_SHAPEBURST_DIMPLED: rbd.dist = sqrt (SQR (ex - sx) + SQR (ey - sy)); - gradient_precalc_shapeburst (gimage, drawable, PR, rbd.dist, - progress_callback, progress_data); + gradient_precalc_shapeburst (gimage, drawable, PR, rbd.dist, progress); break; default: @@ -1024,14 +1023,15 @@ gradient_fill_region (GimpImage *gimage, max_depth, threshold, gradient_render_pixel, &rbd, gradient_put_pixel, &ppd, - progress_callback, progress_data); + gimp_progress_update_and_flush, + progress); g_free (ppd.row_data); } else { - gint max_progress = PR->w * PR->h; - gint progress = 0; + gint max_progress = PR->w * PR->h; + gint curr_progress = 0; for (pr = pixel_regions_register (1, PR); pr != NULL; @@ -1129,10 +1129,12 @@ gradient_fill_region (GimpImage *gimage, } } - if (progress_callback) + if (progress) { - progress += PR->w * PR->h; - (* progress_callback) (0, max_progress, progress, progress_data); + curr_progress += PR->w * PR->h; + + gimp_progress_update_and_flush (0, max_progress, curr_progress, + progress); } } } diff --git a/app/core/gimpdrawable-blend.h b/app/core/gimpdrawable-blend.h index 5b9212542a..d04fc4e380 100644 --- a/app/core/gimpdrawable-blend.h +++ b/app/core/gimpdrawable-blend.h @@ -37,8 +37,7 @@ void gimp_drawable_blend (GimpDrawable *drawable, gdouble starty, gdouble endx, gdouble endy, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); #endif /* __GIMP_DRAWABLE_BLEND_H__ */ diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c index a89f4c56eb..816fa2735b 100644 --- a/app/core/gimpdrawable-transform.c +++ b/app/core/gimpdrawable-transform.c @@ -44,6 +44,7 @@ #include "gimpimage-undo-push.h" #include "gimplayer.h" #include "gimplayer-floating-sel.h" +#include "gimpprogress.h" #include "gimpselection.h" #include "gimp-intl.h" @@ -110,8 +111,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpImage *gimage; PixelRegion destPR; @@ -148,6 +148,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (orig_tiles != NULL, NULL); g_return_val_if_fail (matrix != NULL, NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); gimage = gimp_item_get_image (GIMP_ITEM (drawable)); @@ -302,8 +303,10 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, for (y = y1; y < y2; y++) { - if (progress_callback && !(y & 0xf)) - (* progress_callback) (y1, y2, y, progress_data); + if (progress && !(y & 0xf)) + gimp_progress_set_value (progress, + (gdouble) (y - y1) / + (gdouble) (y2 - y1)); /* set up inverse transform steps */ tu[0] = uinc * x1 + m.coeff[0][1] * y + m.coeff[0][2]; @@ -887,7 +890,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable, supersample, recursion_level, FALSE, - NULL, NULL); + NULL); /* Free the cut/copied buffer */ tile_manager_unref (orig_tiles); diff --git a/app/core/gimpdrawable-transform.h b/app/core/gimpdrawable-transform.h index b1b82ccea3..b21d416569 100644 --- a/app/core/gimpdrawable-transform.h +++ b/app/core/gimpdrawable-transform.h @@ -42,8 +42,7 @@ TileManager * gimp_drawable_transform_tiles_affine (GimpDrawable *draw gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); TileManager * gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, GimpContext *context, TileManager *orig_tiles, diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c index 4c1943e82f..5fc56cfb04 100644 --- a/app/core/gimpdrawable.c +++ b/app/core/gimpdrawable.c @@ -46,6 +46,7 @@ #include "gimppattern.h" #include "gimppickable.h" #include "gimppreviewcache.h" +#include "gimpprogress.h" #include "gimp-intl.h" @@ -84,8 +85,7 @@ static void gimp_drawable_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interp_type, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static void gimp_drawable_resize (GimpItem *item, GimpContext *context, gint new_width, @@ -111,8 +111,7 @@ static void gimp_drawable_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static guchar * gimp_drawable_get_color_at (GimpPickable *pickable, gint x, @@ -401,8 +400,7 @@ gimp_drawable_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation_type, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpDrawable *drawable = GIMP_DRAWABLE (item); PixelRegion srcPR, destPR; @@ -425,7 +423,8 @@ gimp_drawable_scale (GimpItem *item, scale_region (&srcPR, &destPR, gimp_drawable_is_indexed (drawable) ? GIMP_INTERPOLATION_NONE : interpolation_type, - progress_callback, progress_data); + progress ? gimp_progress_update_and_flush : NULL, + progress); gimp_drawable_set_tiles_full (drawable, TRUE, NULL, new_tiles, gimp_drawable_type (drawable), @@ -573,8 +572,7 @@ gimp_drawable_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpDrawable *drawable = GIMP_DRAWABLE (item); TileManager *tiles; @@ -592,8 +590,7 @@ gimp_drawable_transform (GimpItem *item, interpolation_type, supersample, recursion_level, clip_result, - progress_callback, - progress_data); + progress); tile_manager_set_offsets (drawable->tiles, old_off_x, old_off_y); diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index 2e70d7fb0d..c77fa7c95d 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -144,6 +144,7 @@ #include "gimplist.h" #include "gimplayer.h" #include "gimppalette.h" +#include "gimpprogress.h" #include "cpercep.h" #include "gimpimage-convert-fsdither.h" @@ -478,11 +479,9 @@ struct _QuantizeObj gboolean want_alpha_dither; int error_freedom; /* 0=much bleed, 1=controlled bleed */ - GimpImageConvertProgressCallback progress_callback; - gpointer progress_data; - - gint nth_layer; - gint n_layers; + GimpProgress *progress; + gint nth_layer; + gint n_layers; }; typedef struct @@ -518,35 +517,30 @@ typedef struct -static void zero_histogram_gray (CFHistogram histogram); -static void zero_histogram_rgb (CFHistogram histogram); -static void generate_histogram_gray (CFHistogram hostogram, - GimpLayer *layer, - gboolean alpha_dither); -static void generate_histogram_rgb (CFHistogram histogram, - GimpLayer *layer, - gint col_limit, - gboolean alpha_dither, - GimpImageConvertProgressCallback - progress_callback, - gpointer progress_data, - gint nth_layer, - gint n_layers); +static void zero_histogram_gray (CFHistogram histogram); +static void zero_histogram_rgb (CFHistogram histogram); +static void generate_histogram_gray (CFHistogram hostogram, + GimpLayer *layer, + gboolean alpha_dither); +static void generate_histogram_rgb (CFHistogram histogram, + GimpLayer *layer, + gint col_limit, + gboolean alpha_dither, + GimpProgress *progress, + gint nth_layer, + gint n_layers); -static QuantizeObj* initialize_median_cut (GimpImageBaseType old_type, - gint num_cols, - GimpConvertDitherType dither_type, - GimpConvertPaletteType palette_type, - gboolean alpha_dither, - GimpImageConvertProgressCallback - progress_callback, - gpointer progress_data); +static QuantizeObj * initialize_median_cut (GimpImageBaseType old_type, + gint num_cols, + GimpConvertDitherType dither_type, + GimpConvertPaletteType palette_type, + gboolean alpha_dither, + GimpProgress *progress); -static void -compute_color_lin8 (QuantizeObj *quantobj, - CFHistogram histogram, - boxptr boxp, - const int icolor); +static void compute_color_lin8 (QuantizeObj *quantobj, + CFHistogram histogram, + boxptr boxp, + const int icolor); static guchar found_cols[MAXNUMCOLORS][3]; @@ -759,8 +753,7 @@ gimp_image_convert (GimpImage *gimage, gboolean remove_dups, GimpConvertPaletteType palette_type, GimpPalette *custom_palette, - GimpImageConvertProgressCallback progress_callback, - gpointer progress_data) + GimpProgress *progress) { QuantizeObj *quantobj = NULL; GimpLayer *layer; @@ -773,6 +766,7 @@ gimp_image_convert (GimpImage *gimage, g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (new_type != gimp_image_base_type (gimage)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); theCustomPalette = custom_palette; @@ -829,9 +823,8 @@ gimp_image_convert (GimpImage *gimage, } quantobj = initialize_median_cut (old_type, num_cols, dither, - palette_type, alpha_dither, - progress_callback, - progress_data); + palette_type, alpha_dither, + progress); if (palette_type == GIMP_MAKE_PALETTE) { @@ -860,9 +853,7 @@ gimp_image_convert (GimpImage *gimage, else generate_histogram_rgb (quantobj->histogram, layer, num_cols, alpha_dither, - progress_callback, - progress_data, - nth_layer, n_layers); + progress, nth_layer, n_layers); /* * Note: generate_histogram_rgb may set needs_quantize if * the image contains more colours than the limit specified @@ -871,6 +862,10 @@ gimp_image_convert (GimpImage *gimage, } } + if (progress) + gimp_progress_set_text (progress, + _("Converting to indexed (stage 2)...")); + if (old_type == GIMP_RGB && ! needs_quantize && palette_type == GIMP_MAKE_PALETTE) @@ -890,8 +885,7 @@ gimp_image_convert (GimpImage *gimage, GIMP_NODESTRUCT_DITHER, palette_type, alpha_dither, - progress_callback, - progress_data); + progress); /* We can skip the first pass (palette creation) */ quantobj->actual_number_of_colors = num_found_cols; @@ -912,6 +906,10 @@ gimp_image_convert (GimpImage *gimage, color_quicksort); } + if (progress) + gimp_progress_set_text (progress, + _("Converting to indexed (stage 3)...")); + /* Initialise data which must persist across indexed layer iterations */ switch (new_type) { @@ -1301,14 +1299,13 @@ generate_histogram_gray (CFHistogram histogram, static void -generate_histogram_rgb (CFHistogram histogram, - GimpLayer *layer, - gint col_limit, - gboolean alpha_dither, - GimpImageConvertProgressCallback progress_callback, - gpointer progress_data, - gint nth_layer, - gint n_layers) +generate_histogram_rgb (CFHistogram histogram, + GimpLayer *layer, + gint col_limit, + gboolean alpha_dither, + GimpProgress *progress, + gint nth_layer, + gint n_layers) { PixelRegion srcPR; guchar *data; @@ -1335,8 +1332,8 @@ generate_histogram_rgb (CFHistogram histogram, layer_size = GIMP_ITEM (layer)->width * GIMP_ITEM (layer)->height; - if (progress_callback) - progress_callback (1, 0.0, progress_data); + if (progress) + gimp_progress_set_value (progress, 0.0); for (pr = pixel_regions_register (1, &srcPR); pr != NULL; @@ -1483,11 +1480,10 @@ generate_histogram_rgb (CFHistogram histogram, } } - if (progress_callback) - progress_callback (1, - (nth_layer + ((gdouble) total_size)/ - layer_size) / (gdouble) n_layers, - progress_data); + if (progress) + gimp_progress_set_value (progress, + (nth_layer + ((gdouble) total_size)/ + layer_size) / (gdouble) n_layers); } /* g_print ("O: col_limit = %d, nfc = %d\n", col_limit, num_found_cols);*/ @@ -1496,10 +1492,10 @@ generate_histogram_rgb (CFHistogram histogram, static boxptr -find_split_candidate (const boxptr boxlist, - const int numboxes, - axisType *which_axis, - const int desired_colors) +find_split_candidate (const boxptr boxlist, + const int numboxes, + axisType *which_axis, + const int desired_colors) { boxptr boxp; int i; @@ -2123,16 +2119,15 @@ median_cut_gray (CFHistogram histogram, } static int -median_cut_rgb (CFHistogram histogram, - boxptr boxlist, - int numboxes, - int desired_colors, - GimpImageConvertProgressCallback progress_callback, - gpointer progress_data) +median_cut_rgb (CFHistogram histogram, + boxptr boxlist, + int numboxes, + int desired_colors, + GimpProgress *progress) /* Repeatedly select and split the largest box until we have enough boxes */ { - int lb; - boxptr b1,b2; + int lb; + boxptr b1, b2; axisType which_axis; while (numboxes < desired_colors) @@ -2180,9 +2175,8 @@ median_cut_rgb (CFHistogram histogram, /* Update stats for boxes */ numboxes++; - if (progress_callback) - progress_callback (2, ((gdouble) numboxes) / desired_colors, - progress_data); + if (progress) + gimp_progress_set_value (progress, (gdouble) numboxes / desired_colors); update_box_rgb (histogram, b1, desired_colors - numboxes); update_box_rgb (histogram, b2, desired_colors - numboxes); @@ -2413,8 +2407,7 @@ select_colors_rgb (QuantizeObj *quantobj, update_box_rgb (histogram, &boxlist[0], quantobj->desired_number_of_colors); /* Perform median-cut to produce final box list */ numboxes = median_cut_rgb (histogram, boxlist, numboxes, desired, - quantobj->progress_callback, - quantobj->progress_data); + quantobj->progress); quantobj->actual_number_of_colors = numboxes; /* Compute the representative color for each box, fill colormap */ @@ -3154,11 +3147,10 @@ median_cut_pass2_no_dither_rgb (QuantizeObj *quantobj, } } - if (quantobj->progress_callback) - quantobj->progress_callback (3, - (nth_layer + ((gdouble) total_size)/ - layer_size) / (gdouble) n_layers, - quantobj->progress_data); + if (quantobj->progress) + gimp_progress_set_value (quantobj->progress, + (nth_layer + ((gdouble) total_size)/ + layer_size) / (gdouble) n_layers); } } @@ -3289,11 +3281,10 @@ median_cut_pass2_fixed_dither_rgb (QuantizeObj *quantobj, } } - if (quantobj->progress_callback) - quantobj->progress_callback (3, - (nth_layer + ((gdouble) total_size)/ - layer_size) / (gdouble) n_layers, - quantobj->progress_data); + if (quantobj->progress) + gimp_progress_set_value (quantobj->progress, + (nth_layer + ((gdouble) total_size)/ + layer_size) / (gdouble) n_layers); } } @@ -4029,11 +4020,10 @@ median_cut_pass2_fs_dither_rgb (QuantizeObj *quantobj, pixel_region_set_row (&destPR, 0, row, width, dest_buf); - if (quantobj->progress_callback) - quantobj->progress_callback (3, - (nth_layer + ((gdouble) row) / - height) / (gdouble) n_layers, - quantobj->progress_data); + if (quantobj->progress) + gimp_progress_set_value (quantobj->progress, + (nth_layer + ((gdouble) row) / + height) / (gdouble) n_layers); } g_free (error_limiter - 255); @@ -4063,9 +4053,7 @@ initialize_median_cut (GimpImageBaseType type, GimpConvertDitherType dither_type, GimpConvertPaletteType palette_type, gboolean want_alpha_dither, - GimpImageConvertProgressCallback progress_callback, - gpointer progress_data - ) + GimpProgress *progress) { QuantizeObj * quantobj; @@ -4082,9 +4070,7 @@ initialize_median_cut (GimpImageBaseType type, quantobj->desired_number_of_colors = num_colors; quantobj->want_alpha_dither = want_alpha_dither; - - quantobj->progress_callback = progress_callback; - quantobj->progress_data = progress_data; + quantobj->progress = progress; switch (type) { diff --git a/app/core/gimpimage-convert.h b/app/core/gimpimage-convert.h index b9c8ecd56d..8a1692419a 100644 --- a/app/core/gimpimage-convert.h +++ b/app/core/gimpimage-convert.h @@ -22,10 +22,6 @@ #define MAXNUMCOLORS 256 -typedef void (* GimpImageConvertProgressCallback) (gint stage, - gdouble progress, - gpointer data); - void gimp_image_convert (GimpImage *gimage, GimpImageBaseType new_type, @@ -38,8 +34,7 @@ void gimp_image_convert (GimpImage *gimage, gboolean remove_dups, GimpConvertPaletteType palette_type, GimpPalette *custom_palette, - GimpImageConvertProgressCallback progress_callback, - gpointer progress_data); + GimpProgress *progress); void gimp_drawable_convert_rgb (GimpDrawable *drawable, TileManager *new_tiles, diff --git a/app/core/gimpimage-flip.c b/app/core/gimpimage-flip.c index d19ae11011..662569d0c1 100644 --- a/app/core/gimpimage-flip.c +++ b/app/core/gimpimage-flip.c @@ -31,23 +31,24 @@ #include "gimpimage-undo-push.h" #include "gimpitem.h" #include "gimplist.h" +#include "gimpprogress.h" void gimp_image_flip (GimpImage *gimage, GimpContext *context, GimpOrientationType flip_type, - GimpProgressFunc progress_func, - gpointer progress_data) + GimpProgress *progress) { GimpItem *item; GList *list; gdouble axis; - gint progress_max; - gint progress_current = 1; + gdouble progress_max; + gdouble progress_current = 1.0; g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); gimp_set_busy (gimage->gimp); @@ -82,8 +83,8 @@ gimp_image_flip (GimpImage *gimage, gimp_item_flip (item, context, flip_type, axis, TRUE); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Flip all vectors */ @@ -95,16 +96,16 @@ gimp_image_flip (GimpImage *gimage, gimp_item_flip (item, context, flip_type, axis, FALSE); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Don't forget the selection mask! */ gimp_item_flip (GIMP_ITEM (gimp_image_get_mask (gimage)), context, flip_type, axis, TRUE); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); /* Flip all layers */ for (list = GIMP_LIST (gimage->layers)->list; @@ -115,8 +116,8 @@ gimp_image_flip (GimpImage *gimage, gimp_item_flip (item, context, flip_type, axis, FALSE); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Flip all Guides */ diff --git a/app/core/gimpimage-flip.h b/app/core/gimpimage-flip.h index f908798d30..a107545eb4 100644 --- a/app/core/gimpimage-flip.h +++ b/app/core/gimpimage-flip.h @@ -23,8 +23,7 @@ void gimp_image_flip (GimpImage *gimage, GimpContext *context, GimpOrientationType flip_type, - GimpProgressFunc progress_func, - gpointer progress_data); + GimpProgress *progress); #endif /* __GIMP_IMAGE_FLIP_H__ */ diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index 5f51f23117..30b2783251 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -31,27 +31,28 @@ #include "gimpimage-undo-push.h" #include "gimplayer.h" #include "gimplist.h" +#include "gimpprogress.h" #include "gimp-intl.h" void -gimp_image_resize (GimpImage *gimage, - GimpContext *context, - gint new_width, - gint new_height, - gint offset_x, - gint offset_y, - GimpProgressFunc progress_func, - gpointer progress_data) +gimp_image_resize (GimpImage *gimage, + GimpContext *context, + gint new_width, + gint new_height, + gint offset_x, + gint offset_y, + GimpProgress *progress) { - GList *list; - gint progress_max; - gint progress_current = 1; + GList *list; + gdouble progress_max; + gdouble progress_current = 1.0; g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_CONTEXT (context)); g_return_if_fail (new_width > 0 && new_height > 0); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); gimp_set_busy (gimage->gimp); @@ -84,8 +85,8 @@ gimp_image_resize (GimpImage *gimage, gimp_item_resize (item, context, new_width, new_height, offset_x, offset_y); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Resize all vectors */ @@ -98,16 +99,16 @@ gimp_image_resize (GimpImage *gimage, gimp_item_resize (item, context, new_width, new_height, offset_x, offset_y); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Don't forget the selection mask! */ gimp_item_resize (GIMP_ITEM (gimp_image_get_mask (gimage)), context, new_width, new_height, offset_x, offset_y); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); /* Reposition all layers */ for (list = GIMP_LIST (gimage->layers)->list; @@ -118,8 +119,8 @@ gimp_image_resize (GimpImage *gimage, gimp_item_translate (item, offset_x, offset_y, TRUE); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Reposition or remove all guides */ diff --git a/app/core/gimpimage-resize.h b/app/core/gimpimage-resize.h index f1c275abfe..fd08f73890 100644 --- a/app/core/gimpimage-resize.h +++ b/app/core/gimpimage-resize.h @@ -20,14 +20,13 @@ #define __GIMP_IMAGE_RESIZE_H__ -void gimp_image_resize (GimpImage *gimage, - GimpContext *context, - gint new_width, - gint new_height, - gint offset_x, - gint offset_y, - GimpProgressFunc progress_func, - gpointer progress_data); +void gimp_image_resize (GimpImage *gimage, + GimpContext *context, + gint new_width, + gint new_height, + gint offset_x, + gint offset_y, + GimpProgress *progress); #endif /* __GIMP_IMAGE_RESIZE_H__ */ diff --git a/app/core/gimpimage-rotate.c b/app/core/gimpimage-rotate.c index f2cd9ce91d..6ee3a5863f 100644 --- a/app/core/gimpimage-rotate.c +++ b/app/core/gimpimage-rotate.c @@ -31,6 +31,7 @@ #include "gimpimage-undo-push.h" #include "gimpitem.h" #include "gimplist.h" +#include "gimpprogress.h" static void gimp_image_rotate_item_offset (GimpImage *gimage, @@ -46,21 +47,21 @@ void gimp_image_rotate (GimpImage *gimage, GimpContext *context, GimpRotationType rotate_type, - GimpProgressFunc progress_func, - gpointer progress_data) + GimpProgress *progress) { GimpItem *item; GList *list; gdouble center_x; gdouble center_y; - gint progress_max; - gint progress_current = 1; + gdouble progress_max; + gdouble progress_current = 1.0; gint new_image_width; gint new_image_height; gboolean size_changed; g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); gimp_set_busy (gimage->gimp); @@ -109,8 +110,8 @@ gimp_image_rotate (GimpImage *gimage, item->offset_x = 0; item->offset_y = 0; - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Rotate all vectors */ @@ -132,8 +133,8 @@ gimp_image_rotate (GimpImage *gimage, (new_image_height - gimage->height) / 2, FALSE); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Don't forget the selection mask! */ @@ -143,8 +144,8 @@ gimp_image_rotate (GimpImage *gimage, GIMP_ITEM (gimage->selection_mask)->offset_x = 0; GIMP_ITEM (gimage->selection_mask)->offset_y = 0; - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); /* Rotate all layers */ for (list = GIMP_LIST (gimage->layers)->list; @@ -161,8 +162,8 @@ gimp_image_rotate (GimpImage *gimage, gimp_image_rotate_item_offset (gimage, rotate_type, item, off_x, off_y); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Rotate all Guides */ diff --git a/app/core/gimpimage-rotate.h b/app/core/gimpimage-rotate.h index d2bc811aa5..7ce174a2a3 100644 --- a/app/core/gimpimage-rotate.h +++ b/app/core/gimpimage-rotate.h @@ -23,8 +23,7 @@ void gimp_image_rotate (GimpImage *gimage, GimpContext *context, GimpRotationType rotate_type, - GimpProgressFunc progress_func, - gpointer progress_data); + GimpProgress *progress); #endif /* __GIMP_IMAGE_ROTATE_H__ */ diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index c64bc91e64..7320112e9a 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -32,6 +32,7 @@ #include "gimpimage-undo-push.h" #include "gimplayer.h" #include "gimplist.h" +#include "gimpprogress.h" #include "gimp-intl.h" @@ -41,8 +42,7 @@ gimp_image_scale (GimpImage *gimage, gint new_width, gint new_height, GimpInterpolationType interpolation_type, - GimpProgressFunc progress_func, - gpointer progress_data) + GimpProgress *progress) { GimpItem *item; GList *list; @@ -51,11 +51,12 @@ gimp_image_scale (GimpImage *gimage, gint old_height; gdouble img_scale_w = 1.0; gdouble img_scale_h = 1.0; - gint progress_max; - gint progress_current = 1; + gdouble progress_max; + gdouble progress_current = 1.0; g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (new_width > 0 && new_height > 0); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); gimp_set_busy (gimage->gimp); @@ -92,10 +93,10 @@ gimp_image_scale (GimpImage *gimage, gimp_item_scale (item, new_width, new_height, 0, 0, - interpolation_type, NULL, NULL); + interpolation_type, NULL); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Scale all vectors */ @@ -107,19 +108,19 @@ gimp_image_scale (GimpImage *gimage, gimp_item_scale (item, new_width, new_height, 0, 0, - interpolation_type, NULL, NULL); + interpolation_type, NULL); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* Don't forget the selection mask! */ gimp_item_scale (GIMP_ITEM (gimp_image_get_mask (gimage)), new_width, new_height, 0, 0, - interpolation_type, NULL, NULL); + interpolation_type, NULL); - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); /* Scale all layers */ for (list = GIMP_LIST (gimage->layers)->list; @@ -130,7 +131,7 @@ gimp_image_scale (GimpImage *gimage, if (! gimp_item_scale_by_factors (item, img_scale_w, img_scale_h, - interpolation_type, NULL, NULL)) + interpolation_type, NULL)) { /* Since 0 < img_scale_w, img_scale_h, failure due to one or more * vanishing scaled layer dimensions. Implicit delete implemented @@ -140,8 +141,8 @@ gimp_image_scale (GimpImage *gimage, remove = g_list_prepend (remove, item); } - if (progress_func) - (* progress_func) (0, progress_max, progress_current++, progress_data); + if (progress) + gimp_progress_set_value (progress, progress_current++ / progress_max); } /* We defer removing layers lost to scaling until now so as not to mix diff --git a/app/core/gimpimage-scale.h b/app/core/gimpimage-scale.h index 73064ef645..80da9e6a06 100644 --- a/app/core/gimpimage-scale.h +++ b/app/core/gimpimage-scale.h @@ -24,8 +24,7 @@ void gimp_image_scale (GimpImage *gimage, gint new_width, gint new_height, GimpInterpolationType interpolation_type, - GimpProgressFunc progress_func, - gpointer progress_data); + GimpProgress *progress); GimpImageScaleCheckType gimp_image_scale_check (const GimpImage *gimage, diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c index 64d0e38502..477e6e6651 100644 --- a/app/core/gimpimagefile.c +++ b/app/core/gimpimagefile.c @@ -42,6 +42,7 @@ #include "gimpimage.h" #include "gimpimagefile.h" #include "gimpmarshal.h" +#include "gimpprogress.h" #include "file/file-open.h" #include "file/file-utils.h" @@ -55,6 +56,7 @@ enum LAST_SIGNAL }; + static void gimp_imagefile_class_init (GimpImagefileClass *klass); static void gimp_imagefile_init (GimpImagefile *imagefile); static void gimp_imagefile_finalize (GObject *object); @@ -233,12 +235,14 @@ gimp_imagefile_update (GimpImagefile *imagefile) void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile, GimpContext *context, + GimpProgress *progress, gint size) { GimpThumbnail *thumbnail; g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); if (! imagefile->gimp->config->layer_previews) return; @@ -259,8 +263,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile, const gchar *mime_type = NULL; GError *error = NULL; - gimage = file_open_image (imagefile->gimp, - context, + gimage = file_open_image (imagefile->gimp, context, progress, thumbnail->image_uri, thumbnail->image_uri, NULL, diff --git a/app/core/gimpimagefile.h b/app/core/gimpimagefile.h index 83f7653faa..1dcf682d23 100644 --- a/app/core/gimpimagefile.h +++ b/app/core/gimpimagefile.h @@ -66,6 +66,7 @@ GimpImagefile * gimp_imagefile_new (Gimp *gimp, void gimp_imagefile_update (GimpImagefile *imagefile); void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile, GimpContext *context, + GimpProgress *progress, gint thumb_size); gboolean gimp_imagefile_save_thumbnail (GimpImagefile *imagefile, GimpImage *gimage); diff --git a/app/core/gimpitem-linked.c b/app/core/gimpitem-linked.c index 4e46d84f9b..9f5276fe93 100644 --- a/app/core/gimpitem-linked.c +++ b/app/core/gimpitem-linked.c @@ -27,6 +27,7 @@ #include "gimpitem.h" #include "gimpitem-linked.h" #include "gimplist.h" +#include "gimpprogress.h" /* public functions */ @@ -134,8 +135,7 @@ gimp_item_linked_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpImage *gimage; GList *linked_list; @@ -144,6 +144,7 @@ gimp_item_linked_transform (GimpItem *item, g_return_if_fail (GIMP_IS_ITEM (item)); g_return_if_fail (GIMP_IS_CONTEXT (context)); g_return_if_fail (gimp_item_get_linked (item) == TRUE); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); gimage = gimp_item_get_image (item); @@ -156,8 +157,7 @@ gimp_item_linked_transform (GimpItem *item, matrix, direction, interpolation_type, supersample, recursion_level, - clip_result, - progress_callback, progress_data); + clip_result, progress); g_list_free (linked_list); } diff --git a/app/core/gimpitem-linked.h b/app/core/gimpitem-linked.h index 5f02ebc8ec..4928afaacf 100644 --- a/app/core/gimpitem-linked.h +++ b/app/core/gimpitem-linked.h @@ -55,8 +55,7 @@ void gimp_item_linked_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); GList * gimp_item_linked_get_list (GimpImage *gimage, GimpItem *item, diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c index 481a8fdd89..d068ce70b8 100644 --- a/app/core/gimpitem.c +++ b/app/core/gimpitem.c @@ -39,6 +39,7 @@ #include "gimpmarshal.h" #include "gimppaintinfo.h" #include "gimpparasitelist.h" +#include "gimpprogress.h" #include "gimpstrokeoptions.h" #include "gimp-intl.h" @@ -83,8 +84,7 @@ static void gimp_item_real_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static void gimp_item_real_resize (GimpItem *item, GimpContext *context, gint new_width, @@ -345,8 +345,7 @@ gimp_item_real_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { item->width = new_width; item->height = new_height; @@ -700,13 +699,13 @@ gimp_item_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpItemClass *item_class; GimpImage *gimage; g_return_if_fail (GIMP_IS_ITEM (item)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); if (new_width < 1 || new_height < 1) return; @@ -718,7 +717,7 @@ gimp_item_scale (GimpItem *item, item_class->scale_desc); item_class->scale (item, new_width, new_height, new_offset_x, new_offset_y, - interpolation, progress_callback, progress_data); + interpolation, progress); gimp_image_undo_group_end (gimage); } @@ -729,8 +728,7 @@ gimp_item_scale (GimpItem *item, * @w_factor: scale factor to apply to width and horizontal offset * @h_factor: scale factor to apply to height and vertical offset * @interpolation: - * @progress_callback: - * @progress_data: + * @progress: * * Scales item dimensions and offsets by uniform width and * height factors. @@ -759,13 +757,13 @@ gimp_item_scale_by_factors (GimpItem *item, gdouble w_factor, gdouble h_factor, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { gint new_width, new_height; gint new_offset_x, new_offset_y; g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE); if (w_factor == 0.0 || h_factor == 0.0) { @@ -783,7 +781,7 @@ gimp_item_scale_by_factors (GimpItem *item, gimp_item_scale (item, new_width, new_height, new_offset_x, new_offset_y, - interpolation, progress_callback, progress_data); + interpolation, progress); return TRUE; } @@ -796,8 +794,7 @@ gimp_item_scale_by_factors (GimpItem *item, * @new_width: The width that item will acquire * @new_height: The height that the item will acquire * @interpolation: - * @progress_callback: - * @progress_data: + * @progress: * @local_origin: sets fixed point of the scaling transform. See below. * * Sets item dimensions to new_width and @@ -824,13 +821,13 @@ gimp_item_scale_by_origin (GimpItem *item, gint new_width, gint new_height, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data, + GimpProgress *progress, gboolean local_origin) { gint new_offset_x, new_offset_y; g_return_if_fail (GIMP_IS_ITEM (item)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); if (new_width == 0 || new_height == 0) { @@ -857,7 +854,7 @@ gimp_item_scale_by_origin (GimpItem *item, gimp_item_scale (item, new_width, new_height, new_offset_x, new_offset_y, - interpolation, progress_callback, progress_data); + interpolation, progress); } void @@ -947,14 +944,15 @@ gimp_item_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpItemClass *item_class; GimpImage *gimage; g_return_if_fail (GIMP_IS_ITEM (item)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (matrix != NULL); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); item_class = GIMP_ITEM_GET_CLASS (item); gimage = gimp_item_get_image (item); @@ -964,8 +962,7 @@ gimp_item_transform (GimpItem *item, item_class->transform (item, context, matrix, direction, interpolation, supersample, recursion_level, - clip_result, - progress_callback, progress_data); + clip_result, progress); gimp_image_undo_group_end (gimage); } diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h index d3de23f8eb..313a845dfd 100644 --- a/app/core/gimpitem.h +++ b/app/core/gimpitem.h @@ -85,8 +85,7 @@ struct _GimpItemClass gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation_type, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); void (* resize) (GimpItem *item, GimpContext *context, gint new_width, @@ -112,8 +111,7 @@ struct _GimpItemClass gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); gboolean (* stroke) (GimpItem *item, GimpDrawable *drawable, GimpContext *context, @@ -180,21 +178,18 @@ void gimp_item_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); gboolean gimp_item_scale_by_factors (GimpItem *item, gdouble w_factor, gdouble h_factor, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); void gimp_item_scale_by_origin (GimpItem *item, gint new_width, gint new_height, GimpInterpolationType interpolation, - GimpProgressFunc progress_callback, - gpointer progress_data, - gboolean local_origin); + GimpProgress *progress, + gboolean local_origin); void gimp_item_resize (GimpItem *item, GimpContext *context, gint new_width, @@ -222,8 +217,7 @@ void gimp_item_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); gboolean gimp_item_stroke (GimpItem *item, GimpDrawable *drawable, diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index c364e733b0..313dff6851 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -94,8 +94,7 @@ static void gimp_layer_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interp_type, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static void gimp_layer_resize (GimpItem *item, GimpContext *context, gint new_width, @@ -121,9 +120,7 @@ static void gimp_layer_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); - + GimpProgress *progress); static void gimp_layer_invalidate_boundary (GimpDrawable *drawable); static void gimp_layer_get_active_components (const GimpDrawable *drawable, gboolean *active); @@ -649,21 +646,19 @@ gimp_layer_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation_type, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpLayer *layer = GIMP_LAYER (item); GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height, new_offset_x, new_offset_y, - interpolation_type, - progress_callback, progress_data); + interpolation_type, progress); if (layer->mask) gimp_item_scale (GIMP_ITEM (layer->mask), new_width, new_height, new_offset_x, new_offset_y, - interpolation_type, NULL, NULL); + interpolation_type, progress); } static void @@ -729,24 +724,21 @@ gimp_layer_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpLayer *layer = GIMP_LAYER (item); GIMP_ITEM_CLASS (parent_class)->transform (item, context, matrix, direction, interpolation_type, supersample, recursion_level, - clip_result, - progress_callback, progress_data); + clip_result, progress); if (layer->mask) gimp_item_transform (GIMP_ITEM (layer->mask), context, matrix, direction, interpolation_type, supersample, recursion_level, - clip_result, - progress_callback, progress_data); + clip_result, progress); } static void diff --git a/app/core/gimpprogress.c b/app/core/gimpprogress.c new file mode 100644 index 0000000000..3aaf32f176 --- /dev/null +++ b/app/core/gimpprogress.c @@ -0,0 +1,196 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimpprogress.c + * Copyright (C) 2004 Michael Natterer + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include + +#include "core-types.h" + +#include "gimpmarshal.h" +#include "gimpprogress.h" + +#include "gimp-intl.h" + + +enum +{ + CANCEL, + LAST_SIGNAL +}; + + +/* local function prototypes */ + +static void gimp_progress_iface_base_init (GimpProgressInterface *progress_iface); + + +static guint progress_signals[LAST_SIGNAL] = { 0 }; + + +GType +gimp_progress_interface_get_type (void) +{ + static GType progress_iface_type = 0; + + if (! progress_iface_type) + { + static const GTypeInfo progress_iface_info = + { + sizeof (GimpProgressInterface), + (GBaseInitFunc) gimp_progress_iface_base_init, + (GBaseFinalizeFunc) NULL, + }; + + progress_iface_type = g_type_register_static (G_TYPE_INTERFACE, + "GimpProgressInterface", + &progress_iface_info, + 0); + + g_type_interface_add_prerequisite (progress_iface_type, G_TYPE_OBJECT); + } + + return progress_iface_type; +} + +static void +gimp_progress_iface_base_init (GimpProgressInterface *progress_iface) +{ + static gboolean initialized = FALSE; + + if (! initialized) + { + progress_signals[CANCEL] = + g_signal_new ("cancel", + G_TYPE_FROM_INTERFACE (progress_iface), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GimpProgressInterface, cancel), + NULL, NULL, + gimp_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + initialized = TRUE; + } +} + +GimpProgress * +gimp_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable) +{ + GimpProgressInterface *progress_iface; + + g_return_val_if_fail (GIMP_IS_PROGRESS (progress), NULL); + + if (! message || ! strlen (message)) + message = _("Please wait..."); + + progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress); + + if (progress_iface->start) + return progress_iface->start (progress, message, cancelable); + + return NULL; +} + +void +gimp_progress_end (GimpProgress *progress) +{ + GimpProgressInterface *progress_iface; + + g_return_if_fail (GIMP_IS_PROGRESS (progress)); + + progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress); + + if (progress_iface->end) + progress_iface->end (progress); +} + +void +gimp_progress_set_text (GimpProgress *progress, + const gchar *message) +{ + GimpProgressInterface *progress_iface; + + g_return_if_fail (GIMP_IS_PROGRESS (progress)); + + if (! message || ! strlen (message)) + message = _("Please wait..."); + + progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress); + + if (progress_iface->set_text) + progress_iface->set_text (progress, message); +} + +void +gimp_progress_set_value (GimpProgress *progress, + gdouble percentage) +{ + GimpProgressInterface *progress_iface; + + g_return_if_fail (GIMP_IS_PROGRESS (progress)); + + percentage = CLAMP (percentage, 0.0, 1.0); + + progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress); + + if (progress_iface->set_value) + progress_iface->set_value (progress, percentage); +} + +gdouble +gimp_progress_get_value (GimpProgress *progress) +{ + GimpProgressInterface *progress_iface; + + g_return_val_if_fail (GIMP_IS_PROGRESS (progress), 0.0); + + progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress); + + if (progress_iface->get_value) + return progress_iface->get_value (progress); + + return 0.0; +} + +void +gimp_progress_cancel (GimpProgress *progress) +{ + g_return_if_fail (GIMP_IS_PROGRESS (progress)); + + g_signal_emit (progress, progress_signals[CANCEL], 0); +} + +void +gimp_progress_update_and_flush (gint min, + gint max, + gint current, + gpointer data) +{ + gimp_progress_set_value (GIMP_PROGRESS (data), + (gfloat) (current - min) / (gfloat) (max - min)); + + while (g_main_context_pending (NULL)) + g_main_context_iteration (NULL, TRUE); +} diff --git a/app/core/gimpprogress.h b/app/core/gimpprogress.h new file mode 100644 index 0000000000..8409053759 --- /dev/null +++ b/app/core/gimpprogress.h @@ -0,0 +1,76 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimpprogress.h + * Copyright (C) 2004 Michael Natterer + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GIMP_PROGRESS_H__ +#define __GIMP_PROGRESS_H__ + + +#define GIMP_TYPE_PROGRESS (gimp_progress_interface_get_type ()) +#define GIMP_IS_PROGRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROGRESS)) +#define GIMP_PROGRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROGRESS, GimpProgress)) +#define GIMP_PROGRESS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_PROGRESS, GimpProgressInterface)) + + +typedef struct _GimpProgressInterface GimpProgressInterface; + +struct _GimpProgressInterface +{ + GTypeInterface base_iface; + + /* virtual functions */ + GimpProgress * (* start) (GimpProgress *progress, + const gchar *message, + gboolean cancelable); + void (* end) (GimpProgress *progress); + + void (* set_text) (GimpProgress *progress, + const gchar *message); + void (* set_value) (GimpProgress *progress, + gdouble percentage); + gdouble (* get_value) (GimpProgress *progress); + + /* signals */ + void (* cancel) (GimpProgress *progress); +}; + + +GType gimp_progress_interface_get_type (void) G_GNUC_CONST; + +GimpProgress * gimp_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable); +void gimp_progress_end (GimpProgress *progress); + +void gimp_progress_set_text (GimpProgress *progress, + const gchar *message); +void gimp_progress_set_value (GimpProgress *progress, + gdouble percentage); +gdouble gimp_progress_get_value (GimpProgress *progress); + +void gimp_progress_cancel (GimpProgress *progress); + +void gimp_progress_update_and_flush (gint min, + gint max, + gint current, + gpointer data); + + +#endif /* __GIMP_PROGRESS_H__ */ diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c index 48b05b81ca..1ae191f314 100644 --- a/app/core/gimpselection.c +++ b/app/core/gimpselection.c @@ -56,8 +56,7 @@ static void gimp_selection_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interp_type, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static void gimp_selection_resize (GimpItem *item, GimpContext *context, gint new_width, @@ -240,13 +239,11 @@ gimp_selection_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interp_type, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height, new_offset_x, new_offset_y, - interp_type, - progress_callback, progress_data); + interp_type, progress); item->offset_x = 0; item->offset_y = 0; diff --git a/app/dialogs/convert-dialog.c b/app/dialogs/convert-dialog.c index 5eae83441c..9e8e66ca09 100644 --- a/app/dialogs/convert-dialog.c +++ b/app/dialogs/convert-dialog.c @@ -30,18 +30,18 @@ #include "core/gimpimage-convert.h" #include "core/gimplist.h" #include "core/gimppalette.h" +#include "core/gimpprogress.h" #include "widgets/gimpenumwidgets.h" #include "widgets/gimphelp-ids.h" #include "widgets/gimppaletteselect.h" #include "widgets/gimpviewabledialog.h" -#include "display/gimpprogress.h" - #include "menus/menus.h" #include "gimp-intl.h" + typedef struct { GtkWidget *shell; @@ -55,8 +55,6 @@ typedef struct gint palette; GimpConvertPaletteType palette_type; GimpDisplay *gdisp; - GimpProgress *progress; - gint current_stage; } IndexedDialog; @@ -412,28 +410,6 @@ build_palette_button (Gimp *gimp) return gtk_button_new_with_label (GIMP_OBJECT (theCustomPalette)->name); } - -static void -progress_callback (gint stage, - gdouble percentage, - gpointer data) -{ - IndexedDialog *dialog = data; - - if (stage != dialog->current_stage) - { - gchar buffer[1024]; - - g_snprintf (buffer, sizeof (buffer), _("Stage %d"), stage); - - dialog->current_stage = stage; - dialog->progress = gimp_progress_restart (dialog->progress, - buffer, NULL, NULL); - } - - gimp_progress_update (dialog->progress, percentage); -} - static void indexed_response (GtkWidget *widget, gint response_id, @@ -441,9 +417,11 @@ indexed_response (GtkWidget *widget, { if (response_id == GTK_RESPONSE_OK) { - dialog->current_stage = 1; - dialog->progress = gimp_progress_start (dialog->gdisp, _("Stage 1"), - FALSE, NULL, NULL); + GimpProgress *progress; + + progress = gimp_progress_start (GIMP_PROGRESS (dialog->gdisp), + _("Converting to indexed..."), FALSE); + /* Convert the image to indexed color */ gimp_image_convert (dialog->gimage, GIMP_INDEXED, @@ -453,10 +431,11 @@ indexed_response (GtkWidget *widget, dialog->remove_dups, dialog->palette_type, theCustomPalette, - progress_callback, - dialog); + progress); + + if (progress) + gimp_progress_end (progress); - gimp_progress_end (dialog->progress); gimp_image_flush (dialog->gimage); /* Save defaults for next time */ diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c index 3a8dd7b623..dc76197bc0 100644 --- a/app/dialogs/file-open-dialog.c +++ b/app/dialogs/file-open-dialog.c @@ -29,6 +29,7 @@ #include "core/gimp.h" #include "core/gimpimage.h" +#include "core/gimpprogress.h" #include "file/file-open.h" #include "file/file-utils.h" @@ -118,6 +119,7 @@ file_open_dialog_response (GtkWidget *open_dialog, { GSList *uris; GSList *list; + gboolean success = FALSE; if (response_id != GTK_RESPONSE_OK) { @@ -141,13 +143,18 @@ file_open_dialog_response (GtkWidget *open_dialog, list->data, GIMP_FILE_DIALOG (open_dialog)->file_proc)) { - gtk_widget_hide (open_dialog); + success = TRUE; + + gdk_window_raise (open_dialog->window); } } g_free (filename); } + if (success) + gtk_widget_hide (open_dialog); + gtk_widget_set_sensitive (open_dialog, TRUE); g_slist_foreach (uris, (GFunc) g_free, NULL); @@ -167,6 +174,7 @@ file_open_dialog_open_image (GtkWidget *open_dialog, gimage = file_open_with_proc_and_display (gimp, gimp_get_user_context (gimp), + GIMP_PROGRESS (open_dialog), uri, entered_filename, load_proc, diff --git a/app/dialogs/file-open-location-dialog.c b/app/dialogs/file-open-location-dialog.c index 55156b1957..783bab89c1 100644 --- a/app/dialogs/file-open-location-dialog.c +++ b/app/dialogs/file-open-location-dialog.c @@ -157,9 +157,12 @@ file_open_location_response (GtkWidget *dialog, { uri = file_utils_filename_to_uri (gimp->load_procs, text, NULL); } - +#ifdef __GNUC__ +#warning FIXME: add progress bar to open location dialog +#endif image = file_open_with_proc_and_display (gimp, gimp_get_user_context (gimp), + NULL, uri, text, NULL, &status, &error); diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c index 5d11bc263b..c62acd22e8 100644 --- a/app/dialogs/file-save-dialog.c +++ b/app/dialogs/file-save-dialog.c @@ -29,6 +29,7 @@ #include "core/gimp.h" #include "core/gimpimage.h" +#include "core/gimpprogress.h" #include "file/file-save.h" #include "file/file-utils.h" @@ -300,6 +301,7 @@ file_save_dialog_save_image (GtkWidget *save_dialog, status = file_save_as (gimage, gimp_get_user_context (gimage->gimp), + GIMP_PROGRESS (save_dialog), uri, raw_filename, save_proc, diff --git a/app/display/Makefile.am b/app/display/Makefile.am index 85f349e1ca..55aa7c5b65 100644 --- a/app/display/Makefile.am +++ b/app/display/Makefile.am @@ -64,8 +64,6 @@ libappdisplay_a_sources = \ gimpdisplayshell-transform.h \ gimpnavigationview.c \ gimpnavigationview.h \ - gimpprogress.c \ - gimpprogress.h \ gimpscalecombobox.c \ gimpscalecombobox.h \ gimpstatusbar.c \ diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 041cd907ee..68b91ca47e 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -27,6 +27,7 @@ #include "core/gimparea.h" #include "core/gimpimage.h" #include "core/gimplist.h" +#include "core/gimpprogress.h" #include "tools/gimptool.h" #include "tools/tool_manager.h" @@ -50,25 +51,39 @@ enum /* local function prototypes */ -static void gimp_display_class_init (GimpDisplayClass *klass); -static void gimp_display_init (GimpDisplay *gdisp); +static void gimp_display_class_init (GimpDisplayClass *klass); +static void gimp_display_init (GimpDisplay *gdisp); +static void gimp_display_progress_iface_init (GimpProgressInterface *progress_iface); -static void gimp_display_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_display_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); +static void gimp_display_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_display_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -static void gimp_display_flush_whenever (GimpDisplay *gdisp, - gboolean now); -static void gimp_display_paint_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); +static GimpProgress * + gimp_display_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable); +static void gimp_display_progress_end (GimpProgress *progress); +static void gimp_display_progress_set_text (GimpProgress *progress, + const gchar *message); +static void gimp_display_progress_set_value (GimpProgress *progress, + gdouble percentage); +static gdouble gimp_display_progress_get_value (GimpProgress *progress); +static void gimp_display_progress_canceled (GimpProgress *progress, + GimpDisplay *display); + +static void gimp_display_flush_whenever (GimpDisplay *gdisp, + gboolean now); +static void gimp_display_paint_area (GimpDisplay *gdisp, + gint x, + gint y, + gint w, + gint h); static GimpObjectClass *parent_class = NULL; @@ -94,9 +109,19 @@ gimp_display_get_type (void) (GInstanceInitFunc) gimp_display_init, }; + static const GInterfaceInfo progress_iface_info = + { + (GInterfaceInitFunc) gimp_display_progress_iface_init, + NULL, /* iface_finalize */ + NULL /* iface_data */ + }; + display_type = g_type_register_static (GIMP_TYPE_OBJECT, "GimpDisplay", &display_info, 0); + + g_type_add_interface_static (display_type, GIMP_TYPE_PROGRESS, + &progress_iface_info); } return display_type; @@ -139,6 +164,16 @@ gimp_display_init (GimpDisplay *gdisp) gdisp->update_areas = NULL; } +static void +gimp_display_progress_iface_init (GimpProgressInterface *progress_iface) +{ + progress_iface->start = gimp_display_progress_start; + progress_iface->end = gimp_display_progress_end; + progress_iface->set_text = gimp_display_progress_set_text; + progress_iface->set_value = gimp_display_progress_set_value; + progress_iface->get_value = gimp_display_progress_get_value; +} + static void gimp_display_set_property (GObject *object, guint property_id, @@ -183,6 +218,61 @@ gimp_display_get_property (GObject *object, } } +static GimpProgress * +gimp_display_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable) +{ + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (GIMP_DISPLAY (progress)->shell); + + return gimp_progress_start (GIMP_PROGRESS (shell->statusbar), + message, cancelable); +} + +static void +gimp_display_progress_end (GimpProgress *progress) +{ + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (GIMP_DISPLAY (progress)->shell); + + gimp_progress_end (GIMP_PROGRESS (shell->statusbar)); +} + +static void +gimp_display_progress_set_text (GimpProgress *progress, + const gchar *message) +{ + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (GIMP_DISPLAY (progress)->shell); + + gimp_progress_set_text (GIMP_PROGRESS (shell->statusbar), message); +} + +static void +gimp_display_progress_set_value (GimpProgress *progress, + gdouble percentage) +{ + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (GIMP_DISPLAY (progress)->shell); + + gimp_progress_set_value (GIMP_PROGRESS (shell->statusbar), percentage); +} + +static gdouble +gimp_display_progress_get_value (GimpProgress *progress) +{ + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (GIMP_DISPLAY (progress)->shell); + + return gimp_progress_get_value (GIMP_PROGRESS (shell->statusbar)); +} + +static void +gimp_display_progress_canceled (GimpProgress *progress, + GimpDisplay *display) +{ + gimp_progress_cancel (GIMP_PROGRESS (display)); +} + + +/* public functions */ + GimpDisplay * gimp_display_new (GimpImage *gimage, GimpUnit unit, @@ -208,9 +298,12 @@ gimp_display_new (GimpImage *gimage, /* create the shell for the image */ gdisp->shell = gimp_display_shell_new (gdisp, unit, scale, menu_factory, popup_manager); - gtk_widget_show (gdisp->shell); + g_signal_connect (GIMP_DISPLAY_SHELL (gdisp->shell)->statusbar, "cancel", + G_CALLBACK (gimp_display_progress_canceled), + gdisp); + return gdisp; } diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c index a3cd8627d0..bb286d73be 100644 --- a/app/display/gimpdisplayshell-dnd.c +++ b/app/display/gimpdisplayshell-dnd.c @@ -34,6 +34,7 @@ #include "core/gimpimage-undo.h" #include "core/gimplayer.h" #include "core/gimppattern.h" +#include "core/gimpprogress.h" #include "file/file-open.h" #include "file/file-utils.h" @@ -300,7 +301,9 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget, GimpPDBStatusType status; GError *error = NULL; - new_layer = file_open_layer (gimage->gimp, context, gimage, uri, + new_layer = file_open_layer (gimage->gimp, context, + GIMP_PROGRESS (shell->statusbar), + gimage, uri, &status, &error); if (new_layer) diff --git a/app/display/gimpprogress.c b/app/display/gimpprogress.c deleted file mode 100644 index 913548de3b..0000000000 --- a/app/display/gimpprogress.c +++ /dev/null @@ -1,455 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "libgimpwidgets/gimpwidgets.h" - -#include "display-types.h" - -#include "gimpdisplay.h" -#include "gimpdisplayshell.h" -#include "gimpstatusbar.h" -#include "gimpprogress.h" - -#include "gimp-intl.h" - - -struct _GimpProgress -{ - GimpDisplay *gdisp; /* gdisp in use, or NULL*/ - - /* next four fields are only valid if gdisp is NULL */ - GtkWidget *dialog; /* progress dialog, NULL if using gdisp */ - GtkWidget *dialog_label; - GtkWidget *progressbar; - GtkWidget *cancelbutton; - - GCallback cancel_callback; /* callback to remove, or NULL */ - gpointer cancel_data; -}; - - -/* local function prototypes */ - -static void gimp_progress_signal_setup (GimpProgress *progress, - GCallback cancel_callback, - gpointer cancel_data); -static void gimp_progress_response (GtkWidget *dialog, - gint response_id, - GimpProgress *progress); - - -/** - * gimp_progress_start: - * @gdisp: The #GimpDisplay to show the progress in. - * @message: The message. - * @important: Setting this to #FALSE will cause the progress - * to silently fail if the display's statusbar - * is hidden. - * @cancel_callback: The callback to call if the "Cancel" button is clicked. - * @cancel_data: The %cancel_callback's "user_data". - * - * Start a progress bar on %gdisp with reason %message. If %gdisp - * is #NULL, the progress bar is presented in a new dialog box. If - * %message is #NULL, then no message is used. - * - * If %cancel_callback is not %NULL, it is attached to the progress - * bar cancel button's "clicked" signal, with data %cancel_data. The - * cancel button is only made sensitive if the callback is set. - * - * It is an error to gimp_progress_start() a bar on a %gdisp for which - * there is already a progress bar active. - * - * Progress bars with %important set to #TRUE will be shown to the - * user in any possible way. Unimportant progress bars will not be - * shown to the user if it would mean creating a new window. - * - * Return value: The new #GimpProgress. - **/ -GimpProgress * -gimp_progress_start (GimpDisplay *gdisp, - const gchar *message, - gboolean important, - GCallback cancel_callback, - gpointer cancel_data) -{ - GimpDisplayShell *shell = NULL; - GimpProgress *progress; - GtkWidget *vbox; - - g_return_val_if_fail (gdisp == NULL || GIMP_IS_DISPLAY (gdisp), NULL); - - if (gdisp) - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - progress = g_new0 (GimpProgress, 1); - - /* do we have a useful gdisplay and statusarea? */ - if (gdisp && GTK_WIDGET_VISIBLE (shell->statusbar)) - { - progress->gdisp = gdisp; - - if (message) - { - gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar), - "progress", - message); - } - - /* really need image locking to stop multiple people going at - * the image - */ - if (GIMP_STATUSBAR (shell->statusbar)->progressid) - { - g_warning ("%s: %d progress bars already active for display %p", - G_STRFUNC, GIMP_STATUSBAR (shell->statusbar)->progressid, - gdisp); - } - - GIMP_STATUSBAR (shell->statusbar)->progressid++; - } - else - { - /* unimporant progress indications are occasionally failed */ - if (! important) - { - g_free (progress); - return NULL; - } - - progress->dialog = gimp_dialog_new (_("Progress"), "progress", - NULL, 0, - NULL, NULL, - NULL); - - progress->cancelbutton = - gtk_dialog_add_button (GTK_DIALOG (progress->dialog), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - - gtk_window_set_resizable (GTK_WINDOW (progress->dialog), FALSE); - - vbox = gtk_vbox_new (FALSE, 12); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (progress->dialog)->vbox), - vbox); - gtk_widget_show (vbox); - - progress->dialog_label = gtk_label_new (message ? message : - _("Please wait...")); - gtk_misc_set_alignment (GTK_MISC (progress->dialog_label), 0.0, 0.5); - gtk_box_pack_start (GTK_BOX (vbox), progress->dialog_label, - FALSE, FALSE, 0); - gtk_widget_show (progress->dialog_label); - - progress->progressbar = gtk_progress_bar_new (); - gtk_widget_set_size_request (progress->progressbar, 150, 20); - gtk_box_pack_start (GTK_BOX (vbox), progress->progressbar, - FALSE, FALSE, 0); - gtk_widget_show (progress->progressbar); - - gtk_widget_show (progress->dialog); - } - - gimp_progress_signal_setup (progress, cancel_callback, cancel_data); - - return progress; -} - - -/** - * gimp_progress_restart: - * @progress: The #GimpProgress to restart. - * @message: The new message. - * @cancel_callback: The new cancel_callback - * @cancel_data: The new cancel_data - * - * Update the message and/or the callbacks for a progress and reset - * the bar to zero, with the minimum of disturbance to the user. - * - * Return value: The same #GimpProgress as passed in as %progress. - **/ -GimpProgress * -gimp_progress_restart (GimpProgress *progress, - const char *message, - GCallback cancel_callback, - gpointer cancel_data) -{ - GtkWidget *bar; - - g_return_val_if_fail (progress != NULL, NULL); - - /* change the message */ - if (progress->gdisp) - { - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress->gdisp->shell); - - gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar), "progress"); - - if (message) - gimp_statusbar_push (GIMP_STATUSBAR (shell->statusbar), - "progress", - message); - - bar = GIMP_STATUSBAR (shell->statusbar)->progressbar; - } - else - { - gtk_label_set_text (GTK_LABEL (progress->dialog_label), - message ? message : _("Please wait...")); - - bar = progress->progressbar; - } - - /* reset the progress bar */ - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), 0.0); - - /* do we need to change the callbacks? */ - gimp_progress_signal_setup (progress, cancel_callback, cancel_data); - - return progress; -} - - -void -gimp_progress_update (GimpProgress *progress, - gdouble percentage) -{ - GtkWidget *bar; - - g_return_if_fail (progress != NULL); - - if (percentage < 0.0 || percentage > 1.0) - return; - - /* do we have a dialog box, or are we using the statusbar? */ - if (progress->gdisp) - { - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress->gdisp->shell); - - bar = GIMP_STATUSBAR (shell->statusbar)->progressbar; - } - else - { - bar = progress->progressbar; - } - - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage); - - /* force updates so there's feedback even when the main loop is busy */ - if (GTK_WIDGET_DRAWABLE (bar)) - gdk_window_process_updates (bar->window, TRUE); -} - - -/** - * gimp_progress_step: - * @progress: The #GimpProgress. - * - * Step the progress bar by one percent, wrapping at 100% - **/ -void -gimp_progress_step (GimpProgress *progress) -{ - GtkWidget *bar; - gdouble val; - - g_return_if_fail (progress != NULL); - - if (progress->gdisp) - { - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress->gdisp->shell); - - bar = GIMP_STATUSBAR (shell->statusbar)->progressbar; - } - else - { - bar = progress->progressbar; - } - - val = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (bar)) + 0.01; - if (val > 1.0) - val = 0.0; - - gimp_progress_update (progress, val); -} - - -/** - * gimp_progress_end: - * @progress: The #GimpProgress. - * - * Finish using the progress bar. - **/ -void -gimp_progress_end (GimpProgress *progress) -{ - g_return_if_fail (progress != NULL); - - /* We might get called from gimp_exit() and at that time - * the display shell has been destroyed already. - */ - if (progress->gdisp && !progress->gdisp->shell) - return; - - /* remove all callbacks so they don't get called while we're - * destroying widgets - */ - gimp_progress_signal_setup (progress, NULL, NULL); - - if (progress->gdisp) - { - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress->gdisp->shell); - GtkProgressBar *bar; - - gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar), "progress"); - - bar = GTK_PROGRESS_BAR (GIMP_STATUSBAR (shell->statusbar)->progressbar); - - gtk_progress_bar_set_fraction (bar, 0.0); - - if (GIMP_STATUSBAR (shell->statusbar)->progressid > 0) - GIMP_STATUSBAR (shell->statusbar)->progressid--; - } - else - { - gtk_widget_destroy (progress->dialog); - } - - g_free (progress); -} - - -/* This function's prototype is conveniently - * the same as progress_func_t - */ - -/** - * gimp_progress_update_and_flush: - * @min: The minimum, ... - * @max: ... the maximum, ... - * @current: ... and the current progress of your operation. - * @data: The #GimpProgress you want to update. - * - * This function's prototype is conveniently - * the same as #GimpProgressFunc from libgimpcolor. - **/ -void -gimp_progress_update_and_flush (gint min, - gint max, - gint current, - gpointer data) -{ - gimp_progress_update ((GimpProgress *) data, - (gfloat) (current - min) / (gfloat) (max - min)); - - while (gtk_events_pending ()) - gtk_main_iteration (); -} - - -/* private functions */ - -/* Helper function to add or remove signals */ -static void -gimp_progress_signal_setup (GimpProgress *progress, - GCallback cancel_callback, - gpointer cancel_data) -{ - GtkWidget *button; - GtkWidget *dialog; - - if (progress->cancel_callback == cancel_callback && - progress->cancel_data == cancel_data) - return; - - /* are we using the statusbar or a freestanding dialog? */ - if (progress->gdisp) - { - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress->gdisp->shell); - - dialog = NULL; - button = GIMP_STATUSBAR (shell->statusbar)->cancelbutton; - } - else - { - dialog = progress->dialog; - button = progress->cancelbutton; - } - - /* remove any existing signal handlers */ - if (progress->cancel_callback) - { - if (dialog) - g_signal_handlers_disconnect_by_func (dialog, - progress->cancel_callback, - progress->cancel_data); - else - g_signal_handlers_disconnect_by_func (button, - progress->cancel_callback, - progress->cancel_data); - } - - /* add the new handlers */ - if (cancel_callback) - { - if (dialog) - g_signal_connect (dialog, "response", - G_CALLBACK (gimp_progress_response), - progress); - else - g_signal_connect (button, "clicked", - G_CALLBACK (cancel_callback), - cancel_data); - - } - - gtk_widget_set_sensitive (GTK_WIDGET (button), - cancel_callback ? TRUE : FALSE); - - progress->cancel_callback = cancel_callback; - progress->cancel_data = cancel_data; -} - -static void -gimp_progress_response (GtkWidget *dialog, - gint response_id, - GimpProgress *progress) -{ - typedef void (* cb) (GtkWidget*, gpointer); - - GtkWidget *button; - cb callback; - - callback = (cb) progress->cancel_callback; - - if (progress->gdisp) - { - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress->gdisp->shell); - - button = GIMP_STATUSBAR (shell->statusbar)->cancelbutton; - } - else - { - button = progress->cancelbutton; - } - - callback (button, progress->cancel_data); -} diff --git a/app/display/gimpprogress.h b/app/display/gimpprogress.h deleted file mode 100644 index c21a84cf9b..0000000000 --- a/app/display/gimpprogress.h +++ /dev/null @@ -1,43 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __GIMP_PROGRESS_H__ -#define __GIMP_PROGRESS_H__ - - -GimpProgress * gimp_progress_start (GimpDisplay *gdisp, - const gchar *message, - gboolean important, - GCallback cancel_callback, - gpointer cancel_data); -GimpProgress * gimp_progress_restart (GimpProgress *progress, - const gchar *message, - GCallback cancel_callback, - gpointer cancel_data); -void gimp_progress_update (GimpProgress *progress, - gdouble percentage); -void gimp_progress_step (GimpProgress *progress); -void gimp_progress_end (GimpProgress *progress); - -void gimp_progress_update_and_flush (gint min, - gint max, - gint current, - gpointer data); - - -#endif /* __GIMP_PROGRESS_H__ */ diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c index 2a1f853f28..431977b109 100644 --- a/app/display/gimpstatusbar.c +++ b/app/display/gimpstatusbar.c @@ -27,6 +27,7 @@ #include "core/gimpimage.h" #include "core/gimpunit.h" #include "core/gimpmarshal.h" +#include "core/gimpprogress.h" #include "widgets/gimpunitstore.h" #include "widgets/gimpunitcombobox.h" @@ -54,20 +55,34 @@ struct _GimpStatusbarMsg #define CURSOR_LEN 256 -static void gimp_statusbar_class_init (GimpStatusbarClass *klass); -static void gimp_statusbar_init (GimpStatusbar *statusbar); +static void gimp_statusbar_class_init (GimpStatusbarClass *klass); +static void gimp_statusbar_init (GimpStatusbar *statusbar); +static void gimp_statusbar_progress_iface_init (GimpProgressInterface *progress_iface); -static void gimp_statusbar_destroy (GtkObject *object); +static void gimp_statusbar_destroy (GtkObject *object); -static void gimp_statusbar_update (GimpStatusbar *statusbar); -static void gimp_statusbar_unit_changed (GimpUnitComboBox *combo, - GimpStatusbar *statusbar); -static void gimp_statusbar_scale_changed (GimpScaleComboBox *combo, - GimpStatusbar *statusbar); -static void gimp_statusbar_shell_scaled (GimpDisplayShell *shell, - GimpStatusbar *statusbar); -static guint gimp_statusbar_get_context_id (GimpStatusbar *statusbar, - const gchar *context); +static GimpProgress * + gimp_statusbar_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable); +static void gimp_statusbar_progress_end (GimpProgress *progress); +static void gimp_statusbar_progress_set_text (GimpProgress *progress, + const gchar *message); +static void gimp_statusbar_progress_set_value (GimpProgress *progress, + gdouble percentage); +static gdouble gimp_statusbar_progress_get_value (GimpProgress *progress); +static void gimp_statusbar_progress_canceled (GtkWidget *button, + GimpStatusbar *statusbar); + +static void gimp_statusbar_update (GimpStatusbar *statusbar); +static void gimp_statusbar_unit_changed (GimpUnitComboBox *combo, + GimpStatusbar *statusbar); +static void gimp_statusbar_scale_changed (GimpScaleComboBox *combo, + GimpStatusbar *statusbar); +static void gimp_statusbar_shell_scaled (GimpDisplayShell *shell, + GimpStatusbar *statusbar); +static guint gimp_statusbar_get_context_id (GimpStatusbar *statusbar, + const gchar *context); static GtkHBoxClass *parent_class = NULL; @@ -93,9 +108,19 @@ gimp_statusbar_get_type (void) (GInstanceInitFunc) gimp_statusbar_init, }; + static const GInterfaceInfo progress_iface_info = + { + (GInterfaceInitFunc) gimp_statusbar_progress_iface_init, + NULL, /* iface_finalize */ + NULL /* iface_data */ + }; + statusbar_type = g_type_register_static (GTK_TYPE_HBOX, "GimpStatusbar", &statusbar_info, 0); + + g_type_add_interface_static (statusbar_type, GIMP_TYPE_PROGRESS, + &progress_iface_info); } return statusbar_type; @@ -134,7 +159,7 @@ gimp_statusbar_init (GimpStatusbar *statusbar) statusbar->shell = NULL; statusbar->cursor_format_str[0] = '\0'; - statusbar->progressid = 0; + statusbar->progress_active = FALSE; gtk_box_set_spacing (box, 1); @@ -188,10 +213,14 @@ gimp_statusbar_init (GimpStatusbar *statusbar) GTK_PROGRESS_BAR (statusbar->progressbar)->progress.x_align = 0.0; GTK_PROGRESS_BAR (statusbar->progressbar)->progress.y_align = 0.5; - statusbar->cancelbutton = gtk_button_new_with_label (_("Cancel")); - gtk_widget_set_sensitive (statusbar->cancelbutton, FALSE); - gtk_box_pack_start (box, statusbar->cancelbutton, FALSE, FALSE, 0); - gtk_widget_show (statusbar->cancelbutton); + statusbar->cancel_button = gtk_button_new_with_label (_("Cancel")); + gtk_widget_set_sensitive (statusbar->cancel_button, FALSE); + gtk_box_pack_start (box, statusbar->cancel_button, FALSE, FALSE, 0); + gtk_widget_show (statusbar->cancel_button); + + g_signal_connect (statusbar->cancel_button, "clicked", + G_CALLBACK (gimp_statusbar_progress_canceled), + statusbar); /* Update the statusbar once to work around a canvas size problem: * @@ -210,6 +239,16 @@ gimp_statusbar_init (GimpStatusbar *statusbar) statusbar->keys = NULL; } +static void +gimp_statusbar_progress_iface_init (GimpProgressInterface *progress_iface) +{ + progress_iface->start = gimp_statusbar_progress_start; + progress_iface->end = gimp_statusbar_progress_end; + progress_iface->set_text = gimp_statusbar_progress_set_text; + progress_iface->set_value = gimp_statusbar_progress_set_value; + progress_iface->get_value = gimp_statusbar_progress_get_value; +} + static void gimp_statusbar_destroy (GtkObject *object) { @@ -236,6 +275,101 @@ gimp_statusbar_destroy (GtkObject *object) GTK_OBJECT_CLASS (parent_class)->destroy (object); } +static GimpProgress * +gimp_statusbar_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable) +{ + GimpStatusbar *statusbar = GIMP_STATUSBAR (progress); + + if (! statusbar->progress_active) + { + GtkWidget *bar = statusbar->progressbar; + + gimp_statusbar_push (statusbar, "progress", message); + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), 0.0); + gtk_widget_set_sensitive (statusbar->cancel_button, cancelable); + + statusbar->progress_active = TRUE; + + return progress; + } + + g_warning ("%s: progress bar already active for statusbar %p", + G_STRFUNC, statusbar); + + return NULL; +} + +static void +gimp_statusbar_progress_end (GimpProgress *progress) +{ + GimpStatusbar *statusbar = GIMP_STATUSBAR (progress); + + if (statusbar->progress_active) + { + GtkWidget *bar = statusbar->progressbar; + + gimp_statusbar_pop (statusbar, "progress"); + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), 0.0); + gtk_widget_set_sensitive (statusbar->cancel_button, FALSE); + + statusbar->progress_active = FALSE; + } +} + +static void +gimp_statusbar_progress_set_text (GimpProgress *progress, + const gchar *message) +{ + GimpStatusbar *statusbar = GIMP_STATUSBAR (progress); + + if (statusbar->progress_active) + { + gimp_statusbar_replace (statusbar, "progress", message); + } +} + +static void +gimp_statusbar_progress_set_value (GimpProgress *progress, + gdouble percentage) +{ + GimpStatusbar *statusbar = GIMP_STATUSBAR (progress); + + if (statusbar->progress_active) + { + GtkWidget *bar = statusbar->progressbar; + + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage); + + if (GTK_WIDGET_DRAWABLE (bar)) + gdk_window_process_updates (bar->window, TRUE); + } +} + +static gdouble +gimp_statusbar_progress_get_value (GimpProgress *progress) +{ + GimpStatusbar *statusbar = GIMP_STATUSBAR (progress); + + if (statusbar->progress_active) + { + GtkWidget *bar = statusbar->progressbar; + + return gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (bar)); + } + + return 0.0; +} + +static void +gimp_statusbar_progress_canceled (GtkWidget *button, + GimpStatusbar *statusbar) +{ + if (statusbar->progress_active) + gimp_progress_cancel (GIMP_PROGRESS (statusbar)); +} + static void gimp_statusbar_update (GimpStatusbar *statusbar) { diff --git a/app/display/gimpstatusbar.h b/app/display/gimpstatusbar.h index e69405fdee..99d8328860 100644 --- a/app/display/gimpstatusbar.h +++ b/app/display/gimpstatusbar.h @@ -53,8 +53,8 @@ struct _GimpStatusbar GtkWidget *scale_combo; GtkWidget *progressbar; - guint progressid; - GtkWidget *cancelbutton; + GtkWidget *cancel_button; + gboolean progress_active; }; struct _GimpStatusbarClass diff --git a/app/file/file-open.c b/app/file/file-open.c index 644510fd0b..60e09379f7 100644 --- a/app/file/file-open.c +++ b/app/file/file-open.c @@ -48,6 +48,7 @@ #include "core/gimpimage-undo.h" #include "core/gimpimagefile.h" #include "core/gimplayer.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -65,6 +66,7 @@ GimpImage * file_open_image (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *uri, const gchar *entered_filename, PlugInProcDef *file_proc, @@ -82,6 +84,7 @@ file_open_image (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (status != NULL, NULL); g_return_val_if_fail (mime_type == NULL || *mime_type == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); @@ -134,7 +137,8 @@ file_open_image (Gimp *gimp, args[1].value.pdb_pointer = filename ? filename : (gchar *) uri; args[2].value.pdb_pointer = (gchar *) entered_filename; - return_vals = procedural_db_execute (gimp, context, proc->name, args); + return_vals = procedural_db_execute (gimp, context, progress, + proc->name, args); if (filename) g_free (filename); @@ -190,17 +194,19 @@ file_open_image (Gimp *gimp, GimpImage * file_open_with_display (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *uri, GimpPDBStatusType *status, GError **error) { - return file_open_with_proc_and_display (gimp, context, + return file_open_with_proc_and_display (gimp, context, progress, uri, uri, NULL, status, error); } GimpImage * file_open_with_proc_and_display (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *uri, const gchar *entered_filename, PlugInProcDef *file_proc, @@ -212,9 +218,10 @@ file_open_with_proc_and_display (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (status != NULL, NULL); - gimage = file_open_image (gimp, context, + gimage = file_open_image (gimp, context, progress, uri, entered_filename, file_proc, @@ -251,6 +258,7 @@ file_open_with_proc_and_display (Gimp *gimp, GimpLayer * file_open_layer (Gimp *gimp, GimpContext *context, + GimpProgress *progress, GimpImage *dest_image, const gchar *uri, GimpPDBStatusType *status, @@ -261,12 +269,13 @@ file_open_layer (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL); g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (status != NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); - new_image = file_open_image (gimp, context, uri, uri, + new_image = file_open_image (gimp, context, progress, uri, uri, NULL, GIMP_RUN_NONINTERACTIVE, status, NULL, error); diff --git a/app/file/file-open.h b/app/file/file-open.h index caca487b50..818275a529 100644 --- a/app/file/file-open.h +++ b/app/file/file-open.h @@ -22,6 +22,7 @@ GimpImage * file_open_image (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *uri, const gchar *entered_filename, PlugInProcDef *file_proc, @@ -32,12 +33,14 @@ GimpImage * file_open_image (Gimp *gimp, GimpImage * file_open_with_display (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *uri, GimpPDBStatusType *status, GError **error); GimpImage * file_open_with_proc_and_display (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *uri, const gchar *entered_filename, PlugInProcDef *file_proc, @@ -46,6 +49,7 @@ GimpImage * file_open_with_proc_and_display (Gimp *gimp, GimpLayer * file_open_layer (Gimp *gimp, GimpContext *context, + GimpProgress *progress, GimpImage *dest_image, const gchar *uri, GimpPDBStatusType *status, diff --git a/app/file/file-save.c b/app/file/file-save.c index a666ebf30f..95ccc62403 100644 --- a/app/file/file-save.c +++ b/app/file/file-save.c @@ -48,6 +48,7 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpimagefile.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -65,6 +66,7 @@ GimpPDBStatusType file_save (GimpImage *gimage, GimpContext *context, + GimpProgress *progress, GimpRunMode run_mode, GError **error) { @@ -73,6 +75,8 @@ file_save (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_PDB_CALLING_ERROR); g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_PDB_CALLING_ERROR); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), + GIMP_PDB_CALLING_ERROR); g_return_val_if_fail (error == NULL || *error == NULL, GIMP_PDB_CALLING_ERROR); @@ -82,13 +86,15 @@ file_save (GimpImage *gimage, file_proc = gimp_image_get_save_proc (gimage); - return file_save_as (gimage, context, uri, uri, file_proc, run_mode, + return file_save_as (gimage, context, progress, + uri, uri, file_proc, run_mode, FALSE, TRUE, error); } GimpPDBStatusType file_save_as (GimpImage *gimage, GimpContext *context, + GimpProgress *progress, const gchar *uri, const gchar *raw_filename, PlugInProcDef *file_proc, @@ -106,6 +112,8 @@ file_save_as (GimpImage *gimage, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), GIMP_PDB_CALLING_ERROR); g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_PDB_CALLING_ERROR); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), + GIMP_PDB_CALLING_ERROR); g_return_val_if_fail (uri != NULL, GIMP_PDB_CALLING_ERROR); g_return_val_if_fail (raw_filename != NULL, GIMP_PDB_CALLING_ERROR); g_return_val_if_fail (error == NULL || *error == NULL, @@ -165,7 +173,8 @@ file_save_as (GimpImage *gimage, args[3].value.pdb_pointer = (gpointer) (filename ? filename : uri); args[4].value.pdb_pointer = (gpointer) raw_filename; - return_vals = procedural_db_execute (gimage->gimp, context, proc->name, args); + return_vals = procedural_db_execute (gimage->gimp, context, progress, + proc->name, args); if (filename) g_free (filename); diff --git a/app/file/file-save.h b/app/file/file-save.h index 1f05e83d21..f94af72408 100644 --- a/app/file/file-save.h +++ b/app/file/file-save.h @@ -22,10 +22,12 @@ GimpPDBStatusType file_save (GimpImage *gimage, GimpContext *context, + GimpProgress *progress, GimpRunMode run_mode, GError **error); GimpPDBStatusType file_save_as (GimpImage *gimage, GimpContext *context, + GimpProgress *progress, const gchar *uri, const gchar *raw_filename, PlugInProcDef *file_proc, diff --git a/app/gui/convert-dialog.c b/app/gui/convert-dialog.c index 5eae83441c..9e8e66ca09 100644 --- a/app/gui/convert-dialog.c +++ b/app/gui/convert-dialog.c @@ -30,18 +30,18 @@ #include "core/gimpimage-convert.h" #include "core/gimplist.h" #include "core/gimppalette.h" +#include "core/gimpprogress.h" #include "widgets/gimpenumwidgets.h" #include "widgets/gimphelp-ids.h" #include "widgets/gimppaletteselect.h" #include "widgets/gimpviewabledialog.h" -#include "display/gimpprogress.h" - #include "menus/menus.h" #include "gimp-intl.h" + typedef struct { GtkWidget *shell; @@ -55,8 +55,6 @@ typedef struct gint palette; GimpConvertPaletteType palette_type; GimpDisplay *gdisp; - GimpProgress *progress; - gint current_stage; } IndexedDialog; @@ -412,28 +410,6 @@ build_palette_button (Gimp *gimp) return gtk_button_new_with_label (GIMP_OBJECT (theCustomPalette)->name); } - -static void -progress_callback (gint stage, - gdouble percentage, - gpointer data) -{ - IndexedDialog *dialog = data; - - if (stage != dialog->current_stage) - { - gchar buffer[1024]; - - g_snprintf (buffer, sizeof (buffer), _("Stage %d"), stage); - - dialog->current_stage = stage; - dialog->progress = gimp_progress_restart (dialog->progress, - buffer, NULL, NULL); - } - - gimp_progress_update (dialog->progress, percentage); -} - static void indexed_response (GtkWidget *widget, gint response_id, @@ -441,9 +417,11 @@ indexed_response (GtkWidget *widget, { if (response_id == GTK_RESPONSE_OK) { - dialog->current_stage = 1; - dialog->progress = gimp_progress_start (dialog->gdisp, _("Stage 1"), - FALSE, NULL, NULL); + GimpProgress *progress; + + progress = gimp_progress_start (GIMP_PROGRESS (dialog->gdisp), + _("Converting to indexed..."), FALSE); + /* Convert the image to indexed color */ gimp_image_convert (dialog->gimage, GIMP_INDEXED, @@ -453,10 +431,11 @@ indexed_response (GtkWidget *widget, dialog->remove_dups, dialog->palette_type, theCustomPalette, - progress_callback, - dialog); + progress); + + if (progress) + gimp_progress_end (progress); - gimp_progress_end (dialog->progress); gimp_image_flush (dialog->gimage); /* Save defaults for next time */ diff --git a/app/gui/file-open-dialog.c b/app/gui/file-open-dialog.c index 3a8dd7b623..dc76197bc0 100644 --- a/app/gui/file-open-dialog.c +++ b/app/gui/file-open-dialog.c @@ -29,6 +29,7 @@ #include "core/gimp.h" #include "core/gimpimage.h" +#include "core/gimpprogress.h" #include "file/file-open.h" #include "file/file-utils.h" @@ -118,6 +119,7 @@ file_open_dialog_response (GtkWidget *open_dialog, { GSList *uris; GSList *list; + gboolean success = FALSE; if (response_id != GTK_RESPONSE_OK) { @@ -141,13 +143,18 @@ file_open_dialog_response (GtkWidget *open_dialog, list->data, GIMP_FILE_DIALOG (open_dialog)->file_proc)) { - gtk_widget_hide (open_dialog); + success = TRUE; + + gdk_window_raise (open_dialog->window); } } g_free (filename); } + if (success) + gtk_widget_hide (open_dialog); + gtk_widget_set_sensitive (open_dialog, TRUE); g_slist_foreach (uris, (GFunc) g_free, NULL); @@ -167,6 +174,7 @@ file_open_dialog_open_image (GtkWidget *open_dialog, gimage = file_open_with_proc_and_display (gimp, gimp_get_user_context (gimp), + GIMP_PROGRESS (open_dialog), uri, entered_filename, load_proc, diff --git a/app/gui/file-open-location-dialog.c b/app/gui/file-open-location-dialog.c index 55156b1957..783bab89c1 100644 --- a/app/gui/file-open-location-dialog.c +++ b/app/gui/file-open-location-dialog.c @@ -157,9 +157,12 @@ file_open_location_response (GtkWidget *dialog, { uri = file_utils_filename_to_uri (gimp->load_procs, text, NULL); } - +#ifdef __GNUC__ +#warning FIXME: add progress bar to open location dialog +#endif image = file_open_with_proc_and_display (gimp, gimp_get_user_context (gimp), + NULL, uri, text, NULL, &status, &error); diff --git a/app/gui/file-save-dialog.c b/app/gui/file-save-dialog.c index 5d11bc263b..c62acd22e8 100644 --- a/app/gui/file-save-dialog.c +++ b/app/gui/file-save-dialog.c @@ -29,6 +29,7 @@ #include "core/gimp.h" #include "core/gimpimage.h" +#include "core/gimpprogress.h" #include "file/file-save.h" #include "file/file-utils.h" @@ -300,6 +301,7 @@ file_save_dialog_save_image (GtkWidget *save_dialog, status = file_save_as (gimage, gimp_get_user_context (gimage->gimp), + GIMP_PROGRESS (save_dialog), uri, raw_filename, save_proc, diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c index 237e9a66ab..dba053fb8c 100644 --- a/app/gui/gui-vtable.c +++ b/app/gui/gui-vtable.c @@ -37,6 +37,7 @@ #include "core/gimpimage.h" #include "core/gimppalette.h" #include "core/gimppattern.h" +#include "core/gimpprogress.h" #include "text/gimpfont.h" @@ -54,13 +55,13 @@ #include "widgets/gimpmenufactory.h" #include "widgets/gimppaletteselect.h" #include "widgets/gimppatternselect.h" +#include "widgets/gimpprogressdialog.h" #include "widgets/gimpuimanager.h" #include "widgets/gimpwidgets-utils.h" #include "display/gimpdisplay.h" #include "display/gimpdisplay-foreach.h" #include "display/gimpdisplayshell.h" -#include "display/gimpprogress.h" #include "actions/plug-in-actions.h" @@ -106,20 +107,8 @@ static void gui_menus_create_entry (Gimp *gimp, PlugInProcDef *proc_def); static void gui_menus_delete_entry (Gimp *gimp, PlugInProcDef *proc_def); -static GimpProgress * gui_start_progress (Gimp *gimp, - gint gdisp_ID, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data); -static GimpProgress * gui_restart_progress (Gimp *gimp, - GimpProgress *progress, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data); -static void gui_update_progress (Gimp *gimp, - GimpProgress *progress, - gdouble percentage); -static void gui_end_progress (Gimp *gimp, +static GimpProgress * gui_new_progress (Gimp *gimp); +static void gui_free_progress (Gimp *gimp, GimpProgress *progress); static gboolean gui_pdb_dialog_new (Gimp *gimp, GimpContext *context, @@ -163,10 +152,8 @@ gui_vtable_init (Gimp *gimp) gimp->gui.menus_init = gui_menus_init; gimp->gui.menus_create = gui_menus_create_entry; gimp->gui.menus_delete = gui_menus_delete_entry; - gimp->gui.progress_start = gui_start_progress; - gimp->gui.progress_restart = gui_restart_progress; - gimp->gui.progress_update = gui_update_progress; - gimp->gui.progress_end = gui_end_progress; + gimp->gui.progress_new = gui_new_progress; + gimp->gui.progress_free = gui_free_progress; gimp->gui.pdb_dialog_new = gui_pdb_dialog_new; gimp->gui.pdb_dialog_set = gui_pdb_dialog_set; gimp->gui.pdb_dialog_close = gui_pdb_dialog_close; @@ -410,43 +397,18 @@ gui_menus_delete_entry (Gimp *gimp, } static GimpProgress * -gui_start_progress (Gimp *gimp, - gint gdisp_ID, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data) +gui_new_progress (Gimp *gimp) { - GimpDisplay *gdisp = NULL; - - if (gdisp_ID > 0) - gdisp = gimp_display_get_by_ID (gimp, gdisp_ID); - - return gimp_progress_start (gdisp, message, TRUE, cancel_cb, cancel_data); -} - -static GimpProgress * -gui_restart_progress (Gimp *gimp, - GimpProgress *progress, - const gchar *message, - GCallback cancel_cb, - gpointer cancel_data) -{ - return gimp_progress_restart (progress, message, cancel_cb, cancel_data); + return GIMP_PROGRESS (gimp_progress_dialog_new ()); } static void -gui_update_progress (Gimp *gimp, - GimpProgress *progress, - gdouble percentage) +gui_free_progress (Gimp *gimp, + GimpProgress *progress) { - gimp_progress_update (progress, percentage); -} + g_return_if_fail (GIMP_IS_PROGRESS_DIALOG (progress)); -static void -gui_end_progress (Gimp *gimp, - GimpProgress *progress) -{ - gimp_progress_end (progress); + gtk_widget_destroy (GTK_WIDGET (progress)); } static gboolean diff --git a/app/pdb/brush_select_cmds.c b/app/pdb/brush_select_cmds.c index aca0615885..18ec77eaab 100644 --- a/app/pdb/brush_select_cmds.c +++ b/app/pdb/brush_select_cmds.c @@ -42,9 +42,10 @@ register_brush_select_procs (Gimp *gimp) } static Argument * -brushes_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *brush_callback; @@ -145,9 +146,10 @@ static ProcRecord brushes_popup_proc = }; static Argument * -brushes_close_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_close_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *brush_callback; @@ -194,9 +196,10 @@ static ProcRecord brushes_close_popup_proc = }; static Argument * -brushes_set_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_set_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *brush_callback; diff --git a/app/pdb/brushes_cmds.c b/app/pdb/brushes_cmds.c index 61f7d460b4..dba93e63c2 100644 --- a/app/pdb/brushes_cmds.c +++ b/app/pdb/brushes_cmds.c @@ -64,9 +64,10 @@ register_brushes_procs (Gimp *gimp) } static Argument * -brushes_refresh_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_refresh_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_data_factory_data_save (gimp->brush_factory); gimp_data_factory_data_init (gimp->brush_factory, FALSE); @@ -90,9 +91,10 @@ static ProcRecord brushes_refresh_proc = }; static Argument * -brushes_get_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_get_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -158,9 +160,10 @@ static ProcRecord brushes_get_list_proc = }; static Argument * -brushes_get_brush_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_get_brush_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -222,9 +225,10 @@ static ProcRecord brushes_get_brush_proc = }; static Argument * -brushes_set_brush_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_set_brush_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -274,9 +278,10 @@ static ProcRecord brushes_set_brush_proc = }; static Argument * -brushes_get_opacity_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_get_opacity_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; @@ -312,9 +317,10 @@ static ProcRecord brushes_get_opacity_proc = }; static Argument * -brushes_set_opacity_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_set_opacity_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gdouble opacity; @@ -355,9 +361,10 @@ static ProcRecord brushes_set_opacity_proc = }; static Argument * -brushes_get_spacing_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_get_spacing_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; @@ -393,9 +400,10 @@ static ProcRecord brushes_get_spacing_proc = }; static Argument * -brushes_set_spacing_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_set_spacing_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gint32 spacing; @@ -436,9 +444,10 @@ static ProcRecord brushes_set_spacing_proc = }; static Argument * -brushes_get_paint_mode_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_get_paint_mode_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; @@ -474,9 +483,10 @@ static ProcRecord brushes_get_paint_mode_proc = }; static Argument * -brushes_set_paint_mode_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_set_paint_mode_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gint32 paint_mode; @@ -517,9 +527,10 @@ static ProcRecord brushes_set_paint_mode_proc = }; static Argument * -brushes_get_brush_data_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brushes_get_brush_data_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/channel_cmds.c b/app/pdb/channel_cmds.c index bf6abecdc1..724d571262 100644 --- a/app/pdb/channel_cmds.c +++ b/app/pdb/channel_cmds.c @@ -57,9 +57,10 @@ register_channel_procs (Gimp *gimp) } static Argument * -channel_new_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_new_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -170,9 +171,10 @@ static ProcRecord channel_new_proc = }; static Argument * -channel_copy_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_copy_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -233,9 +235,10 @@ static ProcRecord channel_copy_proc = }; static Argument * -channel_combine_masks_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_combine_masks_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpChannel *channel1; @@ -314,9 +317,10 @@ static ProcRecord channel_combine_masks_proc = }; static Argument * -channel_get_show_masked_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_get_show_masked_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -369,9 +373,10 @@ static ProcRecord channel_get_show_masked_proc = }; static Argument * -channel_set_show_masked_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_set_show_masked_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpChannel *channel; @@ -420,9 +425,10 @@ static ProcRecord channel_set_show_masked_proc = }; static Argument * -channel_get_opacity_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_get_opacity_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -475,9 +481,10 @@ static ProcRecord channel_get_opacity_proc = }; static Argument * -channel_set_opacity_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_set_opacity_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpChannel *channel; @@ -528,9 +535,10 @@ static ProcRecord channel_set_opacity_proc = }; static Argument * -channel_get_color_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_get_color_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -587,9 +595,10 @@ static ProcRecord channel_get_color_proc = }; static Argument * -channel_set_color_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +channel_set_color_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpChannel *channel; diff --git a/app/pdb/color_cmds.c b/app/pdb/color_cmds.c index d350110e49..34cb4189e2 100644 --- a/app/pdb/color_cmds.c +++ b/app/pdb/color_cmds.c @@ -79,9 +79,10 @@ register_color_procs (Gimp *gimp) } static Argument * -brightness_contrast_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +brightness_contrast_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -174,9 +175,10 @@ static ProcRecord brightness_contrast_proc = }; static Argument * -levels_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +levels_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -327,9 +329,10 @@ static ProcRecord levels_proc = }; static Argument * -levels_auto_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +levels_auto_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -416,9 +419,10 @@ static ProcRecord levels_auto_proc = }; static Argument * -posterize_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +posterize_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -499,9 +503,10 @@ static ProcRecord posterize_proc = }; static Argument * -desaturate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +desaturate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -547,9 +552,10 @@ static ProcRecord desaturate_proc = }; static Argument * -equalize_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +equalize_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -603,9 +609,10 @@ static ProcRecord equalize_proc = }; static Argument * -invert_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +invert_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -651,9 +658,10 @@ static ProcRecord invert_proc = }; static Argument * -curves_spline_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +curves_spline_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -774,9 +782,10 @@ static ProcRecord curves_spline_proc = }; static Argument * -curves_explicit_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +curves_explicit_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -892,9 +901,10 @@ static ProcRecord curves_explicit_proc = }; static Argument * -color_balance_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +color_balance_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1021,9 +1031,10 @@ static ProcRecord color_balance_proc = }; static Argument * -histogram_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +histogram_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1176,9 +1187,10 @@ static ProcRecord histogram_proc = }; static Argument * -hue_saturation_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +hue_saturation_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1296,9 +1308,10 @@ static ProcRecord hue_saturation_proc = }; static Argument * -threshold_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +threshold_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; diff --git a/app/pdb/convert_cmds.c b/app/pdb/convert_cmds.c index 4e920ed136..f280956df3 100644 --- a/app/pdb/convert_cmds.c +++ b/app/pdb/convert_cmds.c @@ -46,9 +46,10 @@ register_convert_procs (Gimp *gimp) } static Argument * -image_convert_rgb_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_convert_rgb_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -60,7 +61,7 @@ image_convert_rgb_invoker (Gimp *gimp, if (success) { if (gimp_image_base_type (gimage) != GIMP_RGB) - gimp_image_convert (gimage, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL, NULL, NULL); + gimp_image_convert (gimage, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL, NULL); else success = FALSE; } @@ -94,9 +95,10 @@ static ProcRecord image_convert_rgb_proc = }; static Argument * -image_convert_grayscale_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_convert_grayscale_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -108,7 +110,7 @@ image_convert_grayscale_invoker (Gimp *gimp, if (success) { if (gimp_image_base_type (gimage) != GIMP_GRAY) - gimp_image_convert (gimage, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL, NULL, NULL); + gimp_image_convert (gimage, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL, NULL); else success = FALSE; } @@ -142,9 +144,10 @@ static ProcRecord image_convert_grayscale_proc = }; static Argument * -image_convert_indexed_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_convert_indexed_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -214,7 +217,8 @@ image_convert_indexed_invoker (Gimp *gimp, if (success) gimp_image_convert (gimage, GIMP_INDEXED, num_cols, dither_type, - alpha_dither, remove_unused, palette_type, palette, NULL, NULL); + alpha_dither, remove_unused, palette_type, palette, + NULL); } return procedural_db_return_args (&image_convert_indexed_proc, success); diff --git a/app/pdb/display_cmds.c b/app/pdb/display_cmds.c index 26b206972b..9706073fec 100644 --- a/app/pdb/display_cmds.c +++ b/app/pdb/display_cmds.c @@ -45,9 +45,10 @@ register_display_procs (Gimp *gimp) } static Argument * -display_new_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +display_new_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -112,9 +113,10 @@ static ProcRecord display_new_proc = }; static Argument * -display_delete_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +display_delete_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpObject *display; @@ -155,9 +157,10 @@ static ProcRecord display_delete_proc = }; static Argument * -displays_flush_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +displays_flush_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_container_foreach (gimp->images, (GFunc) gimp_image_flush, NULL); return procedural_db_return_args (&displays_flush_proc, TRUE); @@ -180,9 +183,10 @@ static ProcRecord displays_flush_proc = }; static Argument * -displays_reconnect_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +displays_reconnect_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *old_image; diff --git a/app/pdb/drawable_cmds.c b/app/pdb/drawable_cmds.c index aae6a94890..2e00704a75 100644 --- a/app/pdb/drawable_cmds.c +++ b/app/pdb/drawable_cmds.c @@ -110,9 +110,10 @@ register_drawable_procs (Gimp *gimp) } static Argument * -drawable_delete_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_delete_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -158,9 +159,10 @@ static ProcRecord drawable_delete_proc = }; static Argument * -drawable_is_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_is_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -213,9 +215,10 @@ static ProcRecord drawable_is_layer_proc = }; static Argument * -drawable_is_layer_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_is_layer_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -268,9 +271,10 @@ static ProcRecord drawable_is_layer_mask_proc = }; static Argument * -drawable_is_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_is_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -323,9 +327,10 @@ static ProcRecord drawable_is_channel_proc = }; static Argument * -drawable_type_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_type_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -378,9 +383,10 @@ static ProcRecord drawable_type_proc = }; static Argument * -drawable_type_with_alpha_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_type_with_alpha_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -433,9 +439,10 @@ static ProcRecord drawable_type_with_alpha_proc = }; static Argument * -drawable_has_alpha_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_has_alpha_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -488,9 +495,10 @@ static ProcRecord drawable_has_alpha_proc = }; static Argument * -drawable_is_rgb_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_is_rgb_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -543,9 +551,10 @@ static ProcRecord drawable_is_rgb_proc = }; static Argument * -drawable_is_gray_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_is_gray_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -598,9 +607,10 @@ static ProcRecord drawable_is_gray_proc = }; static Argument * -drawable_is_indexed_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_is_indexed_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -653,9 +663,10 @@ static ProcRecord drawable_is_indexed_proc = }; static Argument * -drawable_bpp_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_bpp_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -708,9 +719,10 @@ static ProcRecord drawable_bpp_proc = }; static Argument * -drawable_width_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_width_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -763,9 +775,10 @@ static ProcRecord drawable_width_proc = }; static Argument * -drawable_height_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_height_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -818,9 +831,10 @@ static ProcRecord drawable_height_proc = }; static Argument * -drawable_offsets_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_offsets_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -886,9 +900,10 @@ static ProcRecord drawable_offsets_proc = }; static Argument * -drawable_get_image_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_get_image_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -945,9 +960,10 @@ static ProcRecord drawable_get_image_proc = }; static Argument * -drawable_set_image_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_set_image_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -998,9 +1014,10 @@ static ProcRecord drawable_set_image_proc = }; static Argument * -drawable_get_name_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_get_name_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1053,9 +1070,10 @@ static ProcRecord drawable_get_name_proc = }; static Argument * -drawable_set_name_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_set_name_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1106,9 +1124,10 @@ static ProcRecord drawable_set_name_proc = }; static Argument * -drawable_get_visible_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_get_visible_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1161,9 +1180,10 @@ static ProcRecord drawable_get_visible_proc = }; static Argument * -drawable_set_visible_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_set_visible_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1212,9 +1232,10 @@ static ProcRecord drawable_set_visible_proc = }; static Argument * -drawable_get_linked_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_get_linked_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1267,9 +1288,10 @@ static ProcRecord drawable_get_linked_proc = }; static Argument * -drawable_set_linked_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_set_linked_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1318,9 +1340,10 @@ static ProcRecord drawable_set_linked_proc = }; static Argument * -drawable_get_tattoo_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_get_tattoo_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1373,9 +1396,10 @@ static ProcRecord drawable_get_tattoo_proc = }; static Argument * -drawable_set_tattoo_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_set_tattoo_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1426,9 +1450,10 @@ static ProcRecord drawable_set_tattoo_proc = }; static Argument * -drawable_mask_bounds_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_mask_bounds_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1515,9 +1540,10 @@ static ProcRecord drawable_mask_bounds_proc = }; static Argument * -drawable_merge_shadow_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_merge_shadow_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1577,9 +1603,10 @@ static ProcRecord drawable_merge_shadow_proc = }; static Argument * -drawable_update_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_update_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1652,9 +1679,10 @@ static ProcRecord drawable_update_proc = }; static Argument * -drawable_get_pixel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_get_pixel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1764,9 +1792,10 @@ static ProcRecord drawable_get_pixel_proc = }; static Argument * -drawable_set_pixel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_set_pixel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1865,9 +1894,10 @@ static ProcRecord drawable_set_pixel_proc = }; static Argument * -drawable_fill_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_fill_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1918,9 +1948,10 @@ static ProcRecord drawable_fill_proc = }; static Argument * -drawable_offset_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_offset_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1998,9 +2029,10 @@ static ProcRecord drawable_offset_proc = }; static Argument * -drawable_thumbnail_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_thumbnail_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/edit_cmds.c b/app/pdb/edit_cmds.c index dbbf7fc646..d7e39f40de 100644 --- a/app/pdb/edit_cmds.c +++ b/app/pdb/edit_cmds.c @@ -60,9 +60,10 @@ register_edit_procs (Gimp *gimp) } static Argument * -edit_cut_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_cut_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -123,9 +124,10 @@ static ProcRecord edit_cut_proc = }; static Argument * -edit_copy_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_copy_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -186,9 +188,10 @@ static ProcRecord edit_copy_proc = }; static Argument * -edit_paste_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_paste_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -265,9 +268,10 @@ static ProcRecord edit_paste_proc = }; static Argument * -edit_clear_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_clear_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -312,9 +316,10 @@ static ProcRecord edit_clear_proc = }; static Argument * -edit_fill_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_fill_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -369,9 +374,10 @@ static ProcRecord edit_fill_proc = }; static Argument * -edit_bucket_fill_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_bucket_fill_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -495,9 +501,10 @@ static ProcRecord edit_bucket_fill_proc = }; static Argument * -edit_blend_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_blend_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -585,7 +592,7 @@ edit_blend_invoker (Gimp *gimp, supersample, max_depth, threshold, dither, x1, y1, x2, y2, - NULL, NULL); + NULL); } } @@ -693,9 +700,10 @@ static ProcRecord edit_blend_proc = }; static Argument * -edit_stroke_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +edit_stroke_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; diff --git a/app/pdb/fileops_cmds.c b/app/pdb/fileops_cmds.c index 22e81e7c48..444fe76f8a 100644 --- a/app/pdb/fileops_cmds.c +++ b/app/pdb/fileops_cmds.c @@ -79,9 +79,10 @@ register_fileops_procs (Gimp *gimp) } static Argument * -file_load_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +file_load_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *new_args; Argument *return_vals; @@ -114,7 +115,7 @@ file_load_invoker (Gimp *gimp, new_args[i].value.pdb_pointer = g_strdup (""); } - return_vals = procedural_db_execute (gimp, context, proc->name, new_args); + return_vals = procedural_db_execute (gimp, context, progress, proc->name, new_args); g_free (new_args); return return_vals; @@ -165,9 +166,10 @@ static ProcRecord file_load_proc = }; static Argument * -file_save_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +file_save_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *new_args; Argument *return_vals; @@ -200,7 +202,7 @@ file_save_invoker (Gimp *gimp, new_args[i].value.pdb_pointer = g_strdup (""); } - return_vals = procedural_db_execute (gimp, context, proc->name, new_args); + return_vals = procedural_db_execute (gimp, context, progress, proc->name, new_args); g_free (new_args); return return_vals; @@ -252,9 +254,10 @@ static ProcRecord file_save_proc = }; static Argument * -file_load_thumbnail_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +file_load_thumbnail_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -383,9 +386,10 @@ static ProcRecord file_load_thumbnail_proc = }; static Argument * -file_save_thumbnail_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +file_save_thumbnail_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -465,9 +469,10 @@ static ProcRecord file_save_thumbnail_proc = }; static Argument * -temp_name_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +temp_name_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -542,9 +547,10 @@ static ProcRecord temp_name_proc = }; static Argument * -register_magic_load_handler_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +register_magic_load_handler_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -644,9 +650,10 @@ static ProcRecord register_magic_load_handler_proc = }; static Argument * -register_load_handler_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +register_load_handler_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { int i; Argument argv[4]; @@ -657,7 +664,7 @@ register_load_handler_invoker (Gimp *gimp, argv[3].arg_type = GIMP_PDB_STRING; argv[3].value.pdb_pointer = NULL; - return register_magic_load_handler_invoker (gimp, context, argv); + return register_magic_load_handler_invoker (gimp, context, progress, argv); } static ProcArg register_load_handler_inargs[] = @@ -696,9 +703,10 @@ static ProcRecord register_load_handler_proc = }; static Argument * -register_save_handler_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +register_save_handler_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -790,9 +798,10 @@ static ProcRecord register_save_handler_proc = }; static Argument * -register_file_handler_mime_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +register_file_handler_mime_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; diff --git a/app/pdb/floating_sel_cmds.c b/app/pdb/floating_sel_cmds.c index 7eeb688d57..48a1333fe1 100644 --- a/app/pdb/floating_sel_cmds.c +++ b/app/pdb/floating_sel_cmds.c @@ -49,9 +49,10 @@ register_floating_sel_procs (Gimp *gimp) } static Argument * -floating_sel_remove_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +floating_sel_remove_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *floating_sel; @@ -97,9 +98,10 @@ static ProcRecord floating_sel_remove_proc = }; static Argument * -floating_sel_anchor_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +floating_sel_anchor_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *floating_sel; @@ -145,9 +147,10 @@ static ProcRecord floating_sel_anchor_proc = }; static Argument * -floating_sel_to_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +floating_sel_to_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *floating_sel; @@ -193,9 +196,10 @@ static ProcRecord floating_sel_to_layer_proc = }; static Argument * -floating_sel_attach_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +floating_sel_attach_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -251,9 +255,10 @@ static ProcRecord floating_sel_attach_proc = }; static Argument * -floating_sel_rigor_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +floating_sel_rigor_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *floating_sel; @@ -307,9 +312,10 @@ static ProcRecord floating_sel_rigor_proc = }; static Argument * -floating_sel_relax_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +floating_sel_relax_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *floating_sel; diff --git a/app/pdb/font_select_cmds.c b/app/pdb/font_select_cmds.c index 395052c97c..1b0703c63e 100644 --- a/app/pdb/font_select_cmds.c +++ b/app/pdb/font_select_cmds.c @@ -41,9 +41,10 @@ register_font_select_procs (Gimp *gimp) } static Argument * -fonts_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +fonts_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *font_callback; @@ -111,9 +112,10 @@ static ProcRecord fonts_popup_proc = }; static Argument * -fonts_close_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +fonts_close_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *font_callback; @@ -159,9 +161,10 @@ static ProcRecord fonts_close_popup_proc = }; static Argument * -fonts_set_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +fonts_set_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *font_callback; diff --git a/app/pdb/fonts_cmds.c b/app/pdb/fonts_cmds.c index 505c30b8c5..bfd070f3e9 100644 --- a/app/pdb/fonts_cmds.c +++ b/app/pdb/fonts_cmds.c @@ -42,9 +42,10 @@ register_fonts_procs (Gimp *gimp) } static Argument * -fonts_refresh_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +fonts_refresh_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_fonts_load (gimp); return procedural_db_return_args (&fonts_refresh_proc, TRUE); @@ -67,9 +68,10 @@ static ProcRecord fonts_refresh_proc = }; static Argument * -fonts_get_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +fonts_get_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/gimp-pdb.c b/app/pdb/gimp-pdb.c index 8b18cf3a8b..8c23571453 100644 --- a/app/pdb/gimp-pdb.c +++ b/app/pdb/gimp-pdb.c @@ -30,6 +30,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpprogress.h" #include "plug-in/plug-in-run.h" @@ -214,16 +215,18 @@ procedural_db_lookup (Gimp *gimp, } Argument * -procedural_db_execute (Gimp *gimp, - GimpContext *context, - const gchar *name, - Argument *args) +procedural_db_execute (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + Argument *args) { Argument *return_args = NULL; GList *list; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); list = g_hash_table_lookup (gimp->procedural_ht, name); @@ -288,13 +291,14 @@ procedural_db_execute (Gimp *gimp, case GIMP_INTERNAL: return_args = (* procedure->exec_method.internal.marshal_func) (gimp, context, + progress, args); break; case GIMP_PLUGIN: case GIMP_EXTENSION: case GIMP_TEMPORARY: - return_args = plug_in_run (gimp, context, procedure, + return_args = plug_in_run (gimp, context, progress, procedure, args, procedure->num_args, TRUE, FALSE, -1); break; @@ -336,10 +340,11 @@ procedural_db_execute (Gimp *gimp, } Argument * -procedural_db_run_proc (Gimp *gimp, - GimpContext *context, - const gchar *name, - gint *nreturn_vals, +procedural_db_run_proc (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + gint *nreturn_vals, ...) { ProcRecord *proc; @@ -350,6 +355,7 @@ procedural_db_run_proc (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (nreturn_vals != NULL, NULL); @@ -441,7 +447,7 @@ procedural_db_run_proc (Gimp *gimp, *nreturn_vals = proc->num_values; - return_vals = procedural_db_execute (gimp, context, name, params); + return_vals = procedural_db_execute (gimp, context, progress, name, params); g_free (params); diff --git a/app/pdb/gimp-pdb.h b/app/pdb/gimp-pdb.h index 9db961a5f8..7ef3f81c88 100644 --- a/app/pdb/gimp-pdb.h +++ b/app/pdb/gimp-pdb.h @@ -35,9 +35,10 @@ struct _Argument /* Argument marshalling procedures */ -typedef Argument * (* ArgMarshal) (Gimp *gimp, - GimpContext *context, - Argument *args); +typedef Argument * (* ArgMarshal) (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args); /* Execution types */ @@ -136,10 +137,12 @@ ProcRecord * procedural_db_lookup (Gimp *gimp, Argument * procedural_db_execute (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, Argument *args); Argument * procedural_db_run_proc (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, gint *nreturn_vals, ...); diff --git a/app/pdb/gimppdb.c b/app/pdb/gimppdb.c index 8b18cf3a8b..8c23571453 100644 --- a/app/pdb/gimppdb.c +++ b/app/pdb/gimppdb.c @@ -30,6 +30,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpprogress.h" #include "plug-in/plug-in-run.h" @@ -214,16 +215,18 @@ procedural_db_lookup (Gimp *gimp, } Argument * -procedural_db_execute (Gimp *gimp, - GimpContext *context, - const gchar *name, - Argument *args) +procedural_db_execute (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + Argument *args) { Argument *return_args = NULL; GList *list; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); list = g_hash_table_lookup (gimp->procedural_ht, name); @@ -288,13 +291,14 @@ procedural_db_execute (Gimp *gimp, case GIMP_INTERNAL: return_args = (* procedure->exec_method.internal.marshal_func) (gimp, context, + progress, args); break; case GIMP_PLUGIN: case GIMP_EXTENSION: case GIMP_TEMPORARY: - return_args = plug_in_run (gimp, context, procedure, + return_args = plug_in_run (gimp, context, progress, procedure, args, procedure->num_args, TRUE, FALSE, -1); break; @@ -336,10 +340,11 @@ procedural_db_execute (Gimp *gimp, } Argument * -procedural_db_run_proc (Gimp *gimp, - GimpContext *context, - const gchar *name, - gint *nreturn_vals, +procedural_db_run_proc (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + gint *nreturn_vals, ...) { ProcRecord *proc; @@ -350,6 +355,7 @@ procedural_db_run_proc (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (nreturn_vals != NULL, NULL); @@ -441,7 +447,7 @@ procedural_db_run_proc (Gimp *gimp, *nreturn_vals = proc->num_values; - return_vals = procedural_db_execute (gimp, context, name, params); + return_vals = procedural_db_execute (gimp, context, progress, name, params); g_free (params); diff --git a/app/pdb/gimppdb.h b/app/pdb/gimppdb.h index 9db961a5f8..7ef3f81c88 100644 --- a/app/pdb/gimppdb.h +++ b/app/pdb/gimppdb.h @@ -35,9 +35,10 @@ struct _Argument /* Argument marshalling procedures */ -typedef Argument * (* ArgMarshal) (Gimp *gimp, - GimpContext *context, - Argument *args); +typedef Argument * (* ArgMarshal) (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args); /* Execution types */ @@ -136,10 +137,12 @@ ProcRecord * procedural_db_lookup (Gimp *gimp, Argument * procedural_db_execute (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, Argument *args); Argument * procedural_db_run_proc (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, gint *nreturn_vals, ...); diff --git a/app/pdb/gimpprocedure.c b/app/pdb/gimpprocedure.c index 8b18cf3a8b..8c23571453 100644 --- a/app/pdb/gimpprocedure.c +++ b/app/pdb/gimpprocedure.c @@ -30,6 +30,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpprogress.h" #include "plug-in/plug-in-run.h" @@ -214,16 +215,18 @@ procedural_db_lookup (Gimp *gimp, } Argument * -procedural_db_execute (Gimp *gimp, - GimpContext *context, - const gchar *name, - Argument *args) +procedural_db_execute (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + Argument *args) { Argument *return_args = NULL; GList *list; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); list = g_hash_table_lookup (gimp->procedural_ht, name); @@ -288,13 +291,14 @@ procedural_db_execute (Gimp *gimp, case GIMP_INTERNAL: return_args = (* procedure->exec_method.internal.marshal_func) (gimp, context, + progress, args); break; case GIMP_PLUGIN: case GIMP_EXTENSION: case GIMP_TEMPORARY: - return_args = plug_in_run (gimp, context, procedure, + return_args = plug_in_run (gimp, context, progress, procedure, args, procedure->num_args, TRUE, FALSE, -1); break; @@ -336,10 +340,11 @@ procedural_db_execute (Gimp *gimp, } Argument * -procedural_db_run_proc (Gimp *gimp, - GimpContext *context, - const gchar *name, - gint *nreturn_vals, +procedural_db_run_proc (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + gint *nreturn_vals, ...) { ProcRecord *proc; @@ -350,6 +355,7 @@ procedural_db_run_proc (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (nreturn_vals != NULL, NULL); @@ -441,7 +447,7 @@ procedural_db_run_proc (Gimp *gimp, *nreturn_vals = proc->num_values; - return_vals = procedural_db_execute (gimp, context, name, params); + return_vals = procedural_db_execute (gimp, context, progress, name, params); g_free (params); diff --git a/app/pdb/gimpprocedure.h b/app/pdb/gimpprocedure.h index 9db961a5f8..7ef3f81c88 100644 --- a/app/pdb/gimpprocedure.h +++ b/app/pdb/gimpprocedure.h @@ -35,9 +35,10 @@ struct _Argument /* Argument marshalling procedures */ -typedef Argument * (* ArgMarshal) (Gimp *gimp, - GimpContext *context, - Argument *args); +typedef Argument * (* ArgMarshal) (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args); /* Execution types */ @@ -136,10 +137,12 @@ ProcRecord * procedural_db_lookup (Gimp *gimp, Argument * procedural_db_execute (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, Argument *args); Argument * procedural_db_run_proc (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, gint *nreturn_vals, ...); diff --git a/app/pdb/gimprc_cmds.c b/app/pdb/gimprc_cmds.c index 4f60e74a64..9ad63c0ecd 100644 --- a/app/pdb/gimprc_cmds.c +++ b/app/pdb/gimprc_cmds.c @@ -54,9 +54,10 @@ register_gimprc_procs (Gimp *gimp) } static Argument * -gimprc_query_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gimprc_query_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -119,9 +120,10 @@ static ProcRecord gimprc_query_proc = }; static Argument * -gimprc_set_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gimprc_set_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *token; @@ -175,9 +177,10 @@ static ProcRecord gimprc_set_proc = }; static Argument * -get_default_comment_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +get_default_comment_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gchar *comment; @@ -216,9 +219,10 @@ static ProcRecord get_default_comment_proc = }; static Argument * -get_monitor_resolution_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +get_monitor_resolution_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gdouble xres; @@ -266,9 +270,10 @@ static ProcRecord get_monitor_resolution_proc = }; static Argument * -get_theme_dir_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +get_theme_dir_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gchar *theme_dir; @@ -307,9 +312,10 @@ static ProcRecord get_theme_dir_proc = }; static Argument * -get_module_load_inhibit_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +get_module_load_inhibit_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gchar *load_inhibit; diff --git a/app/pdb/gradient_edit_cmds.c b/app/pdb/gradient_edit_cmds.c index 8a482cb65c..b064050aec 100644 --- a/app/pdb/gradient_edit_cmds.c +++ b/app/pdb/gradient_edit_cmds.c @@ -89,9 +89,10 @@ register_gradient_edit_procs (Gimp *gimp) } static Argument * -gradient_segment_get_left_color_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_get_left_color_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -196,9 +197,10 @@ static ProcRecord gradient_segment_get_left_color_proc = }; static Argument * -gradient_segment_set_left_color_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_set_left_color_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -296,9 +298,10 @@ static ProcRecord gradient_segment_set_left_color_proc = }; static Argument * -gradient_segment_get_right_color_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_get_right_color_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -403,9 +406,10 @@ static ProcRecord gradient_segment_get_right_color_proc = }; static Argument * -gradient_segment_set_right_color_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_set_right_color_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -503,9 +507,10 @@ static ProcRecord gradient_segment_set_right_color_proc = }; static Argument * -gradient_segment_get_left_pos_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_get_left_pos_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -600,9 +605,10 @@ static ProcRecord gradient_segment_get_left_pos_proc = }; static Argument * -gradient_segment_set_left_pos_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_set_left_pos_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -708,9 +714,10 @@ static ProcRecord gradient_segment_set_left_pos_proc = }; static Argument * -gradient_segment_get_middle_pos_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_get_middle_pos_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -805,9 +812,10 @@ static ProcRecord gradient_segment_get_middle_pos_proc = }; static Argument * -gradient_segment_set_middle_pos_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_set_middle_pos_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -913,9 +921,10 @@ static ProcRecord gradient_segment_set_middle_pos_proc = }; static Argument * -gradient_segment_get_right_pos_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_get_right_pos_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1010,9 +1019,10 @@ static ProcRecord gradient_segment_get_right_pos_proc = }; static Argument * -gradient_segment_set_right_pos_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_set_right_pos_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1118,9 +1128,10 @@ static ProcRecord gradient_segment_set_right_pos_proc = }; static Argument * -gradient_segment_get_blending_function_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_get_blending_function_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1216,9 +1227,10 @@ static ProcRecord gradient_segment_get_blending_function_proc = }; static Argument * -gradient_segment_get_coloring_type_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_get_coloring_type_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1314,9 +1326,10 @@ static ProcRecord gradient_segment_get_coloring_type_proc = }; static Argument * -gradient_segment_range_set_blending_function_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_set_blending_function_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -1435,9 +1448,10 @@ static ProcRecord gradient_segment_range_set_blending_function_proc = }; static Argument * -gradient_segment_range_set_coloring_type_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_set_coloring_type_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -1556,9 +1570,10 @@ static ProcRecord gradient_segment_range_set_coloring_type_proc = }; static Argument * -gradient_segment_range_flip_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_flip_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -1667,9 +1682,10 @@ static ProcRecord gradient_segment_range_flip_proc = }; static Argument * -gradient_segment_range_replicate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_replicate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -1789,9 +1805,10 @@ static ProcRecord gradient_segment_range_replicate_proc = }; static Argument * -gradient_segment_range_split_midpoint_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_split_midpoint_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -1900,9 +1917,10 @@ static ProcRecord gradient_segment_range_split_midpoint_proc = }; static Argument * -gradient_segment_range_split_uniform_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_split_uniform_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -2022,9 +2040,10 @@ static ProcRecord gradient_segment_range_split_uniform_proc = }; static Argument * -gradient_segment_range_delete_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_delete_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -2133,9 +2152,10 @@ static ProcRecord gradient_segment_range_delete_proc = }; static Argument * -gradient_segment_range_redistribute_handles_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_redistribute_handles_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -2243,9 +2263,10 @@ static ProcRecord gradient_segment_range_redistribute_handles_proc = }; static Argument * -gradient_segment_range_blend_colors_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_blend_colors_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -2355,9 +2376,10 @@ static ProcRecord gradient_segment_range_blend_colors_proc = }; static Argument * -gradient_segment_range_blend_opacity_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_blend_opacity_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -2467,9 +2489,10 @@ static ProcRecord gradient_segment_range_blend_opacity_proc = }; static Argument * -gradient_segment_range_move_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradient_segment_range_move_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/gradient_select_cmds.c b/app/pdb/gradient_select_cmds.c index f823e1cbbb..af1e7f96e4 100644 --- a/app/pdb/gradient_select_cmds.c +++ b/app/pdb/gradient_select_cmds.c @@ -43,9 +43,10 @@ register_gradient_select_procs (Gimp *gimp) } static Argument * -gradients_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *gradient_callback; @@ -124,9 +125,10 @@ static ProcRecord gradients_popup_proc = }; static Argument * -gradients_close_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_close_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *gradient_callback; @@ -173,9 +175,10 @@ static ProcRecord gradients_close_popup_proc = }; static Argument * -gradients_set_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_set_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *gradient_callback; diff --git a/app/pdb/gradients_cmds.c b/app/pdb/gradients_cmds.c index 56c0c7d2e1..567d491808 100644 --- a/app/pdb/gradients_cmds.c +++ b/app/pdb/gradients_cmds.c @@ -63,9 +63,10 @@ register_gradients_procs (Gimp *gimp) } static Argument * -gradients_refresh_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_refresh_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_data_factory_data_save (gimp->gradient_factory); gimp_data_factory_data_init (gimp->gradient_factory, FALSE); @@ -89,9 +90,10 @@ static ProcRecord gradients_refresh_proc = }; static Argument * -gradients_get_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_get_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -157,9 +159,10 @@ static ProcRecord gradients_get_list_proc = }; static Argument * -gradients_get_gradient_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_get_gradient_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -200,9 +203,10 @@ static ProcRecord gradients_get_gradient_proc = }; static Argument * -gradients_set_gradient_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_set_gradient_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -252,9 +256,10 @@ static ProcRecord gradients_set_gradient_proc = }; static Argument * -gradients_sample_uniform_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_sample_uniform_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -353,9 +358,10 @@ static ProcRecord gradients_sample_uniform_proc = }; static Argument * -gradients_sample_custom_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_sample_custom_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -458,9 +464,10 @@ static ProcRecord gradients_sample_custom_proc = }; static Argument * -gradients_get_gradient_data_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_get_gradient_data_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -589,9 +596,10 @@ static ProcRecord gradients_get_gradient_data_proc = }; static Argument * -gradients_new_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_new_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -651,9 +659,10 @@ static ProcRecord gradients_new_proc = }; static Argument * -gradients_duplicate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_duplicate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -735,9 +744,10 @@ static ProcRecord gradients_duplicate_proc = }; static Argument * -gradients_delete_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_delete_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -807,9 +817,10 @@ static ProcRecord gradients_delete_proc = }; static Argument * -gradients_rename_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +gradients_rename_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/guides_cmds.c b/app/pdb/guides_cmds.c index 59058e469c..478bdbcd57 100644 --- a/app/pdb/guides_cmds.c +++ b/app/pdb/guides_cmds.c @@ -49,9 +49,10 @@ register_guides_procs (Gimp *gimp) } static Argument * -image_add_hguide_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_add_hguide_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -127,9 +128,10 @@ static ProcRecord image_add_hguide_proc = }; static Argument * -image_add_vguide_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_add_vguide_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -205,9 +207,10 @@ static ProcRecord image_add_vguide_proc = }; static Argument * -image_delete_guide_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_delete_guide_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -271,9 +274,10 @@ static ProcRecord image_delete_guide_proc = }; static Argument * -image_find_next_guide_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_find_next_guide_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -376,9 +380,10 @@ static ProcRecord image_find_next_guide_proc = }; static Argument * -image_get_guide_orientation_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_guide_orientation_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -459,9 +464,10 @@ static ProcRecord image_get_guide_orientation_proc = }; static Argument * -image_get_guide_position_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_guide_position_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/help_cmds.c b/app/pdb/help_cmds.c index 4f547f80b6..65b1e7adcf 100644 --- a/app/pdb/help_cmds.c +++ b/app/pdb/help_cmds.c @@ -39,9 +39,10 @@ register_help_procs (Gimp *gimp) } static Argument * -help_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +help_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *help_domain; diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index d20f46513c..60497dba61 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -190,9 +190,10 @@ register_image_procs (Gimp *gimp) #endif static Argument * -image_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gint32 num_images = 0; @@ -249,9 +250,10 @@ static ProcRecord image_list_proc = }; static Argument * -image_new_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_new_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -331,9 +333,10 @@ static ProcRecord image_new_proc = }; static Argument * -image_duplicate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_duplicate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -390,9 +393,10 @@ static ProcRecord image_duplicate_proc = }; static Argument * -image_delete_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_delete_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -438,9 +442,10 @@ static ProcRecord image_delete_proc = }; static Argument * -image_base_type_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_base_type_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -497,9 +502,10 @@ static ProcRecord image_base_type_proc = }; static Argument * -image_width_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_width_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -552,9 +558,10 @@ static ProcRecord image_width_proc = }; static Argument * -image_height_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_height_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -607,9 +614,10 @@ static ProcRecord image_height_proc = }; static Argument * -image_free_shadow_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_free_shadow_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -650,9 +658,10 @@ static ProcRecord image_free_shadow_proc = }; static Argument * -image_resize_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_resize_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -680,7 +689,7 @@ image_resize_invoker (Gimp *gimp, if (success) { gimp_image_resize (gimage, context, - new_width, new_height, offx, offy, NULL, NULL); + new_width, new_height, offx, offy, NULL); } return procedural_db_return_args (&image_resize_proc, success); @@ -732,9 +741,10 @@ static ProcRecord image_resize_proc = }; static Argument * -image_scale_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_scale_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -757,7 +767,7 @@ image_scale_invoker (Gimp *gimp, { gimp_image_scale (gimage, new_width, new_height, gimp->config->interpolation_type, - NULL, NULL); + NULL); } return procedural_db_return_args (&image_scale_proc, success); @@ -799,9 +809,10 @@ static ProcRecord image_scale_proc = }; static Argument * -image_crop_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_crop_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -892,9 +903,10 @@ static ProcRecord image_crop_proc = }; static Argument * -image_flip_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_flip_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -910,7 +922,7 @@ image_flip_invoker (Gimp *gimp, if (success) { - gimp_image_flip (gimage, context, flip_type, NULL, NULL); + gimp_image_flip (gimage, context, flip_type, NULL); } return procedural_db_return_args (&image_flip_proc, success); @@ -947,9 +959,10 @@ static ProcRecord image_flip_proc = }; static Argument * -image_rotate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_rotate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -965,7 +978,7 @@ image_rotate_invoker (Gimp *gimp, if (success) { - gimp_image_rotate (gimage, context, rotate_type, NULL, NULL); + gimp_image_rotate (gimage, context, rotate_type, NULL); } return procedural_db_return_args (&image_rotate_proc, success); @@ -1002,9 +1015,10 @@ static ProcRecord image_rotate_proc = }; static Argument * -image_get_layers_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_layers_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1082,9 +1096,10 @@ static ProcRecord image_get_layers_proc = }; static Argument * -image_get_channels_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_channels_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1162,9 +1177,10 @@ static ProcRecord image_get_channels_proc = }; static Argument * -image_get_active_drawable_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_active_drawable_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1221,9 +1237,10 @@ static ProcRecord image_get_active_drawable_proc = }; static Argument * -image_unset_active_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_unset_active_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1264,9 +1281,10 @@ static ProcRecord image_unset_active_channel_proc = }; static Argument * -image_get_floating_sel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_floating_sel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1323,9 +1341,10 @@ static ProcRecord image_get_floating_sel_proc = }; static Argument * -image_floating_sel_attached_to_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_floating_sel_attached_to_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1390,9 +1409,10 @@ static ProcRecord image_floating_sel_attached_to_proc = }; static Argument * -image_pick_color_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_pick_color_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1514,9 +1534,10 @@ static ProcRecord image_pick_color_proc = }; static Argument * -image_pick_correlate_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_pick_correlate_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1589,9 +1610,10 @@ static ProcRecord image_pick_correlate_layer_proc = }; static Argument * -image_add_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_add_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1660,9 +1682,10 @@ static ProcRecord image_add_layer_proc = }; static Argument * -image_remove_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_remove_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1713,9 +1736,10 @@ static ProcRecord image_remove_layer_proc = }; static Argument * -image_raise_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_raise_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1766,9 +1790,10 @@ static ProcRecord image_raise_layer_proc = }; static Argument * -image_lower_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_lower_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1819,9 +1844,10 @@ static ProcRecord image_lower_layer_proc = }; static Argument * -image_raise_layer_to_top_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_raise_layer_to_top_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1872,9 +1898,10 @@ static ProcRecord image_raise_layer_to_top_proc = }; static Argument * -image_lower_layer_to_bottom_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_lower_layer_to_bottom_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1925,9 +1952,10 @@ static ProcRecord image_lower_layer_to_bottom_proc = }; static Argument * -image_add_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_add_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1986,9 +2014,10 @@ static ProcRecord image_add_channel_proc = }; static Argument * -image_remove_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_remove_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2039,9 +2068,10 @@ static ProcRecord image_remove_channel_proc = }; static Argument * -image_raise_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_raise_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2092,9 +2122,10 @@ static ProcRecord image_raise_channel_proc = }; static Argument * -image_lower_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_lower_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2145,9 +2176,10 @@ static ProcRecord image_lower_channel_proc = }; static Argument * -image_flatten_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_flatten_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -2204,9 +2236,10 @@ static ProcRecord image_flatten_proc = }; static Argument * -image_merge_visible_layers_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_merge_visible_layers_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -2276,9 +2309,10 @@ static ProcRecord image_merge_visible_layers_proc = }; static Argument * -image_merge_down_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_merge_down_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -2358,9 +2392,10 @@ static ProcRecord image_merge_down_proc = }; static Argument * -image_add_layer_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_add_layer_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2423,9 +2458,10 @@ static ProcRecord image_add_layer_mask_proc = }; static Argument * -image_remove_layer_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_remove_layer_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2486,9 +2522,10 @@ static ProcRecord image_remove_layer_mask_proc = }; static Argument * -image_get_cmap_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_cmap_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -2557,9 +2594,10 @@ static ProcRecord image_get_cmap_proc = }; static Argument * -image_set_cmap_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_cmap_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2618,9 +2656,10 @@ static ProcRecord image_set_cmap_proc = }; static Argument * -image_clean_all_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_clean_all_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2661,9 +2700,10 @@ static ProcRecord image_clean_all_proc = }; static Argument * -image_is_dirty_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_is_dirty_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -2720,9 +2760,10 @@ static ProcRecord image_is_dirty_proc = }; static Argument * -image_thumbnail_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_thumbnail_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -2867,9 +2908,10 @@ static ProcRecord image_thumbnail_proc = }; static Argument * -image_get_active_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_active_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -2926,9 +2968,10 @@ static ProcRecord image_get_active_layer_proc = }; static Argument * -image_set_active_layer_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_active_layer_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -2979,9 +3022,10 @@ static ProcRecord image_set_active_layer_proc = }; static Argument * -image_get_active_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_active_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3038,9 +3082,10 @@ static ProcRecord image_get_active_channel_proc = }; static Argument * -image_set_active_channel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_active_channel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -3091,9 +3136,10 @@ static ProcRecord image_set_active_channel_proc = }; static Argument * -image_get_selection_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_selection_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3150,9 +3196,10 @@ static ProcRecord image_get_selection_proc = }; static Argument * -image_get_component_active_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_component_active_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3225,9 +3272,10 @@ static ProcRecord image_get_component_active_proc = }; static Argument * -image_set_component_active_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_component_active_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -3296,9 +3344,10 @@ static ProcRecord image_set_component_active_proc = }; static Argument * -image_get_component_visible_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_component_visible_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3371,9 +3420,10 @@ static ProcRecord image_get_component_visible_proc = }; static Argument * -image_set_component_visible_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_component_visible_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -3442,9 +3492,10 @@ static ProcRecord image_set_component_visible_proc = }; static Argument * -image_get_filename_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_filename_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3497,9 +3548,10 @@ static ProcRecord image_get_filename_proc = }; static Argument * -image_set_filename_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_filename_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -3550,9 +3602,10 @@ static ProcRecord image_set_filename_proc = }; static Argument * -image_get_name_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_name_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3622,9 +3675,10 @@ static ProcRecord image_get_name_proc = }; static Argument * -image_get_resolution_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_resolution_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3685,9 +3739,10 @@ static ProcRecord image_get_resolution_proc = }; static Argument * -image_set_resolution_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_resolution_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -3758,9 +3813,10 @@ static ProcRecord image_set_resolution_proc = }; static Argument * -image_get_unit_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_unit_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3813,9 +3869,10 @@ static ProcRecord image_get_unit_proc = }; static Argument * -image_set_unit_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_unit_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -3866,9 +3923,10 @@ static ProcRecord image_set_unit_proc = }; static Argument * -image_get_tattoo_state_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_tattoo_state_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -3921,9 +3979,10 @@ static ProcRecord image_get_tattoo_state_proc = }; static Argument * -image_set_tattoo_state_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_set_tattoo_state_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -3972,9 +4031,10 @@ static ProcRecord image_set_tattoo_state_proc = }; static Argument * -image_get_layer_by_tattoo_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_layer_by_tattoo_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -4044,9 +4104,10 @@ static ProcRecord image_get_layer_by_tattoo_proc = }; static Argument * -image_get_channel_by_tattoo_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_get_channel_by_tattoo_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/layer_cmds.c b/app/pdb/layer_cmds.c index 6c3d1af450..163964cfe8 100644 --- a/app/pdb/layer_cmds.c +++ b/app/pdb/layer_cmds.c @@ -96,9 +96,10 @@ register_layer_procs (Gimp *gimp) } static Argument * -layer_new_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_new_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -222,9 +223,10 @@ static ProcRecord layer_new_proc = }; static Argument * -layer_new_from_drawable_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_new_from_drawable_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -309,9 +311,10 @@ static ProcRecord layer_new_from_drawable_proc = }; static Argument * -layer_copy_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_copy_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -376,9 +379,10 @@ static ProcRecord layer_copy_proc = }; static Argument * -layer_add_alpha_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_add_alpha_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -419,9 +423,10 @@ static ProcRecord layer_add_alpha_proc = }; static Argument * -layer_scale_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_scale_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -444,7 +449,7 @@ layer_scale_invoker (Gimp *gimp, local_origin = args[3].value.pdb_int ? TRUE : FALSE; if (success) - gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height, gimp->config->interpolation_type, NULL, NULL, local_origin); + gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height, gimp->config->interpolation_type, NULL, local_origin); return procedural_db_return_args (&layer_scale_proc, success); } @@ -490,9 +495,10 @@ static ProcRecord layer_scale_proc = }; static Argument * -layer_resize_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_resize_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -569,9 +575,10 @@ static ProcRecord layer_resize_proc = }; static Argument * -layer_resize_to_image_size_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_resize_to_image_size_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -617,9 +624,10 @@ static ProcRecord layer_resize_to_image_size_proc = }; static Argument * -layer_translate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_translate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -694,9 +702,10 @@ static ProcRecord layer_translate_proc = }; static Argument * -layer_set_offsets_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_set_offsets_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -771,9 +780,10 @@ static ProcRecord layer_set_offsets_proc = }; static Argument * -layer_create_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_create_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -840,9 +850,10 @@ static ProcRecord layer_create_mask_proc = }; static Argument * -layer_get_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_get_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -895,9 +906,10 @@ static ProcRecord layer_get_mask_proc = }; static Argument * -layer_add_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_add_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -950,9 +962,10 @@ static ProcRecord layer_add_mask_proc = }; static Argument * -layer_remove_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_remove_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -1003,9 +1016,10 @@ static ProcRecord layer_remove_mask_proc = }; static Argument * -layer_is_floating_sel_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_is_floating_sel_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1058,9 +1072,10 @@ static ProcRecord layer_is_floating_sel_proc = }; static Argument * -layer_get_preserve_trans_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_get_preserve_trans_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1113,9 +1128,10 @@ static ProcRecord layer_get_preserve_trans_proc = }; static Argument * -layer_set_preserve_trans_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_set_preserve_trans_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -1164,9 +1180,10 @@ static ProcRecord layer_set_preserve_trans_proc = }; static Argument * -layer_get_apply_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_get_apply_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1219,9 +1236,10 @@ static ProcRecord layer_get_apply_mask_proc = }; static Argument * -layer_set_apply_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_set_apply_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -1270,9 +1288,10 @@ static ProcRecord layer_set_apply_mask_proc = }; static Argument * -layer_get_show_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_get_show_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1325,9 +1344,10 @@ static ProcRecord layer_get_show_mask_proc = }; static Argument * -layer_set_show_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_set_show_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -1376,9 +1396,10 @@ static ProcRecord layer_set_show_mask_proc = }; static Argument * -layer_get_edit_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_get_edit_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1431,9 +1452,10 @@ static ProcRecord layer_get_edit_mask_proc = }; static Argument * -layer_set_edit_mask_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_set_edit_mask_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -1482,9 +1504,10 @@ static ProcRecord layer_set_edit_mask_proc = }; static Argument * -layer_get_opacity_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_get_opacity_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1537,9 +1560,10 @@ static ProcRecord layer_get_opacity_proc = }; static Argument * -layer_set_opacity_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_set_opacity_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -1590,9 +1614,10 @@ static ProcRecord layer_set_opacity_proc = }; static Argument * -layer_get_mode_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_get_mode_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1645,9 +1670,10 @@ static ProcRecord layer_get_mode_proc = }; static Argument * -layer_set_mode_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +layer_set_mode_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; diff --git a/app/pdb/message_cmds.c b/app/pdb/message_cmds.c index d0e650dc99..525ba64bc3 100644 --- a/app/pdb/message_cmds.c +++ b/app/pdb/message_cmds.c @@ -44,9 +44,10 @@ register_message_procs (Gimp *gimp) } static Argument * -message_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +message_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *message; @@ -96,9 +97,10 @@ static ProcRecord message_proc = }; static Argument * -message_get_handler_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +message_get_handler_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; @@ -134,9 +136,10 @@ static ProcRecord message_get_handler_proc = }; static Argument * -message_set_handler_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +message_set_handler_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gint32 handler; diff --git a/app/pdb/misc_cmds.c b/app/pdb/misc_cmds.c index 2e8aae5713..7cc170805d 100644 --- a/app/pdb/misc_cmds.c +++ b/app/pdb/misc_cmds.c @@ -41,9 +41,10 @@ register_misc_procs (Gimp *gimp) } static Argument * -version_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +version_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; @@ -79,9 +80,10 @@ static ProcRecord version_proc = }; static Argument * -quit_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +quit_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean force; diff --git a/app/pdb/paint_tools_cmds.c b/app/pdb/paint_tools_cmds.c index 1518518373..fd79d6fefa 100644 --- a/app/pdb/paint_tools_cmds.c +++ b/app/pdb/paint_tools_cmds.c @@ -132,9 +132,10 @@ paint_tools_stroke (Gimp *gimp, } static Argument * -airbrush_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +airbrush_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -216,9 +217,10 @@ static ProcRecord airbrush_proc = }; static Argument * -airbrush_default_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +airbrush_default_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -288,9 +290,10 @@ static ProcRecord airbrush_default_proc = }; static Argument * -clone_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +clone_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -409,9 +412,10 @@ static ProcRecord clone_proc = }; static Argument * -clone_default_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +clone_default_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -481,9 +485,10 @@ static ProcRecord clone_default_proc = }; static Argument * -convolve_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +convolve_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -578,9 +583,10 @@ static ProcRecord convolve_proc = }; static Argument * -convolve_default_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +convolve_default_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -650,9 +656,10 @@ static ProcRecord convolve_default_proc = }; static Argument * -dodgeburn_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +dodgeburn_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -758,9 +765,10 @@ static ProcRecord dodgeburn_proc = }; static Argument * -dodgeburn_default_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +dodgeburn_default_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -830,9 +838,10 @@ static ProcRecord dodgeburn_default_proc = }; static Argument * -eraser_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +eraser_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -927,9 +936,10 @@ static ProcRecord eraser_proc = }; static Argument * -eraser_default_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +eraser_default_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -999,9 +1009,10 @@ static ProcRecord eraser_default_proc = }; static Argument * -paintbrush_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +paintbrush_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1109,9 +1120,10 @@ static ProcRecord paintbrush_proc = }; static Argument * -paintbrush_default_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +paintbrush_default_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1181,9 +1193,10 @@ static ProcRecord paintbrush_default_proc = }; static Argument * -pencil_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +pencil_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1253,9 +1266,10 @@ static ProcRecord pencil_proc = }; static Argument * -smudge_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +smudge_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -1339,9 +1353,10 @@ static ProcRecord smudge_proc = }; static Argument * -smudge_default_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +smudge_default_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; diff --git a/app/pdb/palette_cmds.c b/app/pdb/palette_cmds.c index 27918a7240..73b7074a7c 100644 --- a/app/pdb/palette_cmds.c +++ b/app/pdb/palette_cmds.c @@ -50,9 +50,10 @@ register_palette_procs (Gimp *gimp) } static Argument * -palette_get_foreground_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palette_get_foreground_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; GimpRGB color; @@ -91,9 +92,10 @@ static ProcRecord palette_get_foreground_proc = }; static Argument * -palette_get_background_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palette_get_background_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; GimpRGB color; @@ -132,9 +134,10 @@ static ProcRecord palette_get_background_proc = }; static Argument * -palette_set_foreground_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palette_set_foreground_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { GimpRGB color; @@ -172,9 +175,10 @@ static ProcRecord palette_set_foreground_proc = }; static Argument * -palette_set_background_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palette_set_background_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { GimpRGB color; @@ -212,9 +216,10 @@ static ProcRecord palette_set_background_proc = }; static Argument * -palette_set_default_colors_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palette_set_default_colors_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_context_set_default_colors (context); return procedural_db_return_args (&palette_set_default_colors_proc, TRUE); @@ -237,9 +242,10 @@ static ProcRecord palette_set_default_colors_proc = }; static Argument * -palette_swap_colors_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palette_swap_colors_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_context_swap_colors (context); return procedural_db_return_args (&palette_swap_colors_proc, TRUE); diff --git a/app/pdb/palette_select_cmds.c b/app/pdb/palette_select_cmds.c index 2cdd941f62..7efa7efbc3 100644 --- a/app/pdb/palette_select_cmds.c +++ b/app/pdb/palette_select_cmds.c @@ -42,9 +42,10 @@ register_palette_select_procs (Gimp *gimp) } static Argument * -palettes_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *palette_callback; @@ -112,9 +113,10 @@ static ProcRecord palettes_popup_proc = }; static Argument * -palettes_close_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_close_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *palette_callback; @@ -161,9 +163,10 @@ static ProcRecord palettes_close_popup_proc = }; static Argument * -palettes_set_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_set_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *palette_callback; diff --git a/app/pdb/palettes_cmds.c b/app/pdb/palettes_cmds.c index fbcf41a29c..2ece2a8702 100644 --- a/app/pdb/palettes_cmds.c +++ b/app/pdb/palettes_cmds.c @@ -53,9 +53,10 @@ register_palettes_procs (Gimp *gimp) } static Argument * -palettes_refresh_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_refresh_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_data_factory_data_save (gimp->palette_factory); gimp_data_factory_data_init (gimp->palette_factory, FALSE); @@ -79,9 +80,10 @@ static ProcRecord palettes_refresh_proc = }; static Argument * -palettes_get_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_get_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -147,9 +149,10 @@ static ProcRecord palettes_get_list_proc = }; static Argument * -palettes_get_palette_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_get_palette_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -199,9 +202,10 @@ static ProcRecord palettes_get_palette_proc = }; static Argument * -palettes_set_palette_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_set_palette_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -251,9 +255,10 @@ static ProcRecord palettes_set_palette_proc = }; static Argument * -palettes_get_palette_entry_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +palettes_get_palette_entry_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/parasite_cmds.c b/app/pdb/parasite_cmds.c index c47b2cf6c8..7c317a2d8a 100644 --- a/app/pdb/parasite_cmds.c +++ b/app/pdb/parasite_cmds.c @@ -63,9 +63,10 @@ register_parasite_procs (Gimp *gimp) } static Argument * -parasite_find_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +parasite_find_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -125,9 +126,10 @@ static ProcRecord parasite_find_proc = }; static Argument * -parasite_attach_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +parasite_attach_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpParasite *parasite; @@ -168,9 +170,10 @@ static ProcRecord parasite_attach_proc = }; static Argument * -parasite_detach_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +parasite_detach_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -211,9 +214,10 @@ static ProcRecord parasite_detach_proc = }; static Argument * -parasite_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +parasite_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gint32 num_parasites; @@ -260,9 +264,10 @@ static ProcRecord parasite_list_proc = }; static Argument * -drawable_parasite_find_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_parasite_find_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -332,9 +337,10 @@ static ProcRecord drawable_parasite_find_proc = }; static Argument * -drawable_parasite_attach_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_parasite_attach_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -385,9 +391,10 @@ static ProcRecord drawable_parasite_attach_proc = }; static Argument * -drawable_parasite_detach_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_parasite_detach_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -438,9 +445,10 @@ static ProcRecord drawable_parasite_detach_proc = }; static Argument * -drawable_parasite_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +drawable_parasite_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -506,9 +514,10 @@ static ProcRecord drawable_parasite_list_proc = }; static Argument * -image_parasite_find_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_parasite_find_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -578,9 +587,10 @@ static ProcRecord image_parasite_find_proc = }; static Argument * -image_parasite_attach_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_parasite_attach_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -631,9 +641,10 @@ static ProcRecord image_parasite_attach_proc = }; static Argument * -image_parasite_detach_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_parasite_detach_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -684,9 +695,10 @@ static ProcRecord image_parasite_detach_proc = }; static Argument * -image_parasite_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_parasite_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/paths_cmds.c b/app/pdb/paths_cmds.c index fac2745b35..2994769b2d 100644 --- a/app/pdb/paths_cmds.c +++ b/app/pdb/paths_cmds.c @@ -77,9 +77,10 @@ register_paths_procs (Gimp *gimp) } static Argument * -path_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -145,9 +146,10 @@ static ProcRecord path_list_proc = }; static Argument * -path_get_current_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_get_current_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -212,9 +214,10 @@ static ProcRecord path_get_current_proc = }; static Argument * -path_set_current_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_set_current_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -273,9 +276,10 @@ static ProcRecord path_set_current_proc = }; static Argument * -path_delete_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_delete_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -334,9 +338,10 @@ static ProcRecord path_delete_proc = }; static Argument * -path_get_points_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_get_points_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -465,9 +470,10 @@ static ProcRecord path_get_points_proc = }; static Argument * -path_set_points_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_set_points_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -582,9 +588,10 @@ static ProcRecord path_set_points_proc = }; static Argument * -path_stroke_current_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_stroke_current_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -641,9 +648,10 @@ static ProcRecord path_stroke_current_proc = }; static Argument * -path_get_point_at_dist_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_get_point_at_dist_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -773,9 +781,10 @@ static ProcRecord path_get_point_at_dist_proc = }; static Argument * -path_get_tattoo_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_get_tattoo_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -850,9 +859,10 @@ static ProcRecord path_get_tattoo_proc = }; static Argument * -path_set_tattoo_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_set_tattoo_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -919,9 +929,10 @@ static ProcRecord path_set_tattoo_proc = }; static Argument * -get_path_by_tattoo_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +get_path_by_tattoo_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -994,9 +1005,10 @@ static ProcRecord get_path_by_tattoo_proc = }; static Argument * -path_get_locked_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_get_locked_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1071,9 +1083,10 @@ static ProcRecord path_get_locked_proc = }; static Argument * -path_set_locked_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_set_locked_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1140,9 +1153,10 @@ static ProcRecord path_set_locked_proc = }; static Argument * -path_to_selection_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_to_selection_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -1250,9 +1264,10 @@ static ProcRecord path_to_selection_proc = }; static Argument * -path_import_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +path_import_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; diff --git a/app/pdb/pattern_select_cmds.c b/app/pdb/pattern_select_cmds.c index 4140732eba..0fa3a01bf0 100644 --- a/app/pdb/pattern_select_cmds.c +++ b/app/pdb/pattern_select_cmds.c @@ -42,9 +42,10 @@ register_pattern_select_procs (Gimp *gimp) } static Argument * -patterns_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *pattern_callback; @@ -112,9 +113,10 @@ static ProcRecord patterns_popup_proc = }; static Argument * -patterns_close_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_close_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *pattern_callback; @@ -161,9 +163,10 @@ static ProcRecord patterns_close_popup_proc = }; static Argument * -patterns_set_popup_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_set_popup_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *pattern_callback; diff --git a/app/pdb/patterns_cmds.c b/app/pdb/patterns_cmds.c index 9676b8966a..363eebd121 100644 --- a/app/pdb/patterns_cmds.c +++ b/app/pdb/patterns_cmds.c @@ -52,9 +52,10 @@ register_patterns_procs (Gimp *gimp) } static Argument * -patterns_refresh_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_refresh_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gimp_data_factory_data_save (gimp->pattern_factory); gimp_data_factory_data_init (gimp->pattern_factory, FALSE); @@ -78,9 +79,10 @@ static ProcRecord patterns_refresh_proc = }; static Argument * -patterns_get_list_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_get_list_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -146,9 +148,10 @@ static ProcRecord patterns_get_list_proc = }; static Argument * -patterns_get_pattern_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_get_pattern_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -204,9 +207,10 @@ static ProcRecord patterns_get_pattern_proc = }; static Argument * -patterns_set_pattern_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_set_pattern_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *name; @@ -256,9 +260,10 @@ static ProcRecord patterns_set_pattern_proc = }; static Argument * -patterns_get_pattern_data_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +patterns_get_pattern_data_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/plug_in_cmds.c b/app/pdb/plug_in_cmds.c index 5b2cdc0d34..50065206a5 100644 --- a/app/pdb/plug_in_cmds.c +++ b/app/pdb/plug_in_cmds.c @@ -73,9 +73,10 @@ match_strings (regex_t *preg, } static Argument * -progress_init_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +progress_init_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *message; @@ -132,9 +133,10 @@ static ProcRecord progress_init_proc = }; static Argument * -progress_update_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +progress_update_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gdouble percentage; @@ -178,9 +180,10 @@ static ProcRecord progress_update_proc = }; static Argument * -plugins_query_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +plugins_query_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gchar *search_str; @@ -393,9 +396,10 @@ static ProcRecord plugins_query_proc = }; static Argument * -plugin_domain_register_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +plugin_domain_register_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *domain_name; @@ -454,9 +458,10 @@ static ProcRecord plugin_domain_register_proc = }; static Argument * -plugin_help_register_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +plugin_help_register_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *domain_name; @@ -517,9 +522,10 @@ static ProcRecord plugin_help_register_proc = }; static Argument * -plugin_menu_register_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +plugin_menu_register_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *procedure_name; @@ -633,9 +639,10 @@ static ProcRecord plugin_menu_register_proc = }; static Argument * -plugin_icon_register_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +plugin_icon_register_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *procedure_name; diff --git a/app/pdb/procedural_db.c b/app/pdb/procedural_db.c index 8b18cf3a8b..8c23571453 100644 --- a/app/pdb/procedural_db.c +++ b/app/pdb/procedural_db.c @@ -30,6 +30,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpprogress.h" #include "plug-in/plug-in-run.h" @@ -214,16 +215,18 @@ procedural_db_lookup (Gimp *gimp, } Argument * -procedural_db_execute (Gimp *gimp, - GimpContext *context, - const gchar *name, - Argument *args) +procedural_db_execute (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + Argument *args) { Argument *return_args = NULL; GList *list; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); list = g_hash_table_lookup (gimp->procedural_ht, name); @@ -288,13 +291,14 @@ procedural_db_execute (Gimp *gimp, case GIMP_INTERNAL: return_args = (* procedure->exec_method.internal.marshal_func) (gimp, context, + progress, args); break; case GIMP_PLUGIN: case GIMP_EXTENSION: case GIMP_TEMPORARY: - return_args = plug_in_run (gimp, context, procedure, + return_args = plug_in_run (gimp, context, progress, procedure, args, procedure->num_args, TRUE, FALSE, -1); break; @@ -336,10 +340,11 @@ procedural_db_execute (Gimp *gimp, } Argument * -procedural_db_run_proc (Gimp *gimp, - GimpContext *context, - const gchar *name, - gint *nreturn_vals, +procedural_db_run_proc (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + const gchar *name, + gint *nreturn_vals, ...) { ProcRecord *proc; @@ -350,6 +355,7 @@ procedural_db_run_proc (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (nreturn_vals != NULL, NULL); @@ -441,7 +447,7 @@ procedural_db_run_proc (Gimp *gimp, *nreturn_vals = proc->num_values; - return_vals = procedural_db_execute (gimp, context, name, params); + return_vals = procedural_db_execute (gimp, context, progress, name, params); g_free (params); diff --git a/app/pdb/procedural_db.h b/app/pdb/procedural_db.h index 9db961a5f8..7ef3f81c88 100644 --- a/app/pdb/procedural_db.h +++ b/app/pdb/procedural_db.h @@ -35,9 +35,10 @@ struct _Argument /* Argument marshalling procedures */ -typedef Argument * (* ArgMarshal) (Gimp *gimp, - GimpContext *context, - Argument *args); +typedef Argument * (* ArgMarshal) (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args); /* Execution types */ @@ -136,10 +137,12 @@ ProcRecord * procedural_db_lookup (Gimp *gimp, Argument * procedural_db_execute (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, Argument *args); Argument * procedural_db_run_proc (Gimp *gimp, GimpContext *context, + GimpProgress *progress, const gchar *name, gint *nreturn_vals, ...); diff --git a/app/pdb/procedural_db_cmds.c b/app/pdb/procedural_db_cmds.c index 490da26402..94a3815f9b 100644 --- a/app/pdb/procedural_db_cmds.c +++ b/app/pdb/procedural_db_cmds.c @@ -333,9 +333,10 @@ pdb_type_name (gint type) } static Argument * -procedural_db_temp_name_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_temp_name_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; gchar *temp_name; @@ -375,9 +376,10 @@ static ProcRecord procedural_db_temp_name_proc = }; static Argument * -procedural_db_dump_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_dump_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *filename; @@ -428,9 +430,10 @@ static ProcRecord procedural_db_dump_proc = }; static Argument * -procedural_db_query_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_query_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -584,9 +587,10 @@ static ProcRecord procedural_db_query_proc = }; static Argument * -procedural_db_proc_info_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_proc_info_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -711,9 +715,10 @@ static ProcRecord procedural_db_proc_info_proc = }; static Argument * -procedural_db_proc_arg_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_proc_arg_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -810,9 +815,10 @@ static ProcRecord procedural_db_proc_arg_proc = }; static Argument * -procedural_db_proc_val_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_proc_val_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -909,9 +915,10 @@ static ProcRecord procedural_db_proc_val_proc = }; static Argument * -procedural_db_get_data_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_get_data_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -984,9 +991,10 @@ static ProcRecord procedural_db_get_data_proc = }; static Argument * -procedural_db_get_data_size_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_get_data_size_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1047,9 +1055,10 @@ static ProcRecord procedural_db_get_data_size_proc = }; static Argument * -procedural_db_set_data_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +procedural_db_set_data_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; gchar *identifier; diff --git a/app/pdb/selection_cmds.c b/app/pdb/selection_cmds.c index c696d08366..4712d2736a 100644 --- a/app/pdb/selection_cmds.c +++ b/app/pdb/selection_cmds.c @@ -77,9 +77,10 @@ register_selection_procs (Gimp *gimp) } static Argument * -selection_bounds_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_bounds_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -166,9 +167,10 @@ static ProcRecord selection_bounds_proc = }; static Argument * -selection_value_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_value_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -237,9 +239,10 @@ static ProcRecord selection_value_proc = }; static Argument * -selection_is_empty_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_is_empty_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -292,9 +295,10 @@ static ProcRecord selection_is_empty_proc = }; static Argument * -selection_translate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_translate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -351,9 +355,10 @@ static ProcRecord selection_translate_proc = }; static Argument * -selection_float_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_float_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -438,9 +443,10 @@ static ProcRecord selection_float_proc = }; static Argument * -selection_clear_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_clear_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -481,9 +487,10 @@ static ProcRecord selection_clear_proc = }; static Argument * -selection_invert_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_invert_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -524,9 +531,10 @@ static ProcRecord selection_invert_proc = }; static Argument * -selection_sharpen_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_sharpen_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -567,9 +575,10 @@ static ProcRecord selection_sharpen_proc = }; static Argument * -selection_all_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_all_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -610,9 +619,10 @@ static ProcRecord selection_all_proc = }; static Argument * -selection_none_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_none_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -653,9 +663,10 @@ static ProcRecord selection_none_proc = }; static Argument * -selection_feather_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_feather_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -706,9 +717,10 @@ static ProcRecord selection_feather_proc = }; static Argument * -selection_border_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_border_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -759,9 +771,10 @@ static ProcRecord selection_border_proc = }; static Argument * -selection_grow_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_grow_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -812,9 +825,10 @@ static ProcRecord selection_grow_proc = }; static Argument * -selection_shrink_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_shrink_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -865,9 +879,10 @@ static ProcRecord selection_shrink_proc = }; static Argument * -selection_layer_alpha_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_layer_alpha_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpLayer *layer; @@ -914,9 +929,10 @@ static ProcRecord selection_layer_alpha_proc = }; static Argument * -selection_load_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_load_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpChannel *channel; @@ -970,9 +986,10 @@ static ProcRecord selection_load_proc = }; static Argument * -selection_save_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_save_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -1029,9 +1046,10 @@ static ProcRecord selection_save_proc = }; static Argument * -selection_combine_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +selection_combine_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpChannel *channel; diff --git a/app/pdb/selection_tools_cmds.c b/app/pdb/selection_tools_cmds.c index f9949cd5ac..10f8209f48 100644 --- a/app/pdb/selection_tools_cmds.c +++ b/app/pdb/selection_tools_cmds.c @@ -50,9 +50,10 @@ register_selection_tools_procs (Gimp *gimp) } static Argument * -by_color_select_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +by_color_select_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -167,9 +168,10 @@ static ProcRecord by_color_select_proc = }; static Argument * -ellipse_select_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +ellipse_select_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -287,9 +289,10 @@ static ProcRecord ellipse_select_proc = }; static Argument * -free_select_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +free_select_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -392,9 +395,10 @@ static ProcRecord free_select_proc = }; static Argument * -fuzzy_select_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +fuzzy_select_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpDrawable *drawable; @@ -519,9 +523,10 @@ static ProcRecord fuzzy_select_proc = }; static Argument * -rect_select_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +rect_select_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; diff --git a/app/pdb/text_tool_cmds.c b/app/pdb/text_tool_cmds.c index 87abfea383..6a5d2804b5 100644 --- a/app/pdb/text_tool_cmds.c +++ b/app/pdb/text_tool_cmds.c @@ -48,9 +48,10 @@ register_text_tool_procs (Gimp *gimp) } static Argument * -text_fontname_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +text_fontname_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -205,9 +206,10 @@ static ProcRecord text_fontname_proc = }; static Argument * -text_get_extents_fontname_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +text_get_extents_fontname_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -326,9 +328,10 @@ static ProcRecord text_get_extents_fontname_proc = }; static Argument * -text_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +text_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -553,9 +556,10 @@ static ProcRecord text_proc = }; static Argument * -text_get_extents_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +text_get_extents_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/transform_tools_cmds.c b/app/pdb/transform_tools_cmds.c index 8240d052f9..0a37ffa174 100644 --- a/app/pdb/transform_tools_cmds.c +++ b/app/pdb/transform_tools_cmds.c @@ -54,9 +54,10 @@ register_transform_tools_procs (Gimp *gimp) } static Argument * -flip_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +flip_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -127,9 +128,10 @@ static ProcRecord flip_proc = }; static Argument * -perspective_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +perspective_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -281,9 +283,10 @@ static ProcRecord perspective_proc = }; static Argument * -rotate_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +rotate_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -380,9 +383,10 @@ static ProcRecord rotate_proc = }; static Argument * -scale_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +scale_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -505,9 +509,10 @@ static ProcRecord scale_proc = }; static Argument * -shear_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +shear_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -616,9 +621,10 @@ static ProcRecord shear_proc = }; static Argument * -transform_2d_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +transform_2d_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/undo_cmds.c b/app/pdb/undo_cmds.c index 73dd7f6a81..28fdaf74ad 100644 --- a/app/pdb/undo_cmds.c +++ b/app/pdb/undo_cmds.c @@ -52,9 +52,10 @@ register_undo_procs (Gimp *gimp) } static Argument * -image_undo_group_start_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_undo_group_start_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -104,9 +105,10 @@ static ProcRecord image_undo_group_start_proc = }; static Argument * -image_undo_group_end_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_undo_group_end_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpImage *gimage; @@ -147,9 +149,10 @@ static ProcRecord image_undo_group_end_proc = }; static Argument * -image_undo_is_enabled_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_undo_is_enabled_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -206,9 +209,10 @@ static ProcRecord image_undo_is_enabled_proc = }; static Argument * -image_undo_disable_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_undo_disable_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -264,9 +268,10 @@ static ProcRecord image_undo_disable_proc = }; static Argument * -image_undo_enable_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_undo_enable_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -322,9 +327,10 @@ static ProcRecord image_undo_enable_proc = }; static Argument * -image_undo_freeze_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_undo_freeze_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -380,9 +386,10 @@ static ProcRecord image_undo_freeze_proc = }; static Argument * -image_undo_thaw_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +image_undo_thaw_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/pdb/unit_cmds.c b/app/pdb/unit_cmds.c index 6196c7e4aa..61efad4947 100644 --- a/app/pdb/unit_cmds.c +++ b/app/pdb/unit_cmds.c @@ -61,9 +61,10 @@ register_unit_procs (Gimp *gimp) } static Argument * -unit_get_number_of_units_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_number_of_units_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; @@ -99,9 +100,10 @@ static ProcRecord unit_get_number_of_units_proc = }; static Argument * -unit_get_number_of_built_in_units_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_number_of_built_in_units_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { Argument *return_args; @@ -137,9 +139,10 @@ static ProcRecord unit_get_number_of_built_in_units_proc = }; static Argument * -unit_new_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_new_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -253,9 +256,10 @@ static ProcRecord unit_new_proc = }; static Argument * -unit_get_deletion_flag_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_deletion_flag_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -308,9 +312,10 @@ static ProcRecord unit_get_deletion_flag_proc = }; static Argument * -unit_set_deletion_flag_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_set_deletion_flag_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; GimpUnit unit; @@ -359,9 +364,10 @@ static ProcRecord unit_set_deletion_flag_proc = }; static Argument * -unit_get_identifier_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_identifier_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -414,9 +420,10 @@ static ProcRecord unit_get_identifier_proc = }; static Argument * -unit_get_factor_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_factor_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -469,9 +476,10 @@ static ProcRecord unit_get_factor_proc = }; static Argument * -unit_get_digits_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_digits_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -524,9 +532,10 @@ static ProcRecord unit_get_digits_proc = }; static Argument * -unit_get_symbol_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_symbol_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -579,9 +588,10 @@ static ProcRecord unit_get_symbol_proc = }; static Argument * -unit_get_abbreviation_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_abbreviation_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -634,9 +644,10 @@ static ProcRecord unit_get_abbreviation_proc = }; static Argument * -unit_get_singular_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_singular_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -689,9 +700,10 @@ static ProcRecord unit_get_singular_proc = }; static Argument * -unit_get_plural_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +unit_get_plural_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { gboolean success = TRUE; Argument *return_args; diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 24b4698101..62a6369257 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -395,6 +395,7 @@ plug_in_handle_proc_run (PlugIn *plug_in, * procedural_db_execute() will return appropriate error return_vals. */ return_vals = procedural_db_execute (plug_in->gimp, plug_in->context, + plug_in->progress, proc_name, args); plug_in_pop (plug_in->gimp); diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 494d5fc878..8864e4340b 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -23,6 +23,7 @@ #include "plug-in-types.h" #include "core/gimp.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -32,8 +33,8 @@ /* local function prototypes */ -static void plug_in_progress_cancel (gpointer eek, - PlugIn *plug_in); +static void plug_in_progress_cancel (GimpProgress *progress, + PlugIn *plug_in); /* public functions */ @@ -48,16 +49,28 @@ plug_in_progress_start (PlugIn *plug_in, if (! message) message = plug_in->prog; + if (! plug_in->progress) + { + plug_in->progress = gimp_new_progress (plug_in->gimp); + + if (plug_in->progress) + plug_in->progress_created = TRUE; + } + if (plug_in->progress) - plug_in->progress = gimp_restart_progress (plug_in->gimp, - plug_in->progress, message, - G_CALLBACK (plug_in_progress_cancel), - plug_in); - else - plug_in->progress = gimp_start_progress (plug_in->gimp, - gdisp_ID, message, - G_CALLBACK (plug_in_progress_cancel), - plug_in); + { + if (plug_in->progress_active) + plug_in_progress_end (plug_in); + + if (gimp_progress_start (plug_in->progress, message, TRUE)) + { + g_signal_connect (plug_in->progress, "cancel", + G_CALLBACK (plug_in_progress_cancel), + plug_in); + + plug_in->progress_active = TRUE; + } + } } void @@ -66,10 +79,11 @@ plug_in_progress_update (PlugIn *plug_in, { g_return_if_fail (plug_in != NULL); - if (! plug_in->progress) + if (! plug_in->progress && plug_in->progress_active) plug_in_progress_start (plug_in, NULL, -1); - gimp_update_progress (plug_in->gimp, plug_in->progress, percentage); + if (plug_in->progress && plug_in->progress_active) + gimp_progress_set_value (plug_in->progress, percentage); } void @@ -79,8 +93,21 @@ plug_in_progress_end (PlugIn *plug_in) if (plug_in->progress) { - gimp_end_progress (plug_in->gimp, plug_in->progress); - plug_in->progress = NULL; + if (plug_in->progress_active) + { + g_signal_handlers_disconnect_by_func (plug_in->progress, + plug_in_progress_cancel, + plug_in); + gimp_progress_end (plug_in->progress); + + plug_in->progress_active = FALSE; + } + + if (plug_in->progress_created) + { + gimp_free_progress (plug_in->gimp, plug_in->progress); + plug_in->progress = NULL; + } } } @@ -88,8 +115,8 @@ plug_in_progress_end (PlugIn *plug_in) /* private functions */ static void -plug_in_progress_cancel (gpointer eek, - PlugIn *plug_in) +plug_in_progress_cancel (GimpProgress *progress, + PlugIn *plug_in) { if (plug_in->recurse_main_loop || plug_in->temp_main_loops) { diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index f8a000646f..508fecac9e 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -284,6 +284,8 @@ plug_in_new (Gimp *gimp, plug_in->n_return_vals = 0; plug_in->progress = NULL; + plug_in->progress_created = FALSE; + plug_in->plug_in_def = NULL; return plug_in; @@ -315,6 +317,9 @@ plug_in_unref (PlugIn *plug_in) if (plug_in->progress) plug_in_progress_end (plug_in); + if (plug_in->progress) + g_object_unref (plug_in->progress); + g_object_unref (plug_in->context); g_free (plug_in); @@ -608,6 +613,12 @@ plug_in_close (PlugIn *plug_in, if (plug_in->progress) plug_in_progress_end (plug_in); + if (plug_in->progress) + { + g_object_unref (plug_in->progress); + plug_in->progress = NULL; + } + while (plug_in->temp_main_loops) { #ifdef GIMP_UNSTABLE diff --git a/app/plug-in/gimpplugin.h b/app/plug-in/gimpplugin.h index 113c49f88c..5742048ae7 100644 --- a/app/plug-in/gimpplugin.h +++ b/app/plug-in/gimpplugin.h @@ -67,6 +67,8 @@ struct _PlugIn gint n_return_vals; GimpProgress *progress; /* Progress dialog */ + gboolean progress_active; /* Is the progress currently used */ + gboolean progress_created; /* Was the progress created by the plug-in */ PlugInDef *plug_in_def; /* Valid only during query() and init() */ }; diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 84949a38dc..7aa828a72e 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -34,6 +34,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -48,36 +49,39 @@ /* local function prototypes */ -static Argument * plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc); -static Argument * plug_in_get_return_vals (PlugIn *plug_in, - ProcRecord *proc_rec); +static Argument * plug_in_temp_run (ProcRecord *proc_rec, + GimpProgress *progress, + Argument *args, + gint argc); +static Argument * plug_in_get_return_vals (PlugIn *plug_in, + ProcRecord *proc_rec); /* public functions */ Argument * -plug_in_run (Gimp *gimp, - GimpContext *context, - ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_return_vals, - gint gdisp_ID) +plug_in_run (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + ProcRecord *proc_rec, + Argument *args, + gint argc, + gboolean synchronous, + gboolean destroy_return_vals, + gint gdisp_ID) { Argument *return_vals = NULL; PlugIn *plug_in; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (proc_rec != NULL, NULL); g_return_val_if_fail (argc == 0 || args != NULL, NULL); if (proc_rec->proc_type == GIMP_TEMPORARY) { - return_vals = plug_in_temp_run (proc_rec, args, argc); + return_vals = plug_in_temp_run (proc_rec, progress, args, argc); goto done; } @@ -96,6 +100,9 @@ plug_in_run (Gimp *gimp, goto done; } + if (progress) + plug_in->progress = g_object_ref (progress); + config.version = GIMP_PROTOCOL_VERSION; config.tile_width = TILE_WIDTH; config.tile_height = TILE_HEIGHT; @@ -177,18 +184,20 @@ plug_in_run (Gimp *gimp, } void -plug_in_repeat (Gimp *gimp, - GimpContext *context, - gint display_ID, - gint image_ID, - gint drawable_ID, - gboolean with_interface) +plug_in_repeat (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + gint display_ID, + gint image_ID, + gint drawable_ID, + gboolean with_interface) { Argument *args; gint i; g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); if (gimp->last_plug_in) { @@ -206,7 +215,7 @@ plug_in_repeat (Gimp *gimp, args[2].value.pdb_int = drawable_ID; /* run the plug-in procedure */ - plug_in_run (gimp, context, &gimp->last_plug_in->db_info, + plug_in_run (gimp, context, progress, &gimp->last_plug_in->db_info, args, 3, FALSE, TRUE, display_ID); g_free (args); @@ -219,9 +228,10 @@ plug_in_repeat (Gimp *gimp, #define ENABLE_TEMP_RETURN 1 static Argument * -plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc) +plug_in_temp_run (ProcRecord *proc_rec, + GimpProgress *progress, + Argument *args, + gint argc) { Argument *return_vals = NULL; PlugIn *plug_in; diff --git a/app/plug-in/gimppluginmanager-call.h b/app/plug-in/gimppluginmanager-call.h index d80659a53d..d5971e1205 100644 --- a/app/plug-in/gimppluginmanager-call.h +++ b/app/plug-in/gimppluginmanager-call.h @@ -22,24 +22,26 @@ /* Run a plug-in as if it were a procedure database procedure */ -Argument * plug_in_run (Gimp *gimp, - GimpContext *context, - ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_return_vals, - gint gdisp_ID); +Argument * plug_in_run (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + ProcRecord *proc_rec, + Argument *args, + gint argc, + gboolean synchronous, + gboolean destroy_return_vals, + gint gdisp_ID); /* Run the last plug-in again with the same arguments. Extensions * are exempt from this "privelege". */ -void plug_in_repeat (Gimp *gimp, - GimpContext *context, - gint display_ID, - gint image_ID, - gint drawable_ID, - gboolean with_interface); +void plug_in_repeat (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + gint display_ID, + gint image_ID, + gint drawable_ID, + gboolean with_interface); #endif /* __PLUG_IN_RUN_H__ */ diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 84949a38dc..7aa828a72e 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -34,6 +34,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -48,36 +49,39 @@ /* local function prototypes */ -static Argument * plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc); -static Argument * plug_in_get_return_vals (PlugIn *plug_in, - ProcRecord *proc_rec); +static Argument * plug_in_temp_run (ProcRecord *proc_rec, + GimpProgress *progress, + Argument *args, + gint argc); +static Argument * plug_in_get_return_vals (PlugIn *plug_in, + ProcRecord *proc_rec); /* public functions */ Argument * -plug_in_run (Gimp *gimp, - GimpContext *context, - ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_return_vals, - gint gdisp_ID) +plug_in_run (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + ProcRecord *proc_rec, + Argument *args, + gint argc, + gboolean synchronous, + gboolean destroy_return_vals, + gint gdisp_ID) { Argument *return_vals = NULL; PlugIn *plug_in; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (proc_rec != NULL, NULL); g_return_val_if_fail (argc == 0 || args != NULL, NULL); if (proc_rec->proc_type == GIMP_TEMPORARY) { - return_vals = plug_in_temp_run (proc_rec, args, argc); + return_vals = plug_in_temp_run (proc_rec, progress, args, argc); goto done; } @@ -96,6 +100,9 @@ plug_in_run (Gimp *gimp, goto done; } + if (progress) + plug_in->progress = g_object_ref (progress); + config.version = GIMP_PROTOCOL_VERSION; config.tile_width = TILE_WIDTH; config.tile_height = TILE_HEIGHT; @@ -177,18 +184,20 @@ plug_in_run (Gimp *gimp, } void -plug_in_repeat (Gimp *gimp, - GimpContext *context, - gint display_ID, - gint image_ID, - gint drawable_ID, - gboolean with_interface) +plug_in_repeat (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + gint display_ID, + gint image_ID, + gint drawable_ID, + gboolean with_interface) { Argument *args; gint i; g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); if (gimp->last_plug_in) { @@ -206,7 +215,7 @@ plug_in_repeat (Gimp *gimp, args[2].value.pdb_int = drawable_ID; /* run the plug-in procedure */ - plug_in_run (gimp, context, &gimp->last_plug_in->db_info, + plug_in_run (gimp, context, progress, &gimp->last_plug_in->db_info, args, 3, FALSE, TRUE, display_ID); g_free (args); @@ -219,9 +228,10 @@ plug_in_repeat (Gimp *gimp, #define ENABLE_TEMP_RETURN 1 static Argument * -plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc) +plug_in_temp_run (ProcRecord *proc_rec, + GimpProgress *progress, + Argument *args, + gint argc) { Argument *return_vals = NULL; PlugIn *plug_in; diff --git a/app/plug-in/gimppluginmanager-run.h b/app/plug-in/gimppluginmanager-run.h index d80659a53d..d5971e1205 100644 --- a/app/plug-in/gimppluginmanager-run.h +++ b/app/plug-in/gimppluginmanager-run.h @@ -22,24 +22,26 @@ /* Run a plug-in as if it were a procedure database procedure */ -Argument * plug_in_run (Gimp *gimp, - GimpContext *context, - ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_return_vals, - gint gdisp_ID); +Argument * plug_in_run (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + ProcRecord *proc_rec, + Argument *args, + gint argc, + gboolean synchronous, + gboolean destroy_return_vals, + gint gdisp_ID); /* Run the last plug-in again with the same arguments. Extensions * are exempt from this "privelege". */ -void plug_in_repeat (Gimp *gimp, - GimpContext *context, - gint display_ID, - gint image_ID, - gint drawable_ID, - gboolean with_interface); +void plug_in_repeat (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + gint display_ID, + gint image_ID, + gint drawable_ID, + gboolean with_interface); #endif /* __PLUG_IN_RUN_H__ */ diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 312a72207d..5c44b1be4f 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -357,7 +357,7 @@ plug_ins_init (Gimp *gimp, (* status_callback) (NULL, proc_def->db_info.name, nth / n_plugins); - plug_in_run (gimp, context, &proc_def->db_info, + plug_in_run (gimp, context, NULL, &proc_def->db_info, NULL, 0, FALSE, TRUE, -1); } @@ -956,7 +956,7 @@ plug_ins_add_to_db (Gimp *gimp, args[3].arg_type = GIMP_PDB_STRING; args[3].value.pdb_pointer = proc_def->magics; - g_free (procedural_db_execute (gimp, context, + g_free (procedural_db_execute (gimp, context, NULL, proc_def->image_types ? "gimp_register_save_handler" : "gimp_register_magic_load_handler", diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 24b4698101..62a6369257 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -395,6 +395,7 @@ plug_in_handle_proc_run (PlugIn *plug_in, * procedural_db_execute() will return appropriate error return_vals. */ return_vals = procedural_db_execute (plug_in->gimp, plug_in->context, + plug_in->progress, proc_name, args); plug_in_pop (plug_in->gimp); diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 494d5fc878..8864e4340b 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -23,6 +23,7 @@ #include "plug-in-types.h" #include "core/gimp.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -32,8 +33,8 @@ /* local function prototypes */ -static void plug_in_progress_cancel (gpointer eek, - PlugIn *plug_in); +static void plug_in_progress_cancel (GimpProgress *progress, + PlugIn *plug_in); /* public functions */ @@ -48,16 +49,28 @@ plug_in_progress_start (PlugIn *plug_in, if (! message) message = plug_in->prog; + if (! plug_in->progress) + { + plug_in->progress = gimp_new_progress (plug_in->gimp); + + if (plug_in->progress) + plug_in->progress_created = TRUE; + } + if (plug_in->progress) - plug_in->progress = gimp_restart_progress (plug_in->gimp, - plug_in->progress, message, - G_CALLBACK (plug_in_progress_cancel), - plug_in); - else - plug_in->progress = gimp_start_progress (plug_in->gimp, - gdisp_ID, message, - G_CALLBACK (plug_in_progress_cancel), - plug_in); + { + if (plug_in->progress_active) + plug_in_progress_end (plug_in); + + if (gimp_progress_start (plug_in->progress, message, TRUE)) + { + g_signal_connect (plug_in->progress, "cancel", + G_CALLBACK (plug_in_progress_cancel), + plug_in); + + plug_in->progress_active = TRUE; + } + } } void @@ -66,10 +79,11 @@ plug_in_progress_update (PlugIn *plug_in, { g_return_if_fail (plug_in != NULL); - if (! plug_in->progress) + if (! plug_in->progress && plug_in->progress_active) plug_in_progress_start (plug_in, NULL, -1); - gimp_update_progress (plug_in->gimp, plug_in->progress, percentage); + if (plug_in->progress && plug_in->progress_active) + gimp_progress_set_value (plug_in->progress, percentage); } void @@ -79,8 +93,21 @@ plug_in_progress_end (PlugIn *plug_in) if (plug_in->progress) { - gimp_end_progress (plug_in->gimp, plug_in->progress); - plug_in->progress = NULL; + if (plug_in->progress_active) + { + g_signal_handlers_disconnect_by_func (plug_in->progress, + plug_in_progress_cancel, + plug_in); + gimp_progress_end (plug_in->progress); + + plug_in->progress_active = FALSE; + } + + if (plug_in->progress_created) + { + gimp_free_progress (plug_in->gimp, plug_in->progress); + plug_in->progress = NULL; + } } } @@ -88,8 +115,8 @@ plug_in_progress_end (PlugIn *plug_in) /* private functions */ static void -plug_in_progress_cancel (gpointer eek, - PlugIn *plug_in) +plug_in_progress_cancel (GimpProgress *progress, + PlugIn *plug_in) { if (plug_in->recurse_main_loop || plug_in->temp_main_loops) { diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 84949a38dc..7aa828a72e 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -34,6 +34,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpprogress.h" #include "pdb/procedural_db.h" @@ -48,36 +49,39 @@ /* local function prototypes */ -static Argument * plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc); -static Argument * plug_in_get_return_vals (PlugIn *plug_in, - ProcRecord *proc_rec); +static Argument * plug_in_temp_run (ProcRecord *proc_rec, + GimpProgress *progress, + Argument *args, + gint argc); +static Argument * plug_in_get_return_vals (PlugIn *plug_in, + ProcRecord *proc_rec); /* public functions */ Argument * -plug_in_run (Gimp *gimp, - GimpContext *context, - ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_return_vals, - gint gdisp_ID) +plug_in_run (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + ProcRecord *proc_rec, + Argument *args, + gint argc, + gboolean synchronous, + gboolean destroy_return_vals, + gint gdisp_ID) { Argument *return_vals = NULL; PlugIn *plug_in; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); + g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (proc_rec != NULL, NULL); g_return_val_if_fail (argc == 0 || args != NULL, NULL); if (proc_rec->proc_type == GIMP_TEMPORARY) { - return_vals = plug_in_temp_run (proc_rec, args, argc); + return_vals = plug_in_temp_run (proc_rec, progress, args, argc); goto done; } @@ -96,6 +100,9 @@ plug_in_run (Gimp *gimp, goto done; } + if (progress) + plug_in->progress = g_object_ref (progress); + config.version = GIMP_PROTOCOL_VERSION; config.tile_width = TILE_WIDTH; config.tile_height = TILE_HEIGHT; @@ -177,18 +184,20 @@ plug_in_run (Gimp *gimp, } void -plug_in_repeat (Gimp *gimp, - GimpContext *context, - gint display_ID, - gint image_ID, - gint drawable_ID, - gboolean with_interface) +plug_in_repeat (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + gint display_ID, + gint image_ID, + gint drawable_ID, + gboolean with_interface) { Argument *args; gint i; g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_CONTEXT (context)); + g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress)); if (gimp->last_plug_in) { @@ -206,7 +215,7 @@ plug_in_repeat (Gimp *gimp, args[2].value.pdb_int = drawable_ID; /* run the plug-in procedure */ - plug_in_run (gimp, context, &gimp->last_plug_in->db_info, + plug_in_run (gimp, context, progress, &gimp->last_plug_in->db_info, args, 3, FALSE, TRUE, display_ID); g_free (args); @@ -219,9 +228,10 @@ plug_in_repeat (Gimp *gimp, #define ENABLE_TEMP_RETURN 1 static Argument * -plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc) +plug_in_temp_run (ProcRecord *proc_rec, + GimpProgress *progress, + Argument *args, + gint argc) { Argument *return_vals = NULL; PlugIn *plug_in; diff --git a/app/plug-in/plug-in-run.h b/app/plug-in/plug-in-run.h index d80659a53d..d5971e1205 100644 --- a/app/plug-in/plug-in-run.h +++ b/app/plug-in/plug-in-run.h @@ -22,24 +22,26 @@ /* Run a plug-in as if it were a procedure database procedure */ -Argument * plug_in_run (Gimp *gimp, - GimpContext *context, - ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_return_vals, - gint gdisp_ID); +Argument * plug_in_run (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + ProcRecord *proc_rec, + Argument *args, + gint argc, + gboolean synchronous, + gboolean destroy_return_vals, + gint gdisp_ID); /* Run the last plug-in again with the same arguments. Extensions * are exempt from this "privelege". */ -void plug_in_repeat (Gimp *gimp, - GimpContext *context, - gint display_ID, - gint image_ID, - gint drawable_ID, - gboolean with_interface); +void plug_in_repeat (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + gint display_ID, + gint image_ID, + gint drawable_ID, + gboolean with_interface); #endif /* __PLUG_IN_RUN_H__ */ diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index f8a000646f..508fecac9e 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -284,6 +284,8 @@ plug_in_new (Gimp *gimp, plug_in->n_return_vals = 0; plug_in->progress = NULL; + plug_in->progress_created = FALSE; + plug_in->plug_in_def = NULL; return plug_in; @@ -315,6 +317,9 @@ plug_in_unref (PlugIn *plug_in) if (plug_in->progress) plug_in_progress_end (plug_in); + if (plug_in->progress) + g_object_unref (plug_in->progress); + g_object_unref (plug_in->context); g_free (plug_in); @@ -608,6 +613,12 @@ plug_in_close (PlugIn *plug_in, if (plug_in->progress) plug_in_progress_end (plug_in); + if (plug_in->progress) + { + g_object_unref (plug_in->progress); + plug_in->progress = NULL; + } + while (plug_in->temp_main_loops) { #ifdef GIMP_UNSTABLE diff --git a/app/plug-in/plug-in.h b/app/plug-in/plug-in.h index 113c49f88c..5742048ae7 100644 --- a/app/plug-in/plug-in.h +++ b/app/plug-in/plug-in.h @@ -67,6 +67,8 @@ struct _PlugIn gint n_return_vals; GimpProgress *progress; /* Progress dialog */ + gboolean progress_active; /* Is the progress currently used */ + gboolean progress_created; /* Was the progress created by the plug-in */ PlugInDef *plug_in_def; /* Valid only during query() and init() */ }; diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 312a72207d..5c44b1be4f 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -357,7 +357,7 @@ plug_ins_init (Gimp *gimp, (* status_callback) (NULL, proc_def->db_info.name, nth / n_plugins); - plug_in_run (gimp, context, &proc_def->db_info, + plug_in_run (gimp, context, NULL, &proc_def->db_info, NULL, 0, FALSE, TRUE, -1); } @@ -956,7 +956,7 @@ plug_ins_add_to_db (Gimp *gimp, args[3].arg_type = GIMP_PDB_STRING; args[3].value.pdb_pointer = proc_def->magics; - g_free (procedural_db_execute (gimp, context, + g_free (procedural_db_execute (gimp, context, NULL, proc_def->image_types ? "gimp_register_save_handler" : "gimp_register_magic_load_handler", diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index bc71d2a309..f5ed4657c2 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -32,12 +32,12 @@ #include "core/gimpdrawable-blend.h" #include "core/gimpgradient.h" #include "core/gimpimage.h" +#include "core/gimpprogress.h" #include "core/gimptoolinfo.h" #include "widgets/gimphelp-ids.h" #include "display/gimpdisplay.h" -#include "display/gimpprogress.h" #include "gimpblendoptions.h" #include "gimpblendtool.h" @@ -223,7 +223,6 @@ gimp_blend_tool_button_release (GimpTool *tool, GimpBlendOptions *options; GimpContext *context; GimpImage *gimage; - GimpProgress *progress; blend_tool = GIMP_BLEND_TOOL (tool); paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options); @@ -243,8 +242,10 @@ gimp_blend_tool_button_release (GimpTool *tool, ((blend_tool->startx != blend_tool->endx) || (blend_tool->starty != blend_tool->endy))) { - progress = gimp_progress_start (gdisp, _("Blending..."), FALSE, - NULL, NULL); + GimpProgress *progress; + + progress = gimp_progress_start (GIMP_PROGRESS (gdisp), + _("Blending..."), FALSE); gimp_drawable_blend (gimp_image_active_drawable (gimage), context, @@ -263,11 +264,10 @@ gimp_blend_tool_button_release (GimpTool *tool, blend_tool->starty, blend_tool->endx, blend_tool->endy, - progress ? gimp_progress_update_and_flush : NULL, progress); if (progress) - gimp_progress_end (progress); + gimp_progress_end (progress); gimp_image_flush (gimage); } diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index e78b2fd013..da353ef6ca 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -39,6 +39,7 @@ #include "core/gimpimage-undo-push.h" #include "core/gimpitem-linked.h" #include "core/gimplayer.h" +#include "core/gimpprogress.h" #include "core/gimptoolinfo.h" #include "vectors/gimpvectors.h" @@ -48,7 +49,6 @@ #include "widgets/gimpviewabledialog.h" #include "display/gimpdisplay.h" -#include "display/gimpprogress.h" #include "display/gimpdisplayshell.h" #include "display/gimpdisplayshell-appearance.h" #include "display/gimpdisplayshell-transform.h" @@ -876,8 +876,8 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool, if (tr_tool->info_dialog) gtk_widget_set_sensitive (GTK_WIDGET (tr_tool->info_dialog->shell), FALSE); - progress = gimp_progress_start (gdisp, tr_tool->progress_text, FALSE, - NULL, NULL); + progress = gimp_progress_start (GIMP_PROGRESS (gdisp), + tr_tool->progress_text, FALSE); if (gimp_item_get_linked (active_item)) gimp_item_linked_transform (active_item, context, @@ -887,8 +887,6 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool, options->supersample, options->recursion_level, options->clip, - progress ? - gimp_progress_update_and_flush : NULL, progress); switch (options->type) @@ -915,9 +913,6 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool, options->supersample, options->recursion_level, clip_result, - progress ? - gimp_progress_update_and_flush : - NULL, progress); } break; @@ -930,9 +925,6 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool, options->supersample, options->recursion_level, options->clip, - progress ? - gimp_progress_update_and_flush : - NULL, progress); break; } diff --git a/app/vectors/gimpvectors.c b/app/vectors/gimpvectors.c index 5d88b4ffff..ff2a021975 100644 --- a/app/vectors/gimpvectors.c +++ b/app/vectors/gimpvectors.c @@ -83,8 +83,7 @@ static void gimp_vectors_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interp_type, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static void gimp_vectors_resize (GimpItem *item, GimpContext *context, gint new_width, @@ -110,8 +109,7 @@ static void gimp_vectors_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data); + GimpProgress *progress); static gboolean gimp_vectors_stroke (GimpItem *item, GimpDrawable *drawable, GimpContext *context, @@ -395,8 +393,7 @@ gimp_vectors_scale (GimpItem *item, gint new_offset_x, gint new_offset_y, GimpInterpolationType interpolation_type, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpVectors *vectors = GIMP_VECTORS (item); GimpImage *image = gimp_item_get_image (item); @@ -417,8 +414,7 @@ gimp_vectors_scale (GimpItem *item, } GIMP_ITEM_CLASS (parent_class)->scale (item, image->width, image->height, - 0, 0, interpolation_type, - progress_callback, progress_data); + 0, 0, interpolation_type, progress); gimp_vectors_thaw (vectors); } @@ -534,8 +530,7 @@ gimp_vectors_transform (GimpItem *item, gboolean supersample, gint recursion_level, gboolean clip_result, - GimpProgressFunc progress_callback, - gpointer progress_data) + GimpProgress *progress) { GimpVectors *vectors = GIMP_VECTORS (item); GimpMatrix3 local_matrix; diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am index a5909e8aff..97b7df2f6c 100644 --- a/app/widgets/Makefile.am +++ b/app/widgets/Makefile.am @@ -206,6 +206,8 @@ libappwidgets_a_sources = \ gimppreviewrendererlayer.h \ gimppreviewrenderervectors.c \ gimppreviewrenderervectors.h \ + gimpprogressdialog.c \ + gimpprogressdialog.h \ gimppropwidgets.c \ gimppropwidgets.h \ gimpselectiondata.c \ diff --git a/app/widgets/gimpbrushselect.c b/app/widgets/gimpbrushselect.c index 1a9a60a7fa..d5c135d962 100644 --- a/app/widgets/gimpbrushselect.c +++ b/app/widgets/gimpbrushselect.c @@ -285,6 +285,7 @@ gimp_brush_select_run_callback (GimpPdbDialog *dialog, return procedural_db_run_proc (dialog->context->gimp, dialog->context, + NULL, dialog->callback_name, n_return_vals, GIMP_PDB_STRING, object->name, diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c index 0ae1f65053..faca023823 100644 --- a/app/widgets/gimpfiledialog.c +++ b/app/widgets/gimpfiledialog.c @@ -31,6 +31,7 @@ #include "core/gimp.h" #include "core/gimpimage.h" +#include "core/gimpprogress.h" #include "config/gimpcoreconfig.h" @@ -49,32 +50,45 @@ #include "gimp-intl.h" -static void gimp_file_dialog_class_init (GimpFileDialogClass *klass); +static void gimp_file_dialog_class_init (GimpFileDialogClass *klass); +static void gimp_file_dialog_progress_iface_init (GimpProgressInterface *progress_iface); -static gboolean gimp_file_dialog_delete_event (GtkWidget *widget, - GdkEventAny *event); +static gboolean gimp_file_dialog_delete_event (GtkWidget *widget, + GdkEventAny *event); -static void gimp_file_dialog_add_preview (GimpFileDialog *dialog, - Gimp *gimp); -static void gimp_file_dialog_add_filters (GimpFileDialog *dialog, - Gimp *gimp, - GSList *file_procs); -static void gimp_file_dialog_add_proc_selection (GimpFileDialog *dialog, - Gimp *gimp, - GSList *file_procs, - const gchar *automatic, - const gchar *automatic_help_id); +static GimpProgress * + gimp_file_dialog_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable); +static void gimp_file_dialog_progress_end (GimpProgress *progress); +static void gimp_file_dialog_progress_set_text (GimpProgress *progress, + const gchar *message); +static void gimp_file_dialog_progress_set_value (GimpProgress *progress, + gdouble percentage); +static gdouble gimp_file_dialog_progress_get_value (GimpProgress *progress); -static void gimp_file_dialog_selection_changed (GtkFileChooser *chooser, - GimpFileDialog *dialog); -static void gimp_file_dialog_update_preview (GtkFileChooser *chooser, - GimpFileDialog *dialog); +static void gimp_file_dialog_add_preview (GimpFileDialog *dialog, + Gimp *gimp); +static void gimp_file_dialog_add_filters (GimpFileDialog *dialog, + Gimp *gimp, + GSList *file_procs); +static void gimp_file_dialog_add_proc_selection (GimpFileDialog *dialog, + Gimp *gimp, + GSList *file_procs, + const gchar *automatic, + const gchar *automatic_help_id, + GtkWidget *vbox); -static void gimp_file_dialog_proc_changed (GimpFileProcView *view, - GimpFileDialog *dialog); +static void gimp_file_dialog_selection_changed (GtkFileChooser *chooser, + GimpFileDialog *dialog); +static void gimp_file_dialog_update_preview (GtkFileChooser *chooser, + GimpFileDialog *dialog); -static void gimp_file_dialog_help_func (const gchar *help_id, - gpointer help_data); +static void gimp_file_dialog_proc_changed (GimpFileProcView *view, + GimpFileDialog *dialog); + +static void gimp_file_dialog_help_func (const gchar *help_id, + gpointer help_data); @@ -98,9 +112,19 @@ gimp_file_dialog_get_type (void) NULL, /* instance_init */ }; + static const GInterfaceInfo progress_iface_info = + { + (GInterfaceInitFunc) gimp_file_dialog_progress_iface_init, + NULL, /* iface_finalize */ + NULL /* iface_data */ + }; + dialog_type = g_type_register_static (GTK_TYPE_FILE_CHOOSER_DIALOG, "GimpFileDialog", &dialog_info, 0); + + g_type_add_interface_static (dialog_type, GIMP_TYPE_PROGRESS, + &progress_iface_info); } return dialog_type; @@ -114,6 +138,16 @@ gimp_file_dialog_class_init (GimpFileDialogClass *klass) widget_class->delete_event = gimp_file_dialog_delete_event; } +static void +gimp_file_dialog_progress_iface_init (GimpProgressInterface *progress_iface) +{ + progress_iface->start = gimp_file_dialog_progress_start; + progress_iface->end = gimp_file_dialog_progress_end; + progress_iface->set_text = gimp_file_dialog_progress_set_text; + progress_iface->set_value = gimp_file_dialog_progress_set_value; + progress_iface->get_value = gimp_file_dialog_progress_get_value; +} + static gboolean gimp_file_dialog_delete_event (GtkWidget *widget, GdkEventAny *event) @@ -121,6 +155,93 @@ gimp_file_dialog_delete_event (GtkWidget *widget, return TRUE; } +static GimpProgress * +gimp_file_dialog_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable) +{ + GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress); + + if (! dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress); + + gtk_progress_bar_set_text (bar, message); + gtk_progress_bar_set_fraction (bar, 0.0); + /* gtk_widget_set_sensitive (dialog->cancel_button, cancelable); */ + + gtk_widget_show (dialog->progress); + + dialog->progress_active = TRUE; + + return progress; + } + + return NULL; +} + +static void +gimp_file_dialog_progress_end (GimpProgress *progress) +{ + GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress); + + if (dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress); + + gtk_progress_bar_set_text (bar, ""); + gtk_progress_bar_set_fraction (bar, 0.0); + /* gtk_widget_set_sensitive (dialog->cancel_button, FALSE); */ + + gtk_widget_hide (dialog->progress); + + dialog->progress_active = FALSE; + } +} + +static void +gimp_file_dialog_progress_set_text (GimpProgress *progress, + const gchar *message) +{ + GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress); + + if (dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress); + + gtk_progress_bar_set_text (bar, message); + } +} + +static void +gimp_file_dialog_progress_set_value (GimpProgress *progress, + gdouble percentage) +{ + GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress); + + if (dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress); + + gtk_progress_bar_set_fraction (bar, percentage); + } +} + +static gdouble +gimp_file_dialog_progress_get_value (GimpProgress *progress) +{ + GimpFileDialog *dialog = GIMP_FILE_DIALOG (progress); + + if (dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progress); + + return gtk_progress_bar_get_fraction (bar); + } + + return 0.0; +} + /* public functions */ @@ -133,6 +254,7 @@ gimp_file_dialog_new (Gimp *gimp, const gchar *help_id) { GimpFileDialog *dialog; + GtkWidget *extra_vbox; GSList *file_procs; const gchar *automatic; const gchar *automatic_help_id; @@ -182,8 +304,16 @@ gimp_file_dialog_new (Gimp *gimp, gimp_file_dialog_add_filters (dialog, gimp, file_procs); + extra_vbox = gtk_vbox_new (FALSE, 12); + gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra_vbox); + gtk_widget_show (extra_vbox); + + dialog->progress = gtk_progress_bar_new (); + gtk_box_pack_start (GTK_BOX (extra_vbox), dialog->progress, FALSE, FALSE, 0); + /* don't gtk_widget_show (dialog->progress); */ + gimp_file_dialog_add_proc_selection (dialog, gimp, file_procs, automatic, - automatic_help_id); + automatic_help_id, extra_vbox); return GTK_WIDGET (dialog); } @@ -367,13 +497,13 @@ gimp_file_dialog_add_proc_selection (GimpFileDialog *dialog, Gimp *gimp, GSList *file_procs, const gchar *automatic, - const gchar *automatic_help_id) + const gchar *automatic_help_id, + GtkWidget *vbox) { GtkWidget *scrolled_window; dialog->proc_expander = gtk_expander_new_with_mnemonic (NULL); - gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), - dialog->proc_expander); + gtk_box_pack_start (GTK_BOX (vbox), dialog->proc_expander, TRUE, TRUE, 0); gtk_widget_show (dialog->proc_expander); scrolled_window = gtk_scrolled_window_new (NULL, NULL); diff --git a/app/widgets/gimpfiledialog.h b/app/widgets/gimpfiledialog.h index 2342957662..fc2fc54ba6 100644 --- a/app/widgets/gimpfiledialog.h +++ b/app/widgets/gimpfiledialog.h @@ -48,6 +48,9 @@ struct _GimpFileDialog GtkWidget *thumb_box; GtkWidget *proc_expander; GtkWidget *proc_view; + + gboolean progress_active; + GtkWidget *progress; }; struct _GimpFileDialogClass diff --git a/app/widgets/gimpfontselect.c b/app/widgets/gimpfontselect.c index a7fe2904cd..6ae25827c5 100644 --- a/app/widgets/gimpfontselect.c +++ b/app/widgets/gimpfontselect.c @@ -132,6 +132,7 @@ gimp_font_select_run_callback (GimpPdbDialog *dialog, { return procedural_db_run_proc (dialog->context->gimp, dialog->context, + NULL, dialog->callback_name, n_return_vals, GIMP_PDB_STRING, object->name, diff --git a/app/widgets/gimpgradientselect.c b/app/widgets/gimpgradientselect.c index 3a86905b80..6f3efef69b 100644 --- a/app/widgets/gimpgradientselect.c +++ b/app/widgets/gimpgradientselect.c @@ -178,6 +178,7 @@ gimp_gradient_select_run_callback (GimpPdbDialog *dialog, return procedural_db_run_proc (dialog->context->gimp, dialog->context, + NULL, dialog->callback_name, n_return_vals, GIMP_PDB_STRING, GIMP_OBJECT (gradient)->name, diff --git a/app/widgets/gimphelp.c b/app/widgets/gimphelp.c index 16e0918966..95d03c393f 100644 --- a/app/widgets/gimphelp.c +++ b/app/widgets/gimphelp.c @@ -220,7 +220,7 @@ gimp_help_internal (Gimp *gimp) args[0].arg_type = GIMP_PDB_INT32; args[0].value.pdb_int = GIMP_RUN_INTERACTIVE; - plug_in_run (gimp, gimp_get_user_context (gimp), + plug_in_run (gimp, gimp_get_user_context (gimp), NULL, proc_rec, args, 1, FALSE, TRUE, -1); procedural_db_destroy_args (args, 1); @@ -294,7 +294,7 @@ gimp_help_call (Gimp *gimp, args[3].arg_type = GIMP_PDB_STRINGARRAY; args[3].value.pdb_pointer = help_uris; - plug_in_run (gimp, gimp_get_user_context (gimp), + plug_in_run (gimp, gimp_get_user_context (gimp), NULL, proc_rec, args, 4, FALSE, TRUE, -1); procedural_db_destroy_args (args, 4); @@ -324,6 +324,7 @@ gimp_help_call (Gimp *gimp, return_vals = procedural_db_run_proc (gimp, gimp_get_user_context (gimp), + NULL, "extension_gimp_help_temp", &n_return_vals, GIMP_PDB_STRING, procedure, diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index 05345ab5dc..f96f37a242 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -790,9 +790,8 @@ gimp_layer_tree_view_drop_uri_list (GimpContainerTreeView *view, GimpPDBStatusType status; GError *error = NULL; - new_layer = file_open_layer (gimage->gimp, item_view->context, gimage, - uri, - &status, &error); + new_layer = file_open_layer (gimage->gimp, item_view->context, NULL, + gimage, uri, &status, &error); if (new_layer) { diff --git a/app/widgets/gimppaletteselect.c b/app/widgets/gimppaletteselect.c index 36fc0849f7..d6ee6c8c8a 100644 --- a/app/widgets/gimppaletteselect.c +++ b/app/widgets/gimppaletteselect.c @@ -145,6 +145,7 @@ gimp_palette_select_run_callback (GimpPdbDialog *dialog, return procedural_db_run_proc (dialog->context->gimp, dialog->context, + NULL, dialog->callback_name, n_return_vals, GIMP_PDB_STRING, GIMP_OBJECT (palette)->name, diff --git a/app/widgets/gimppatternselect.c b/app/widgets/gimppatternselect.c index a3923ae82a..6490c141a3 100644 --- a/app/widgets/gimppatternselect.c +++ b/app/widgets/gimppatternselect.c @@ -139,6 +139,7 @@ gimp_pattern_select_run_callback (GimpPdbDialog *dialog, return procedural_db_run_proc (dialog->context->gimp, dialog->context, + NULL, dialog->callback_name, n_return_vals, GIMP_PDB_STRING, GIMP_OBJECT (pattern)->name, diff --git a/app/widgets/gimpprogressdialog.c b/app/widgets/gimpprogressdialog.c new file mode 100644 index 0000000000..b658fc42e2 --- /dev/null +++ b/app/widgets/gimpprogressdialog.c @@ -0,0 +1,251 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimpprogressdialog.c + * Copyright (C) 2004 Michael Natterer + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "widgets-types.h" + +#include "core/gimpprogress.h" + +#include "gimpprogressdialog.h" + +#include "gimp-intl.h" + + +static void gimp_progress_dialog_class_init (GimpProgressDialogClass *klass); +static void gimp_progress_dialog_init (GimpProgressDialog *dialog); +static void gimp_progress_dialog_progress_iface_init (GimpProgressInterface *progress_iface); + +static void gimp_progress_dialog_response (GtkDialog *dialog, + gint response_id); + +static GimpProgress * + gimp_progress_dialog_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable); +static void gimp_progress_dialog_progress_end (GimpProgress *progress); +static void gimp_progress_dialog_progress_set_text (GimpProgress *progress, + const gchar *message); +static void gimp_progress_dialog_progress_set_value (GimpProgress *progress, + gdouble percentage); +static gdouble gimp_progress_dialog_progress_get_value (GimpProgress *progress); + + +static GimpDialogClass *parent_class = NULL; + + +GType +gimp_progress_dialog_get_type (void) +{ + static GType dialog_type = 0; + + if (! dialog_type) + { + static const GTypeInfo dialog_info = + { + sizeof (GimpProgressDialogClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_progress_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpProgressDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_progress_dialog_init, + }; + + static const GInterfaceInfo progress_iface_info = + { + (GInterfaceInitFunc) gimp_progress_dialog_progress_iface_init, + NULL, /* iface_finalize */ + NULL /* iface_data */ + }; + + dialog_type = g_type_register_static (GIMP_TYPE_DIALOG, + "GimpProgressDialog", + &dialog_info, 0); + + g_type_add_interface_static (dialog_type, GIMP_TYPE_PROGRESS, + &progress_iface_info); + } + + return dialog_type; +} + +static void +gimp_progress_dialog_class_init (GimpProgressDialogClass *klass) +{ + GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + dialog_class->response = gimp_progress_dialog_response; +} + +static void +gimp_progress_dialog_init (GimpProgressDialog *dialog) +{ +} + +static void +gimp_progress_dialog_progress_iface_init (GimpProgressInterface *progress_iface) +{ + progress_iface->start = gimp_progress_dialog_progress_start; + progress_iface->end = gimp_progress_dialog_progress_end; + progress_iface->set_text = gimp_progress_dialog_progress_set_text; + progress_iface->set_value = gimp_progress_dialog_progress_set_value; + progress_iface->get_value = gimp_progress_dialog_progress_get_value; +} + +static void +gimp_progress_dialog_response (GtkDialog *dialog, + gint response_id) +{ + if (response_id == GTK_RESPONSE_CANCEL) + gimp_progress_cancel (GIMP_PROGRESS (dialog)); +} + +static GimpProgress * +gimp_progress_dialog_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable) +{ + GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress); + + if (! dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progressbar); + + gtk_label_set_text (GTK_LABEL (dialog->label), message); + gtk_progress_bar_set_fraction (bar, 0.0); + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + GTK_RESPONSE_CANCEL, cancelable); + + gtk_window_present (GTK_WINDOW (dialog)); + + dialog->progress_active = TRUE; + + return progress; + } + + return NULL; +} + +static void +gimp_progress_dialog_progress_end (GimpProgress *progress) +{ + GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress); + + if (dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progressbar); + + gtk_label_set_text (GTK_LABEL (dialog->label), ""); + gtk_progress_bar_set_fraction (bar, 0.0); + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + GTK_RESPONSE_CANCEL, FALSE); + + gtk_widget_hide (GTK_WIDGET (dialog)); + + dialog->progress_active = FALSE; + } +} + +static void +gimp_progress_dialog_progress_set_text (GimpProgress *progress, + const gchar *message) +{ + GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress); + + if (dialog->progress_active) + { + gtk_label_set_text (GTK_LABEL (dialog->label), message); + } +} + +static void +gimp_progress_dialog_progress_set_value (GimpProgress *progress, + gdouble percentage) +{ + GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress); + + if (dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progressbar); + + gtk_progress_bar_set_fraction (bar, percentage); + + if (GTK_WIDGET_DRAWABLE (dialog->progressbar)) + gdk_window_process_updates (dialog->progressbar->window, TRUE); + } +} + +static gdouble +gimp_progress_dialog_progress_get_value (GimpProgress *progress) +{ + GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress); + + if (dialog->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (dialog->progressbar); + + return gtk_progress_bar_get_fraction (bar); + } + + return 0.0; +} + +GtkWidget * +gimp_progress_dialog_new (void) +{ + GimpProgressDialog *dialog; + GtkWidget *vbox; + + dialog = g_object_new (GIMP_TYPE_PROGRESS_DIALOG, + "title", _("Progress"), + "role", "progress", + "resizable", FALSE, + NULL); + + gtk_dialog_add_button (GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); + + vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); + gtk_widget_show (vbox); + + dialog->label = gtk_label_new (""); + gtk_misc_set_alignment (GTK_MISC (dialog->label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (vbox), dialog->label, FALSE, FALSE, 0); + gtk_widget_show (dialog->label); + + dialog->progressbar = gtk_progress_bar_new (); + gtk_widget_set_size_request (dialog->progressbar, 150, 20); + gtk_box_pack_start (GTK_BOX (vbox), dialog->progressbar, FALSE, FALSE, 0); + gtk_widget_show (dialog->progressbar); + + return GTK_WIDGET (dialog); +} diff --git a/app/widgets/gimpprogressdialog.h b/app/widgets/gimpprogressdialog.h new file mode 100644 index 0000000000..8c83185a8c --- /dev/null +++ b/app/widgets/gimpprogressdialog.h @@ -0,0 +1,62 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimpprogressdialog.h + * Copyright (C) 2004 Michael Natterer + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GIMP_PROGRESS_DIALOG_H__ +#define __GIMP_PROGRESS_DIALOG_H__ + +#include "libgimpwidgets/gimpdialog.h" + +G_BEGIN_DECLS + + +#define GIMP_TYPE_PROGRESS_DIALOG (gimp_progress_dialog_get_type ()) +#define GIMP_PROGRESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROGRESS_DIALOG, GimpProgressDialog)) +#define GIMP_PROGRESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROGRESS_DIALOG, GimpProgressDialogClass)) +#define GIMP_IS_PROGRESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROGRESS_DIALOG)) +#define GIMP_IS_PROGRESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PROGRESS_DIALOG)) +#define GIMP_PROGRESS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PROGRESS_DIALOG, GimpProgressDialogClass)) + + +typedef struct _GimpProgressDialogClass GimpProgressDialogClass; + +struct _GimpProgressDialog +{ + GimpDialog parent_instance; + + gboolean progress_active; + GtkWidget *label; + GtkWidget *progressbar; +}; + +struct _GimpProgressDialogClass +{ + GimpDialogClass parent_class; +}; + + +GType gimp_progress_dialog_get_type (void) G_GNUC_CONST; + +GtkWidget * gimp_progress_dialog_new (void); + + +G_END_DECLS + +#endif /* __GIMP_PROGRESS_DIALOG_H__ */ diff --git a/app/widgets/gimpthumbbox.c b/app/widgets/gimpthumbbox.c index 4c7c037345..339252026e 100644 --- a/app/widgets/gimpthumbbox.c +++ b/app/widgets/gimpthumbbox.c @@ -31,6 +31,7 @@ #include "core/gimp.h" #include "core/gimpimagefile.h" +#include "core/gimpprogress.h" #include "file/file-utils.h" @@ -45,12 +46,22 @@ static void gimp_thumb_box_class_init (GimpThumbBoxClass *klass); static void gimp_thumb_box_init (GimpThumbBox *box); +static void gimp_thumb_box_progress_iface_init (GimpProgressInterface *progress_iface); static void gimp_thumb_box_finalize (GObject *object); static void gimp_thumb_box_style_set (GtkWidget *widget, GtkStyle *prev_style); +static GimpProgress * + gimp_thumb_box_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable); +static void gimp_thumb_box_progress_end (GimpProgress *progress); +static void gimp_thumb_box_progress_set_value (GimpProgress *progress, + gdouble percentage); +static gdouble gimp_thumb_box_progress_get_value (GimpProgress *progress); + static gboolean gimp_thumb_box_ebox_button_press (GtkWidget *widget, GdkEventButton *bevent, GimpThumbBox *box); @@ -92,9 +103,19 @@ gimp_thumb_box_get_type (void) (GInstanceInitFunc) gimp_thumb_box_init, }; + static const GInterfaceInfo progress_iface_info = + { + (GInterfaceInitFunc) gimp_thumb_box_progress_iface_init, + NULL, /* iface_finalize */ + NULL /* iface_data */ + }; + box_type = g_type_register_static (GTK_TYPE_FRAME, "GimpThumbBox", &box_info, 0); + + g_type_add_interface_static (box_type, GIMP_TYPE_PROGRESS, + &progress_iface_info); } return box_type; @@ -119,6 +140,15 @@ gimp_thumb_box_init (GimpThumbBox *box) gtk_frame_set_shadow_type (GTK_FRAME (box), GTK_SHADOW_IN); } +static void +gimp_thumb_box_progress_iface_init (GimpProgressInterface *progress_iface) +{ + progress_iface->start = gimp_thumb_box_progress_start; + progress_iface->end = gimp_thumb_box_progress_end; + progress_iface->set_value = gimp_thumb_box_progress_set_value; + progress_iface->get_value = gimp_thumb_box_progress_get_value; +} + static void gimp_thumb_box_finalize (GObject *object) { @@ -157,6 +187,73 @@ gimp_thumb_box_style_set (GtkWidget *widget, &widget->style->base[GTK_STATE_NORMAL]); } +static GimpProgress * +gimp_thumb_box_progress_start (GimpProgress *progress, + const gchar *message, + gboolean cancelable) +{ + GimpThumbBox *thumb_box = GIMP_THUMB_BOX (progress); + + if (! thumb_box->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (thumb_box->progress); + + gtk_progress_bar_set_fraction (bar, 0.0); + /* gtk_widget_set_sensitive (thumb_box->cancel_button, cancelable); */ + + thumb_box->progress_active = TRUE; + + return progress; + } + + return NULL; +} + +static void +gimp_thumb_box_progress_end (GimpProgress *progress) +{ + GimpThumbBox *thumb_box = GIMP_THUMB_BOX (progress); + + if (thumb_box->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (thumb_box->progress); + + gtk_progress_bar_set_fraction (bar, 0.0); + /* gtk_widget_set_sensitive (thumb_box->cancel_button, FALSE); */ + + thumb_box->progress_active = FALSE; + } +} + +static void +gimp_thumb_box_progress_set_value (GimpProgress *progress, + gdouble percentage) +{ + GimpThumbBox *thumb_box = GIMP_THUMB_BOX (progress); + + if (thumb_box->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (thumb_box->progress); + + gtk_progress_bar_set_fraction (bar, percentage); + } +} + +static gdouble +gimp_thumb_box_progress_get_value (GimpProgress *progress) +{ + GimpThumbBox *thumb_box = GIMP_THUMB_BOX (progress); + + if (thumb_box->progress_active) + { + GtkProgressBar *bar = GTK_PROGRESS_BAR (thumb_box->progress); + + return gtk_progress_bar_get_fraction (bar); + } + + return 0.0; +} + /* public functions */ @@ -172,6 +269,7 @@ gimp_thumb_box_new (Gimp *gimp) GtkWidget *label; gchar *str; GtkRequisition info_requisition; + GtkRequisition thumb_progress_requisition; GtkRequisition progress_requisition; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); @@ -260,14 +358,21 @@ gimp_thumb_box_new (Gimp *gimp) gtk_widget_show (box->info); box->progress = gtk_progress_bar_new (); - gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), "foo"); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), "Fog"); gtk_box_pack_end (GTK_BOX (vbox2), box->progress, FALSE, FALSE, 0); gtk_widget_set_no_show_all (box->progress, TRUE); /* don't gtk_widget_show (box->progress); */ + box->thumb_progress = gtk_progress_bar_new (); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), "Fog"); + gtk_box_pack_end (GTK_BOX (vbox2), box->thumb_progress, FALSE, FALSE, 0); + gtk_widget_set_no_show_all (box->thumb_progress, TRUE); + /* don't gtk_widget_show (box->thumb_progress); */ + /* eek */ - gtk_widget_size_request (box->info, &info_requisition); - gtk_widget_size_request (box->progress, &progress_requisition); + gtk_widget_size_request (box->info, &info_requisition); + gtk_widget_size_request (box->thumb_progress, &thumb_progress_requisition); + gtk_widget_size_request (box->progress, &progress_requisition); gtk_widget_set_size_request (box->info, progress_requisition.width, @@ -275,6 +380,14 @@ gimp_thumb_box_new (Gimp *gimp) gtk_widget_set_size_request (box->filename, progress_requisition.width, -1); + gtk_widget_set_size_request (box->thumb_progress, -1, + thumb_progress_requisition.height); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), ""); + + gtk_widget_set_size_request (box->progress, -1, + progress_requisition.height); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), ""); + return GTK_WIDGET (box); } @@ -366,24 +479,30 @@ gimp_thumb_box_create_thumbnails (GimpThumbBox *box, gtk_widget_set_sensitive (gtk_widget_get_toplevel (GTK_WIDGET (box)), FALSE); + if (box->uris) + gtk_widget_show (box->progress); + n_uris = g_slist_length (box->uris); if (n_uris > 1) { gchar *str; - gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), NULL); - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->progress), 0.0); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), + NULL); + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->thumb_progress), + 0.0); gtk_widget_hide (box->info); - gtk_widget_show (box->progress); + gtk_widget_show (box->thumb_progress); for (list = box->uris->next, i = 0; list; list = g_slist_next (list), i++) { str = g_strdup_printf (_("Thumbnail %d of %d"), i, n_uris); - gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), str); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), + str); g_free (str); while (g_main_context_pending (NULL)) @@ -394,7 +513,7 @@ gimp_thumb_box_create_thumbnails (GimpThumbBox *box, gimp->config->thumbnail_size, always_create); - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->progress), + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->thumb_progress), (gdouble) i / (gdouble) n_uris); @@ -403,7 +522,8 @@ gimp_thumb_box_create_thumbnails (GimpThumbBox *box, } str = g_strdup_printf (_("Thumbnail %d of %d"), n_uris, n_uris); - gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->progress), str); + gtk_progress_bar_set_text (GTK_PROGRESS_BAR (box->thumb_progress), + str); g_free (str); while (g_main_context_pending (NULL)) @@ -419,7 +539,7 @@ gimp_thumb_box_create_thumbnails (GimpThumbBox *box, if (n_uris > 1) { - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->progress), + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (box->thumb_progress), 1.0); while (g_main_context_pending (NULL)) @@ -429,10 +549,13 @@ gimp_thumb_box_create_thumbnails (GimpThumbBox *box, if (n_uris > 1) { - gtk_widget_hide (box->progress); + gtk_widget_hide (box->thumb_progress); gtk_widget_show (box->info); } + if (box->uris) + gtk_widget_hide (box->progress); + gtk_widget_set_sensitive (gtk_widget_get_toplevel (GTK_WIDGET (box)), TRUE); gimp_unset_busy (gimp); @@ -462,6 +585,7 @@ gimp_thumb_box_create_thumbnail (GimpThumbBox *box, { gimp_imagefile_create_thumbnail (box->imagefile, gimp_get_user_context (box->imagefile->gimp), + GIMP_PROGRESS (box), size); } } diff --git a/app/widgets/gimpthumbbox.h b/app/widgets/gimpthumbbox.h index c3dc3e348c..d5b51c6521 100644 --- a/app/widgets/gimpthumbbox.h +++ b/app/widgets/gimpthumbbox.h @@ -40,6 +40,9 @@ struct _GimpThumbBox GtkWidget *preview; GtkWidget *filename; GtkWidget *info; + GtkWidget *thumb_progress; + + gboolean progress_active; GtkWidget *progress; }; diff --git a/app/widgets/gimptoolbox-dnd.c b/app/widgets/gimptoolbox-dnd.c index 530fdb7d57..410ac3ec03 100644 --- a/app/widgets/gimptoolbox-dnd.c +++ b/app/widgets/gimptoolbox-dnd.c @@ -113,7 +113,7 @@ gimp_toolbox_drop_uri_list (GtkWidget *widget, GimpPDBStatusType status; GError *error = NULL; - gimage = file_open_with_display (context->gimp, context, + gimage = file_open_with_display (context->gimp, context, NULL, uri, &status, &error); if (! gimage && status != GIMP_PDB_CANCEL) diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h index 3f0cfa32b0..54e54b5ed8 100644 --- a/app/widgets/widgets-types.h +++ b/app/widgets/widgets-types.h @@ -123,6 +123,7 @@ typedef struct _GimpUIManager GimpUIManager; /* misc dialogs */ typedef struct _GimpFileDialog GimpFileDialog; +typedef struct _GimpProgressDialog GimpProgressDialog; typedef struct _GimpTextEditor GimpTextEditor; typedef struct _GimpViewableDialog GimpToolDialog; typedef struct _GimpViewableDialog GimpViewableDialog; diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c index a704321144..9f8d7ff3e8 100644 --- a/app/xcf/xcf.c +++ b/app/xcf/xcf.c @@ -50,12 +50,14 @@ typedef GimpImage * GimpXcfLoaderFunc (Gimp *gimp, XcfInfo *info); -static Argument * xcf_load_invoker (Gimp *gimp, - GimpContext *context, - Argument *args); -static Argument * xcf_save_invoker (Gimp *gimp, - GimpContext *context, - Argument *args); +static Argument * xcf_load_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args); +static Argument * xcf_save_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args); static ProcArg xcf_load_args[] = @@ -213,9 +215,10 @@ xcf_exit (Gimp *gimp) } static Argument* -xcf_load_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +xcf_load_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { XcfInfo info; Argument *return_args; @@ -262,7 +265,7 @@ xcf_load_invoker (Gimp *gimp, } else if (id[9] == 'v') { - info.file_version = atoi(id + 10); + info.file_version = atoi (id + 10); } else { @@ -304,9 +307,10 @@ xcf_load_invoker (Gimp *gimp, } static Argument * -xcf_save_invoker (Gimp *gimp, - GimpContext *context, - Argument *args) +xcf_save_invoker (Gimp *gimp, + GimpContext *context, + GimpProgress *progress, + Argument *args) { XcfInfo info; Argument *return_args; diff --git a/tools/pdbgen/app.pl b/tools/pdbgen/app.pl index 33a91525ec..e41e104923 100644 --- a/tools/pdbgen/app.pl +++ b/tools/pdbgen/app.pl @@ -498,9 +498,10 @@ CODE } $out->{code} .= "\nstatic Argument *\n"; - $out->{code} .= "${name}_invoker (Gimp *gimp,\n"; - $out->{code} .= ' ' x length($name) . " GimpContext *context,\n"; - $out->{code} .= ' ' x length($name) . " Argument *args)\n{\n"; + $out->{code} .= "${name}_invoker (Gimp *gimp,\n"; + $out->{code} .= ' ' x length($name) . " GimpContext *context,\n"; + $out->{code} .= ' ' x length($name) . " GimpProgress *progress,\n"; + $out->{code} .= ' ' x length($name) . " Argument *args)\n{\n"; my $code = ""; @@ -509,7 +510,7 @@ CODE my ($exec, $fail, $argtype); my $custom = $proc->{invoke}->{code}; - $exec = "procedural_db_execute (gimp, context, $procname, $args)"; + $exec = "procedural_db_execute (gimp, context, progress, $procname, $args)"; $fail = "procedural_db_return_args (\&${name}_proc, FALSE)"; $argtype = 'Argument'; @@ -613,7 +614,7 @@ CODE } $code .= <{pass_through}_invoker (gimp, context, argv); + return $invoke->{pass_through}_invoker (gimp, context, progress, argv); } CODE } diff --git a/tools/pdbgen/pdb/convert.pdb b/tools/pdbgen/pdb/convert.pdb index 5b6a4a4578..c33496ba7d 100644 --- a/tools/pdbgen/pdb/convert.pdb +++ b/tools/pdbgen/pdb/convert.pdb @@ -29,7 +29,7 @@ sub simple_invoke { code => < <<'CODE' { gimp_image_resize (gimage, context, - new_width, new_height, offx, offy, NULL, NULL); + new_width, new_height, offx, offy, NULL); } CODE ); @@ -360,7 +360,7 @@ HELP { gimp_image_scale (gimage, new_width, new_height, gimp->config->interpolation_type, - NULL, NULL); + NULL); } CODE ); @@ -428,7 +428,7 @@ HELP headers => [ qw("core/gimpimage-flip.h") ], code => <<'CODE' { - gimp_image_flip (gimage, context, flip_type, NULL, NULL); + gimp_image_flip (gimage, context, flip_type, NULL); } CODE ); @@ -450,7 +450,7 @@ sub image_rotate { headers => [ qw("core/gimpimage-rotate.h") ], code => <<'CODE' { - gimp_image_rotate (gimage, context, rotate_type, NULL, NULL); + gimp_image_rotate (gimage, context, rotate_type, NULL); } CODE ); diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb index 5b47bfdcac..28a509c730 100644 --- a/tools/pdbgen/pdb/layer.pdb +++ b/tools/pdbgen/pdb/layer.pdb @@ -53,7 +53,7 @@ HELP } if ($op eq 'scale') { - $invoke{code} = "gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height, gimp->config->interpolation_type, NULL, NULL, $args);"; + $invoke{code} = "gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height, gimp->config->interpolation_type, NULL, $args);"; } else { $invoke{code} = "gimp_item_resize (GIMP_ITEM (layer), context, new_width, new_height, $args);"; }