Bill Skaggs <weskaggs@primate.ucdavis.edu>

* app/tools/gimptransformtool.[ch]
	* app/tools/gimptransformoptions.[ch]
	* app/display/gimpdisplayshell-preview.c: apply patch
	from Tom Lechner (comment #35 in bug #167926) to allow
	tranlucency in transform tool previews, for testing.

svn path=/branches/weskaggs/; revision=25033
This commit is contained in:
William Skaggs 2008-03-04 19:17:18 +00:00
parent 4f6b37e9e5
commit 2d09193310
6 changed files with 878 additions and 408 deletions

View File

@ -1,3 +1,11 @@
2008-03-04 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/tools/gimptransformtool.[ch]
* app/tools/gimptransformoptions.[ch]
* app/display/gimpdisplayshell-preview.c: apply patch
from Tom Lechner (comment #35 in bug #167926) to allow
tranlucency in transform tool previews, for testing.
2008-03-04 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/display/gimpdisplayshell.[ch]

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,8 @@ enum
PROP_PREVIEW_TYPE,
PROP_GRID_TYPE,
PROP_GRID_SIZE,
PROP_CONSTRAIN
PROP_CONSTRAIN,
PROP_PREVIEW_OPACITY
};
@ -69,6 +70,10 @@ static void gimp_transform_options_preview_notify (GimpTransformOptions *optio
GParamSpec *pspec,
GtkWidget *density_box);
static void gimp_transform_options_preview_opacity_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box);
G_DEFINE_TYPE (GimpTransformOptions, gimp_transform_options,
GIMP_TYPE_TOOL_OPTIONS)
@ -125,6 +130,10 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
"constrain", NULL,
FALSE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_PREVIEW_OPACITY,
"preview-opacity", NULL,
0, 100, 100,
GIMP_PARAM_STATIC_STRINGS);
}
static void
@ -167,6 +176,9 @@ gimp_transform_options_set_property (GObject *object,
case PROP_CONSTRAIN:
options->constrain = g_value_get_boolean (value);
break;
case PROP_PREVIEW_OPACITY:
options->preview_opacity = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -207,6 +219,9 @@ gimp_transform_options_get_property (GObject *object,
case PROP_CONSTRAIN:
g_value_set_boolean (value, options->constrain);
break;
case PROP_PREVIEW_OPACITY:
g_value_set_int (value, options->preview_opacity);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -228,6 +243,12 @@ gimp_transform_options_reset (GimpToolOptions *tool_options)
GIMP_TOOL_OPTIONS_CLASS (parent_class)->reset (tool_options);
}
/**
* gimp_transform_options_gui:
* @tool_options: a #GimpToolOptions
*
* Build the Transform Tool Options dialog.
**/
GtkWidget *
gimp_transform_options_gui (GimpToolOptions *tool_options)
{
@ -311,7 +332,17 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (button), table, FALSE, FALSE, 0);
gtk_widget_show (table);
gtk_widget_set_sensitive (button,
gtk_widget_set_sensitive (combo,
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_GRID ||
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID);
g_signal_connect (config, "notify::preview-type",
G_CALLBACK (gimp_transform_options_preview_notify),
combo);
gtk_widget_set_sensitive (table,
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_GRID ||
options->preview_type ==
@ -319,7 +350,7 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
g_signal_connect (config, "notify::preview-type",
G_CALLBACK (gimp_transform_options_preview_notify),
button);
table);
gimp_prop_scale_entry_new (config, "grid-size",
GTK_TABLE (table), 0, 0,
@ -327,6 +358,29 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
1.0, 8.0, 0,
FALSE, 0.0, 0.0);
/* the preview opacity scale */
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 2);
gtk_box_pack_start (GTK_BOX (button), table, FALSE, FALSE, 0);
gtk_widget_show (table);
gtk_widget_set_sensitive (table,
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE ||
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID);
g_signal_connect (config, "notify::preview-type",
G_CALLBACK (gimp_transform_options_preview_opacity_notify),
table);
gimp_prop_scale_entry_new (config, "preview-opacity",
GTK_TABLE (table), 0, 0,
_("Opacity:"),
1.0, 8.0, 0,
FALSE, 0.0, 0.0);
if (tool_options->tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL)
{
constrain = (_("15 degrees (%s)"));
@ -365,3 +419,16 @@ gimp_transform_options_preview_notify (GimpTransformOptions *options,
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID);
}
static void
gimp_transform_options_preview_opacity_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box)
{
gtk_widget_set_sensitive (density_box,
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE ||
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID);
}

View File

@ -47,6 +47,7 @@ struct _GimpTransformOptions
GimpTransformGridType grid_type;
gint grid_size;
gboolean constrain;
gint preview_opacity;
};

View File

@ -280,6 +280,10 @@ gimp_transform_tool_constructor (GType type,
g_signal_connect_object (options, "notify::grid-size",
G_CALLBACK (gimp_transform_tool_notify_preview),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::preview-opacity",
G_CALLBACK (gimp_transform_tool_notify_preview),
tr_tool, 0);
}
g_signal_connect_object (options, "notify::constrain",
@ -1360,7 +1364,7 @@ gimp_transform_tool_force_expose_preview (GimpTransformTool *tr_tool)
static gint last_h = 0;
GimpDisplayShell *shell;
gdouble dx [4], dy [4];
gdouble dx[4], dy[4];
gint area_x, area_y, area_w, area_h;
gint i;
@ -1388,20 +1392,20 @@ gimp_transform_tool_force_expose_preview (GimpTransformTool *tr_tool)
dx + 3, dy + 3, FALSE);
/* find bounding box around preview */
area_x = area_w = (gint) dx [0];
area_y = area_h = (gint) dy [0];
area_x = area_w = (gint) dx[0];
area_y = area_h = (gint) dy[0];
for (i = 1; i < 4; i++)
{
if (dx [i] < area_x)
area_x = (gint) dx [i];
else if (dx [i] > area_w)
area_w = (gint) dx [i];
if (dx[i] < area_x)
area_x = (gint) dx[i];
else if (dx[i] > area_w)
area_w = (gint) dx[i];
if (dy [i] < area_y)
area_y = (gint) dy [i];
else if (dy [i] > area_h)
area_h = (gint) dy [i];
if (dy[i] < area_y)
area_y = (gint) dy[i];
else if (dy[i] > area_h)
area_h = (gint) dy[i];
}
area_w -= area_x;

View File

@ -62,7 +62,7 @@ struct _GimpTransformTool
gdouble cx, cy; /* center point (for rotation) */
gdouble aspect; /* original aspect ratio */
gdouble tx1, ty1; /* transformed coords */
gdouble tx1, ty1; /* transformed handle coords */
gdouble tx2, ty2;
gdouble tx3, ty3;
gdouble tx4, ty4;