2001-06-26 20:09:43 +08:00
|
|
|
/* 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 <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
#include "gui-types.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
#include "core/gimp.h"
|
2001-10-17 19:33:43 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
|
|
|
#include "core/gimpdrawable-desaturate.h"
|
|
|
|
#include "core/gimpdrawable-equalize.h"
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "core/gimpimage-duplicate.h"
|
|
|
|
|
|
|
|
#include "pdb/procedural_db.h"
|
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-10-13 20:52:30 +08:00
|
|
|
#include "display/gimpdisplay-foreach.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "convert-dialog.h"
|
|
|
|
#include "offset-dialog.h"
|
|
|
|
#include "resize-dialog.h"
|
|
|
|
|
|
|
|
#include "undo.h"
|
|
|
|
|
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
#define return_if_no_display(gdisp,data) \
|
|
|
|
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
|
|
|
|
if (! gdisp) \
|
|
|
|
return
|
|
|
|
|
|
|
|
#define return_if_no_image(gimage,data) \
|
|
|
|
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
|
|
|
if (! gimage) \
|
|
|
|
return
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* local functions */
|
|
|
|
|
|
|
|
static void image_resize_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void image_scale_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void image_scale_warn_callback (GtkWidget *widget,
|
|
|
|
gboolean do_scale,
|
|
|
|
gpointer data);
|
|
|
|
static void image_scale_implement (ImageResize *image_scale);
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
void
|
|
|
|
image_convert_rgb_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
convert_to_rgb (gimage);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
convert_to_grayscale (gimage);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_convert_indexed_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
convert_to_indexed (gimage);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_desaturate_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
2001-06-26 20:09:43 +08:00
|
|
|
GimpDrawable *drawable;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
drawable = gimp_image_active_drawable (gimage);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
if (! gimp_drawable_is_rgb (drawable))
|
|
|
|
{
|
|
|
|
g_message (_("Desaturate operates only on RGB color drawables."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_drawable_desaturate (drawable);
|
|
|
|
|
|
|
|
gdisplays_flush ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_invert_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
2001-06-26 20:09:43 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
Argument *return_vals;
|
|
|
|
gint nreturn_vals;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
drawable = gimp_image_active_drawable (gimage);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
if (gimp_drawable_is_indexed (drawable))
|
|
|
|
{
|
|
|
|
g_message (_("Invert does not operate on indexed drawables."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return_vals =
|
2001-10-29 19:47:11 +08:00
|
|
|
procedural_db_run_proc (gimage->gimp,
|
2001-07-05 03:31:35 +08:00
|
|
|
"gimp_invert",
|
2001-06-26 20:09:43 +08:00
|
|
|
&nreturn_vals,
|
|
|
|
GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
|
|
|
|
GIMP_PDB_END);
|
|
|
|
|
|
|
|
if (!return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
|
|
|
|
g_message (_("Invert operation failed."));
|
|
|
|
|
|
|
|
procedural_db_destroy_args (return_vals, nreturn_vals);
|
|
|
|
|
|
|
|
gdisplays_flush ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_equalize_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
2001-06-26 20:09:43 +08:00
|
|
|
GimpDrawable *drawable;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
drawable = gimp_image_active_drawable (gimage);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
if (gimp_drawable_is_indexed (drawable))
|
|
|
|
{
|
|
|
|
g_message (_("Equalize does not operate on indexed drawables."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_drawable_equalize (drawable, TRUE);
|
|
|
|
|
|
|
|
gdisplays_flush ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_offset_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
offset_dialog_create (gimage);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_resize_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
GimpDisplay *gdisp;
|
2001-06-26 20:09:43 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
ImageResize *image_resize;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
gimage = gdisp->gimage;
|
|
|
|
|
|
|
|
image_resize = g_new0 (ImageResize, 1);
|
|
|
|
|
|
|
|
image_resize->gimage = gimage;
|
2001-10-29 19:47:11 +08:00
|
|
|
image_resize->resize = resize_widget_new (gimage,
|
|
|
|
ResizeWidget,
|
2001-06-26 20:09:43 +08:00
|
|
|
ResizeImage,
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_OBJECT (gimage),
|
2001-11-10 22:17:01 +08:00
|
|
|
"disconnect",
|
2001-06-26 20:09:43 +08:00
|
|
|
gimage->width,
|
|
|
|
gimage->height,
|
|
|
|
gimage->xresolution,
|
|
|
|
gimage->yresolution,
|
|
|
|
gimage->unit,
|
|
|
|
gdisp->dot_for_dot,
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_CALLBACK (image_resize_callback),
|
2001-06-26 20:09:43 +08:00
|
|
|
NULL,
|
|
|
|
image_resize);
|
|
|
|
|
2001-08-15 00:33:28 +08:00
|
|
|
g_object_weak_ref (G_OBJECT (image_resize->resize->resize_shell),
|
|
|
|
(GWeakNotify) g_free,
|
|
|
|
image_resize);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
gtk_widget_show (image_resize->resize->resize_shell);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_scale_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
GimpDisplay *gdisp;
|
2001-06-26 20:09:43 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
ImageResize *image_scale;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
gimage = gdisp->gimage;
|
|
|
|
|
|
|
|
image_scale = g_new0 (ImageResize, 1);
|
|
|
|
|
|
|
|
image_scale->gimage = gimage;
|
2001-10-29 19:47:11 +08:00
|
|
|
image_scale->resize = resize_widget_new (gimage,
|
|
|
|
ScaleWidget,
|
2001-06-26 20:09:43 +08:00
|
|
|
ResizeImage,
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_OBJECT (gimage),
|
2001-11-10 22:17:01 +08:00
|
|
|
"disconnect",
|
2001-06-26 20:09:43 +08:00
|
|
|
gimage->width,
|
|
|
|
gimage->height,
|
|
|
|
gimage->xresolution,
|
|
|
|
gimage->yresolution,
|
|
|
|
gimage->unit,
|
|
|
|
gdisp->dot_for_dot,
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_CALLBACK (image_scale_callback),
|
2001-06-26 20:09:43 +08:00
|
|
|
NULL,
|
|
|
|
image_scale);
|
|
|
|
|
2001-08-15 00:33:28 +08:00
|
|
|
g_object_weak_ref (G_OBJECT (image_scale->resize->resize_shell),
|
|
|
|
(GWeakNotify) g_free,
|
|
|
|
image_scale);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
gtk_widget_show (image_scale->resize->resize_shell);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_duplicate_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
GimpImage *new_gimage;
|
|
|
|
return_if_no_image (gimage, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
new_gimage = gimp_image_duplicate (gimage);
|
2001-08-14 22:53:55 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_create_display (new_gimage->gimp, new_gimage, 0x0101);
|
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (new_gimage));
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
image_resize_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ImageResize *image_resize;
|
|
|
|
|
|
|
|
image_resize = (ImageResize *) data;
|
|
|
|
|
|
|
|
g_assert (image_resize != NULL);
|
|
|
|
g_assert (image_resize->gimage != NULL);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (image_resize->resize->resize_shell, FALSE);
|
|
|
|
|
|
|
|
if (image_resize->resize->width > 0 &&
|
|
|
|
image_resize->resize->height > 0)
|
|
|
|
{
|
|
|
|
gimp_image_resize (image_resize->gimage,
|
|
|
|
image_resize->resize->width,
|
|
|
|
image_resize->resize->height,
|
|
|
|
image_resize->resize->offset_x,
|
|
|
|
image_resize->resize->offset_y);
|
|
|
|
gdisplays_flush ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_message (_("Resize Error: Both width and height must be "
|
|
|
|
"greater than zero."));
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_destroy (image_resize->resize->resize_shell);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
image_scale_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ImageResize *image_scale;
|
|
|
|
|
|
|
|
image_scale = (ImageResize *) data;
|
|
|
|
|
|
|
|
g_assert (image_scale != NULL);
|
|
|
|
g_assert (image_scale->gimage != NULL);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (image_scale->resize->resize_shell, FALSE);
|
|
|
|
|
|
|
|
if (gimp_image_check_scaling (image_scale->gimage,
|
|
|
|
image_scale->resize->width,
|
|
|
|
image_scale->resize->height))
|
|
|
|
{
|
|
|
|
image_scale_implement (image_scale);
|
|
|
|
|
|
|
|
gtk_widget_destroy (image_scale->resize->resize_shell);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
|
|
dialog =
|
|
|
|
gimp_query_boolean_box (_("Layer Too Small"),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/scale_layer_warn.html",
|
|
|
|
FALSE,
|
|
|
|
_("The chosen image size will shrink\n"
|
|
|
|
"some layers completely away.\n"
|
|
|
|
"Is this what you want?"),
|
2001-07-31 01:17:36 +08:00
|
|
|
GTK_STOCK_OK, GTK_STOCK_CANCEL,
|
|
|
|
G_OBJECT (image_scale->resize->resize_shell),
|
2001-06-26 20:09:43 +08:00
|
|
|
"destroy",
|
|
|
|
image_scale_warn_callback,
|
|
|
|
image_scale);
|
|
|
|
gtk_widget_show (dialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
image_scale_warn_callback (GtkWidget *widget,
|
|
|
|
gboolean do_scale,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ImageResize *image_scale;
|
|
|
|
GimpImage *gimage;
|
|
|
|
|
|
|
|
image_scale = (ImageResize *) data;
|
|
|
|
gimage = image_scale->gimage;
|
|
|
|
|
|
|
|
if (do_scale) /* User doesn't mind losing layers... */
|
|
|
|
{
|
|
|
|
image_scale_implement (image_scale);
|
|
|
|
|
|
|
|
gtk_widget_destroy (image_scale->resize->resize_shell);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive (image_scale->resize->resize_shell, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
image_scale_implement (ImageResize *image_scale)
|
|
|
|
{
|
|
|
|
GimpImage *gimage = NULL;
|
|
|
|
gboolean display_flush = FALSE; /* this is a bit ugly:
|
|
|
|
we hijack the flush variable
|
|
|
|
to check if an undo_group was
|
|
|
|
already started */
|
|
|
|
|
|
|
|
g_assert (image_scale != NULL);
|
|
|
|
g_assert (image_scale->gimage != NULL);
|
|
|
|
|
|
|
|
gimage = image_scale->gimage;
|
|
|
|
|
|
|
|
if (image_scale->resize->resolution_x != gimage->xresolution ||
|
|
|
|
image_scale->resize->resolution_y != gimage->yresolution)
|
|
|
|
{
|
|
|
|
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
|
|
|
|
|
|
|
gimp_image_set_resolution (gimage,
|
|
|
|
image_scale->resize->resolution_x,
|
|
|
|
image_scale->resize->resolution_y);
|
|
|
|
|
|
|
|
display_flush = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (image_scale->resize->unit != gimage->unit)
|
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
if (! display_flush)
|
2001-06-26 20:09:43 +08:00
|
|
|
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
|
|
|
|
|
|
|
gimp_image_set_unit (gimage, image_scale->resize->unit);
|
|
|
|
|
|
|
|
display_flush = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (image_scale->resize->width != gimage->width ||
|
|
|
|
image_scale->resize->height != gimage->height)
|
|
|
|
{
|
|
|
|
if (image_scale->resize->width > 0 &&
|
|
|
|
image_scale->resize->height > 0)
|
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
if (! display_flush)
|
2001-06-26 20:09:43 +08:00
|
|
|
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
|
|
|
|
|
|
|
gimp_image_scale (gimage,
|
|
|
|
image_scale->resize->width,
|
|
|
|
image_scale->resize->height);
|
|
|
|
|
|
|
|
display_flush = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_message (_("Scale Error: Both width and height must be "
|
|
|
|
"greater than zero."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display_flush)
|
|
|
|
{
|
|
|
|
undo_push_group_end (gimage);
|
|
|
|
gdisplays_flush ();
|
|
|
|
}
|
|
|
|
}
|