Commit 9fd4ac8a authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/tools/gimpmoveoptions.[ch] applied (cleaned up version of) a patch

2004-10-30  Sven Neumann  <sven@gimp.org>

	* app/tools/gimpmoveoptions.[ch]
	* app/tools/gimpmovetool.[ch]: applied (cleaned up version of) a
	patch from Joao S. O. Bueno that adds a tool-option to restore the
	old Move tool behaviour. Fixes bug #156801.
parent 6eea7ef5
2004-10-30 Sven Neumann <sven@gimp.org>
* app/tools/gimpmoveoptions.[ch]
* app/tools/gimpmovetool.[ch]: applied (cleaned up version of) a
patch from Joao S. O. Bueno that adds a tool-option to restore the
old Move tool behaviour. Fixes bug #156801.
2004-10-30 Sven Neumann <sven@gimp.org>
 
* plug-ins/common/despeckle.c: applied a patch from Geert Jordaens
......
......@@ -41,7 +41,8 @@ enum
{
PROP_0,
PROP_MOVE_TYPE,
PROP_MOVE_CURRENT
PROP_MOVE_CURRENT,
PROP_CHANGE_ACTIVE
};
......@@ -107,6 +108,11 @@ gimp_move_options_class_init (GimpMoveOptionsClass *klass)
"move-current", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_CHANGE_ACTIVE,
"change-active", NULL,
TRUE,
0);
}
static void
......@@ -125,6 +131,9 @@ gimp_move_options_set_property (GObject *object,
case PROP_MOVE_CURRENT:
options->move_current = g_value_get_boolean (value);
break;
case PROP_CHANGE_ACTIVE:
options->change_active = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -147,6 +156,9 @@ gimp_move_options_get_property (GObject *object,
case PROP_MOVE_CURRENT:
g_value_set_boolean (value, options->move_current);
break;
case PROP_CHANGE_ACTIVE:
g_value_set_boolean (value, options->change_active);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -160,27 +172,33 @@ gimp_move_options_notify_type (GimpMoveOptions *move_options,
{
const gchar *false_label = NULL;
const gchar *true_label = NULL;
const gchar *change_active_label = NULL;
GtkWidget *button;
GtkWidget *check;
GSList *group;
button = g_object_get_data (G_OBJECT (frame), "radio-button");
check = g_object_get_data (G_OBJECT (frame), "check");
switch (move_options->move_type)
{
case GIMP_TRANSFORM_TYPE_LAYER:
false_label = _("Pick a layer or guide to Move");
true_label = _("Move the current layer");
false_label = _("Pick a layer or guide to Move");
true_label = _("Move the active layer");
change_active_label = _("Change the active layer");
break;
case GIMP_TRANSFORM_TYPE_SELECTION:
false_label = _("Move selection");
true_label = _("Move selection");
false_label = _("Move selection");
true_label = _("Move selection");
change_active_label = NULL;
break;
case GIMP_TRANSFORM_TYPE_PATH:
false_label = _("Pick a path to move");
true_label = _("Move the current path");
break;
false_label = _("Pick a path to move");
true_label = _("Move the active path");
change_active_label = _("Change the active path");
break;
}
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
......@@ -189,8 +207,21 @@ gimp_move_options_notify_type (GimpMoveOptions *move_options,
group = g_slist_next (group);
gtk_button_set_label (GTK_BUTTON (group->data), false_label);
gtk_button_set_label (GTK_BUTTON (check), change_active_label);
gtk_widget_set_sensitive (frame,
move_options->move_type != GIMP_TRANSFORM_TYPE_SELECTION);
gtk_widget_set_sensitive (check,
move_options->move_type != GIMP_TRANSFORM_TYPE_SELECTION);
if (move_options->move_type == GIMP_TRANSFORM_TYPE_SELECTION)
{
gtk_widget_hide (check);
}
else
{
gtk_widget_show (check);
}
}
GtkWidget *
......@@ -201,6 +232,7 @@ gimp_move_options_gui (GimpToolOptions *tool_options)
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *check;
gchar *title;
vbox = gimp_tool_options_gui (tool_options);
......@@ -221,6 +253,11 @@ gimp_move_options_gui (GimpToolOptions *tool_options)
frame = gimp_prop_boolean_radio_frame_new (config, "move-current",
title, "true", "false");
/* change active layer */
check = gimp_prop_check_button_new (config, "change_active", "false");
g_object_set_data (G_OBJECT (frame), "check", check);
gimp_move_options_notify_type (GIMP_MOVE_OPTIONS (config), NULL, frame);
g_signal_connect_object (config, "notify::move-type",
......@@ -230,6 +267,10 @@ gimp_move_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
if (GIMP_MOVE_OPTIONS (config)->move_type == GIMP_TRANSFORM_TYPE_SELECTION)
gtk_widget_show (check);
g_free (title);
return vbox;
......
......@@ -40,6 +40,7 @@ struct _GimpMoveOptions
GimpTransformType move_type;
gboolean move_current;
gboolean change_active;
};
......
......@@ -237,6 +237,7 @@ gimp_move_tool_button_press (GimpTool *tool,
move->moving_guide = FALSE;
move->old_active_layer = NULL;
move->old_active_vectors = NULL;
move->change_active = options->change_active;
if (! options->move_current)
{
......@@ -246,7 +247,8 @@ gimp_move_tool_button_press (GimpTool *tool,
if (gimp_draw_tool_on_vectors (GIMP_DRAW_TOOL (tool), gdisp,
coords, 7, 7,
NULL, NULL, NULL, NULL, NULL, &vectors))
NULL, NULL, NULL, NULL, NULL,
&vectors))
{
move->old_active_vectors =
gimp_image_get_active_vectors (gdisp->gimage);
......@@ -256,7 +258,6 @@ gimp_move_tool_button_press (GimpTool *tool,
else
{
/* no path picked */
return;
}
}
......@@ -457,15 +458,21 @@ gimp_move_tool_button_release (GimpTool *tool,
{
if (move->old_active_layer)
{
gimp_image_set_active_layer (gdisp->gimage,
move->old_active_layer);
if ( ! move->change_active)
{
gimp_image_set_active_layer (gdisp->gimage,
move->old_active_layer);
}
move->old_active_layer = NULL;
}
if (move->old_active_vectors)
{
gimp_image_set_active_vectors (gdisp->gimage,
move->old_active_vectors);
if (! move->change_active)
{
gimp_image_set_active_vectors (gdisp->gimage,
move->old_active_vectors);
}
move->old_active_vectors = NULL;
}
......
......@@ -49,6 +49,8 @@ struct _GimpMoveTool
GimpLayer *old_active_layer;
GimpVectors *old_active_vectors;
gboolean change_active;
};
struct _GimpMoveToolClass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment