gimp/app/core/gimp-gui.c

408 lines
9.7 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2002 Spencer Kimball, Peter Mattis, and others
*
* 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 <glib-object.h>
2006-02-07 20:47:50 +08:00
#include "libgimpbase/gimpbase.h"
#include "core-types.h"
#include "gimp.h"
#include "gimp-gui.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpimage.h"
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> 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-11 02:47:21 +08:00
#include "gimpprogress.h"
#include "about.h"
#include "gimp-intl.h"
void
gimp_gui_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->gui.ungrab = NULL;
Added API to explicitly register dynamic menu items hierarchies. Fixes bug 2005-03-24 Michael Natterer <mitch@gimp.org> Added API to explicitly register dynamic menu items hierarchies. Fixes bug #170623. * app/core/gimp.h: added "GSList *plug_in_menu_branches". * app/plug-in/plug-in-types.h * app/plug-in/plug-ins.[ch]: added API to register plug-in menu branches, just as for locale and help domans. Cleaned up handling of locale and help domains. (plug_ins_exit): free the registered menu branches. * app/actions/plug-in-actions.[ch] (plug_in_actions_add_branch): new function to explicitly add a menu branch action. (plug_in_actions_setup): add the registered menu branches to each new action group. (plug_in_actions_build_path): always strip the untranslated menu path from underlines before using it as hash table key or action name. * app/menus/plug-in-menus.c (plug_in_menus_add_proc): changed accordingly: strip underlines from untranslated menu paths before passing them to plug_in_menus_build_path(). * app/core/gimp-gui.[ch]: added gimp_menus_create_branch() plus vtable entry to access the new stuff from the core. Renamed the functions desling with items from gimp_foo_entry() to gimp_foo_item(). * app/gui/gui-vtable.c: implement create_branch() and add the branch action to all existing "plug-in" action groups. Note that we don't need to create any menus because that happens implicitly when adding menu items. * tools/pdbgen/pdb/plug_in.pdb (plugin_menu_branch_register): new PDB wrapper to access branch registering from plug-ins. * app/pdb/internal_procs.c * app/pdb/plug_in_cmds.c * libgimp/gimpplugin_pdb.[ch]: regenerated. * libgimp/gimp.def: changed accordingly. * plug-ins/script-fu/script-fu-scripts.c (script_fu_find_scripts): register the menu branches for all included scripts.
2005-03-25 00:08:04 +08:00
gimp->gui.threads_enter = NULL;
gimp->gui.threads_leave = NULL;
gimp->gui.set_busy = NULL;
gimp->gui.unset_busy = NULL;
gimp->gui.show_message = NULL;
Added API to explicitly register dynamic menu items hierarchies. Fixes bug 2005-03-24 Michael Natterer <mitch@gimp.org> Added API to explicitly register dynamic menu items hierarchies. Fixes bug #170623. * app/core/gimp.h: added "GSList *plug_in_menu_branches". * app/plug-in/plug-in-types.h * app/plug-in/plug-ins.[ch]: added API to register plug-in menu branches, just as for locale and help domans. Cleaned up handling of locale and help domains. (plug_ins_exit): free the registered menu branches. * app/actions/plug-in-actions.[ch] (plug_in_actions_add_branch): new function to explicitly add a menu branch action. (plug_in_actions_setup): add the registered menu branches to each new action group. (plug_in_actions_build_path): always strip the untranslated menu path from underlines before using it as hash table key or action name. * app/menus/plug-in-menus.c (plug_in_menus_add_proc): changed accordingly: strip underlines from untranslated menu paths before passing them to plug_in_menus_build_path(). * app/core/gimp-gui.[ch]: added gimp_menus_create_branch() plus vtable entry to access the new stuff from the core. Renamed the functions desling with items from gimp_foo_entry() to gimp_foo_item(). * app/gui/gui-vtable.c: implement create_branch() and add the branch action to all existing "plug-in" action groups. Note that we don't need to create any menus because that happens implicitly when adding menu items. * tools/pdbgen/pdb/plug_in.pdb (plugin_menu_branch_register): new PDB wrapper to access branch registering from plug-ins. * app/pdb/internal_procs.c * app/pdb/plug_in_cmds.c * libgimp/gimpplugin_pdb.[ch]: regenerated. * libgimp/gimp.def: changed accordingly. * plug-ins/script-fu/script-fu-scripts.c (script_fu_find_scripts): register the menu branches for all included scripts.
2005-03-25 00:08:04 +08:00
gimp->gui.help = NULL;
gimp->gui.get_program_class = NULL;
gimp->gui.get_display_name = NULL;
gimp->gui.get_theme_dir = NULL;
gimp->gui.display_get_by_id = NULL;
gimp->gui.display_get_id = NULL;
gimp->gui.display_get_window = NULL;
Added API to explicitly register dynamic menu items hierarchies. Fixes bug 2005-03-24 Michael Natterer <mitch@gimp.org> Added API to explicitly register dynamic menu items hierarchies. Fixes bug #170623. * app/core/gimp.h: added "GSList *plug_in_menu_branches". * app/plug-in/plug-in-types.h * app/plug-in/plug-ins.[ch]: added API to register plug-in menu branches, just as for locale and help domans. Cleaned up handling of locale and help domains. (plug_ins_exit): free the registered menu branches. * app/actions/plug-in-actions.[ch] (plug_in_actions_add_branch): new function to explicitly add a menu branch action. (plug_in_actions_setup): add the registered menu branches to each new action group. (plug_in_actions_build_path): always strip the untranslated menu path from underlines before using it as hash table key or action name. * app/menus/plug-in-menus.c (plug_in_menus_add_proc): changed accordingly: strip underlines from untranslated menu paths before passing them to plug_in_menus_build_path(). * app/core/gimp-gui.[ch]: added gimp_menus_create_branch() plus vtable entry to access the new stuff from the core. Renamed the functions desling with items from gimp_foo_entry() to gimp_foo_item(). * app/gui/gui-vtable.c: implement create_branch() and add the branch action to all existing "plug-in" action groups. Note that we don't need to create any menus because that happens implicitly when adding menu items. * tools/pdbgen/pdb/plug_in.pdb (plugin_menu_branch_register): new PDB wrapper to access branch registering from plug-ins. * app/pdb/internal_procs.c * app/pdb/plug_in_cmds.c * libgimp/gimpplugin_pdb.[ch]: regenerated. * libgimp/gimp.def: changed accordingly. * plug-ins/script-fu/script-fu-scripts.c (script_fu_find_scripts): register the menu branches for all included scripts.
2005-03-25 00:08:04 +08:00
gimp->gui.display_create = NULL;
gimp->gui.display_delete = NULL;
gimp->gui.displays_reconnect = NULL;
gimp->gui.progress_new = NULL;
gimp->gui.progress_free = NULL;
gimp->gui.pdb_dialog_set = NULL;
gimp->gui.pdb_dialog_close = NULL;
}
void
gimp_gui_ungrab (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.ungrab)
gimp->gui.ungrab (gimp);
}
void
gimp_threads_enter (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.threads_enter)
gimp->gui.threads_enter (gimp);
}
void
gimp_threads_leave (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.threads_leave)
gimp->gui.threads_leave (gimp);
}
void
gimp_set_busy (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
/* FIXME: gimp_busy HACK */
gimp->busy++;
if (gimp->busy == 1)
{
if (gimp->gui.set_busy)
gimp->gui.set_busy (gimp);
}
}
static gboolean
gimp_idle_unset_busy (gpointer data)
{
Gimp *gimp = data;
gimp_unset_busy (gimp);
gimp->busy_idle_id = 0;
return FALSE;
}
void
gimp_set_busy_until_idle (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (! gimp->busy_idle_id)
{
gimp_set_busy (gimp);
gimp->busy_idle_id = g_idle_add_full (G_PRIORITY_HIGH,
gimp_idle_unset_busy, gimp,
NULL);
}
}
void
gimp_unset_busy (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (gimp->busy > 0);
/* FIXME: gimp_busy HACK */
gimp->busy--;
if (gimp->busy == 0)
{
if (gimp->gui.unset_busy)
gimp->gui.unset_busy (gimp);
}
}
void
gimp_show_message (Gimp *gimp,
GimpProgress *progress,
const gchar *domain,
const gchar *message)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
g_return_if_fail (message != NULL);
if (! domain)
domain = GIMP_ACRONYM;
if (progress &&
gimp_progress_message (progress, gimp, domain, message))
{
/* message has already been handled by GimpProgress */
}
else if (gimp->gui.show_message && ! gimp->console_messages)
{
gimp->gui.show_message (gimp, progress, domain, message);
}
else
{
g_printerr ("%s: %s\n\n", domain, message);
}
}
void
gimp_help (Gimp *gimp,
const gchar *help_domain,
const gchar *help_id)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.help)
gimp->gui.help (gimp, help_domain, help_id);
}
const gchar *
gimp_get_program_class (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->gui.get_program_class)
return gimp->gui.get_program_class (gimp);
return NULL;
}
gchar *
gimp_get_display_name (Gimp *gimp,
gint display_ID,
gint *monitor_number)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (monitor_number != NULL, NULL);
if (gimp->gui.get_display_name)
return gimp->gui.get_display_name (gimp, display_ID, monitor_number);
*monitor_number = 0;
return NULL;
}
const gchar *
gimp_get_theme_dir (Gimp *gimp)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->gui.get_theme_dir)
return gimp->gui.get_theme_dir (gimp);
return NULL;
}
GimpObject *
gimp_get_display_by_ID (Gimp *gimp,
gint ID)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
if (gimp->gui.display_get_by_id)
return gimp->gui.display_get_by_id (gimp, ID);
return NULL;
}
gint
gimp_get_display_ID (Gimp *gimp,
GimpObject *display)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
g_return_val_if_fail (GIMP_IS_OBJECT (display), -1);
if (gimp->gui.display_get_id)
return gimp->gui.display_get_id (display);
return -1;
}
guint32
gimp_get_display_window (Gimp *gimp,
GimpObject *display)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
g_return_val_if_fail (GIMP_IS_OBJECT (display), -1);
if (gimp->gui.display_get_window)
return gimp->gui.display_get_window (display);
return -1;
}
GimpObject *
gimp_create_display (Gimp *gimp,
GimpImage *image,
GimpUnit unit,
gdouble scale)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
if (gimp->gui.display_create)
return gimp->gui.display_create (image, unit, scale);
return NULL;
}
void
gimp_delete_display (Gimp *gimp,
GimpObject *display)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_OBJECT (display));
if (gimp->gui.display_delete)
gimp->gui.display_delete (display);
}
void
gimp_reconnect_displays (Gimp *gimp,
GimpImage *old_image,
GimpImage *new_image)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_IMAGE (old_image));
g_return_if_fail (GIMP_IS_IMAGE (new_image));
if (gimp->gui.displays_reconnect)
gimp->gui.displays_reconnect (gimp, old_image, new_image);
}
GimpProgress *
gimp_new_progress (Gimp *gimp,
GimpObject *display)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (display == NULL || GIMP_IS_OBJECT (display), NULL);
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> 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-11 02:47:21 +08:00
if (gimp->gui.progress_new)
return gimp->gui.progress_new (gimp, display);
return NULL;
}
void
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> 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-11 02:47:21 +08:00
gimp_free_progress (Gimp *gimp,
GimpProgress *progress)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> 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-11 02:47:21 +08:00
g_return_if_fail (GIMP_IS_PROGRESS (progress));
Redid the whole internal progress stuff: don't pass around 2004-08-10 Michael Natterer <mitch@gimp.org> 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-11 02:47:21 +08:00
if (gimp->gui.progress_free)
gimp->gui.progress_free (gimp, progress);
}
gboolean
gimp_pdb_dialog_new (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpContainer *container,
const gchar *title,
const gchar *callback_name,
const gchar *object_name,
...)
{
gboolean retval = FALSE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (title != NULL, FALSE);
g_return_val_if_fail (callback_name != NULL, FALSE);
if (gimp->gui.pdb_dialog_new)
{
va_list args;
va_start (args, object_name);
retval = gimp->gui.pdb_dialog_new (gimp, context, progress,
container, title,
callback_name, object_name,
args);
va_end (args);
}
return retval;
}
gboolean
gimp_pdb_dialog_set (Gimp *gimp,
GimpContainer *container,
const gchar *callback_name,
const gchar *object_name,
...)
{
gboolean retval = FALSE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (callback_name != NULL, FALSE);
g_return_val_if_fail (object_name != NULL, FALSE);
if (gimp->gui.pdb_dialog_set)
{
va_list args;
va_start (args, object_name);
retval = gimp->gui.pdb_dialog_set (gimp, container, callback_name,
object_name, args);
va_end (args);
}
return retval;
}
gboolean
gimp_pdb_dialog_close (Gimp *gimp,
GimpContainer *container,
const gchar *callback_name)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (callback_name != NULL, FALSE);
if (gimp->gui.pdb_dialog_close)
return gimp->gui.pdb_dialog_close (gimp, container, callback_name);
return FALSE;
}