2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-06-26 20:09:43 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-06-26 20:09:43 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-06-26 20:09:43 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-06-26 20:09:43 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2001-06-26 20:09:43 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2016-05-07 09:01:18 +08:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "actions-types.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
2013-06-23 23:15:30 +08:00
|
|
|
#include "gegl/gimp-babl.h"
|
|
|
|
|
2003-12-09 05:56:22 +08:00
|
|
|
#include "core/core-enums.h"
|
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/gimpimage.h"
|
2015-08-03 04:18:43 +08:00
|
|
|
#include "core/gimpimage-color-profile.h"
|
2012-04-29 22:22:20 +08:00
|
|
|
#include "core/gimpimage-convert-precision.h"
|
2012-06-26 20:38:33 +08:00
|
|
|
#include "core/gimpimage-convert-type.h"
|
2002-03-15 23:09:58 +08:00
|
|
|
#include "core/gimpimage-crop.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "core/gimpimage-duplicate.h"
|
2003-05-19 02:48:36 +08:00
|
|
|
#include "core/gimpimage-flip.h"
|
2002-02-13 22:41:35 +08:00
|
|
|
#include "core/gimpimage-merge.h"
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
#include "core/gimpimage-resize.h"
|
2003-05-20 18:36:29 +08:00
|
|
|
#include "core/gimpimage-rotate.h"
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
#include "core/gimpimage-scale.h"
|
2003-02-13 19:23:50 +08:00
|
|
|
#include "core/gimpimage-undo.h"
|
2015-07-01 21:19:03 +08:00
|
|
|
#include "core/gimpitem.h"
|
2012-09-23 02:35:36 +08:00
|
|
|
#include "core/gimppickable.h"
|
|
|
|
#include "core/gimppickable-auto-shrink.h"
|
2004-08-11 02:47:21 +08:00
|
|
|
#include "core/gimpprogress.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2004-05-25 20:02:54 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
2004-02-01 04:23:53 +08:00
|
|
|
#include "widgets/gimpdock.h"
|
2004-10-27 18:33:08 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2014-05-02 09:01:23 +08:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2002-08-31 05:00:42 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2002-06-27 06:16:59 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2015-08-03 04:20:16 +08:00
|
|
|
#include "dialogs/color-profile-dialog.h"
|
2016-05-01 00:49:02 +08:00
|
|
|
#include "dialogs/convert-indexed-dialog.h"
|
2012-09-24 05:46:11 +08:00
|
|
|
#include "dialogs/convert-precision-dialog.h"
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs/grid-dialog.h"
|
2004-10-24 00:42:37 +08:00
|
|
|
#include "dialogs/image-merge-layers-dialog.h"
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs/image-new-dialog.h"
|
2005-04-05 06:34:29 +08:00
|
|
|
#include "dialogs/image-properties-dialog.h"
|
2004-10-27 09:20:07 +08:00
|
|
|
#include "dialogs/image-scale-dialog.h"
|
2004-11-14 06:27:39 +08:00
|
|
|
#include "dialogs/print-size-dialog.h"
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs/resize-dialog.h"
|
2004-04-20 21:25:55 +08:00
|
|
|
|
2004-05-03 22:03:51 +08:00
|
|
|
#include "actions.h"
|
2002-02-13 22:41:35 +08:00
|
|
|
#include "image-commands.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
|
2012-09-24 05:46:11 +08:00
|
|
|
#define IMAGE_CONVERT_PRECISION_DIALOG_KEY "image-convert-precision-dialog"
|
|
|
|
#define IMAGE_CONVERT_TYPE_DIALOG_KEY "image-convert-type-dialog"
|
2015-08-03 04:20:16 +08:00
|
|
|
#define IMAGE_PROFILE_CONVERT_DIALOG_KEY "image-profile-convert-dialog"
|
|
|
|
#define IMAGE_PROFILE_ASSIGN_DIALOG_KEY "image-profile-assign-dialog"
|
2016-05-07 09:01:18 +08:00
|
|
|
#define IMAGE_PROFILE_SAVE_DIALOG_KEY "image-profile-save-dialog"
|
2012-06-26 19:41:58 +08:00
|
|
|
|
|
|
|
|
2007-05-23 18:42:56 +08:00
|
|
|
typedef struct
|
2001-11-17 01:08:41 +08:00
|
|
|
{
|
2007-05-23 18:42:56 +08:00
|
|
|
GimpContext *context;
|
|
|
|
GimpDisplay *display;
|
|
|
|
} ImageResizeOptions;
|
2004-05-25 22:37:02 +08:00
|
|
|
|
|
|
|
|
2004-05-03 22:46:29 +08:00
|
|
|
/* local function prototypes */
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
static void image_resize_callback (GtkWidget *dialog,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
2005-08-25 01:22:07 +08:00
|
|
|
GimpUnit unit,
|
2004-10-27 18:33:08 +08:00
|
|
|
gint offset_x,
|
|
|
|
gint offset_y,
|
2006-05-19 22:50:46 +08:00
|
|
|
GimpItemSet layer_set,
|
2012-09-06 05:26:54 +08:00
|
|
|
gboolean resize_text_layers,
|
2004-10-24 00:42:37 +08:00
|
|
|
gpointer data);
|
2007-05-23 18:42:56 +08:00
|
|
|
static void image_resize_options_free (ImageResizeOptions *options);
|
|
|
|
|
2004-11-14 06:27:39 +08:00
|
|
|
static void image_print_size_callback (GtkWidget *dialog,
|
|
|
|
GimpImage *image,
|
|
|
|
gdouble xresolution,
|
|
|
|
gdouble yresolution,
|
|
|
|
GimpUnit resolution_unit,
|
|
|
|
gpointer data);
|
2007-05-23 18:42:56 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
static void image_scale_callback (GtkWidget *dialog,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpUnit unit,
|
|
|
|
GimpInterpolationType interpolation,
|
|
|
|
gdouble xresolution,
|
|
|
|
gdouble yresolution,
|
|
|
|
GimpUnit resolution_unit,
|
|
|
|
gpointer user_data);
|
2004-10-27 18:33:08 +08:00
|
|
|
|
2004-10-24 00:42:37 +08:00
|
|
|
static void image_merge_layers_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
ImageMergeLayersDialog *dialog);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
|
2004-10-24 03:13:17 +08:00
|
|
|
/* private variables */
|
|
|
|
|
2011-02-14 16:45:59 +08:00
|
|
|
static GimpMergeType image_merge_layers_type = GIMP_EXPAND_AS_NECESSARY;
|
|
|
|
static gboolean image_merge_layers_merge_active_group = TRUE;
|
|
|
|
static gboolean image_merge_layers_discard_invisible = FALSE;
|
|
|
|
static GimpUnit image_resize_unit = GIMP_UNIT_PIXEL;
|
|
|
|
static GimpUnit image_scale_unit = GIMP_UNIT_PIXEL;
|
|
|
|
static GimpInterpolationType image_scale_interp = -1;
|
2004-10-24 03:13:17 +08:00
|
|
|
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
/* public functions */
|
|
|
|
|
2004-05-25 20:02:54 +08:00
|
|
|
void
|
|
|
|
image_new_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2010-03-01 06:20:57 +08:00
|
|
|
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
|
2004-05-25 20:02:54 +08:00
|
|
|
gtk_widget_get_screen (widget),
|
2014-05-02 09:01:23 +08:00
|
|
|
gimp_widget_get_monitor (widget),
|
2010-05-16 18:19:18 +08:00
|
|
|
NULL /*ui_manager*/,
|
2004-09-13 23:15:23 +08:00
|
|
|
"gimp-image-new-dialog", -1, FALSE);
|
2004-05-25 20:02:54 +08:00
|
|
|
|
|
|
|
if (dialog)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image = action_data_get_image (data);
|
2004-05-25 20:02:54 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
image_new_dialog_set (dialog, image, NULL);
|
2004-09-01 06:41:15 +08:00
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2004-05-25 20:02:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-09 01:32:57 +08:00
|
|
|
void
|
|
|
|
image_duplicate_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *display;
|
|
|
|
GimpImage *image;
|
|
|
|
GimpDisplayShell *shell;
|
|
|
|
GimpImage *new_image;
|
|
|
|
return_if_no_display (display, data);
|
|
|
|
|
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
shell = gimp_display_get_shell (display);
|
|
|
|
|
|
|
|
new_image = gimp_image_duplicate (image);
|
|
|
|
|
|
|
|
gimp_create_display (new_image->gimp, new_image, shell->unit,
|
|
|
|
gimp_zoom_model_get_factor (shell->zoom),
|
|
|
|
G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (shell))),
|
|
|
|
gimp_widget_get_monitor (GTK_WIDGET (shell)));
|
|
|
|
|
|
|
|
g_object_unref (new_image);
|
|
|
|
}
|
|
|
|
|
2006-06-16 17:16:49 +08:00
|
|
|
static void
|
2014-06-16 04:10:06 +08:00
|
|
|
image_convert_type_dialog_unset (GimpImage *image)
|
2006-06-16 17:16:49 +08:00
|
|
|
{
|
2014-06-16 04:10:06 +08:00
|
|
|
g_object_set_data (G_OBJECT (image), IMAGE_CONVERT_TYPE_DIALOG_KEY, NULL);
|
2006-06-16 17:16:49 +08:00
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2012-04-25 22:46:58 +08:00
|
|
|
image_convert_base_type_cmd_callback (GtkAction *action,
|
|
|
|
GtkAction *current,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-06-14 22:36:34 +08:00
|
|
|
GimpImage *image;
|
|
|
|
GimpDisplay *display;
|
2014-06-16 04:10:06 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
2006-06-14 22:36:34 +08:00
|
|
|
GimpImageBaseType value;
|
2007-12-07 03:51:02 +08:00
|
|
|
GError *error = NULL;
|
2006-03-29 01:08:36 +08:00
|
|
|
return_if_no_image (image, data);
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2014-06-16 04:10:06 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-06-14 22:36:34 +08:00
|
|
|
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
|
|
|
|
|
2012-05-08 03:57:33 +08:00
|
|
|
if (value == gimp_image_get_base_type (image))
|
2006-06-14 22:36:34 +08:00
|
|
|
return;
|
|
|
|
|
2014-06-16 04:19:33 +08:00
|
|
|
dialog = g_object_get_data (G_OBJECT (image),
|
|
|
|
IMAGE_CONVERT_TYPE_DIALOG_KEY);
|
2014-06-16 04:10:06 +08:00
|
|
|
|
2016-05-01 00:34:15 +08:00
|
|
|
if (dialog)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
dialog = NULL;
|
|
|
|
}
|
|
|
|
|
2006-06-14 22:36:34 +08:00
|
|
|
switch (value)
|
2004-06-10 22:25:04 +08:00
|
|
|
{
|
|
|
|
case GIMP_RGB:
|
|
|
|
case GIMP_GRAY:
|
2016-05-01 00:34:15 +08:00
|
|
|
if (gimp_image_get_color_profile (image))
|
|
|
|
{
|
|
|
|
ColorProfileDialogType dialog_type;
|
|
|
|
|
|
|
|
if (value == GIMP_RGB)
|
|
|
|
dialog_type = COLOR_PROFILE_DIALOG_CONVERT_TO_RGB;
|
|
|
|
else
|
|
|
|
dialog_type = COLOR_PROFILE_DIALOG_CONVERT_TO_GRAY;
|
|
|
|
|
|
|
|
dialog = color_profile_dialog_new (dialog_type,
|
|
|
|
image,
|
|
|
|
action_data_get_context (data),
|
|
|
|
widget,
|
|
|
|
GIMP_PROGRESS (display));
|
|
|
|
}
|
|
|
|
else if (! gimp_image_convert_type (image, value, NULL, NULL, &error))
|
2007-12-07 03:51:02 +08:00
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_message_literal (image->gimp,
|
2013-09-15 00:59:20 +08:00
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
error->message);
|
2007-12-07 03:51:02 +08:00
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
2004-06-10 22:25:04 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_INDEXED:
|
2016-05-01 00:49:02 +08:00
|
|
|
dialog = convert_indexed_dialog_new (image,
|
|
|
|
action_data_get_context (data),
|
|
|
|
widget,
|
|
|
|
GIMP_PROGRESS (display));
|
2016-05-01 00:34:15 +08:00
|
|
|
break;
|
|
|
|
}
|
2006-06-16 17:16:49 +08:00
|
|
|
|
2016-05-01 00:34:15 +08:00
|
|
|
if (dialog)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (image),
|
|
|
|
IMAGE_CONVERT_TYPE_DIALOG_KEY, dialog);
|
2006-06-16 17:16:49 +08:00
|
|
|
|
2016-05-01 00:34:15 +08:00
|
|
|
g_signal_connect_object (dialog, "destroy",
|
|
|
|
G_CALLBACK (image_convert_type_dialog_unset),
|
|
|
|
image, G_CONNECT_SWAPPED);
|
2006-06-16 17:16:49 +08:00
|
|
|
|
2014-06-16 04:10:06 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2004-06-10 22:25:04 +08:00
|
|
|
}
|
2006-06-16 17:16:49 +08:00
|
|
|
|
2014-06-16 04:10:06 +08:00
|
|
|
/* always flush, also when only the indexed dialog was shown, so the
|
|
|
|
* menu items get updated back to the current image type
|
|
|
|
*/
|
2006-06-16 17:16:49 +08:00
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2012-09-24 05:46:11 +08:00
|
|
|
static void
|
2014-06-16 04:19:33 +08:00
|
|
|
image_convert_precision_dialog_unset (GimpImage *image)
|
2012-09-24 05:46:11 +08:00
|
|
|
{
|
2014-06-16 04:19:33 +08:00
|
|
|
g_object_set_data (G_OBJECT (image), IMAGE_CONVERT_PRECISION_DIALOG_KEY, NULL);
|
2012-09-24 05:46:11 +08:00
|
|
|
}
|
|
|
|
|
2012-04-25 22:46:58 +08:00
|
|
|
void
|
|
|
|
image_convert_precision_cmd_callback (GtkAction *action,
|
|
|
|
GtkAction *current,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2015-11-23 06:19:49 +08:00
|
|
|
GimpImage *image;
|
|
|
|
GimpDisplay *display;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
GimpComponentType value;
|
2012-04-25 22:46:58 +08:00
|
|
|
return_if_no_image (image, data);
|
|
|
|
return_if_no_display (display, data);
|
2014-06-16 04:19:33 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2012-04-25 22:46:58 +08:00
|
|
|
|
|
|
|
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
|
|
|
|
|
2015-11-23 06:19:49 +08:00
|
|
|
if (value == gimp_image_get_component_type (image))
|
2012-04-25 22:46:58 +08:00
|
|
|
return;
|
|
|
|
|
2014-06-16 04:19:33 +08:00
|
|
|
dialog = g_object_get_data (G_OBJECT (image),
|
|
|
|
IMAGE_CONVERT_PRECISION_DIALOG_KEY);
|
|
|
|
|
2015-11-23 06:19:49 +08:00
|
|
|
if (! dialog)
|
2012-09-24 05:46:11 +08:00
|
|
|
{
|
2015-11-23 06:19:49 +08:00
|
|
|
dialog = convert_precision_dialog_new (image,
|
|
|
|
action_data_get_context (data),
|
|
|
|
widget,
|
|
|
|
value,
|
|
|
|
GIMP_PROGRESS (display));
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (image),
|
|
|
|
IMAGE_CONVERT_PRECISION_DIALOG_KEY, dialog);
|
|
|
|
|
|
|
|
g_signal_connect_object (dialog, "destroy",
|
|
|
|
G_CALLBACK (image_convert_precision_dialog_unset),
|
|
|
|
image, G_CONNECT_SWAPPED);
|
|
|
|
}
|
2012-09-24 05:46:11 +08:00
|
|
|
|
2015-11-23 06:19:49 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2012-09-24 05:46:11 +08:00
|
|
|
|
2015-11-23 06:19:49 +08:00
|
|
|
/* see comment above */
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
2012-09-24 05:46:11 +08:00
|
|
|
|
2015-11-23 06:19:49 +08:00
|
|
|
void
|
|
|
|
image_convert_gamma_cmd_callback (GtkAction *action,
|
|
|
|
GtkAction *current,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
GimpDisplay *display;
|
|
|
|
gboolean value;
|
|
|
|
GimpPrecision precision;
|
|
|
|
return_if_no_image (image, data);
|
|
|
|
return_if_no_display (display, data);
|
2014-06-16 04:19:33 +08:00
|
|
|
|
2015-11-23 06:19:49 +08:00
|
|
|
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
|
2012-09-24 05:46:11 +08:00
|
|
|
|
2015-11-23 06:19:49 +08:00
|
|
|
if (value == gimp_babl_format_get_linear (gimp_image_get_layer_format (image,
|
|
|
|
FALSE)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
precision = gimp_babl_precision (gimp_image_get_component_type (image),
|
|
|
|
value);
|
|
|
|
|
|
|
|
gimp_image_convert_precision (image, precision, 0, 0, 0,
|
|
|
|
GIMP_PROGRESS (display));
|
2012-04-25 22:46:58 +08:00
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
|
2016-05-09 01:27:29 +08:00
|
|
|
void
|
|
|
|
image_color_management_enabled_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
gboolean enabled;
|
|
|
|
return_if_no_image (image, data);
|
|
|
|
|
|
|
|
enabled = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
if (enabled != gimp_image_get_is_color_managed (image))
|
|
|
|
{
|
|
|
|
gimp_image_set_is_color_managed (image, enabled, TRUE);
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-03 04:20:16 +08:00
|
|
|
static void
|
|
|
|
image_profile_assign_dialog_unset (GimpImage *image)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (image), IMAGE_PROFILE_ASSIGN_DIALOG_KEY, NULL);
|
|
|
|
}
|
|
|
|
|
2015-06-16 02:19:32 +08:00
|
|
|
void
|
|
|
|
image_color_profile_assign_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2015-08-03 04:20:16 +08:00
|
|
|
GimpImage *image;
|
|
|
|
GimpDisplay *display;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
2015-06-16 02:19:32 +08:00
|
|
|
return_if_no_image (image, data);
|
2015-08-03 04:20:16 +08:00
|
|
|
return_if_no_display (display, data);
|
|
|
|
return_if_no_widget (widget, data);
|
2015-06-16 02:19:32 +08:00
|
|
|
|
2015-08-03 04:20:16 +08:00
|
|
|
dialog = g_object_get_data (G_OBJECT (image),
|
|
|
|
IMAGE_PROFILE_ASSIGN_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
2016-04-29 18:53:43 +08:00
|
|
|
dialog = color_profile_dialog_new (COLOR_PROFILE_DIALOG_ASSIGN_PROFILE,
|
|
|
|
image,
|
|
|
|
action_data_get_context (data),
|
|
|
|
widget,
|
|
|
|
GIMP_PROGRESS (display));
|
2015-08-03 04:20:16 +08:00
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (image),
|
|
|
|
IMAGE_PROFILE_ASSIGN_DIALOG_KEY, dialog);
|
|
|
|
|
|
|
|
g_signal_connect_object (dialog, "destroy",
|
|
|
|
G_CALLBACK (image_profile_assign_dialog_unset),
|
|
|
|
image, G_CONNECT_SWAPPED);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
image_profile_convert_dialog_unset (GimpImage *image)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (image), IMAGE_PROFILE_CONVERT_DIALOG_KEY, NULL);
|
2015-06-16 02:19:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_color_profile_convert_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2015-08-03 04:20:16 +08:00
|
|
|
GimpImage *image;
|
|
|
|
GimpDisplay *display;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
2015-06-16 02:19:32 +08:00
|
|
|
return_if_no_image (image, data);
|
2015-08-03 04:20:16 +08:00
|
|
|
return_if_no_display (display, data);
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
|
|
|
dialog = g_object_get_data (G_OBJECT (image),
|
|
|
|
IMAGE_PROFILE_CONVERT_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
2016-04-29 18:53:43 +08:00
|
|
|
dialog = color_profile_dialog_new (COLOR_PROFILE_DIALOG_CONVERT_TO_PROFILE,
|
|
|
|
image,
|
|
|
|
action_data_get_context (data),
|
|
|
|
widget,
|
|
|
|
GIMP_PROGRESS (display));
|
2015-08-03 04:20:16 +08:00
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (image),
|
|
|
|
IMAGE_PROFILE_CONVERT_DIALOG_KEY, dialog);
|
|
|
|
|
|
|
|
g_signal_connect_object (dialog, "destroy",
|
|
|
|
G_CALLBACK (image_profile_convert_dialog_unset),
|
|
|
|
image, G_CONNECT_SWAPPED);
|
|
|
|
}
|
2015-06-16 02:19:32 +08:00
|
|
|
|
2015-08-03 04:20:16 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2015-06-16 02:19:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_color_profile_discard_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
return_if_no_image (image, data);
|
|
|
|
|
|
|
|
gimp_image_set_color_profile (image, NULL, NULL);
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
|
2016-05-07 09:01:18 +08:00
|
|
|
static void
|
|
|
|
image_profile_save_dialog_unset (GimpImage *image)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (image), IMAGE_PROFILE_SAVE_DIALOG_KEY, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
image_profile_save_dialog_response (GtkWidget *dialog,
|
|
|
|
gint response_id,
|
|
|
|
GimpImage *image)
|
|
|
|
{
|
|
|
|
if (response_id == GTK_RESPONSE_ACCEPT)
|
|
|
|
{
|
|
|
|
GimpColorProfile *profile;
|
|
|
|
GFile *file;
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
|
|
|
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
|
|
|
|
|
|
|
if (! file)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (! gimp_color_profile_save_to_file (profile, file, &error))
|
|
|
|
{
|
|
|
|
gimp_message (image->gimp, NULL,
|
|
|
|
GIMP_MESSAGE_WARNING,
|
|
|
|
_("Saving color profile failed: %s"),
|
|
|
|
error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
g_object_unref (file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref (file);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_color_profile_save_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
GimpDisplay *display;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
return_if_no_image (image, data);
|
|
|
|
return_if_no_display (display, data);
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
|
|
|
dialog = g_object_get_data (G_OBJECT (image),
|
|
|
|
IMAGE_PROFILE_SAVE_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
|
|
|
GtkWindow *toplevel;
|
|
|
|
GimpColorProfile *profile;
|
|
|
|
gchar *basename;
|
|
|
|
|
|
|
|
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (widget));
|
|
|
|
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
|
|
|
|
|
|
|
dialog =
|
|
|
|
gimp_color_profile_chooser_dialog_new (_("Save Color Profile"),
|
|
|
|
toplevel,
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SAVE);
|
|
|
|
|
|
|
|
basename = g_strconcat (gimp_color_profile_get_label (profile),
|
|
|
|
".icc", NULL);
|
|
|
|
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename);
|
|
|
|
g_free (basename);
|
|
|
|
|
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
G_CALLBACK (image_profile_save_dialog_response),
|
|
|
|
image);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (image),
|
|
|
|
IMAGE_PROFILE_SAVE_DIALOG_KEY, dialog);
|
|
|
|
|
|
|
|
g_signal_connect_object (dialog, "destroy",
|
|
|
|
G_CALLBACK (image_profile_save_dialog_unset),
|
|
|
|
image, G_CONNECT_SWAPPED);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
image_resize_cmd_callback (GtkAction *action,
|
2006-04-12 20:49:29 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2004-05-25 22:37:02 +08:00
|
|
|
ImageResizeOptions *options;
|
2005-08-25 01:22:07 +08:00
|
|
|
GimpImage *image;
|
2004-10-27 18:33:08 +08:00
|
|
|
GtkWidget *widget;
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2004-10-27 18:33:08 +08:00
|
|
|
GtkWidget *dialog;
|
2005-08-25 01:22:07 +08:00
|
|
|
return_if_no_image (image, data);
|
2004-10-27 18:33:08 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2007-05-23 18:42:56 +08:00
|
|
|
options = g_slice_new (ImageResizeOptions);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
options->display = display;
|
2004-10-27 18:33:08 +08:00
|
|
|
options->context = action_data_get_context (data);
|
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
if (image_resize_unit != GIMP_UNIT_PERCENT)
|
2009-10-05 01:56:39 +08:00
|
|
|
image_resize_unit = gimp_display_get_shell (display)->unit;
|
2005-08-25 01:22:07 +08:00
|
|
|
|
|
|
|
dialog = resize_dialog_new (GIMP_VIEWABLE (image),
|
2006-09-01 19:26:54 +08:00
|
|
|
action_data_get_context (data),
|
2004-10-27 18:33:08 +08:00
|
|
|
_("Set Image Canvas Size"), "gimp-image-resize",
|
|
|
|
widget,
|
|
|
|
gimp_standard_help_func, GIMP_HELP_IMAGE_RESIZE,
|
2006-10-15 00:51:30 +08:00
|
|
|
image_resize_unit,
|
2004-10-27 18:33:08 +08:00
|
|
|
image_resize_callback,
|
|
|
|
options);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
g_signal_connect_object (display, "disconnect",
|
2002-09-08 20:18:23 +08:00
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
2004-10-27 18:33:08 +08:00
|
|
|
dialog, G_CONNECT_SWAPPED);
|
2002-09-08 20:18:23 +08:00
|
|
|
|
2007-05-23 18:42:56 +08:00
|
|
|
g_object_weak_ref (G_OBJECT (dialog),
|
|
|
|
(GWeakNotify) image_resize_options_free, options);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
gtk_widget_show (dialog);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2004-09-05 06:08:43 +08:00
|
|
|
void
|
|
|
|
image_resize_to_layers_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image;
|
2004-09-05 06:08:43 +08:00
|
|
|
GimpProgress *progress;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2004-09-05 06:08:43 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
2014-07-13 05:45:20 +08:00
|
|
|
progress = gimp_progress_start (GIMP_PROGRESS (display), FALSE,
|
|
|
|
_("Resizing"));
|
2004-09-05 06:08:43 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_resize_to_layers (image,
|
2004-09-05 06:08:43 +08:00
|
|
|
action_data_get_context (data),
|
|
|
|
progress);
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_flush (image);
|
2004-09-05 06:08:43 +08:00
|
|
|
}
|
|
|
|
|
2007-06-10 01:17:30 +08:00
|
|
|
void
|
|
|
|
image_resize_to_selection_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *display;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image;
|
2007-06-10 01:17:30 +08:00
|
|
|
GimpProgress *progress;
|
|
|
|
return_if_no_display (display, data);
|
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
2014-07-13 05:45:20 +08:00
|
|
|
progress = gimp_progress_start (GIMP_PROGRESS (display), FALSE,
|
|
|
|
_("Resizing"));
|
2007-06-10 01:17:30 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_resize_to_selection (image,
|
2007-06-10 01:17:30 +08:00
|
|
|
action_data_get_context (data),
|
|
|
|
progress);
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_flush (image);
|
2007-06-10 01:17:30 +08:00
|
|
|
}
|
|
|
|
|
2004-11-14 06:27:39 +08:00
|
|
|
void
|
|
|
|
image_print_size_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image;
|
2004-11-14 06:27:39 +08:00
|
|
|
GtkWidget *widget;
|
2009-10-07 01:20:44 +08:00
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2004-11-14 06:27:39 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
|
|
|
dialog = print_size_dialog_new (image,
|
2006-09-01 19:26:54 +08:00
|
|
|
action_data_get_context (data),
|
2004-11-14 06:27:39 +08:00
|
|
|
_("Set Image Print Resolution"),
|
|
|
|
"gimp-image-print-size",
|
|
|
|
widget,
|
|
|
|
gimp_standard_help_func,
|
|
|
|
GIMP_HELP_IMAGE_PRINT_SIZE,
|
|
|
|
image_print_size_callback,
|
|
|
|
NULL);
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
g_signal_connect_object (display, "disconnect",
|
2004-11-14 06:27:39 +08:00
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
|
|
|
dialog, G_CONNECT_SWAPPED);
|
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
image_scale_cmd_callback (GtkAction *action,
|
2006-04-12 20:49:29 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-10-15 00:51:30 +08:00
|
|
|
GimpDisplay *display;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image;
|
2006-10-15 00:51:30 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2004-10-27 09:20:07 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
if (image_scale_unit != GIMP_UNIT_PERCENT)
|
2009-10-05 01:56:39 +08:00
|
|
|
image_scale_unit = gimp_display_get_shell (display)->unit;
|
2006-10-15 00:51:30 +08:00
|
|
|
|
|
|
|
if (image_scale_interp == -1)
|
2009-10-05 02:05:28 +08:00
|
|
|
image_scale_interp = display->gimp->config->interpolation_type;
|
2006-10-15 00:51:30 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
dialog = image_scale_dialog_new (image,
|
2004-10-27 09:20:07 +08:00
|
|
|
action_data_get_context (data),
|
|
|
|
widget,
|
2006-10-15 00:51:30 +08:00
|
|
|
image_scale_unit,
|
|
|
|
image_scale_interp,
|
|
|
|
image_scale_callback,
|
|
|
|
display);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
g_signal_connect_object (display, "disconnect",
|
2004-10-31 02:11:16 +08:00
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
2006-10-15 00:51:30 +08:00
|
|
|
dialog, G_CONNECT_SWAPPED);
|
2004-10-31 02:11:16 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
gtk_widget_show (dialog);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:48:36 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
image_flip_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
2003-05-19 02:48:36 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image;
|
2003-05-19 02:48:36 +08:00
|
|
|
GimpProgress *progress;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2003-05-19 02:48:36 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
2014-07-13 05:45:20 +08:00
|
|
|
progress = gimp_progress_start (GIMP_PROGRESS (display), FALSE,
|
|
|
|
_("Flipping"));
|
2003-05-19 02:48:36 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_flip (image, action_data_get_context (data),
|
2004-08-11 02:47:21 +08:00
|
|
|
(GimpOrientationType) value, progress);
|
2003-05-19 02:48:36 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2003-05-19 02:48:36 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_flush (image);
|
2003-05-19 02:48:36 +08:00
|
|
|
}
|
|
|
|
|
2003-05-20 18:36:29 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
image_rotate_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
2003-05-20 18:36:29 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image;
|
2003-05-20 18:36:29 +08:00
|
|
|
GimpProgress *progress;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2003-05-20 18:36:29 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
2014-07-13 05:45:20 +08:00
|
|
|
progress = gimp_progress_start (GIMP_PROGRESS (display), FALSE,
|
|
|
|
_("Rotating"));
|
2003-05-20 18:36:29 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_rotate (image, action_data_get_context (data),
|
2004-08-11 02:47:21 +08:00
|
|
|
(GimpRotationType) value, progress);
|
2003-05-20 18:36:29 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2003-05-20 18:36:29 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
gimp_image_flush (image);
|
2003-05-20 18:36:29 +08:00
|
|
|
}
|
|
|
|
|
2002-03-15 23:09:58 +08:00
|
|
|
void
|
2012-09-23 02:35:36 +08:00
|
|
|
image_crop_to_selection_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
2002-03-15 23:09:58 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2006-10-10 02:49:15 +08:00
|
|
|
GtkWidget *widget;
|
2015-07-04 00:56:59 +08:00
|
|
|
gint x, y, w, h;
|
2006-03-29 01:08:36 +08:00
|
|
|
return_if_no_image (image, data);
|
2006-10-10 02:49:15 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2002-03-15 23:09:58 +08:00
|
|
|
|
2015-07-01 21:19:03 +08:00
|
|
|
if (! gimp_item_bounds (GIMP_ITEM (gimp_image_get_mask (image)),
|
2015-07-04 00:56:59 +08:00
|
|
|
&x, &y, &w, &h))
|
2002-03-15 23:09:58 +08:00
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_message_literal (image->gimp,
|
2013-09-15 00:59:20 +08:00
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
_("Cannot crop because the current selection is empty."));
|
2002-03-15 23:09:58 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-09-23 02:35:36 +08:00
|
|
|
gimp_image_crop (image, action_data_get_context (data),
|
2015-07-04 00:56:59 +08:00
|
|
|
x, y, w, h, TRUE);
|
2012-09-23 02:35:36 +08:00
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
image_crop_to_content_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
GtkWidget *widget;
|
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
return_if_no_image (image, data);
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2014-08-31 23:38:49 +08:00
|
|
|
switch (gimp_pickable_auto_shrink (GIMP_PICKABLE (image),
|
|
|
|
0, 0,
|
|
|
|
gimp_image_get_width (image),
|
|
|
|
gimp_image_get_height (image),
|
|
|
|
&x1, &y1, &x2, &y2))
|
2012-09-23 02:35:36 +08:00
|
|
|
{
|
2014-08-31 23:38:49 +08:00
|
|
|
case GIMP_AUTO_SHRINK_SHRINK:
|
|
|
|
gimp_image_crop (image, action_data_get_context (data),
|
2015-07-04 00:56:59 +08:00
|
|
|
x1, y1, x2 - x1, y2 - y1, TRUE);
|
2014-08-31 23:38:49 +08:00
|
|
|
gimp_image_flush (image);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_AUTO_SHRINK_EMPTY:
|
2012-09-23 02:35:36 +08:00
|
|
|
gimp_message_literal (image->gimp,
|
2014-08-31 23:38:49 +08:00
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_INFO,
|
2013-09-15 00:59:20 +08:00
|
|
|
_("Cannot crop because the image has no content."));
|
2014-08-31 23:38:49 +08:00
|
|
|
break;
|
2012-09-23 02:35:36 +08:00
|
|
|
|
2014-08-31 23:38:49 +08:00
|
|
|
case GIMP_AUTO_SHRINK_UNSHRINKABLE:
|
|
|
|
gimp_message_literal (image->gimp,
|
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_INFO,
|
|
|
|
_("Cannot crop because the image is already cropped to its content."));
|
|
|
|
break;
|
|
|
|
}
|
2002-03-15 23:09:58 +08:00
|
|
|
}
|
|
|
|
|
2002-02-13 22:41:35 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
image_merge_layers_cmd_callback (GtkAction *action,
|
2002-02-13 22:41:35 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2004-10-24 00:42:37 +08:00
|
|
|
ImageMergeLayersDialog *dialog;
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2004-10-24 00:42:37 +08:00
|
|
|
GtkWidget *widget;
|
2006-03-29 01:08:36 +08:00
|
|
|
return_if_no_image (image, data);
|
2004-05-03 22:46:29 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2002-02-13 22:41:35 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
dialog = image_merge_layers_dialog_new (image,
|
2004-10-24 00:42:37 +08:00
|
|
|
action_data_get_context (data),
|
|
|
|
widget,
|
2006-04-07 16:01:02 +08:00
|
|
|
image_merge_layers_type,
|
2011-02-14 16:45:59 +08:00
|
|
|
image_merge_layers_merge_active_group,
|
2006-04-07 16:01:02 +08:00
|
|
|
image_merge_layers_discard_invisible);
|
2004-05-25 22:37:02 +08:00
|
|
|
|
2004-10-24 00:42:37 +08:00
|
|
|
g_signal_connect (dialog->dialog, "response",
|
2004-05-25 22:37:02 +08:00
|
|
|
G_CALLBACK (image_merge_layers_response),
|
2004-10-24 00:42:37 +08:00
|
|
|
dialog);
|
2004-05-25 22:37:02 +08:00
|
|
|
|
2004-10-24 00:42:37 +08:00
|
|
|
gtk_widget_show (dialog->dialog);
|
2002-02-13 22:41:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
image_flatten_image_cmd_callback (GtkAction *action,
|
2002-02-13 22:41:35 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2013-08-10 03:31:55 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
GError *error = NULL;
|
2006-03-29 01:08:36 +08:00
|
|
|
return_if_no_image (image, data);
|
2013-08-10 03:31:55 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
|
|
|
if (! gimp_image_flatten (image, action_data_get_context (data), &error))
|
|
|
|
{
|
|
|
|
gimp_message_literal (image->gimp,
|
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
return;
|
|
|
|
}
|
2002-02-13 22:41:35 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (image);
|
2002-02-13 22:41:35 +08:00
|
|
|
}
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2003-07-27 18:34:15 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
image_configure_grid_cmd_callback (GtkAction *action,
|
2003-07-27 18:34:15 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpDisplayShell *shell;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2003-07-27 18:34:15 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
2009-10-05 01:56:39 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
2003-07-27 18:34:15 +08:00
|
|
|
|
|
|
|
if (! shell->grid_dialog)
|
|
|
|
{
|
2009-10-07 01:20:44 +08:00
|
|
|
shell->grid_dialog = grid_dialog_new (image,
|
2006-09-01 19:26:54 +08:00
|
|
|
action_data_get_context (data),
|
2009-10-06 01:58:03 +08:00
|
|
|
GTK_WIDGET (shell));
|
2003-07-27 18:34:15 +08:00
|
|
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog),
|
2009-10-06 01:58:03 +08:00
|
|
|
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell))));
|
2003-07-27 18:34:15 +08:00
|
|
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (shell->grid_dialog),
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (shell->grid_dialog),
|
2006-06-16 03:37:15 +08:00
|
|
|
(gpointer) &shell->grid_dialog);
|
2003-07-27 18:34:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (shell->grid_dialog));
|
|
|
|
}
|
|
|
|
|
2005-04-05 06:34:29 +08:00
|
|
|
void
|
|
|
|
image_properties_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display;
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpDisplayShell *shell;
|
2005-04-05 06:34:29 +08:00
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2005-04-05 06:34:29 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
image = gimp_display_get_image (display);
|
2009-10-05 01:56:39 +08:00
|
|
|
shell = gimp_display_get_shell (display);
|
2005-04-05 06:34:29 +08:00
|
|
|
|
2009-10-07 01:20:44 +08:00
|
|
|
dialog = image_properties_dialog_new (image,
|
2006-09-01 19:26:54 +08:00
|
|
|
action_data_get_context (data),
|
2009-10-06 01:58:03 +08:00
|
|
|
GTK_WIDGET (shell));
|
2005-04-05 06:34:29 +08:00
|
|
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog),
|
2009-10-06 01:58:03 +08:00
|
|
|
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell))));
|
2005-04-05 06:34:29 +08:00
|
|
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog),
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
|
|
|
}
|
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
2006-05-19 22:50:46 +08:00
|
|
|
image_resize_callback (GtkWidget *dialog,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpUnit unit,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y,
|
|
|
|
GimpItemSet layer_set,
|
2012-09-06 05:26:54 +08:00
|
|
|
gboolean resize_text_layers,
|
2006-05-19 22:50:46 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2004-05-25 22:37:02 +08:00
|
|
|
ImageResizeOptions *options = data;
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
image_resize_unit = unit;
|
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
if (width > 0 && height > 0)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2004-10-27 18:33:08 +08:00
|
|
|
GimpImage *image = GIMP_IMAGE (viewable);
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display = options->display;
|
2004-10-27 18:33:08 +08:00
|
|
|
GimpContext *context = options->context;
|
2003-06-04 00:42:46 +08:00
|
|
|
GimpProgress *progress;
|
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
|
2007-12-26 00:21:40 +08:00
|
|
|
if (width == gimp_image_get_width (image) &&
|
|
|
|
height == gimp_image_get_height (image))
|
2004-10-27 18:33:08 +08:00
|
|
|
return;
|
|
|
|
|
2014-07-13 05:45:20 +08:00
|
|
|
progress = gimp_progress_start (GIMP_PROGRESS (display), FALSE,
|
|
|
|
_("Resizing"));
|
2003-06-04 00:42:46 +08:00
|
|
|
|
2005-02-25 00:39:12 +08:00
|
|
|
gimp_image_resize_with_layers (image,
|
|
|
|
context,
|
|
|
|
width, height, offset_x, offset_y,
|
2006-05-19 22:50:46 +08:00
|
|
|
layer_set,
|
2012-09-06 05:26:54 +08:00
|
|
|
resize_text_layers,
|
2005-02-25 00:39:12 +08:00
|
|
|
progress);
|
2003-06-04 00:42:46 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2003-06-04 00:42:46 +08:00
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
2003-08-22 09:42:57 +08:00
|
|
|
else
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2004-11-15 06:01:13 +08:00
|
|
|
g_warning ("Resize Error: "
|
|
|
|
"Both width and height must be greater than zero.");
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-23 18:42:56 +08:00
|
|
|
static void
|
|
|
|
image_resize_options_free (ImageResizeOptions *options)
|
|
|
|
{
|
|
|
|
g_slice_free (ImageResizeOptions, options);
|
|
|
|
}
|
|
|
|
|
2004-11-14 06:27:39 +08:00
|
|
|
static void
|
|
|
|
image_print_size_callback (GtkWidget *dialog,
|
|
|
|
GimpImage *image,
|
|
|
|
gdouble xresolution,
|
|
|
|
gdouble yresolution,
|
|
|
|
GimpUnit resolution_unit,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2007-12-27 01:33:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
|
2004-11-14 06:27:39 +08:00
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
if (xresolution == xres &&
|
|
|
|
yresolution == yres &&
|
2007-12-26 00:21:40 +08:00
|
|
|
resolution_unit == gimp_image_get_unit (image))
|
2004-11-15 06:01:13 +08:00
|
|
|
return;
|
|
|
|
|
2004-11-14 06:27:39 +08:00
|
|
|
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE,
|
|
|
|
_("Change Print Size"));
|
|
|
|
|
|
|
|
gimp_image_set_resolution (image, xresolution, yresolution);
|
|
|
|
gimp_image_set_unit (image, resolution_unit);
|
|
|
|
|
|
|
|
gimp_image_undo_group_end (image);
|
|
|
|
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
static void
|
2006-10-15 00:51:30 +08:00
|
|
|
image_scale_callback (GtkWidget *dialog,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
GimpUnit unit,
|
|
|
|
GimpInterpolationType interpolation,
|
|
|
|
gdouble xresolution,
|
|
|
|
gdouble yresolution,
|
|
|
|
GimpUnit resolution_unit,
|
|
|
|
gpointer user_data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-10-15 00:51:30 +08:00
|
|
|
GimpImage *image = GIMP_IMAGE (viewable);
|
2007-12-27 01:33:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
2003-12-09 19:49:47 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
image_scale_unit = unit;
|
|
|
|
image_scale_interp = interpolation;
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
if (width > 0 && height > 0)
|
|
|
|
{
|
2007-12-26 00:21:40 +08:00
|
|
|
if (width == gimp_image_get_width (image) &&
|
|
|
|
height == gimp_image_get_height (image) &&
|
2007-12-27 01:33:41 +08:00
|
|
|
xresolution == xres &&
|
|
|
|
yresolution == yres &&
|
2007-12-26 00:21:40 +08:00
|
|
|
resolution_unit == gimp_image_get_unit (image))
|
2006-10-15 00:51:30 +08:00
|
|
|
return;
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE,
|
|
|
|
_("Scale Image"));
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
gimp_image_set_resolution (image, xresolution, yresolution);
|
|
|
|
gimp_image_set_unit (image, resolution_unit);
|
|
|
|
|
2007-12-26 00:21:40 +08:00
|
|
|
if (width != gimp_image_get_width (image) ||
|
|
|
|
height != gimp_image_get_height (image))
|
2004-10-27 09:20:07 +08:00
|
|
|
{
|
2001-11-17 01:08:41 +08:00
|
|
|
GimpProgress *progress;
|
|
|
|
|
2014-07-13 05:45:20 +08:00
|
|
|
progress = gimp_progress_start (GIMP_PROGRESS (user_data), FALSE,
|
|
|
|
_("Scaling"));
|
2001-11-17 01:08:41 +08:00
|
|
|
|
2007-02-27 02:53:07 +08:00
|
|
|
gimp_image_scale (image, width, height, interpolation, progress);
|
2001-11-17 01:08:41 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2004-10-27 09:20:07 +08:00
|
|
|
}
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
gimp_image_undo_group_end (image);
|
2003-06-04 00:42:46 +08:00
|
|
|
|
2006-10-15 00:51:30 +08:00
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Scale Error: "
|
|
|
|
"Both width and height must be greater than zero.");
|
|
|
|
}
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
2004-05-25 22:37:02 +08:00
|
|
|
|
|
|
|
static void
|
2004-10-24 00:42:37 +08:00
|
|
|
image_merge_layers_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
ImageMergeLayersDialog *dialog)
|
2004-05-25 22:37:02 +08:00
|
|
|
{
|
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
|
|
|
{
|
2011-02-14 16:45:59 +08:00
|
|
|
image_merge_layers_type = dialog->merge_type;
|
|
|
|
image_merge_layers_merge_active_group = dialog->merge_active_group;
|
|
|
|
image_merge_layers_discard_invisible = dialog->discard_invisible;
|
2004-10-24 03:13:17 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_merge_visible_layers (dialog->image,
|
2004-10-24 00:42:37 +08:00
|
|
|
dialog->context,
|
2006-04-07 16:01:02 +08:00
|
|
|
image_merge_layers_type,
|
2011-02-14 16:45:59 +08:00
|
|
|
image_merge_layers_merge_active_group,
|
2006-04-07 16:01:02 +08:00
|
|
|
image_merge_layers_discard_invisible);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (dialog->image);
|
2004-05-25 22:37:02 +08:00
|
|
|
}
|
|
|
|
|
2004-10-27 09:20:07 +08:00
|
|
|
gtk_widget_destroy (widget);
|
2004-05-25 22:37:02 +08:00
|
|
|
}
|