1997-11-25 06:05:25 +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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-10-27 06:02:44 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
|
|
|
|
2001-04-18 05:43:29 +08:00
|
|
|
#include "gui/info-dialog.h"
|
2001-01-23 21:01:48 +08:00
|
|
|
|
2001-04-29 04:14:32 +08:00
|
|
|
#include "gimpscaletool.h"
|
|
|
|
#include "tool_manager.h"
|
|
|
|
#include "tool_options.h"
|
|
|
|
#include "transform_options.h"
|
|
|
|
|
2001-07-08 06:49:01 +08:00
|
|
|
#include "gdisplay.h"
|
|
|
|
#include "gimpprogress.h"
|
|
|
|
#include "undo.h"
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
2001-05-14 08:04:29 +08:00
|
|
|
#define WANT_SCALE_BITS
|
|
|
|
#include "icons.h"
|
2001-03-31 22:10:22 +08:00
|
|
|
|
2000-10-27 06:02:44 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
/* forward function declarations */
|
2001-03-25 12:08:51 +08:00
|
|
|
static TileManager * gimp_scale_tool_transform (GimpTransformTool *tool,
|
|
|
|
GDisplay *gdisp,
|
|
|
|
TransformState state);
|
|
|
|
static void gimp_scale_tool_recalc (GimpScaleTool *tool,
|
|
|
|
GDisplay *gdisp);
|
|
|
|
static void gimp_scale_tool_motion (GimpScaleTool *tool,
|
|
|
|
GDisplay *gdisp);
|
|
|
|
static void gimp_scale_tool_info_update (GimpScaleTool *tool);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
static void gimp_scale_tool_size_changed (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_scale_tool_unit_changed (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_scale_tool_class_init (GimpScaleToolClass *klass);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-03-31 22:10:22 +08:00
|
|
|
static void gimp_scale_tool_init (GimpScaleTool *sc_tool);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* storage for information dialog fields */
|
1999-05-31 22:11:10 +08:00
|
|
|
static gchar orig_width_buf[MAX_INFO_BUF];
|
|
|
|
static gchar orig_height_buf[MAX_INFO_BUF];
|
|
|
|
static gdouble size_vals[2];
|
|
|
|
static gchar x_ratio_buf[MAX_INFO_BUF];
|
|
|
|
static gchar y_ratio_buf[MAX_INFO_BUF];
|
1999-04-03 03:46:59 +08:00
|
|
|
|
|
|
|
/* needed for original size unit update */
|
2000-12-31 12:07:42 +08:00
|
|
|
static GtkWidget *sizeentry = NULL;
|
2001-07-07 20:17:23 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
static GimpTransformToolClass *parent_class = NULL;
|
|
|
|
|
2001-04-29 04:14:32 +08:00
|
|
|
static TransformOptions *scale_options = NULL;
|
|
|
|
|
2001-03-31 22:10:22 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
void
|
2001-07-07 20:17:23 +08:00
|
|
|
gimp_scale_tool_register (Gimp *gimp)
|
2001-03-25 12:08:51 +08:00
|
|
|
{
|
2001-07-07 20:17:23 +08:00
|
|
|
tool_manager_register_tool (gimp,
|
|
|
|
GIMP_TYPE_SCALE_TOOL,
|
2001-03-25 12:08:51 +08:00
|
|
|
FALSE,
|
|
|
|
"gimp:scale_tool",
|
|
|
|
_("Scale Tool"),
|
|
|
|
_("Scale the layer or selection"),
|
2001-03-31 23:45:05 +08:00
|
|
|
N_("/Tools/Transform Tools/Transform"), "<shift>T",
|
2001-03-25 12:08:51 +08:00
|
|
|
NULL, "tools/transform.html",
|
|
|
|
(const gchar **) scale_bits);
|
2001-03-31 22:10:22 +08:00
|
|
|
}
|
2001-03-25 12:08:51 +08:00
|
|
|
|
|
|
|
GtkType
|
|
|
|
gimp_scale_tool_get_type (void)
|
|
|
|
{
|
|
|
|
static GtkType tool_type = 0;
|
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
|
|
|
GtkTypeInfo tool_info =
|
|
|
|
{
|
|
|
|
"GimpScaleTool",
|
|
|
|
sizeof (GimpScaleTool),
|
|
|
|
sizeof (GimpScaleToolClass),
|
|
|
|
(GtkClassInitFunc) gimp_scale_tool_class_init,
|
|
|
|
(GtkObjectInitFunc) gimp_scale_tool_init,
|
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
|
|
|
(GtkClassInitFunc) NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
tool_type = gtk_type_unique (GIMP_TYPE_TRANSFORM_TOOL, &tool_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_scale_tool_class_init (GimpScaleToolClass *klass)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GimpToolClass *tool_class;
|
|
|
|
GimpTransformToolClass *transform_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass *) klass;
|
|
|
|
tool_class = (GimpToolClass *) klass;
|
|
|
|
transform_class = (GimpTransformToolClass *) klass;
|
|
|
|
|
|
|
|
parent_class = gtk_type_class (GIMP_TYPE_TRANSFORM_TOOL);
|
|
|
|
|
|
|
|
transform_class->transform = gimp_scale_tool_transform;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_scale_tool_init (GimpScaleTool *sc_tool)
|
|
|
|
{
|
2001-03-31 22:10:22 +08:00
|
|
|
GimpTool *tool;
|
2001-03-25 12:08:51 +08:00
|
|
|
GimpTransformTool *tr_tool;
|
|
|
|
|
2001-03-31 22:10:22 +08:00
|
|
|
tool = GIMP_TOOL (sc_tool);
|
2001-03-25 12:08:51 +08:00
|
|
|
tr_tool = GIMP_TRANSFORM_TOOL (sc_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-29 04:14:32 +08:00
|
|
|
if (! scale_options)
|
|
|
|
{
|
|
|
|
scale_options = transform_options_new (GIMP_TYPE_SCALE_TOOL,
|
|
|
|
transform_options_reset);
|
|
|
|
|
|
|
|
tool_manager_register_tool_options (GIMP_TYPE_SCALE_TOOL,
|
2001-07-18 04:50:01 +08:00
|
|
|
(GimpToolOptions *) scale_options);
|
2001-04-29 04:14:32 +08:00
|
|
|
}
|
|
|
|
|
2001-03-31 22:10:22 +08:00
|
|
|
tool->tool_cursor = GIMP_RESIZE_TOOL_CURSOR;
|
2001-03-25 12:08:51 +08:00
|
|
|
|
|
|
|
/* set the scale specific transformation attributes */
|
|
|
|
tr_tool->trans_info[X0] = 0.0;
|
|
|
|
tr_tool->trans_info[Y0] = 0.0;
|
|
|
|
tr_tool->trans_info[X1] = 0.0;
|
|
|
|
tr_tool->trans_info[Y1] = 0.0;
|
|
|
|
|
|
|
|
/* assemble the transformation matrix */
|
|
|
|
gimp_matrix3_identity (tr_tool->transform); /* FIXME name is confusing */
|
|
|
|
}
|
1998-08-15 21:34:54 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static TileManager *
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_transform (GimpTransformTool *tr_tool,
|
|
|
|
GDisplay *gdisp,
|
|
|
|
TransformState state)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
GimpScaleTool *sc_tool;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GimpTool *tool;
|
|
|
|
|
|
|
|
sc_tool = GIMP_SCALE_TOOL (tr_tool);
|
|
|
|
tool = GIMP_TOOL (sc_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_INIT:
|
2001-03-25 12:08:51 +08:00
|
|
|
size_vals[0] = tr_tool->x2 - tr_tool->x1;
|
|
|
|
size_vals[1] = tr_tool->y2 - tr_tool->y1;
|
1999-06-01 05:46:43 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (!transform_info)
|
|
|
|
{
|
1999-09-28 01:58:10 +08:00
|
|
|
transform_info = info_dialog_new (_("Scaling Information"),
|
2000-01-05 19:18:38 +08:00
|
|
|
gimp_standard_help_func,
|
|
|
|
"tools/transform_scale.html");
|
1999-04-03 03:46:59 +08:00
|
|
|
|
|
|
|
info_dialog_add_label (transform_info, _("Original Width:"),
|
|
|
|
orig_width_buf);
|
|
|
|
info_dialog_add_label (transform_info, _("Height:"),
|
|
|
|
orig_height_buf);
|
|
|
|
|
1999-04-06 20:13:54 +08:00
|
|
|
spinbutton =
|
1999-04-03 03:46:59 +08:00
|
|
|
info_dialog_add_spinbutton (transform_info, _("Current Width:"),
|
|
|
|
NULL, -1, 1, 1, 10, 1, 1, 2, NULL, NULL);
|
|
|
|
sizeentry =
|
|
|
|
info_dialog_add_sizeentry (transform_info, _("Height:"),
|
|
|
|
size_vals, 1,
|
1999-05-23 01:56:35 +08:00
|
|
|
gdisp->gimage->unit, "%a",
|
1999-04-06 20:13:54 +08:00
|
|
|
TRUE, TRUE, FALSE,
|
1999-04-05 20:48:48 +08:00
|
|
|
GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
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 (gimp_scale_tool_size_changed),
|
|
|
|
tool);
|
|
|
|
g_signal_connect (G_OBJECT (sizeentry), "unit_changed",
|
|
|
|
G_CALLBACK (gimp_scale_tool_unit_changed),
|
|
|
|
sc_tool);
|
1999-04-03 03:46:59 +08:00
|
|
|
|
1999-06-01 05:46:43 +08:00
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton), NULL);
|
1999-04-03 03:46:59 +08:00
|
|
|
|
|
|
|
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
|
|
|
|
x_ratio_buf);
|
|
|
|
info_dialog_add_label (transform_info, _("Y:"),
|
|
|
|
y_ratio_buf);
|
|
|
|
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
|
|
|
1, 4);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
|
|
|
|
2, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-06-01 05:46:43 +08:00
|
|
|
|
|
|
|
gtk_signal_handler_block_by_data (GTK_OBJECT (sizeentry), tool);
|
|
|
|
|
|
|
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
|
|
|
gdisp->gimage->unit);
|
|
|
|
if (gdisp->dot_for_dot)
|
2000-02-08 04:35:13 +08:00
|
|
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
1999-06-01 05:46:43 +08:00
|
|
|
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
|
|
|
gdisp->gimage->xresolution, FALSE);
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1,
|
|
|
|
gdisp->gimage->yresolution, FALSE);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
|
|
|
GIMP_MIN_IMAGE_SIZE,
|
|
|
|
GIMP_MAX_IMAGE_SIZE);
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
|
|
|
GIMP_MIN_IMAGE_SIZE,
|
|
|
|
GIMP_MAX_IMAGE_SIZE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-06 20:13:54 +08:00
|
|
|
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 0,
|
1999-06-01 05:46:43 +08:00
|
|
|
0, size_vals[0]);
|
1999-04-06 20:13:54 +08:00
|
|
|
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 1,
|
1999-06-01 05:46:43 +08:00
|
|
|
0, size_vals[1]);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0,
|
|
|
|
size_vals[0]);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
|
|
|
|
size_vals[1]);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), TRUE);
|
|
|
|
|
|
|
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (sizeentry), tool);
|
1999-04-06 20:13:54 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
tr_tool->trans_info [X0] = (double) tr_tool->x1;
|
|
|
|
tr_tool->trans_info [Y0] = (double) tr_tool->y1;
|
|
|
|
tr_tool->trans_info [X1] = (double) tr_tool->x2;
|
|
|
|
tr_tool->trans_info [Y1] = (double) tr_tool->y2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
break;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_MOTION:
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_motion (sc_tool, gdisp);
|
|
|
|
gimp_scale_tool_recalc (sc_tool, gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_RECALC:
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_recalc (sc_tool, gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_FINISH:
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (transform_info->shell), FALSE);
|
2001-03-25 12:08:51 +08:00
|
|
|
return gimp_scale_tool_scale (gdisp->gimage,
|
|
|
|
gimp_image_active_drawable (gdisp->gimage),
|
|
|
|
gdisp,
|
|
|
|
tr_tool->trans_info,
|
|
|
|
tr_tool->original,
|
|
|
|
gimp_transform_tool_smoothing (),
|
|
|
|
tr_tool->transform);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_info_update (GimpScaleTool *sc_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
GimpTool *tool;
|
|
|
|
GimpTransformTool *tr_tool;
|
|
|
|
gdouble ratio_x, ratio_y;
|
|
|
|
gint x1, y1, x2, y2, x3, y3, x4, y4;
|
|
|
|
GimpUnit unit;
|
|
|
|
gdouble unit_factor;
|
|
|
|
gchar format_buf[16];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-08 04:35:13 +08:00
|
|
|
static GimpUnit label_unit = GIMP_UNIT_PIXEL;
|
1999-04-06 20:13:54 +08:00
|
|
|
|
2001-03-31 22:10:22 +08:00
|
|
|
tool = GIMP_TOOL (sc_tool);
|
|
|
|
tr_tool = GIMP_TRANSFORM_TOOL (sc_tool);
|
|
|
|
unit = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (sizeentry));;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Find original sizes */
|
2001-03-25 12:08:51 +08:00
|
|
|
x1 = tr_tool->x1;
|
|
|
|
y1 = tr_tool->y1;
|
|
|
|
x2 = tr_tool->x2;
|
|
|
|
y2 = tr_tool->y2;
|
1999-04-03 03:46:59 +08:00
|
|
|
|
2000-02-08 04:35:13 +08:00
|
|
|
if (unit != GIMP_UNIT_PERCENT)
|
1999-04-06 20:13:54 +08:00
|
|
|
label_unit = unit;
|
|
|
|
|
|
|
|
unit_factor = gimp_unit_get_factor (label_unit);
|
|
|
|
|
2000-02-08 04:35:13 +08:00
|
|
|
if (label_unit) /* unit != GIMP_UNIT_PIXEL */
|
1999-04-03 03:46:59 +08:00
|
|
|
{
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
g_snprintf (format_buf, sizeof (format_buf), "%%.%df %s",
|
1999-04-06 20:13:54 +08:00
|
|
|
gimp_unit_get_digits (label_unit) + 1,
|
|
|
|
gimp_unit_get_symbol (label_unit));
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (orig_width_buf, MAX_INFO_BUF, format_buf,
|
2000-12-31 12:07:42 +08:00
|
|
|
(x2 - x1) * unit_factor / tool->gdisp->gimage->xresolution);
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (orig_height_buf, MAX_INFO_BUF, format_buf,
|
2000-12-31 12:07:42 +08:00
|
|
|
(y2 - y1) * unit_factor / tool->gdisp->gimage->yresolution);
|
1999-04-03 03:46:59 +08:00
|
|
|
}
|
2000-02-08 04:35:13 +08:00
|
|
|
else /* unit == GIMP_UNIT_PIXEL */
|
1999-04-03 03:46:59 +08:00
|
|
|
{
|
|
|
|
g_snprintf (orig_width_buf, MAX_INFO_BUF, "%d", x2 - x1);
|
|
|
|
g_snprintf (orig_height_buf, MAX_INFO_BUF, "%d", y2 - y1);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Find current sizes */
|
2001-03-25 12:08:51 +08:00
|
|
|
x3 = (int) tr_tool->trans_info [X0];
|
|
|
|
y3 = (int) tr_tool->trans_info [Y0];
|
|
|
|
x4 = (int) tr_tool->trans_info [X1];
|
|
|
|
y4 = (int) tr_tool->trans_info [Y1];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-03 03:46:59 +08:00
|
|
|
size_vals[0] = x4 - x3;
|
|
|
|
size_vals[1] = y4 - y3;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
ratio_x = ratio_y = 0.0;
|
|
|
|
|
|
|
|
if (x2 - x1)
|
|
|
|
ratio_x = (double) (x4 - x3) / (double) (x2 - x1);
|
|
|
|
if (y2 - y1)
|
|
|
|
ratio_y = (double) (y4 - y3) / (double) (y2 - y1);
|
|
|
|
|
1999-04-03 03:46:59 +08:00
|
|
|
g_snprintf (x_ratio_buf, MAX_INFO_BUF, "%0.2f", ratio_x);
|
|
|
|
g_snprintf (y_ratio_buf, MAX_INFO_BUF, "%0.2f", ratio_y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
info_dialog_update (transform_info);
|
|
|
|
info_dialog_popup (transform_info);
|
|
|
|
}
|
|
|
|
|
1998-08-15 21:34:54 +08:00
|
|
|
static void
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_size_changed (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-08-15 21:34:54 +08:00
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
GimpTool *tool;
|
|
|
|
GimpTransformTool *tr_tool;
|
|
|
|
GimpDrawTool *dr_tool;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
1998-08-15 21:34:54 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
tool = GIMP_TOOL(data);
|
1998-08-15 21:34:54 +08:00
|
|
|
|
|
|
|
if (tool)
|
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
tr_tool = GIMP_TRANSFORM_TOOL(tool);
|
|
|
|
dr_tool = GIMP_DRAW_TOOL(tool);
|
1998-08-15 21:34:54 +08:00
|
|
|
|
2001-03-31 22:10:22 +08:00
|
|
|
width = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0));
|
2000-10-27 06:02:44 +08:00
|
|
|
height = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1));
|
1998-08-15 21:34:54 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
if ((width != (tr_tool->trans_info[X1] -
|
|
|
|
tr_tool->trans_info[X0])) ||
|
|
|
|
(height != (tr_tool->trans_info[Y1] -
|
|
|
|
tr_tool->trans_info[Y0])))
|
1998-08-15 21:34:54 +08:00
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_draw_tool_pause (dr_tool);
|
|
|
|
tr_tool->trans_info[X1] =
|
|
|
|
tr_tool->trans_info[X0] + width;
|
|
|
|
tr_tool->trans_info[Y1] =
|
|
|
|
tr_tool->trans_info[Y0] + height;
|
|
|
|
gimp_scale_tool_recalc (GIMP_SCALE_TOOL(tool), tool->gdisp);
|
|
|
|
gimp_draw_tool_resume (dr_tool);
|
1998-08-15 21:34:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_unit_changed (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1998-08-15 21:34:54 +08:00
|
|
|
{
|
2001-03-31 22:10:22 +08:00
|
|
|
gimp_scale_tool_info_update (GIMP_SCALE_TOOL (data));
|
1998-08-15 21:34:54 +08:00
|
|
|
}
|
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static void
|
2001-03-31 22:10:22 +08:00
|
|
|
gimp_scale_tool_motion (GimpScaleTool *sc_tool,
|
|
|
|
GDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
GimpTransformTool *tr_tool;
|
|
|
|
gdouble ratio;
|
|
|
|
gdouble *x1;
|
|
|
|
gdouble *y1;
|
|
|
|
gdouble *x2;
|
|
|
|
gdouble *y2;
|
|
|
|
gint w, h;
|
|
|
|
gint dir_x, dir_y;
|
|
|
|
gint diff_x, diff_y;
|
|
|
|
|
|
|
|
tr_tool = GIMP_TRANSFORM_TOOL(sc_tool);
|
|
|
|
|
|
|
|
diff_x = tr_tool->curx - tr_tool->lastx;
|
|
|
|
diff_y = tr_tool->cury - tr_tool->lasty;
|
|
|
|
|
|
|
|
switch (tr_tool->function)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_1:
|
2001-03-25 12:08:51 +08:00
|
|
|
x1 = &tr_tool->trans_info [X0];
|
|
|
|
y1 = &tr_tool->trans_info [Y0];
|
|
|
|
x2 = &tr_tool->trans_info [X1];
|
|
|
|
y2 = &tr_tool->trans_info [Y1];
|
1997-11-25 06:05:25 +08:00
|
|
|
dir_x = dir_y = 1;
|
|
|
|
break;
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_2:
|
2001-03-25 12:08:51 +08:00
|
|
|
x1 = &tr_tool->trans_info [X1];
|
|
|
|
y1 = &tr_tool->trans_info [Y0];
|
|
|
|
x2 = &tr_tool->trans_info [X0];
|
|
|
|
y2 = &tr_tool->trans_info [Y1];
|
1997-11-25 06:05:25 +08:00
|
|
|
dir_x = -1;
|
|
|
|
dir_y = 1;
|
|
|
|
break;
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_3:
|
2001-03-25 12:08:51 +08:00
|
|
|
x1 = &tr_tool->trans_info [X0];
|
|
|
|
y1 = &tr_tool->trans_info [Y1];
|
|
|
|
x2 = &tr_tool->trans_info [X1];
|
|
|
|
y2 = &tr_tool->trans_info [Y0];
|
1997-11-25 06:05:25 +08:00
|
|
|
dir_x = 1;
|
|
|
|
dir_y = -1;
|
|
|
|
break;
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_4:
|
2001-03-25 12:08:51 +08:00
|
|
|
x1 = &tr_tool->trans_info [X1];
|
|
|
|
y1 = &tr_tool->trans_info [Y1];
|
|
|
|
x2 = &tr_tool->trans_info [X0];
|
|
|
|
y2 = &tr_tool->trans_info [Y0];
|
1997-11-25 06:05:25 +08:00
|
|
|
dir_x = dir_y = -1;
|
|
|
|
break;
|
2001-03-31 22:10:22 +08:00
|
|
|
case TRANSFORM_HANDLE_CENTER:
|
|
|
|
return;
|
|
|
|
default:
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-06-18 04:34:50 +08:00
|
|
|
/* if just the mod1 key is down, affect only the height */
|
2001-03-25 12:08:51 +08:00
|
|
|
if (tr_tool->state & GDK_MOD1_MASK &&
|
|
|
|
! (tr_tool->state & GDK_CONTROL_MASK))
|
1997-11-25 06:05:25 +08:00
|
|
|
diff_x = 0;
|
1999-06-18 04:34:50 +08:00
|
|
|
/* if just the control key is down, affect only the width */
|
2001-03-25 12:08:51 +08:00
|
|
|
else if (tr_tool->state & GDK_CONTROL_MASK &&
|
|
|
|
! (tr_tool->state & GDK_MOD1_MASK))
|
1997-11-25 06:05:25 +08:00
|
|
|
diff_y = 0;
|
|
|
|
|
|
|
|
*x1 += diff_x;
|
|
|
|
*y1 += diff_y;
|
|
|
|
|
|
|
|
if (dir_x > 0)
|
|
|
|
{
|
|
|
|
if (*x1 >= *x2) *x1 = *x2 - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*x1 <= *x2) *x1 = *x2 + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dir_y > 0)
|
|
|
|
{
|
|
|
|
if (*y1 >= *y2) *y1 = *y2 - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*y1 <= *y2) *y1 = *y2 + 1;
|
|
|
|
}
|
|
|
|
|
2000-01-05 19:18:38 +08:00
|
|
|
/* if both the control key & mod1 keys are down,
|
|
|
|
* keep the aspect ratio intact
|
|
|
|
*/
|
2001-03-25 12:08:51 +08:00
|
|
|
if (tr_tool->state & GDK_CONTROL_MASK &&
|
|
|
|
tr_tool->state & GDK_MOD1_MASK)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
ratio = (double) (tr_tool->x2 - tr_tool->x1) /
|
|
|
|
(double) (tr_tool->y2 - tr_tool->y1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
w = ABS ((*x2 - *x1));
|
|
|
|
h = ABS ((*y2 - *y1));
|
|
|
|
|
|
|
|
if (w > h * ratio)
|
|
|
|
h = w / ratio;
|
|
|
|
else
|
|
|
|
w = h * ratio;
|
|
|
|
|
|
|
|
*y1 = *y2 - dir_y * h;
|
|
|
|
*x1 = *x2 - dir_x * w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-05 19:18:38 +08:00
|
|
|
static void
|
2001-03-31 22:10:22 +08:00
|
|
|
gimp_scale_tool_recalc (GimpScaleTool *sc_tool,
|
|
|
|
GDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-25 12:08:51 +08:00
|
|
|
GimpTransformTool *tr_tool;
|
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
gint diffx, diffy;
|
|
|
|
gint cx, cy;
|
|
|
|
gdouble scalex, scaley;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-31 22:10:22 +08:00
|
|
|
tr_tool = GIMP_TRANSFORM_TOOL (sc_tool);
|
2000-01-05 19:18:38 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
x1 = (int) tr_tool->trans_info [X0];
|
|
|
|
y1 = (int) tr_tool->trans_info [Y0];
|
|
|
|
x2 = (int) tr_tool->trans_info [X1];
|
|
|
|
y2 = (int) tr_tool->trans_info [Y1];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
scalex = scaley = 1.0;
|
2001-03-25 12:08:51 +08:00
|
|
|
if (tr_tool->x2 - tr_tool->x1)
|
|
|
|
scalex = (double) (x2 - x1) / (double) (tr_tool->x2 - tr_tool->x1);
|
|
|
|
if (tr_tool->y2 - tr_tool->y1)
|
|
|
|
scaley = (double) (y2 - y1) / (double) (tr_tool->y2 - tr_tool->y1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
switch (tr_tool->function)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_1:
|
1997-11-25 06:05:25 +08:00
|
|
|
cx = x2; cy = y2;
|
2001-03-25 12:08:51 +08:00
|
|
|
diffx = x2 - tr_tool->x2;
|
|
|
|
diffy = y2 - tr_tool->y2;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_2:
|
1997-11-25 06:05:25 +08:00
|
|
|
cx = x1; cy = y2;
|
2001-03-25 12:08:51 +08:00
|
|
|
diffx = x1 - tr_tool->x1;
|
|
|
|
diffy = y2 - tr_tool->y2;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_3:
|
1997-11-25 06:05:25 +08:00
|
|
|
cx = x2; cy = y1;
|
2001-03-25 12:08:51 +08:00
|
|
|
diffx = x2 - tr_tool->x2;
|
|
|
|
diffy = y1 - tr_tool->y1;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2000-12-29 23:22:01 +08:00
|
|
|
case TRANSFORM_HANDLE_4:
|
1997-11-25 06:05:25 +08:00
|
|
|
cx = x1; cy = y1;
|
2001-03-25 12:08:51 +08:00
|
|
|
diffx = x1 - tr_tool->x1;
|
|
|
|
diffy = y1 - tr_tool->y1;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2001-03-31 22:10:22 +08:00
|
|
|
case TRANSFORM_HANDLE_CENTER:
|
|
|
|
cx = x1; cy = y1;
|
|
|
|
diffx = diffy = 0;
|
|
|
|
break;
|
|
|
|
default:
|
1997-11-25 06:05:25 +08:00
|
|
|
cx = x1; cy = y1;
|
|
|
|
diffx = diffy = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* assemble the transformation matrix */
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_matrix3_identity (tr_tool->transform);
|
|
|
|
gimp_matrix3_translate (tr_tool->transform,
|
2000-02-15 00:29:41 +08:00
|
|
|
(double) -cx + diffx, (double) -cy + diffy);
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_matrix3_scale (tr_tool->transform, scalex, scaley);
|
|
|
|
gimp_matrix3_translate (tr_tool->transform, (double) cx, (double) cy);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* transform the bounding box */
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_transform_tool_transform_bounding_box (tr_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* update the information dialog */
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_info_update (sc_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-01-05 19:18:38 +08:00
|
|
|
TileManager *
|
2001-03-25 12:08:51 +08:00
|
|
|
gimp_scale_tool_scale (GimpImage *gimage,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GDisplay *gdisp,
|
|
|
|
gdouble *trans_info,
|
|
|
|
TileManager *float_tiles,
|
|
|
|
gboolean interpolation,
|
|
|
|
GimpMatrix3 matrix)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-31 13:31:43 +08:00
|
|
|
GimpProgress *progress;
|
|
|
|
TileManager *ret;
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
|
|
|
|
progress = progress_start (gdisp, _("Scaling..."), FALSE, NULL, NULL);
|
|
|
|
|
2001-03-25 12:08:51 +08:00
|
|
|
ret = gimp_transform_tool_do (gimage, drawable, float_tiles,
|
|
|
|
interpolation, matrix,
|
|
|
|
progress ? progress_update_and_flush :
|
|
|
|
(GimpProgressFunc) NULL,
|
|
|
|
progress);
|
2000-01-05 19:18:38 +08:00
|
|
|
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
if (progress)
|
|
|
|
progress_end (progress);
|
|
|
|
|
|
|
|
return ret;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|