gimp/app/gui/gui-vtable.c

728 lines
22 KiB
C
Raw Normal View History

/* 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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimp-utils.h"
#include "core/gimpbrush.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimppalette.h"
#include "core/gimppattern.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-10 18:47:21 +00:00
#include "core/gimpprogress.h"
#include "text/gimpfont.h"
#include "plug-in/plug-ins.h"
#include "plug-in/plug-in-proc-def.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpbrushselect.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimperrordialog.h"
#include "widgets/gimpfontselect.h"
#include "widgets/gimpgradientselect.h"
#include "widgets/gimphelp.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmenufactory.h"
#include "widgets/gimppaletteselect.h"
#include "widgets/gimppatternselect.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-10 18:47:21 +00:00
#include "widgets/gimpprogressdialog.h"
app/widgets/Makefile.am app/widgets/widgets-types.h new GtkUIManager 2004-04-21 Michael Natterer <mitch@gimp.org> * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpuimanager.[ch]: new GtkUIManager subclass. Adds API to update all action groups and knows which UIs it can create from which XML files. * app/widgets/gimpmenufactory.[ch]: register the XML file basenames along with path of their toplevel menus. Create GimpUIManagers instead of GtkUIManagers and register the XML files and menu paths with them. * app/gui/menus.c: register all XML files and their toplevel menu paths. * app/widgets/gimpeditor.[ch]: also create a GimpUIManager when creating the GtkItemFactory. Added "const gchar *ui_identifier" parameter to gimp_editor_create_menu(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpdataeditor.[ch] * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpitemtreeview.[ch]: added "ui_identifier" parameters to all constructors. * app/widgets/gimpbrusheditor.c * app/widgets/gimpbrushfactoryview.c * app/widgets/gimpbufferview.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainerpopup.c * app/widgets/gimpdocumentview.c * app/widgets/gimperrorconsole.c * app/widgets/gimpfontview.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpimageview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimppatternfactoryview.c * app/widgets/gimptemplateview.c * app/widgets/gimptooloptionseditor.c * app/gui/dialogs-constructors.c * app/gui/gradient-select.c * app/gui/palette-select.c * app/gui/pattern-select.c: pass UI identifiers to the changed functions above. * app/display/gimpdisplayshell.[ch]: added a GimpUIManager for the menubar (menubar creating code still commented out). * app/display/gimpdisplay.c * app/gui/gui-vtable.c: update the ui manager.
2004-04-21 16:33:17 +00:00
#include "widgets/gimpuimanager.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "actions/plug-in-actions.h"
#include "menus/menus.h"
#include "menus/plug-in-menus.h"
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 15:15:23 +00:00
#include "dialogs/dialogs.h"
#include "themes.h"
/* local function prototypes */
static void gui_threads_enter (Gimp *gimp);
static void gui_threads_leave (Gimp *gimp);
static void gui_set_busy (Gimp *gimp);
static void gui_unset_busy (Gimp *gimp);
static void gui_message (Gimp *gimp,
const gchar *domain,
const gchar *message);
static void gui_help (Gimp *gimp,
const gchar *help_domain,
const gchar *help_id);
static const gchar * gui_get_program_class (Gimp *gimp);
static gchar * gui_get_display_name (Gimp *gimp,
gint gdisp_ID,
gint *monitor_number);
static const gchar * gui_get_theme_dir (Gimp *gimp);
static GimpObject * gui_display_get_by_ID (Gimp *gimp,
gint ID);
static gint gui_display_get_ID (GimpObject *display);
static GimpObject * gui_display_create (GimpImage *gimage,
GimpUnit unit,
gdouble scale);
static void gui_display_delete (GimpObject *display);
static void gui_displays_reconnect (Gimp *gimp,
GimpImage *old_image,
GimpImage *new_image);
static void gui_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *plugins_domain);
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-24 16:08:04 +00:00
static void gui_menus_create_item (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path);
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-24 16:08:04 +00:00
static void gui_menus_delete_item (Gimp *gimp,
PlugInProcDef *proc_def);
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-24 16:08:04 +00:00
static void gui_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label);
static GimpProgress * gui_new_progress (Gimp *gimp,
gint display_ID);
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-10 18:47:21 +00:00
static void gui_free_progress (Gimp *gimp,
GimpProgress *progress);
static gboolean gui_pdb_dialog_new (Gimp *gimp,
GimpContext *context,
GimpContainer *container,
const gchar *title,
const gchar *callback_name,
const gchar *object_name,
va_list args);
static gboolean gui_pdb_dialog_set (Gimp *gimp,
GimpContainer *container,
const gchar *callback_name,
const gchar *object_name,
va_list args);
static gboolean gui_pdb_dialog_close (Gimp *gimp,
GimpContainer *container,
const gchar *callback_name);
static void gui_pdb_dialogs_check (Gimp *gimp);
/* public functions */
void
gui_vtable_init (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
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-24 16:08:04 +00:00
gimp->gui.threads_enter = gui_threads_enter;
gimp->gui.threads_leave = gui_threads_leave;
gimp->gui.set_busy = gui_set_busy;
gimp->gui.unset_busy = gui_unset_busy;
gimp->gui.message = gui_message;
gimp->gui.help = gui_help;
gimp->gui.get_program_class = gui_get_program_class;
gimp->gui.get_display_name = gui_get_display_name;
gimp->gui.get_theme_dir = gui_get_theme_dir;
gimp->gui.display_get_by_id = gui_display_get_by_ID;
gimp->gui.display_get_id = gui_display_get_ID;
gimp->gui.display_create = gui_display_create;
gimp->gui.display_delete = gui_display_delete;
gimp->gui.displays_reconnect = gui_displays_reconnect;
gimp->gui.menus_init = gui_menus_init;
gimp->gui.menus_create_item = gui_menus_create_item;
gimp->gui.menus_delete_item = gui_menus_delete_item;
gimp->gui.menus_create_branch = gui_menus_create_branch;
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;
gimp->gui.pdb_dialogs_check = gui_pdb_dialogs_check;
}
/* private functions */
static void
gui_threads_enter (Gimp *gimp)
{
GDK_THREADS_ENTER ();
}
static void
gui_threads_leave (Gimp *gimp)
{
GDK_THREADS_LEAVE ();
}
static void
gui_set_busy (Gimp *gimp)
{
gimp_displays_set_busy (gimp);
gimp_dialog_factories_set_busy ();
gdk_flush ();
}
static void
gui_unset_busy (Gimp *gimp)
{
gimp_displays_unset_busy (gimp);
gimp_dialog_factories_unset_busy ();
gdk_flush ();
}
static void
gui_message (Gimp *gimp,
const gchar *domain,
const gchar *message)
{
switch (gimp->message_handler)
{
case GIMP_ERROR_CONSOLE:
{
GtkWidget *dockable;
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
gdk_screen_get_default (),
"gimp-error-console", -1);
if (dockable)
{
GimpErrorConsole *console;
console = GIMP_ERROR_CONSOLE (GTK_BIN (dockable)->child);
gimp_error_console_add (console,
GIMP_STOCK_WARNING, domain, message);
return;
}
gimp->message_handler = GIMP_MESSAGE_BOX;
}
/* fallthru */
case GIMP_MESSAGE_BOX:
{
GtkWidget *dialog;
dialog = gimp_dialog_factory_dialog_new (global_dialog_factory,
gdk_screen_get_default (),
"gimp-error-dialog", -1,
FALSE);
if (dialog)
{
gimp_error_dialog_add (GIMP_ERROR_DIALOG (dialog),
GIMP_STOCK_WARNING, domain, message);
gtk_window_present (GTK_WINDOW (dialog));
return;
}
gimp->message_handler = GIMP_CONSOLE;
}
/* fallthru */
case GIMP_CONSOLE:
g_printerr ("%s: %s\n\n", domain, message);
break;
}
}
void
gui_help (Gimp *gimp,
const gchar *help_domain,
const gchar *help_id)
{
gimp_help_show (gimp, help_domain, help_id);
}
static const gchar *
gui_get_program_class (Gimp *gimp)
{
return gdk_get_program_class ();
}
static gchar *
gui_get_display_name (Gimp *gimp,
gint gdisp_ID,
gint *monitor_number)
{
GimpDisplay *gdisp = NULL;
GdkScreen *screen;
gint monitor;
if (gdisp_ID > 0)
gdisp = gimp_display_get_by_ID (gimp, gdisp_ID);
if (gdisp)
{
screen = gtk_widget_get_screen (gdisp->shell);
monitor = gdk_screen_get_monitor_at_window (screen,
gdisp->shell->window);
}
else
{
gint x, y;
gdk_display_get_pointer (gdk_display_get_default (),
&screen, &x, &y, NULL);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
}
*monitor_number = monitor;
if (screen)
return gdk_screen_make_display_name (screen);
return NULL;
}
static const gchar *
gui_get_theme_dir (Gimp *gimp)
{
return themes_get_theme_dir (gimp, GIMP_GUI_CONFIG (gimp->config)->theme);
}
static GimpObject *
gui_display_get_by_ID (Gimp *gimp,
gint ID)
{
return (GimpObject *) gimp_display_get_by_ID (gimp, ID);
}
static gint
gui_display_get_ID (GimpObject *display)
{
return gimp_display_get_ID (GIMP_DISPLAY (display));
}
static GimpObject *
gui_display_create (GimpImage *gimage,
GimpUnit unit,
gdouble scale)
{
GimpDisplay *gdisp;
GList *image_managers;
image_managers = gimp_ui_managers_from_name ("<Image>");
gdisp = gimp_display_new (gimage, unit, scale,
global_menu_factory,
image_managers->data);
gimp_context_set_display (gimp_get_user_context (gimage->gimp), gdisp);
gimp_ui_manager_update (GIMP_DISPLAY_SHELL (gdisp->shell)->menubar_manager,
gdisp);
return GIMP_OBJECT (gdisp);
}
static void
gui_display_delete (GimpObject *display)
{
gimp_display_delete (GIMP_DISPLAY (display));
}
static void
gui_displays_reconnect (Gimp *gimp,
GimpImage *old_image,
GimpImage *new_image)
{
gimp_displays_reconnect (gimp, old_image, new_image);
}
static void
gui_menus_init (Gimp *gimp,
GSList *plug_in_defs,
const gchar *std_plugins_domain)
{
plug_in_menus_init (gimp, plug_in_defs, std_plugins_domain);
}
static void
gui_menus_add_proc (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path)
{
gchar *name;
gchar *p;
GList *list;
name = g_strdup (menu_path);
p = strchr (name, '>');
if (p)
{
p[1] = '\0';
for (list = gimp_ui_managers_from_name (name);
list;
list = g_list_next (list))
{
if (! strncmp (menu_path, "<Image>", 7))
{
plug_in_menus_add_proc (list->data, "/image-menubar",
proc_def, menu_path);
plug_in_menus_add_proc (list->data, "/dummy-menubar/image-popup",
proc_def, menu_path);
}
else if (! strncmp (menu_path, "<Toolbox>", 9))
{
plug_in_menus_add_proc (list->data, "/toolbox-menubar",
proc_def, menu_path);
}
}
}
g_free (name);
}
static void
gui_menus_delete_proc (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path)
{
gchar *name;
gchar *p;
GList *list;
name = g_strdup (menu_path);
p = strchr (name, '>');
if (p)
{
p[1] = '\0';
for (list = gimp_ui_managers_from_name (name);
list;
list = g_list_next (list))
{
plug_in_menus_remove_proc (list->data, proc_def);
}
}
g_free (name);
}
static void
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-24 16:08:04 +00:00
gui_menus_create_item (Gimp *gimp,
PlugInProcDef *proc_def,
const gchar *menu_path)
{
Switch from GtkItemFactory to GtkUIManager. The migration is almost 2004-04-29 Michael Natterer <mitch@gimp.org> Switch from GtkItemFactory to GtkUIManager. The migration is almost complete, still stuff missing/incomplete, definitely added a bunch of new bugs... * app/actions/*-commands.[ch]: converted all callback from GtkItemFactory callbacks to GtkAction callbacks. * app/actions/debug-actions.c * app/actions/gradient-editor-actions.c * app/actions/help-actions.c * app/actions/plug-in-actions.c * app/actions/qmask-actions.c * app/actions/tool-options-actions.c: various fixes. * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell-appearance.[ch] * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.[ch]: move everything from GtkItemFactory to GtkUIManager. * app/gui/dialogs.[ch]: added new function dialogs_get_toolbox(). Needed because the action callbacks don't have a widget parameter and sometimes we need a parent window for showing dialogs. * app/gui/Makefile.am * app/gui/brushes-menu.[ch] * app/gui/buffers-menu.[ch] * app/gui/channels-menu.[ch] * app/gui/colormap-editor-menu.[ch] * app/gui/dialogs-menu.[ch] * app/gui/documents-menu.[ch] * app/gui/error-console-menu.[ch] * app/gui/fonts-menu.[ch] * app/gui/gradient-editor-menu.[ch] * app/gui/gradients-menu.[ch] * app/gui/images-menu.[ch] * app/gui/layers-menu.[ch] * app/gui/palette-editor-menu.[ch] * app/gui/palettes-menu.[ch] * app/gui/patterns-menu.[ch] * app/gui/qmask-menu.[ch] * app/gui/templates-menu.[ch] * app/gui/vectors-menu.[ch]: removed these files. * app/gui/gui.c: create a global UI manager for the image popup menu and the toolbox menubar. * app/gui/menus.[ch]: removed all GtkItemFactory code. * app/gui/image-menu.[ch] * app/gui/toolbox-menu.[ch]: removed everything except the trivial setup_funcs. * app/gui/file-open-menu.c * app/gui/file-save-menu.c * app/gui/tool-options-menu.c: don't use the macros from menus.h any more, they are gone. * app/gui/gui-vtable.c * app/gui/plug-in-menus.[ch]: create/destroy the dynamic plug-in menu entries. * app/tools/gimpimagemaptool.c: s/gimp_item_factory_update/ gimp_ui_manager_update/g * app/widgets/gimpuimanager.[ch]: added API to get an action group by name. * app/widgets/gimpmenufactory.c: don't choke on the item_factory entries being NULL. * app/widgets/gimpactiongroup.c: make sure booleans set using g_object_set() only have TRUE or FALSE values. * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcomponenteditor.c * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpdockable.[ch] * app/widgets/gimpdocked.[ch] * app/widgets/gimpeditor.[ch] * app/widgets/gimperrorconsole.c * app/widgets/gimpgradienteditor.c * app/widgets/gimpitemtreeview.c * app/widgets/gimppaletteeditor.c * app/widgets/gimptoolbox.c * app/widgets/gimptooloptionseditor.c: removed all GtkItemFactory code and enable the #if 0'ed UI manager stuff. * menus/gradient-editor-menu.xml: fixed typos. * menus/image-menu.xml: duplicate everything so we have both an image menubar and an image popup menu. Badly cries for an XSL processor. * menus/toolbox-menu.xml: added an "Extensions" placeholder.
2004-04-29 12:52:29 +00:00
GList *list;
for (list = gimp_action_groups_from_name ("plug-in");
list;
list = g_list_next (list))
{
if (menu_path == NULL)
{
plug_in_actions_add_proc (list->data, proc_def);
}
else
{
plug_in_actions_add_path (list->data, proc_def, menu_path);
}
}
if (menu_path == NULL)
{
for (list = proc_def->menu_paths; list; list = g_list_next (list))
gui_menus_add_proc (gimp, proc_def, list->data);
}
else
{
gui_menus_add_proc (gimp, proc_def, menu_path);
}
}
static void
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-24 16:08:04 +00:00
gui_menus_delete_item (Gimp *gimp,
PlugInProcDef *proc_def)
{
GList *list;
for (list = proc_def->menu_paths; list; list = g_list_next (list))
gui_menus_delete_proc (gimp, proc_def, list->data);
for (list = gimp_action_groups_from_name ("plug-in");
list;
list = g_list_next (list))
{
plug_in_actions_remove_proc (list->data, proc_def);
}
}
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-24 16:08:04 +00:00
static void
gui_menus_create_branch (Gimp *gimp,
const gchar *progname,
const gchar *menu_path,
const gchar *menu_label)
{
GList *list;
for (list = gimp_action_groups_from_name ("plug-in");
list;
list = g_list_next (list))
{
plug_in_actions_add_branch (list->data, progname, menu_path, menu_label);
}
}
static GimpProgress *
gui_new_progress (Gimp *gimp,
gint display_ID)
{
GimpDisplay *display = NULL;
if (display_ID > 0)
display = gimp_display_get_by_ID (gimp, display_ID);
if (display)
return GIMP_PROGRESS (display);
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-10 18:47:21 +00:00
return GIMP_PROGRESS (gimp_progress_dialog_new ());
}
static 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-10 18:47:21 +00:00
gui_free_progress (Gimp *gimp,
GimpProgress *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-10 18:47:21 +00:00
g_return_if_fail (GIMP_IS_PROGRESS_DIALOG (progress));
if (GIMP_IS_PROGRESS_DIALOG (progress))
gtk_widget_destroy (GTK_WIDGET (progress));
}
static gboolean
gui_pdb_dialog_new (Gimp *gimp,
GimpContext *context,
GimpContainer *container,
const gchar *title,
const gchar *callback_name,
const gchar *object_name,
va_list args)
{
GType dialog_type = G_TYPE_NONE;
const gchar *dialog_role = NULL;
const gchar *help_id = NULL;
if (container->children_type == GIMP_TYPE_BRUSH)
{
dialog_type = GIMP_TYPE_BRUSH_SELECT;
dialog_role = "gimp-brush-selection";
help_id = GIMP_HELP_BRUSH_DIALOG;
}
else if (container->children_type == GIMP_TYPE_FONT)
{
dialog_type = GIMP_TYPE_FONT_SELECT;
dialog_role = "gimp-font-selection";
help_id = GIMP_HELP_FONT_DIALOG;
}
else if (container->children_type == GIMP_TYPE_GRADIENT)
{
dialog_type = GIMP_TYPE_GRADIENT_SELECT;
dialog_role = "gimp-gradient-selection";
help_id = GIMP_HELP_GRADIENT_DIALOG;
}
else if (container->children_type == GIMP_TYPE_PALETTE)
{
dialog_type = GIMP_TYPE_PALETTE_SELECT;
dialog_role = "gimp-palette-selection";
help_id = GIMP_HELP_PALETTE_DIALOG;
}
else if (container->children_type == GIMP_TYPE_PATTERN)
{
dialog_type = GIMP_TYPE_PATTERN_SELECT;
dialog_role = "gimp-pattern-selection";
help_id = GIMP_HELP_PATTERN_DIALOG;
}
if (dialog_type != G_TYPE_NONE)
{
GimpObject *object = NULL;
if (object_name && strlen (object_name))
object = gimp_container_get_child_by_name (container, object_name);
if (! object)
object = gimp_context_get_by_type (context, container->children_type);
if (object)
{
GParameter *params = NULL;
gint n_params = 0;
GtkWidget *dialog;
params = gimp_parameters_append (dialog_type, params, &n_params,
"title", title,
"role", dialog_role,
"help-func", gimp_standard_help_func,
"help-id", help_id,
"context", context,
"select-type", container->children_type,
"initial-object", object,
"callback-name", callback_name,
"menu-factory", global_menu_factory,
NULL);
params = gimp_parameters_append_valist (dialog_type,
params, &n_params,
args);
dialog = g_object_newv (dialog_type, n_params, params);
gimp_parameters_free (params, n_params);
gtk_widget_show (dialog);
return TRUE;
}
}
return FALSE;
}
static gboolean
gui_pdb_dialog_set (Gimp *gimp,
GimpContainer *container,
const gchar *callback_name,
const gchar *object_name,
va_list args)
{
GimpPdbDialogClass *klass = NULL;
if (container->children_type == GIMP_TYPE_BRUSH)
klass = g_type_class_peek (GIMP_TYPE_BRUSH_SELECT);
else if (container->children_type == GIMP_TYPE_FONT)
klass = g_type_class_peek (GIMP_TYPE_FONT_SELECT);
else if (container->children_type == GIMP_TYPE_GRADIENT)
klass = g_type_class_peek (GIMP_TYPE_GRADIENT_SELECT);
else if (container->children_type == GIMP_TYPE_PALETTE)
klass = g_type_class_peek (GIMP_TYPE_PALETTE_SELECT);
else if (container->children_type == GIMP_TYPE_PATTERN)
klass = g_type_class_peek (GIMP_TYPE_PATTERN_SELECT);
if (klass)
{
GimpPdbDialog *dialog;
dialog = gimp_pdb_dialog_get_by_callback (klass, callback_name);
if (dialog && dialog->select_type == container->children_type)
{
GimpObject *object;
object = gimp_container_get_child_by_name (container, object_name);
if (object)
{
const gchar *prop_name;
gimp_context_set_by_type (dialog->context, dialog->select_type,
object);
prop_name = va_arg (args, const gchar *);
if (prop_name)
g_object_set_valist (G_OBJECT (dialog), prop_name, args);
gtk_window_present (GTK_WINDOW (dialog));
return TRUE;
}
}
}
return FALSE;
}
static gboolean
gui_pdb_dialog_close (Gimp *gimp,
GimpContainer *container,
const gchar *callback_name)
{
GimpPdbDialogClass *klass = NULL;
if (container->children_type == GIMP_TYPE_BRUSH)
klass = g_type_class_peek (GIMP_TYPE_BRUSH_SELECT);
else if (container->children_type == GIMP_TYPE_FONT)
klass = g_type_class_peek (GIMP_TYPE_FONT_SELECT);
else if (container->children_type == GIMP_TYPE_GRADIENT)
klass = g_type_class_peek (GIMP_TYPE_GRADIENT_SELECT);
else if (container->children_type == GIMP_TYPE_PALETTE)
klass = g_type_class_peek (GIMP_TYPE_PALETTE_SELECT);
else if (container->children_type == GIMP_TYPE_PATTERN)
klass = g_type_class_peek (GIMP_TYPE_PATTERN_SELECT);
if (klass)
{
GimpPdbDialog *dialog;
dialog = gimp_pdb_dialog_get_by_callback (klass, callback_name);
if (dialog && dialog->select_type == container->children_type)
{
gtk_widget_destroy (GTK_WIDGET (dialog));
return TRUE;
}
}
return FALSE;
}
static void
gui_pdb_dialogs_check (Gimp *gimp)
{
GimpPdbDialogClass *klass;
if ((klass = g_type_class_peek (GIMP_TYPE_BRUSH_SELECT)))
gimp_pdb_dialogs_check_callback (klass);
if ((klass = g_type_class_peek (GIMP_TYPE_FONT_SELECT)))
gimp_pdb_dialogs_check_callback (klass);
if ((klass = g_type_class_peek (GIMP_TYPE_GRADIENT_SELECT)))
gimp_pdb_dialogs_check_callback (klass);
if ((klass = g_type_class_peek (GIMP_TYPE_PALETTE_SELECT)))
gimp_pdb_dialogs_check_callback (klass);
if ((klass = g_type_class_peek (GIMP_TYPE_PATTERN_SELECT)))
gimp_pdb_dialogs_check_callback (klass);
}