2006-12-09 13:33:38 -08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-04-28 13:14:32 -07:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2009-01-17 14:28:01 -08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-04-28 13:14:32 -07:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-04-28 13:14:32 -07: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-17 14:28:01 -08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-04-28 13:14:32 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2012-03-19 11:57:55 -07:00
|
|
|
#include <gegl.h>
|
2001-04-28 13:14:32 -07:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
2005-01-25 11:11:26 -08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-04-28 13:14:32 -07:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
2001-05-09 15:34:59 -07:00
|
|
|
#include "tools-types.h"
|
|
|
|
|
|
2002-11-18 12:50:31 -08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
|
2002-02-11 18:31:45 -08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 15:34:59 -07:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-04-28 13:14:32 -07:00
|
|
|
|
2010-11-02 06:05:47 -07:00
|
|
|
#include "widgets/gimppropwidgets.h"
|
2002-12-19 08:33:29 -08:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2002-03-17 06:07:54 -08:00
|
|
|
|
2001-11-29 08:44:51 -08:00
|
|
|
#include "gimprotatetool.h"
|
|
|
|
|
#include "gimpscaletool.h"
|
2003-06-29 13:40:45 -07:00
|
|
|
#include "gimptooloptions-gui.h"
|
2003-02-08 13:12:03 -08:00
|
|
|
#include "gimptransformoptions.h"
|
2001-04-28 13:14:32 -07:00
|
|
|
|
2003-03-25 08:38:19 -08:00
|
|
|
#include "gimp-intl.h"
|
2001-04-28 13:14:32 -07:00
|
|
|
|
|
|
|
|
|
2003-02-07 09:12:21 -08:00
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
2003-05-30 16:52:24 -07:00
|
|
|
PROP_TYPE,
|
2003-02-07 09:12:21 -08:00
|
|
|
PROP_DIRECTION,
|
|
|
|
|
PROP_INTERPOLATION,
|
2005-05-07 02:38:29 -07:00
|
|
|
PROP_CLIP,
|
2011-07-27 14:15:02 -07:00
|
|
|
PROP_SHOW_PREVIEW,
|
2008-03-06 03:54:44 -08:00
|
|
|
PROP_PREVIEW_OPACITY,
|
2003-02-07 09:12:21 -08:00
|
|
|
PROP_GRID_TYPE,
|
|
|
|
|
PROP_GRID_SIZE,
|
2008-03-06 03:54:44 -08:00
|
|
|
PROP_CONSTRAIN,
|
2003-02-07 09:12:21 -08:00
|
|
|
};
|
|
|
|
|
|
2001-04-28 13:14:32 -07:00
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
static void gimp_transform_options_set_property (GObject *object,
|
2004-07-02 14:56:30 -07:00
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2011-07-27 14:15:02 -07:00
|
|
|
static void gimp_transform_options_get_property (GObject *object,
|
2004-07-02 14:56:30 -07:00
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2003-02-07 09:12:21 -08:00
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
static void gimp_transform_options_reset (GimpToolOptions *tool_options);
|
2003-02-07 09:12:21 -08:00
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
static gboolean gimp_transform_options_sync_grid (GBinding *binding,
|
|
|
|
|
const GValue *source_value,
|
|
|
|
|
GValue *target_value,
|
|
|
|
|
gpointer user_data);
|
2003-02-07 09:12:21 -08:00
|
|
|
|
|
|
|
|
|
2005-12-13 01:13:50 -08:00
|
|
|
G_DEFINE_TYPE (GimpTransformOptions, gimp_transform_options,
|
2006-05-15 02:46:31 -07:00
|
|
|
GIMP_TYPE_TOOL_OPTIONS)
|
2001-04-28 13:14:32 -07:00
|
|
|
|
2005-12-13 01:13:50 -08:00
|
|
|
#define parent_class gimp_transform_options_parent_class
|
2001-04-28 13:14:32 -07:00
|
|
|
|
|
|
|
|
|
2003-07-17 08:22:21 -07:00
|
|
|
static void
|
2003-02-05 06:39:40 -08:00
|
|
|
gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
|
2001-04-28 13:14:32 -07:00
|
|
|
{
|
2004-09-24 05:01:35 -07:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass);
|
2003-02-07 09:12:21 -08:00
|
|
|
|
|
|
|
|
object_class->set_property = gimp_transform_options_set_property;
|
|
|
|
|
object_class->get_property = gimp_transform_options_get_property;
|
|
|
|
|
|
|
|
|
|
options_class->reset = gimp_transform_options_reset;
|
|
|
|
|
|
2003-05-30 16:52:24 -07:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TYPE,
|
|
|
|
|
"type", NULL,
|
|
|
|
|
GIMP_TYPE_TRANSFORM_TYPE,
|
|
|
|
|
GIMP_TRANSFORM_TYPE_LAYER,
|
2006-01-18 12:29:40 -08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-07 09:12:21 -08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_DIRECTION,
|
2011-04-21 04:28:05 -07:00
|
|
|
"direction",
|
|
|
|
|
N_("Direction of transformation"),
|
2003-02-07 09:12:21 -08:00
|
|
|
GIMP_TYPE_TRANSFORM_DIRECTION,
|
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
2006-01-18 12:29:40 -08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-07 09:12:21 -08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_INTERPOLATION,
|
2011-04-21 04:28:05 -07:00
|
|
|
"interpolation",
|
|
|
|
|
N_("Interpolation method"),
|
2003-02-07 09:12:21 -08:00
|
|
|
GIMP_TYPE_INTERPOLATION_TYPE,
|
2003-08-26 10:33:25 -07:00
|
|
|
GIMP_INTERPOLATION_LINEAR,
|
2006-01-18 12:29:40 -08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2006-12-24 08:48:08 -08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CLIP,
|
2011-04-21 04:28:05 -07:00
|
|
|
"clip",
|
2011-07-27 13:24:10 -07:00
|
|
|
N_("How to clip"),
|
2006-12-24 08:48:08 -08:00
|
|
|
GIMP_TYPE_TRANSFORM_RESIZE,
|
|
|
|
|
GIMP_TRANSFORM_RESIZE_ADJUST,
|
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2011-07-27 14:15:02 -07:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_PREVIEW,
|
|
|
|
|
"show-preview",
|
|
|
|
|
N_("Show a preview of the transformed image"),
|
|
|
|
|
TRUE,
|
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2008-03-06 03:54:44 -08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_PREVIEW_OPACITY,
|
2011-04-21 04:28:05 -07:00
|
|
|
"preview-opacity",
|
2011-07-30 15:25:43 -07:00
|
|
|
N_("Opacity of the preview image"),
|
2008-03-06 03:54:44 -08:00
|
|
|
0.0, 1.0, 1.0,
|
2011-04-21 04:28:05 -07:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-07 09:12:21 -08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_GRID_TYPE,
|
2011-04-21 04:28:05 -07:00
|
|
|
"grid-type",
|
2011-07-27 14:15:02 -07:00
|
|
|
N_("Composition guides such as rule of thirds"),
|
2011-07-24 09:01:21 -07:00
|
|
|
GIMP_TYPE_GUIDES_TYPE,
|
|
|
|
|
GIMP_GUIDES_N_LINES,
|
2006-01-18 12:29:40 -08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-07 09:12:21 -08:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_GRID_SIZE,
|
2011-04-21 04:28:05 -07:00
|
|
|
"grid-size",
|
2011-07-27 14:15:02 -07:00
|
|
|
N_("Size of a grid cell for variable number of composition guides"),
|
2003-02-07 09:12:21 -08:00
|
|
|
1, 128, 15,
|
2006-01-18 12:29:40 -08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2006-05-19 03:56:34 -07:00
|
|
|
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_CONSTRAIN,
|
2011-04-21 04:28:05 -07:00
|
|
|
"constrain",
|
2012-01-07 13:18:22 -08:00
|
|
|
NULL,
|
2003-02-07 09:12:21 -08:00
|
|
|
FALSE,
|
2006-01-18 12:29:40 -08:00
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-05 06:39:40 -08:00
|
|
|
}
|
2001-11-08 11:14:51 -08:00
|
|
|
|
2005-12-13 01:13:50 -08:00
|
|
|
static void
|
|
|
|
|
gimp_transform_options_init (GimpTransformOptions *options)
|
|
|
|
|
{
|
2007-09-10 08:29:48 -07:00
|
|
|
options->recursion_level = 3;
|
2005-12-13 01:13:50 -08:00
|
|
|
}
|
|
|
|
|
|
2003-02-07 09:12:21 -08:00
|
|
|
static void
|
|
|
|
|
gimp_transform_options_set_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
2004-09-24 05:01:35 -07:00
|
|
|
GimpTransformOptions *options = GIMP_TRANSFORM_OPTIONS (object);
|
2003-02-07 09:12:21 -08:00
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
2003-05-30 16:52:24 -07:00
|
|
|
case PROP_TYPE:
|
|
|
|
|
options->type = g_value_get_enum (value);
|
|
|
|
|
break;
|
2003-02-07 09:12:21 -08:00
|
|
|
case PROP_DIRECTION:
|
|
|
|
|
options->direction = g_value_get_enum (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_INTERPOLATION:
|
|
|
|
|
options->interpolation = g_value_get_enum (value);
|
|
|
|
|
break;
|
2005-05-07 02:38:29 -07:00
|
|
|
case PROP_CLIP:
|
2006-12-24 08:48:08 -08:00
|
|
|
options->clip = g_value_get_enum (value);
|
2003-02-07 09:12:21 -08:00
|
|
|
break;
|
2011-07-27 14:15:02 -07:00
|
|
|
case PROP_SHOW_PREVIEW:
|
|
|
|
|
options->show_preview = g_value_get_boolean (value);
|
2004-06-12 18:37:29 -07:00
|
|
|
break;
|
2008-03-06 03:54:44 -08:00
|
|
|
case PROP_PREVIEW_OPACITY:
|
|
|
|
|
options->preview_opacity = g_value_get_double (value);
|
|
|
|
|
break;
|
2003-02-07 09:12:21 -08:00
|
|
|
case PROP_GRID_TYPE:
|
|
|
|
|
options->grid_type = g_value_get_enum (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_GRID_SIZE:
|
|
|
|
|
options->grid_size = g_value_get_int (value);
|
|
|
|
|
break;
|
2006-05-19 03:56:34 -07:00
|
|
|
case PROP_CONSTRAIN:
|
|
|
|
|
options->constrain = g_value_get_boolean (value);
|
2003-02-07 09:12:21 -08:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_transform_options_get_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
2004-09-24 05:01:35 -07:00
|
|
|
GimpTransformOptions *options = GIMP_TRANSFORM_OPTIONS (object);
|
2003-02-07 09:12:21 -08:00
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
2003-05-30 16:52:24 -07:00
|
|
|
case PROP_TYPE:
|
|
|
|
|
g_value_set_enum (value, options->type);
|
|
|
|
|
break;
|
2003-02-07 09:12:21 -08:00
|
|
|
case PROP_DIRECTION:
|
|
|
|
|
g_value_set_enum (value, options->direction);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_INTERPOLATION:
|
|
|
|
|
g_value_set_enum (value, options->interpolation);
|
|
|
|
|
break;
|
2005-05-07 02:38:29 -07:00
|
|
|
case PROP_CLIP:
|
2006-12-24 08:48:08 -08:00
|
|
|
g_value_set_enum (value, options->clip);
|
2003-02-07 09:12:21 -08:00
|
|
|
break;
|
2011-07-27 14:15:02 -07:00
|
|
|
case PROP_SHOW_PREVIEW:
|
|
|
|
|
g_value_set_boolean (value, options->show_preview);
|
2004-06-12 18:37:29 -07:00
|
|
|
break;
|
2008-03-06 03:54:44 -08:00
|
|
|
case PROP_PREVIEW_OPACITY:
|
|
|
|
|
g_value_set_double (value, options->preview_opacity);
|
|
|
|
|
break;
|
2003-02-07 09:12:21 -08:00
|
|
|
case PROP_GRID_TYPE:
|
|
|
|
|
g_value_set_enum (value, options->grid_type);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_GRID_SIZE:
|
|
|
|
|
g_value_set_int (value, options->grid_size);
|
|
|
|
|
break;
|
2006-05-19 03:56:34 -07:00
|
|
|
case PROP_CONSTRAIN:
|
|
|
|
|
g_value_set_boolean (value, options->constrain);
|
2003-02-07 09:12:21 -08:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_transform_options_reset (GimpToolOptions *tool_options)
|
2003-07-17 08:22:21 -07:00
|
|
|
{
|
|
|
|
|
GParamSpec *pspec;
|
2003-02-07 09:12:21 -08:00
|
|
|
|
|
|
|
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (tool_options),
|
|
|
|
|
"interpolation");
|
|
|
|
|
|
|
|
|
|
if (pspec)
|
2003-07-17 08:22:21 -07:00
|
|
|
G_PARAM_SPEC_ENUM (pspec)->default_value =
|
|
|
|
|
tool_options->tool_info->gimp->config->interpolation_type;
|
2004-10-06 10:21:22 -07:00
|
|
|
|
|
|
|
|
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
|
2003-02-05 06:39:40 -08:00
|
|
|
}
|
|
|
|
|
|
2008-03-06 03:54:44 -08:00
|
|
|
/**
|
|
|
|
|
* gimp_transform_options_gui:
|
|
|
|
|
* @tool_options: a #GimpToolOptions
|
|
|
|
|
*
|
|
|
|
|
* Build the Transform Tool Options.
|
|
|
|
|
*
|
|
|
|
|
* Return value: a container holding the transform tool options
|
|
|
|
|
**/
|
2003-02-09 09:32:52 -08:00
|
|
|
GtkWidget *
|
2003-02-05 06:39:40 -08:00
|
|
|
gimp_transform_options_gui (GimpToolOptions *tool_options)
|
|
|
|
|
{
|
2011-07-27 14:15:02 -07:00
|
|
|
GObject *config = G_OBJECT (tool_options);
|
|
|
|
|
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
|
|
|
|
|
GtkWidget *hbox;
|
|
|
|
|
GtkWidget *box;
|
|
|
|
|
GtkWidget *label;
|
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
GtkWidget *combo;
|
|
|
|
|
GtkWidget *scale;
|
2011-07-30 15:25:43 -07:00
|
|
|
GtkWidget *grid_box;
|
2012-01-07 13:18:22 -08:00
|
|
|
const gchar *constrain_label = NULL;
|
|
|
|
|
const gchar *constrain_tip = NULL;
|
2003-02-05 06:39:40 -08:00
|
|
|
|
2011-09-30 02:29:11 -07:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
2003-05-30 16:52:24 -07:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
2006-10-03 12:32:41 -07:00
|
|
|
label = gtk_label_new (_("Transform:"));
|
2003-05-30 16:52:24 -07:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
2008-03-08 06:07:16 -08:00
|
|
|
box = gimp_prop_enum_stock_box_new (config, "type", "gimp", 0, 0);
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), box, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (box);
|
|
|
|
|
|
2005-05-07 02:38:29 -07:00
|
|
|
frame = gimp_prop_enum_radio_frame_new (config, "direction",
|
2006-10-03 12:32:41 -07:00
|
|
|
_("Direction"), 0, 0);
|
2005-05-07 02:38:29 -07:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (frame);
|
2001-04-28 13:14:32 -07:00
|
|
|
|
2005-05-07 02:38:29 -07:00
|
|
|
/* the interpolation menu */
|
2007-10-17 07:36:12 -07:00
|
|
|
frame = gimp_frame_new (_("Interpolation:"));
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (frame);
|
2002-02-11 18:31:45 -08:00
|
|
|
|
2004-04-18 08:12:42 -07:00
|
|
|
combo = gimp_prop_enum_combo_box_new (config, "interpolation", 0, 0);
|
2007-10-17 07:36:12 -07:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), combo);
|
2005-05-07 02:38:29 -07:00
|
|
|
gtk_widget_show (combo);
|
2001-11-29 08:44:51 -08:00
|
|
|
|
2006-12-24 08:48:08 -08:00
|
|
|
/* the clipping menu */
|
2007-10-17 07:36:12 -07:00
|
|
|
frame = gimp_frame_new (_("Clipping:"));
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (frame);
|
2006-12-24 08:48:08 -08:00
|
|
|
|
|
|
|
|
combo = gimp_prop_enum_combo_box_new (config, "clip", 0, 0);
|
2007-10-17 07:36:12 -07:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), combo);
|
2006-12-24 08:48:08 -08:00
|
|
|
gtk_widget_show (combo);
|
2005-05-07 02:38:29 -07:00
|
|
|
|
|
|
|
|
/* the preview frame */
|
2011-07-30 15:25:43 -07:00
|
|
|
scale = gimp_prop_opacity_spin_scale_new (config, "preview-opacity",
|
|
|
|
|
_("Image opacity"));
|
|
|
|
|
frame = gimp_prop_expanding_frame_new (config, "show-preview",
|
|
|
|
|
_("Show image preview"),
|
|
|
|
|
scale, NULL);
|
2001-11-08 11:14:51 -08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (frame);
|
2001-04-28 13:14:32 -07:00
|
|
|
|
2011-07-30 15:25:43 -07:00
|
|
|
/* the guides frame */
|
|
|
|
|
frame = gimp_frame_new (_("Guides"));
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (frame);
|
2008-03-06 03:54:44 -08:00
|
|
|
|
2011-09-30 02:29:11 -07:00
|
|
|
grid_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
2011-07-30 15:25:43 -07:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid_box);
|
|
|
|
|
gtk_widget_show (grid_box);
|
2004-07-02 14:56:30 -07:00
|
|
|
|
2011-07-30 15:25:43 -07:00
|
|
|
/* the guides type menu */
|
2011-07-27 14:15:02 -07:00
|
|
|
combo = gimp_prop_enum_combo_box_new (config, "grid-type", 0, 0);
|
2011-07-30 15:25:43 -07:00
|
|
|
gtk_box_pack_start (GTK_BOX (grid_box), combo, FALSE, FALSE, 0);
|
2004-04-18 08:12:42 -07:00
|
|
|
gtk_widget_show (combo);
|
2002-12-17 07:46:47 -08:00
|
|
|
|
2010-11-02 06:05:47 -07:00
|
|
|
/* the grid density scale */
|
|
|
|
|
scale = gimp_prop_spin_scale_new (config, "grid-size", NULL,
|
|
|
|
|
1.8, 8.0, 0);
|
2011-07-30 15:25:43 -07:00
|
|
|
gtk_box_pack_start (GTK_BOX (grid_box), scale, FALSE, FALSE, 0);
|
2010-11-02 06:05:47 -07:00
|
|
|
gtk_widget_show (scale);
|
2004-07-02 14:56:30 -07:00
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
g_object_bind_property_full (config, "grid-type",
|
2011-07-30 15:25:43 -07:00
|
|
|
scale, "visible",
|
2011-07-27 14:15:02 -07:00
|
|
|
G_BINDING_SYNC_CREATE,
|
|
|
|
|
gimp_transform_options_sync_grid,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL, NULL);
|
2001-11-08 11:14:51 -08:00
|
|
|
|
2006-05-19 03:56:34 -07:00
|
|
|
if (tool_options->tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL)
|
|
|
|
|
{
|
2012-01-07 13:18:22 -08:00
|
|
|
constrain_label = _("15 degrees (%s)");
|
|
|
|
|
constrain_tip = _("Limit rotation steps to 15 degrees");
|
2006-05-19 03:56:34 -07:00
|
|
|
}
|
|
|
|
|
else if (tool_options->tool_info->tool_type == GIMP_TYPE_SCALE_TOOL)
|
|
|
|
|
{
|
2012-01-07 13:18:22 -08:00
|
|
|
constrain_label = _("Keep aspect (%s)");
|
|
|
|
|
constrain_tip = _("Keep the original aspect ratio");
|
2006-05-19 03:56:34 -07:00
|
|
|
}
|
|
|
|
|
|
2012-01-07 13:18:22 -08:00
|
|
|
if (constrain_label)
|
2001-11-29 08:44:51 -08:00
|
|
|
{
|
2011-10-06 12:59:07 -07:00
|
|
|
GtkWidget *button;
|
|
|
|
|
gchar *label;
|
|
|
|
|
GdkModifierType constrain_mask;
|
|
|
|
|
|
|
|
|
|
constrain_mask = gimp_get_constrain_behavior_mask ();
|
2008-03-06 03:54:44 -08:00
|
|
|
|
2012-01-07 13:18:22 -08:00
|
|
|
label = g_strdup_printf (constrain_label,
|
2011-10-06 12:59:07 -07:00
|
|
|
gimp_get_mod_string (constrain_mask));
|
2006-05-19 03:56:34 -07:00
|
|
|
|
|
|
|
|
button = gimp_prop_check_button_new (config, "constrain", label);
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
2012-01-07 13:18:22 -08:00
|
|
|
gimp_help_set_help_data (button, constrain_tip, NULL);
|
|
|
|
|
|
2006-05-19 03:56:34 -07:00
|
|
|
g_free (label);
|
2001-11-29 08:44:51 -08:00
|
|
|
}
|
2001-04-30 05:54:33 -07:00
|
|
|
|
2003-02-09 09:32:52 -08:00
|
|
|
return vbox;
|
2001-04-28 13:14:32 -07:00
|
|
|
}
|
|
|
|
|
|
2011-03-27 12:49:34 -07:00
|
|
|
gboolean
|
|
|
|
|
gimp_transform_options_show_preview (GimpTransformOptions *options)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_TRANSFORM_OPTIONS (options), FALSE);
|
|
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
return (options->show_preview &&
|
|
|
|
|
options->type == GIMP_TRANSFORM_TYPE_LAYER &&
|
|
|
|
|
options->direction == GIMP_TRANSFORM_FORWARD);
|
2011-03-27 12:49:34 -07:00
|
|
|
}
|
|
|
|
|
|
2001-04-28 13:14:32 -07:00
|
|
|
|
2001-11-19 10:23:43 -08:00
|
|
|
/* private functions */
|
|
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
static gboolean
|
|
|
|
|
gimp_transform_options_sync_grid (GBinding *binding,
|
|
|
|
|
const GValue *source_value,
|
|
|
|
|
GValue *target_value,
|
|
|
|
|
gpointer user_data)
|
2001-11-19 10:23:43 -08:00
|
|
|
{
|
2011-07-27 14:15:02 -07:00
|
|
|
GimpGuidesType type = g_value_get_enum (source_value);
|
2008-03-06 03:54:44 -08:00
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
g_value_set_boolean (target_value,
|
|
|
|
|
type == GIMP_GUIDES_N_LINES ||
|
|
|
|
|
type == GIMP_GUIDES_SPACING);
|
2008-03-06 03:54:44 -08:00
|
|
|
|
2011-07-27 14:15:02 -07:00
|
|
|
return TRUE;
|
|
|
|
|
}
|