gimp/libgimp/gimpui.c

439 lines
13 KiB
C
Raw Normal View History

/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
added "wm_name", "wm_class", "display_name" and "monitor_number" to the 2003-11-07 Michael Natterer <mitch@gimp.org> * libgimpbase/gimpprotocol.[ch]: added "wm_name", "wm_class", "display_name" and "monitor_number" to the GPConfig message. Increased protocol version number. * libgimp/gimp.[ch] (gimp_config): read them from the GPConfig message and remember them. Added public accessors for the new config values. * libgimp/gimpui.c (gimp_ui_init): pass wm_name and wm_class to gtk_init() and export the display/screen to use to the environment. * app/core/gimp.[ch]: added vtable entries to get the values from the GUI. * app/gui/gui-vtable.c: implement the vtable entries. * app/plug-in/plug-in-run.c: fill in the GPConfig values using the new Gimp vtable functions. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor-commands.c * app/gui/gradients-commands.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/splash.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tips-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimpdock.c * app/widgets/gimperrorconsole.c * app/widgets/gimptexteditor.c * app/widgets/gimptoolbox.c * app/widgets/gimpviewabledialog.[ch] * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c * plug-ins/helpbrowser/dialog.c * plug-ins/ifscompose/ifscompose.c: replaced all calls to gtk_window_set_wmclass() by gtk_window_set_role() and all "const gchar *wmclass_name" parameters by "const gchar *role". Cleaned up the window role strings.
2003-11-08 01:29:02 +08:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#include "config.h"
added new API gimp_color_button_[get|set]_update() which configures the 2003-11-11 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorbutton.[ch]: added new API gimp_color_button_[get|set]_update() which configures the button to emit "color_changed" continuously while the color in the color selection dialog is being changed. Fixes bug #90091. Renamed GimpColorButton struct member "GtkItemFactory *item_factory" to a /*< private >*/ member named "gpointer popup_menu". This is ugly but fixes bug #125115, * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c * app/widgets/gimpcolorpanel.c: changed accordingly. * libgimpwidgets/gimpcolorbutton.c: use a GimpColorSelection with a handmade GimpDialog instead of GtkColorSelectionDialog. Enabled module loading for plug-ins so the color selection can show the color selectors which are implemented in modules: * libgimpwidgets/gimpwidgets-private.[ch]: added GimpEnsureModlesFunc which can be called by modules users. * app/gui/gui.c (gui_libs_init): pass NULL as GimpEnsureModulesFunc since the core loads the modules itself. * libgimp/gimpui.c (gimp_ui_init): pass new private function gimp_ensure_modules() which will load the modules upon first invocation. * libgimp/Makefile.am: link libgimpui against libgimpmodule. * libgimpwidgets/gimpcolorselection.c: call _gimp_ensure_modules_func() if it is non-NULL so color selector modules are available for plug-ins. * tools/pdbgen/pdb/gimprc.pdb: added new PDB wrapper gimp_get_module_load_inhibit(). * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated.
2003-11-12 01:55:45 +08:00
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_WIN32
#include <gdk/gdkwin32.h>
#endif
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#ifdef GDK_WINDOWING_QUARTZ
#include <Cocoa/Cocoa.h>
#endif
#include "gimp.h"
#include "gimpui.h"
#include "libgimpmodule/gimpmodule.h"
2001-08-04 22:10:58 +08:00
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimpwidgets/gimpwidgets-private.h"
2001-08-04 22:10:58 +08:00
/**
* SECTION: gimpui
* @title: gimpui
* @short_description: Common user interface functions. This header includes
* all other GIMP User Interface Library headers.
* @see_also: gtk_init(), gdk_set_use_xshm(), gtk_widget_set_default_visual().
*
* Common user interface functions. This header includes all other
* GIMP User Interface Library headers.
**/
/* local function prototypes */
static void gimp_ui_help_func (const gchar *help_id,
gpointer help_data);
static void gimp_ui_theme_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
GtkCssProvider *css_provider);
static void gimp_ensure_modules (void);
static void gimp_window_transient_realized (GtkWidget *window,
GdkWindow *parent);
static gboolean gimp_window_set_transient_for (GtkWindow *window,
GdkWindow *parent);
#ifdef GDK_WINDOWING_QUARTZ
static void gimp_osx_focus_window (void);
#endif
static gboolean gimp_ui_initialized = FALSE;
/* public functions */
/**
* gimp_ui_init:
* @prog_name: The name of the plug-in which will be passed as argv[0] to
* gtk_init(). It's a convention to use the name of the
* executable and _not_ the PDB procedure name.
* @preview: This parameter is unused and exists for historical
* reasons only.
*
added "wm_name", "wm_class", "display_name" and "monitor_number" to the 2003-11-07 Michael Natterer <mitch@gimp.org> * libgimpbase/gimpprotocol.[ch]: added "wm_name", "wm_class", "display_name" and "monitor_number" to the GPConfig message. Increased protocol version number. * libgimp/gimp.[ch] (gimp_config): read them from the GPConfig message and remember them. Added public accessors for the new config values. * libgimp/gimpui.c (gimp_ui_init): pass wm_name and wm_class to gtk_init() and export the display/screen to use to the environment. * app/core/gimp.[ch]: added vtable entries to get the values from the GUI. * app/gui/gui-vtable.c: implement the vtable entries. * app/plug-in/plug-in-run.c: fill in the GPConfig values using the new Gimp vtable functions. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor-commands.c * app/gui/gradients-commands.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/splash.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tips-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimpdock.c * app/widgets/gimperrorconsole.c * app/widgets/gimptexteditor.c * app/widgets/gimptoolbox.c * app/widgets/gimpviewabledialog.[ch] * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c * plug-ins/helpbrowser/dialog.c * plug-ins/ifscompose/ifscompose.c: replaced all calls to gtk_window_set_wmclass() by gtk_window_set_role() and all "const gchar *wmclass_name" parameters by "const gchar *role". Cleaned up the window role strings.
2003-11-08 01:29:02 +08:00
* This function initializes GTK+ with gtk_init() and initializes GDK's
* image rendering subsystem (GdkRGB) to follow the GIMP main program's
* colormap allocation/installation policy.
*
* It also sets up various other things so that the plug-in user looks
* and behaves like the GIMP core. This includes selecting the GTK+
* theme and setting up the help system as chosen in the GIMP
* preferences. Any plug-in that provides a user interface should call
* this function.
**/
void
gimp_ui_init (const gchar *prog_name,
gboolean preview)
{
const gchar *display_name;
GtkCssProvider *css_provider;
GFileMonitor *css_monitor;
GFile *file;
g_return_if_fail (prog_name != NULL);
if (gimp_ui_initialized)
return;
g_set_prgname (prog_name);
added "wm_name", "wm_class", "display_name" and "monitor_number" to the 2003-11-07 Michael Natterer <mitch@gimp.org> * libgimpbase/gimpprotocol.[ch]: added "wm_name", "wm_class", "display_name" and "monitor_number" to the GPConfig message. Increased protocol version number. * libgimp/gimp.[ch] (gimp_config): read them from the GPConfig message and remember them. Added public accessors for the new config values. * libgimp/gimpui.c (gimp_ui_init): pass wm_name and wm_class to gtk_init() and export the display/screen to use to the environment. * app/core/gimp.[ch]: added vtable entries to get the values from the GUI. * app/gui/gui-vtable.c: implement the vtable entries. * app/plug-in/plug-in-run.c: fill in the GPConfig values using the new Gimp vtable functions. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor-commands.c * app/gui/gradients-commands.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/splash.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tips-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimpdock.c * app/widgets/gimperrorconsole.c * app/widgets/gimptexteditor.c * app/widgets/gimptoolbox.c * app/widgets/gimpviewabledialog.[ch] * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c * plug-ins/helpbrowser/dialog.c * plug-ins/ifscompose/ifscompose.c: replaced all calls to gtk_window_set_wmclass() by gtk_window_set_role() and all "const gchar *wmclass_name" parameters by "const gchar *role". Cleaned up the window role strings.
2003-11-08 01:29:02 +08:00
display_name = gimp_display_name ();
if (display_name)
{
#if defined (GDK_WINDOWING_X11)
g_setenv ("DISPLAY", display_name, TRUE);
#else
g_setenv ("GDK_DISPLAY", display_name, TRUE);
added "wm_name", "wm_class", "display_name" and "monitor_number" to the 2003-11-07 Michael Natterer <mitch@gimp.org> * libgimpbase/gimpprotocol.[ch]: added "wm_name", "wm_class", "display_name" and "monitor_number" to the GPConfig message. Increased protocol version number. * libgimp/gimp.[ch] (gimp_config): read them from the GPConfig message and remember them. Added public accessors for the new config values. * libgimp/gimpui.c (gimp_ui_init): pass wm_name and wm_class to gtk_init() and export the display/screen to use to the environment. * app/core/gimp.[ch]: added vtable entries to get the values from the GUI. * app/gui/gui-vtable.c: implement the vtable entries. * app/plug-in/plug-in-run.c: fill in the GPConfig values using the new Gimp vtable functions. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor-commands.c * app/gui/gradients-commands.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/splash.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tips-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimpdock.c * app/widgets/gimperrorconsole.c * app/widgets/gimptexteditor.c * app/widgets/gimptoolbox.c * app/widgets/gimpviewabledialog.[ch] * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c * plug-ins/helpbrowser/dialog.c * plug-ins/ifscompose/ifscompose.c: replaced all calls to gtk_window_set_wmclass() by gtk_window_set_role() and all "const gchar *wmclass_name" parameters by "const gchar *role". Cleaned up the window role strings.
2003-11-08 01:29:02 +08:00
#endif
}
if (gimp_user_time ())
{
/* Construct a fake startup ID as we only want to pass the
* interaction timestamp, see _gdk_windowing_set_default_display().
*/
gchar *startup_id = g_strdup_printf ("_TIME%u", gimp_user_time ());
g_setenv ("DESKTOP_STARTUP_ID", startup_id, TRUE);
g_free (startup_id);
}
gtk_init (NULL, NULL);
css_provider = gtk_css_provider_new ();
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
file = gimp_directory_file ("theme.css", NULL);
css_monitor = g_file_monitor (file, G_FILE_MONITOR_NONE, NULL, NULL);
g_object_unref (file);
gimp_ui_theme_changed (css_monitor, NULL, NULL, G_FILE_MONITOR_NONE,
css_provider);
g_signal_connect (css_monitor, "changed",
G_CALLBACK (gimp_ui_theme_changed),
css_provider);
g_object_unref (css_provider);
gdk_set_program_class (gimp_wm_class ());
if (gimp_icon_theme_dir ())
{
file = g_file_new_for_path (gimp_icon_theme_dir ());
gimp_icons_set_icon_theme (file);
g_object_unref (file);
}
gimp_widgets_init (gimp_ui_help_func,
tools/pdbgen/Makefile.am tools/pdbgen/groups.pl removed the "Palette" pdb 2004-09-22 Michael Natterer <mitch@gimp.org> * tools/pdbgen/Makefile.am * tools/pdbgen/groups.pl * tools/pdbgen/pdb/palette.pdb: removed the "Palette" pdb group... * tools/pdbgen/pdb/context.pdb: and added its functions to the "Context" namespace instead. * app/pdb/Makefile.am * app/pdb/palette_cmds.c: removed. * app/pdb/procedural_db.c: added them to the pdb_compat hash table. * libgimp/Makefile.am * libgimp/gimppalette_pdb.[ch]: removed. * libgimp/gimppalette.[ch]: new files holding compat functions which call gimp_context_*() functions. * libgimp/gimp.h * libgimp/gimpui.c: changed accordingly. * app/pdb/context_cmds.c * app/pdb/internal_procs.c * libgimp/gimp_pdb.h * libgimp/gimpcontext_pdb.[ch]: regenerated. * plug-ins/MapObject/mapobject_image.c * plug-ins/MapObject/mapobject_preview.c * plug-ins/common/apply_lens.c * plug-ins/common/blinds.c * plug-ins/common/borderaverage.c * plug-ins/common/checkerboard.c * plug-ins/common/colortoalpha.c * plug-ins/common/cubism.c * plug-ins/common/exchange.c * plug-ins/common/film.c * plug-ins/common/gif.c * plug-ins/common/grid.c * plug-ins/common/mapcolor.c * plug-ins/common/mblur.c * plug-ins/common/mng.c * plug-ins/common/mosaic.c * plug-ins/common/papertile.c * plug-ins/common/png.c * plug-ins/common/polar.c * plug-ins/common/semiflatten.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/whirlpinch.c * plug-ins/gfig/gfig-style.c * plug-ins/gfli/gfli.c * plug-ins/ifscompose/ifscompose.c * plug-ins/maze/handy.c * plug-ins/pagecurl/pagecurl.c * plug-ins/pygimp/gimpmodule.c * plug-ins/script-fu/scripts/*.scm: changed accordingly.
2004-09-23 02:43:09 +08:00
gimp_context_get_foreground,
gimp_context_get_background,
added new API gimp_color_button_[get|set]_update() which configures the 2003-11-11 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorbutton.[ch]: added new API gimp_color_button_[get|set]_update() which configures the button to emit "color_changed" continuously while the color in the color selection dialog is being changed. Fixes bug #90091. Renamed GimpColorButton struct member "GtkItemFactory *item_factory" to a /*< private >*/ member named "gpointer popup_menu". This is ugly but fixes bug #125115, * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c * app/widgets/gimpcolorpanel.c: changed accordingly. * libgimpwidgets/gimpcolorbutton.c: use a GimpColorSelection with a handmade GimpDialog instead of GtkColorSelectionDialog. Enabled module loading for plug-ins so the color selection can show the color selectors which are implemented in modules: * libgimpwidgets/gimpwidgets-private.[ch]: added GimpEnsureModlesFunc which can be called by modules users. * app/gui/gui.c (gui_libs_init): pass NULL as GimpEnsureModulesFunc since the core loads the modules itself. * libgimp/gimpui.c (gimp_ui_init): pass new private function gimp_ensure_modules() which will load the modules upon first invocation. * libgimp/Makefile.am: link libgimpui against libgimpmodule. * libgimpwidgets/gimpcolorselection.c: call _gimp_ensure_modules_func() if it is non-NULL so color selector modules are available for plug-ins. * tools/pdbgen/pdb/gimprc.pdb: added new PDB wrapper gimp_get_module_load_inhibit(). * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated.
2003-11-12 01:55:45 +08:00
gimp_ensure_modules);
2001-08-04 22:10:58 +08:00
gimp_dialogs_show_help_button (gimp_show_help_button ());
#ifdef GDK_WINDOWING_QUARTZ
g_idle_add ((GSourceFunc) gimp_osx_focus_window, NULL);
#endif
gimp_ui_initialized = TRUE;
}
static GdkWindow *
gimp_ui_get_foreign_window (guint32 window)
{
#ifdef GDK_WINDOWING_X11
return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#ifdef GDK_WINDOWING_WIN32
return gdk_win32_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
return NULL;
}
/**
* gimp_ui_get_display_window:
* @gdisp_ID: a #GimpDisplay ID.
*
* Returns the #GdkWindow of a display window. The purpose is to allow
* to make plug-in dialogs transient to the image display as explained
* with gdk_window_set_transient_for().
*
* You shouldn't have to call this function directly. Use
* gimp_window_set_transient_for_display() instead.
*
* Return value: A reference to a #GdkWindow or %NULL. You should
* unref the window using g_object_unref() as soon as
* you don't need it any longer.
*
* Since: 2.4
*/
GdkWindow *
gimp_ui_get_display_window (guint32 gdisp_ID)
{
guint32 window;
g_return_val_if_fail (gimp_ui_initialized, NULL);
window = gimp_display_get_window_handle (gdisp_ID);
if (window)
return gimp_ui_get_foreign_window (window);
return NULL;
}
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
/**
* gimp_ui_get_progress_window:
*
* Returns the #GdkWindow of the window this plug-in's progress bar is
* shown in. Use it to make plug-in dialogs transient to this window
* as explained with gdk_window_set_transient_for().
*
* You shouldn't have to call this function directly. Use
* gimp_window_set_transient() instead.
*
* Return value: A reference to a #GdkWindow or %NULL. You should
* unref the window using g_object_unref() as soon as
* you don't need it any longer.
*
* Since: 2.4
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
*/
GdkWindow *
gimp_ui_get_progress_window (void)
{
guint32 window;
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
g_return_val_if_fail (gimp_ui_initialized, NULL);
window = gimp_progress_get_window_handle ();
if (window)
return gimp_ui_get_foreign_window (window);
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
return NULL;
}
#ifdef GDK_WINDOWING_QUARTZ
static void
gimp_window_transient_show (GtkWidget *window)
{
g_signal_handlers_disconnect_by_func (window,
gimp_window_transient_show,
NULL);
[NSApp arrangeInFront: nil];
}
#endif
/**
* gimp_window_set_transient_for_display:
* @window: the #GtkWindow that should become transient
* @gdisp_ID: display ID of the image window that should become the parent
*
* Indicates to the window manager that @window is a transient dialog
* associated with the GIMP image window that is identified by it's
* display ID. See gdk_window_set_transient_for () for more information.
*
* Most of the time you will want to use the convenience function
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
* gimp_window_set_transient().
*
* Since: 2.4
*/
void
gimp_window_set_transient_for_display (GtkWindow *window,
guint32 gdisp_ID)
{
g_return_if_fail (gimp_ui_initialized);
g_return_if_fail (GTK_IS_WINDOW (window));
if (! gimp_window_set_transient_for (window,
gimp_ui_get_display_window (gdisp_ID)))
{
/* if setting the window transient failed, at least set
* WIN_POS_CENTER, which will center the window on the screen
* where the mouse is (see bug #684003).
*/
gtk_window_set_position (window, GTK_WIN_POS_CENTER);
#ifdef GDK_WINDOWING_QUARTZ
g_signal_connect (window, "show",
G_CALLBACK (gimp_window_transient_show),
NULL);
#endif
}
}
/**
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
* gimp_window_set_transient:
* @window: the #GtkWindow that should become transient
*
* Indicates to the window manager that @window is a transient dialog
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
* associated with the GIMP window that the plug-in has been
* started from. See also gimp_window_set_transient_for_display().
*
* Since: 2.4
*/
void
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
gimp_window_set_transient (GtkWindow *window)
{
g_return_if_fail (gimp_ui_initialized);
g_return_if_fail (GTK_IS_WINDOW (window));
if (! gimp_window_set_transient_for (window, gimp_ui_get_progress_window ()))
{
/* see above */
gtk_window_set_position (window, GTK_WIN_POS_CENTER);
#ifdef GDK_WINDOWING_QUARTZ
g_signal_connect (window, "show",
G_CALLBACK (gimp_window_transient_show),
NULL);
#endif
}
}
/* private functions */
static void
changed GimpHelpFunc typedef: - renamed "const gchar *help_data" to "const 2003-08-23 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpwidgetstypes.h: changed GimpHelpFunc typedef: - renamed "const gchar *help_data" to "const gchar *help_id". - added "gpointer help_data". * libgimpwidgets/gimphelpui.[ch]: added "gpointer help_data" to gimp_help_connect(). Removed all fiddling with html links and treat all help IDs as opaque identifiers. * app/core/gimptoolinfo.[ch]: changed "help_data" member to "help_id". * app/widgets/gimpitemfactory.[ch]: removed the "help_path" parameter from gimp_item_factory_new() since we don't fiddle with html file paths any more. Simplifies menu item help a lot. Renamed "help_data" member of struct GimpItemFactoryEntry to "help_id". * app/gui/plug-in-menus.c: changed accordingly. 3rd party plug-ins' menu item help IDs are now encoded as "help_path:help_id". * app/gui/file-open-menu.c * app/gui/file-save-menu.c: when constructing the <Load> and <Save> menus, take the resp. procedures' locale_domain and help_path into account. Fixes translation of 3rd party menu items. Also do the right thing for load/save procs which are implemented as temporary procedures (they are impossible to implement currently but it's nice to do the right thing anyway...). * app/widgets/gimphelp-ids.h: added GIMP_HELP_MAIN identifier. * libgimpwidgets/gimpdialog.[ch] * libgimpwidgets/gimpwidgets.[ch] * libgimp/gimpui.c * app/display/gimpdisplayshell.c * app/gui/gui.c * app/gui/about-dialog.c * app/gui/color-notebook.c * app/gui/dialogs-constructors.c * app/gui/file-dialog-utils.[ch] * app/gui/gradients-commands.c * app/gui/help-commands.c * app/gui/image-menu.c * app/gui/menus.c * app/gui/preferences-dialog.c * app/gui/tips-dialog.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimpimagemaptool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimperrorconsole.c * app/widgets/gimphelp.[ch] * app/widgets/gimpmenufactory.[ch] * app/widgets/gimptexteditor.c * app/widgets/gimptoolbox.c * app/widgets/gimpviewabledialog.[ch] * plug-ins/common/CEL.c * plug-ins/common/CML_explorer.c * plug-ins/common/gee.c * plug-ins/common/gee_zoom.c * plug-ins/common/gqbist.c * plug-ins/common/spheredesigner.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/helpbrowser/helpbrowser.c * plug-ins/ifscompose/ifscompose.c * plug-ins/imagemap/imap_main.c: changed accordingly. Removed trailing whitespace all over the place.
2003-08-24 03:35:05 +08:00
gimp_ui_help_func (const gchar *help_id,
gpointer help_data)
{
gimp_help (NULL, help_id);
}
added new API gimp_color_button_[get|set]_update() which configures the 2003-11-11 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorbutton.[ch]: added new API gimp_color_button_[get|set]_update() which configures the button to emit "color_changed" continuously while the color in the color selection dialog is being changed. Fixes bug #90091. Renamed GimpColorButton struct member "GtkItemFactory *item_factory" to a /*< private >*/ member named "gpointer popup_menu". This is ugly but fixes bug #125115, * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c * app/widgets/gimpcolorpanel.c: changed accordingly. * libgimpwidgets/gimpcolorbutton.c: use a GimpColorSelection with a handmade GimpDialog instead of GtkColorSelectionDialog. Enabled module loading for plug-ins so the color selection can show the color selectors which are implemented in modules: * libgimpwidgets/gimpwidgets-private.[ch]: added GimpEnsureModlesFunc which can be called by modules users. * app/gui/gui.c (gui_libs_init): pass NULL as GimpEnsureModulesFunc since the core loads the modules itself. * libgimp/gimpui.c (gimp_ui_init): pass new private function gimp_ensure_modules() which will load the modules upon first invocation. * libgimp/Makefile.am: link libgimpui against libgimpmodule. * libgimpwidgets/gimpcolorselection.c: call _gimp_ensure_modules_func() if it is non-NULL so color selector modules are available for plug-ins. * tools/pdbgen/pdb/gimprc.pdb: added new PDB wrapper gimp_get_module_load_inhibit(). * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated.
2003-11-12 01:55:45 +08:00
static void
gimp_ui_theme_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
GtkCssProvider *css_provider)
{
gchar *dark = gimp_gimprc_query ("prefer-dark-theme");
gboolean setting = dark && ! strcmp (dark, "yes");
GError *error = NULL;
g_object_set (gtk_settings_get_for_screen (gdk_screen_get_default ()),
"gtk-application-prefer-dark-theme", setting,
NULL);
g_free (dark);
file = gimp_directory_file ("theme.css", NULL);
if (! gtk_css_provider_load_from_file (css_provider, file, &error))
{
g_printerr ("%s: error parsing %s: %s\n", G_STRFUNC,
gimp_file_get_utf8_name (file), error->message);
g_clear_error (&error);
}
g_object_unref (file);
}
added new API gimp_color_button_[get|set]_update() which configures the 2003-11-11 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorbutton.[ch]: added new API gimp_color_button_[get|set]_update() which configures the button to emit "color_changed" continuously while the color in the color selection dialog is being changed. Fixes bug #90091. Renamed GimpColorButton struct member "GtkItemFactory *item_factory" to a /*< private >*/ member named "gpointer popup_menu". This is ugly but fixes bug #125115, * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c * app/widgets/gimpcolorpanel.c: changed accordingly. * libgimpwidgets/gimpcolorbutton.c: use a GimpColorSelection with a handmade GimpDialog instead of GtkColorSelectionDialog. Enabled module loading for plug-ins so the color selection can show the color selectors which are implemented in modules: * libgimpwidgets/gimpwidgets-private.[ch]: added GimpEnsureModlesFunc which can be called by modules users. * app/gui/gui.c (gui_libs_init): pass NULL as GimpEnsureModulesFunc since the core loads the modules itself. * libgimp/gimpui.c (gimp_ui_init): pass new private function gimp_ensure_modules() which will load the modules upon first invocation. * libgimp/Makefile.am: link libgimpui against libgimpmodule. * libgimpwidgets/gimpcolorselection.c: call _gimp_ensure_modules_func() if it is non-NULL so color selector modules are available for plug-ins. * tools/pdbgen/pdb/gimprc.pdb: added new PDB wrapper gimp_get_module_load_inhibit(). * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated.
2003-11-12 01:55:45 +08:00
static void
gimp_ensure_modules (void)
{
static GimpModuleDB *module_db = NULL;
if (! module_db)
{
gchar *load_inhibit = gimp_get_module_load_inhibit ();
gchar *module_path = gimp_gimprc_query ("module-path");
added new API gimp_color_button_[get|set]_update() which configures the 2003-11-11 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorbutton.[ch]: added new API gimp_color_button_[get|set]_update() which configures the button to emit "color_changed" continuously while the color in the color selection dialog is being changed. Fixes bug #90091. Renamed GimpColorButton struct member "GtkItemFactory *item_factory" to a /*< private >*/ member named "gpointer popup_menu". This is ugly but fixes bug #125115, * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c * app/widgets/gimpcolorpanel.c: changed accordingly. * libgimpwidgets/gimpcolorbutton.c: use a GimpColorSelection with a handmade GimpDialog instead of GtkColorSelectionDialog. Enabled module loading for plug-ins so the color selection can show the color selectors which are implemented in modules: * libgimpwidgets/gimpwidgets-private.[ch]: added GimpEnsureModlesFunc which can be called by modules users. * app/gui/gui.c (gui_libs_init): pass NULL as GimpEnsureModulesFunc since the core loads the modules itself. * libgimp/gimpui.c (gimp_ui_init): pass new private function gimp_ensure_modules() which will load the modules upon first invocation. * libgimp/Makefile.am: link libgimpui against libgimpmodule. * libgimpwidgets/gimpcolorselection.c: call _gimp_ensure_modules_func() if it is non-NULL so color selector modules are available for plug-ins. * tools/pdbgen/pdb/gimprc.pdb: added new PDB wrapper gimp_get_module_load_inhibit(). * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated.
2003-11-12 01:55:45 +08:00
module_db = gimp_module_db_new (FALSE);
added new API gimp_color_button_[get|set]_update() which configures the 2003-11-11 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorbutton.[ch]: added new API gimp_color_button_[get|set]_update() which configures the button to emit "color_changed" continuously while the color in the color selection dialog is being changed. Fixes bug #90091. Renamed GimpColorButton struct member "GtkItemFactory *item_factory" to a /*< private >*/ member named "gpointer popup_menu". This is ugly but fixes bug #125115, * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c * app/widgets/gimpcolorpanel.c: changed accordingly. * libgimpwidgets/gimpcolorbutton.c: use a GimpColorSelection with a handmade GimpDialog instead of GtkColorSelectionDialog. Enabled module loading for plug-ins so the color selection can show the color selectors which are implemented in modules: * libgimpwidgets/gimpwidgets-private.[ch]: added GimpEnsureModlesFunc which can be called by modules users. * app/gui/gui.c (gui_libs_init): pass NULL as GimpEnsureModulesFunc since the core loads the modules itself. * libgimp/gimpui.c (gimp_ui_init): pass new private function gimp_ensure_modules() which will load the modules upon first invocation. * libgimp/Makefile.am: link libgimpui against libgimpmodule. * libgimpwidgets/gimpcolorselection.c: call _gimp_ensure_modules_func() if it is non-NULL so color selector modules are available for plug-ins. * tools/pdbgen/pdb/gimprc.pdb: added new PDB wrapper gimp_get_module_load_inhibit(). * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated.
2003-11-12 01:55:45 +08:00
gimp_module_db_set_load_inhibit (module_db, load_inhibit);
gimp_module_db_load (module_db, module_path);
g_free (module_path);
g_free (load_inhibit);
added new API gimp_color_button_[get|set]_update() which configures the 2003-11-11 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorbutton.[ch]: added new API gimp_color_button_[get|set]_update() which configures the button to emit "color_changed" continuously while the color in the color selection dialog is being changed. Fixes bug #90091. Renamed GimpColorButton struct member "GtkItemFactory *item_factory" to a /*< private >*/ member named "gpointer popup_menu". This is ugly but fixes bug #125115, * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell.c * app/widgets/gimpcolorpanel.c: changed accordingly. * libgimpwidgets/gimpcolorbutton.c: use a GimpColorSelection with a handmade GimpDialog instead of GtkColorSelectionDialog. Enabled module loading for plug-ins so the color selection can show the color selectors which are implemented in modules: * libgimpwidgets/gimpwidgets-private.[ch]: added GimpEnsureModlesFunc which can be called by modules users. * app/gui/gui.c (gui_libs_init): pass NULL as GimpEnsureModulesFunc since the core loads the modules itself. * libgimp/gimpui.c (gimp_ui_init): pass new private function gimp_ensure_modules() which will load the modules upon first invocation. * libgimp/Makefile.am: link libgimpui against libgimpmodule. * libgimpwidgets/gimpcolorselection.c: call _gimp_ensure_modules_func() if it is non-NULL so color selector modules are available for plug-ins. * tools/pdbgen/pdb/gimprc.pdb: added new PDB wrapper gimp_get_module_load_inhibit(). * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated.
2003-11-12 01:55:45 +08:00
}
}
static void
gimp_window_transient_realized (GtkWidget *window,
GdkWindow *parent)
{
if (gtk_widget_get_realized (window))
gdk_window_set_transient_for (gtk_widget_get_window (window), parent);
}
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
static gboolean
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
gimp_window_set_transient_for (GtkWindow *window,
GdkWindow *parent)
{
gtk_window_set_transient_for (window, NULL);
#ifndef GDK_WINDOWING_WIN32
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
g_signal_handlers_disconnect_matched (window, G_SIGNAL_MATCH_FUNC,
0, 0, NULL,
gimp_window_transient_realized,
NULL);
if (! parent)
return FALSE;
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
if (gtk_widget_get_realized (GTK_WIDGET (window)))
gdk_window_set_transient_for (gtk_widget_get_window (GTK_WIDGET (window)),
parent);
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
g_signal_connect_object (window, "realize",
G_CALLBACK (gimp_window_transient_realized),
parent, 0);
g_object_unref (parent);
return TRUE;
#endif
return FALSE;
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
}
#ifdef GDK_WINDOWING_QUARTZ
static void
gimp_osx_focus_window (void)
{
[NSApp activateIgnoringOtherApps:YES];
}
#endif