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
|
|
|
*/
|
|
|
|
#include <stdlib.h>
|
1998-08-14 04:19:09 +08:00
|
|
|
#include <math.h>
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "gdisplay.h"
|
1999-04-13 01:55:06 +08:00
|
|
|
#include "tool_options_ui.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "tools.h"
|
|
|
|
#include "perspective_tool.h"
|
|
|
|
#include "rotate_tool.h"
|
|
|
|
#include "scale_tool.h"
|
|
|
|
#include "shear_tool.h"
|
1998-08-14 04:19:09 +08:00
|
|
|
#include "transform_core.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "transform_tool.h"
|
|
|
|
|
1998-11-23 22:47:09 +08:00
|
|
|
#include "config.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"
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* the transform structures */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
typedef struct _TransformOptions TransformOptions;
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _TransformOptions
|
|
|
|
{
|
1999-04-13 01:55:06 +08:00
|
|
|
ToolOptions tool_options;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
int direction;
|
|
|
|
int direction_d;
|
|
|
|
GtkWidget *direction_w;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
int smoothing;
|
|
|
|
int smoothing_d;
|
|
|
|
GtkWidget *smoothing_w;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
int clip;
|
|
|
|
int clip_d;
|
|
|
|
GtkWidget *clip_w;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
int grid_size;
|
|
|
|
int grid_size_d;
|
|
|
|
GtkObject *grid_size_w;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
int show_grid;
|
|
|
|
int show_grid_d;
|
|
|
|
GtkWidget *show_grid_w;
|
|
|
|
|
|
|
|
ToolType type;
|
|
|
|
ToolType type_d;
|
|
|
|
GtkWidget *type_w;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* the transform tool options */
|
|
|
|
static TransformOptions *transform_options = NULL;
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* local functions */
|
|
|
|
static void transform_change_type (int);
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
|
|
|
|
/* functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
1999-04-13 01:55:06 +08:00
|
|
|
transform_show_grid_update (GtkWidget *widget,
|
1998-08-14 22:46:24 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
1999-04-13 01:55:06 +08:00
|
|
|
tool_options_toggle_update (widget, data);
|
1998-08-14 22:46:24 +08:00
|
|
|
transform_core_grid_density_changed ();
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
1999-04-13 01:55:06 +08:00
|
|
|
transform_type_callback (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
gpointer client_data)
|
|
|
|
{
|
|
|
|
transform_change_type ((long) client_data);
|
|
|
|
}
|
|
|
|
|
1998-08-14 04:19:09 +08:00
|
|
|
static void
|
1999-04-13 01:55:06 +08:00
|
|
|
transform_direction_callback (GtkWidget *widget,
|
1998-08-14 04:19:09 +08:00
|
|
|
gpointer client_data)
|
|
|
|
{
|
|
|
|
long dir = (long) client_data;
|
|
|
|
|
|
|
|
if (dir == TRANSFORM_TRADITIONAL)
|
|
|
|
transform_options->direction = TRANSFORM_TRADITIONAL;
|
|
|
|
else
|
|
|
|
transform_options->direction = TRANSFORM_CORRECTIVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
transform_grid_density_callback (GtkWidget *w,
|
1999-04-09 06:25:54 +08:00
|
|
|
gpointer client_data)
|
1998-08-14 04:19:09 +08:00
|
|
|
{
|
|
|
|
transform_options->grid_size =
|
1999-04-09 06:25:54 +08:00
|
|
|
(int) (pow (2.0, 7.0 - GTK_ADJUSTMENT (w)->value) + 0.5);
|
1998-08-14 04:19:09 +08:00
|
|
|
transform_core_grid_density_changed ();
|
|
|
|
}
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
static void
|
1999-04-13 01:55:06 +08:00
|
|
|
transform_options_reset (void)
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
|
|
|
TransformOptions *options = transform_options;
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w),
|
|
|
|
options->type_d);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
|
|
|
options->smoothing_d);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->direction_w), TRUE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
|
|
|
|
options->show_grid_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
|
|
|
|
7.0 - log (options->grid_size_d) / log (2.0));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
|
|
|
|
options->clip_d);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static TransformOptions *
|
1999-04-13 01:55:06 +08:00
|
|
|
transform_options_new (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
TransformOptions *options;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
GtkWidget *main_box;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *label;
|
1999-04-13 01:55:06 +08:00
|
|
|
GSList *group;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *radio_frame;
|
|
|
|
GtkWidget *radio_box;
|
|
|
|
GtkWidget *radio_button;
|
1998-08-14 04:19:09 +08:00
|
|
|
GtkWidget *grid_density;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
int i;
|
1998-12-26 02:22:01 +08:00
|
|
|
static const char *transform_button_names[] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
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
|
|
|
N_("Rotation"),
|
|
|
|
N_("Scaling"),
|
|
|
|
N_("Shearing"),
|
|
|
|
N_("Perspective")
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
1998-12-26 02:22:01 +08:00
|
|
|
static const char *direction_button_names[] =
|
1998-08-14 04:19:09 +08:00
|
|
|
{
|
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
|
|
|
N_("Traditional"),
|
|
|
|
N_("Corrective")
|
1998-08-14 04:19:09 +08:00
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* the new transform tool options structure */
|
1997-11-25 06:05:25 +08:00
|
|
|
options = (TransformOptions *) g_malloc (sizeof (TransformOptions));
|
1999-04-13 01:55:06 +08:00
|
|
|
tool_options_init ((ToolOptions *) options,
|
|
|
|
_("Transform Tool Options"),
|
|
|
|
transform_options_reset);
|
1999-04-09 06:25:54 +08:00
|
|
|
options->type = options->type_d = ROTATE;
|
|
|
|
options->smoothing = options->smoothing_d = TRUE;
|
|
|
|
options->clip = options->clip_d = FALSE;
|
|
|
|
options->direction = options->direction_d = TRANSFORM_TRADITIONAL;
|
|
|
|
options->grid_size = options->grid_size_d = 32;
|
|
|
|
options->show_grid = options->show_grid_d = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* the main hbox */
|
|
|
|
main_box = gtk_hbox_new (FALSE, 2);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (options->tool_options.main_vbox), main_box,
|
|
|
|
FALSE, FALSE, 0);
|
1998-08-14 04:22:13 +08:00
|
|
|
|
|
|
|
/* the left vbox */
|
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 0);
|
1998-08-14 04:22:13 +08:00
|
|
|
|
1998-08-14 04:19:09 +08:00
|
|
|
/* the first radio frame and box, for transform type */
|
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
|
|
|
radio_frame = gtk_frame_new (_("Transform"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), radio_frame, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
radio_box = gtk_vbox_new (FALSE, 1);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
1998-08-14 04:19:09 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* the radio buttons */
|
1998-08-14 04:19:09 +08:00
|
|
|
group = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
1998-08-14 04:19:09 +08:00
|
|
|
radio_button =
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_radio_button_new_with_label (group,
|
|
|
|
gettext(transform_button_names[i]));
|
1997-11-25 06:05:25 +08:00
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
|
|
|
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
|
|
|
(GtkSignalFunc) transform_type_callback,
|
|
|
|
(gpointer) ((long) ROTATE + i));
|
|
|
|
gtk_widget_show (radio_button);
|
1999-04-09 06:25:54 +08:00
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
options->type_w = radio_button;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
gtk_widget_show (radio_box);
|
|
|
|
gtk_widget_show (radio_frame);
|
|
|
|
|
1998-08-14 04:22:13 +08:00
|
|
|
/* the smoothing toggle button */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
|
|
|
options->smoothing);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->smoothing_w), "toggled",
|
1999-04-13 01:55:06 +08:00
|
|
|
(GtkSignalFunc) tool_options_toggle_update,
|
1998-08-14 04:22:13 +08:00
|
|
|
&options->smoothing);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->smoothing_w, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->smoothing_w);
|
1998-08-14 04:22:13 +08:00
|
|
|
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
/* the right vbox */
|
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 0);
|
1998-08-14 04:22:13 +08:00
|
|
|
|
1998-08-14 04:19:09 +08:00
|
|
|
/* the second radio frame and box, for transform direction */
|
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
|
|
|
radio_frame = gtk_frame_new (_("Tool paradigm"));
|
1998-08-14 04:19:09 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), radio_frame, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
radio_box = gtk_vbox_new (FALSE, 1);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
1998-08-14 04:19:09 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (radio_frame), radio_box);
|
|
|
|
|
|
|
|
/* the radio buttons */
|
|
|
|
group = NULL;
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
radio_button =
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_radio_button_new_with_label (group,
|
|
|
|
gettext(direction_button_names[i]));
|
1998-08-14 04:19:09 +08:00
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
|
|
|
gtk_box_pack_start (GTK_BOX (radio_box), radio_button, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
|
|
|
(GtkSignalFunc) transform_direction_callback,
|
|
|
|
(gpointer) ((long) i));
|
|
|
|
gtk_widget_show (radio_button);
|
1999-04-09 06:25:54 +08:00
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
options->direction_w = radio_button;
|
1998-08-14 04:19:09 +08:00
|
|
|
}
|
|
|
|
gtk_widget_show (radio_box);
|
|
|
|
gtk_widget_show (radio_frame);
|
|
|
|
|
1998-08-14 22:46:24 +08:00
|
|
|
/* the show grid toggle button */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->show_grid_w = gtk_check_button_new_with_label (_("Show grid"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
|
1999-01-16 01:35:04 +08:00
|
|
|
options->show_grid);
|
1998-08-14 22:46:24 +08:00
|
|
|
/* important: connect the signal after setting the state, because calling
|
|
|
|
transform_show_grid_update before the tool is created will fail */
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (options->show_grid_w), "toggled",
|
1998-08-14 22:46:24 +08:00
|
|
|
(GtkSignalFunc) transform_show_grid_update,
|
|
|
|
&options->show_grid);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->show_grid_w, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->show_grid_w);
|
1998-08-14 22:46:24 +08:00
|
|
|
|
1998-08-14 04:19:09 +08:00
|
|
|
/* the grid density entry */
|
1999-04-09 06:25:54 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
1998-08-14 04:19:09 +08:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
1999-04-09 06:25:54 +08:00
|
|
|
label = gtk_label_new (_("Grid density:"));
|
1998-08-14 04:19:09 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
1999-04-09 06:25:54 +08:00
|
|
|
|
|
|
|
options->grid_size_w =
|
|
|
|
gtk_adjustment_new (7.0 - log (options->grid_size) / log (2.0), 0.0, 5.0,
|
|
|
|
1.0, 1.0, 0.0);
|
|
|
|
grid_density =
|
|
|
|
gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0);
|
1998-08-14 04:19:09 +08:00
|
|
|
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (grid_density), TRUE);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (options->grid_size_w), "value_changed",
|
1998-08-14 04:19:09 +08:00
|
|
|
(GtkSignalFunc) transform_grid_density_callback,
|
1999-04-09 06:25:54 +08:00
|
|
|
&options->grid_size);
|
1998-08-14 04:19:09 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), grid_density, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (grid_density);
|
1998-08-14 04:22:13 +08:00
|
|
|
|
|
|
|
/* the clip resulting image toggle button */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->clip_w = gtk_check_button_new_with_label (_("Clip result"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
|
|
|
|
options->clip);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (options->clip_w), "toggled",
|
1999-04-13 01:55:06 +08:00
|
|
|
(GtkSignalFunc) tool_options_toggle_update,
|
1998-08-14 04:22:13 +08:00
|
|
|
&options->clip);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->clip_w, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->clip_w);
|
1998-08-14 04:22:13 +08:00
|
|
|
|
|
|
|
gtk_widget_show (vbox);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_widget_show (main_box);
|
1998-08-14 04:19:09 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool *
|
1999-04-09 06:25:54 +08:00
|
|
|
tools_new_transform_tool (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-04-13 01:55:06 +08:00
|
|
|
/* The tool options */
|
1997-11-25 06:05:25 +08:00
|
|
|
if (! transform_options)
|
1999-04-13 01:55:06 +08:00
|
|
|
{
|
|
|
|
transform_options = transform_options_new ();
|
|
|
|
tools_register (ROTATE, (ToolOptions *) transform_options);
|
|
|
|
tools_register (SCALE, (ToolOptions *) transform_options);
|
|
|
|
tools_register (SHEAR, (ToolOptions *) transform_options);
|
|
|
|
tools_register (PERSPECTIVE, (ToolOptions *) transform_options);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
switch (transform_options->type)
|
|
|
|
{
|
|
|
|
case ROTATE:
|
|
|
|
return tools_new_rotate_tool ();
|
|
|
|
break;
|
|
|
|
case SCALE:
|
|
|
|
return tools_new_scale_tool ();
|
|
|
|
break;
|
|
|
|
case SHEAR:
|
|
|
|
return tools_new_shear_tool ();
|
|
|
|
break;
|
|
|
|
case PERSPECTIVE:
|
|
|
|
return tools_new_perspective_tool ();
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
return NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tools_free_transform_tool (Tool *tool)
|
|
|
|
{
|
|
|
|
switch (transform_options->type)
|
|
|
|
{
|
|
|
|
case ROTATE:
|
|
|
|
tools_free_rotate_tool (tool);
|
|
|
|
break;
|
|
|
|
case SCALE:
|
|
|
|
tools_free_scale_tool (tool);
|
|
|
|
break;
|
|
|
|
case SHEAR:
|
|
|
|
tools_free_shear_tool (tool);
|
|
|
|
break;
|
|
|
|
case PERSPECTIVE:
|
|
|
|
tools_free_perspective_tool (tool);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
transform_change_type (int new_type)
|
|
|
|
{
|
|
|
|
if (transform_options->type != new_type)
|
|
|
|
{
|
|
|
|
/* change the type, free the old tool, create the new tool */
|
|
|
|
transform_options->type = new_type;
|
|
|
|
|
|
|
|
tools_select (transform_options->type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
transform_tool_smoothing ()
|
|
|
|
{
|
|
|
|
if (!transform_options)
|
1998-08-15 21:34:54 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
return transform_options->smoothing;
|
|
|
|
}
|
1998-07-25 05:05:02 +08:00
|
|
|
|
|
|
|
int
|
1998-08-14 04:19:09 +08:00
|
|
|
transform_tool_clip ()
|
1998-07-25 05:05:02 +08:00
|
|
|
{
|
|
|
|
if (!transform_options)
|
1998-08-15 21:34:54 +08:00
|
|
|
return FALSE;
|
1998-08-14 04:19:09 +08:00
|
|
|
else
|
|
|
|
return transform_options->clip;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
transform_tool_direction ()
|
|
|
|
{
|
|
|
|
if (!transform_options)
|
|
|
|
return TRANSFORM_TRADITIONAL;
|
1998-07-25 05:05:02 +08:00
|
|
|
else
|
1998-08-14 04:19:09 +08:00
|
|
|
return transform_options->direction;
|
1998-07-25 05:05:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
transform_tool_grid_size ()
|
|
|
|
{
|
|
|
|
if (!transform_options)
|
|
|
|
return 32;
|
|
|
|
else
|
|
|
|
return transform_options->grid_size;
|
|
|
|
}
|
1998-08-14 22:46:24 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
transform_tool_show_grid ()
|
|
|
|
{
|
|
|
|
if (!transform_options)
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return transform_options->show_grid;
|
|
|
|
}
|