app: remove the offset feature in the Align/Distribute tool.

It's clearly broken right now. I can see it might have been used even to
progressively shift aligned items, but this was not used anymore. As for being
used while distributing, it doesn't make any sense anymore with the new logic of
not moving the extreme (first/last in coordinates) items.

I can see how an additional concept of offset can be useful in some situations,
but for now, let's get rid of this. We'll see in the future if someone asks for
it and provides valid use cases to work from.
This commit is contained in:
Jehan 2022-11-09 00:02:52 +01:00
parent e48b002c84
commit 6a63091e68
5 changed files with 6 additions and 95 deletions

View File

@ -60,7 +60,6 @@ static gint offset_compare (gconstpointer a,
* @reference: The #GObject to align the targets with, or %NULL.
* @reference_alignment: The point on the reference object to align the target item with..
* @align_contents: Take into account non-empty contents rather than item borders.
* @offset: How much to shift the target from perfect alignment..
*
* This function shifts the positions of a set of target objects,
* which can be "items" or guides, to bring them into a specified type
@ -73,11 +72,6 @@ static gint offset_compare (gconstpointer a,
* being arranged, where the order is defined by the type of alignment
* being requested. If the @reference argument is %NULL, then the
* first object in the sorted list is used as reference.
*
* When there are multiple target objects, they are arranged so that
* the spacing between consecutive ones is given by the argument
* @offset but for HFILL and VFILL - in this case, @offset works as an
* internal margin for the distribution (and it can be negative).
*/
void
gimp_image_arrange_objects (GimpImage *image,
@ -86,8 +80,7 @@ gimp_image_arrange_objects (GimpImage *image,
gdouble align_y,
GObject *reference,
GimpAlignmentType reference_alignment,
gboolean align_contents,
gint offset)
gboolean align_contents)
{
gdouble reference_x = 0.0;
gdouble reference_y = 0.0;
@ -222,8 +215,7 @@ gimp_image_arrange_objects (GimpImage *image,
}
else
{
/* The offset parameter works as an internal margin */
fill_offset = (distr_length - 2 * offset) / (gdouble) (g_list_length (object_list) - 1);
fill_offset = distr_length / (gdouble) (g_list_length (object_list) - 1);
}
/* Removing first and last objects. These stay unmoved. */
@ -289,10 +281,10 @@ gimp_image_arrange_objects (GimpImage *image,
*/
{
if (do_x)
xtranslate = z0 - z1 + n * offset;
xtranslate = z0 - z1;
if (do_y)
ytranslate = z0 - z1 + n * offset;
ytranslate = z0 - z1;
}
/* now actually align the target object */

View File

@ -25,7 +25,6 @@ void gimp_image_arrange_objects (GimpImage *image,
gdouble align_y,
GObject *reference,
GimpAlignmentType reference_alignment,
gboolean align_contents,
gint offset);
gboolean align_contents);
#endif /* __GIMP_IMAGE_ARRANGE_H__ */

View File

@ -60,8 +60,6 @@ enum
{
PROP_0,
PROP_ALIGN_REFERENCE,
PROP_OFFSET_X,
PROP_OFFSET_Y,
PROP_ALIGN_LAYERS,
PROP_ALIGN_VECTORS,
PROP_ALIGN_CONTENTS,
@ -153,20 +151,6 @@ gimp_align_options_class_init (GimpAlignOptionsClass *klass)
GIMP_ALIGN_REFERENCE_IMAGE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_OFFSET_X,
"offset-x",
_("Offset"),
_("Horizontal offset for distribution"),
-GIMP_MAX_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE, 0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_OFFSET_Y,
"offset-y",
_("Offset"),
_("Vertical offset for distribution"),
-GIMP_MAX_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE, 0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_ALIGN_LAYERS,
"align-layers",
_("Selected layers"),
@ -234,13 +218,6 @@ gimp_align_options_set_property (GObject *object,
gimp_align_options_update_area (options);
break;
case PROP_OFFSET_X:
options->offset_x = g_value_get_double (value);
break;
case PROP_OFFSET_Y:
options->offset_y = g_value_get_double (value);
break;
case PROP_ALIGN_LAYERS:
options->priv->align_layers = g_value_get_boolean (value);
gimp_align_options_update_area (options);
@ -281,13 +258,6 @@ gimp_align_options_get_property (GObject *object,
g_value_set_enum (value, options->align_reference);
break;
case PROP_OFFSET_X:
g_value_set_double (value, options->offset_x);
break;
case PROP_OFFSET_Y:
g_value_set_double (value, options->offset_y);
break;
case PROP_ALIGN_LAYERS:
g_value_set_boolean (value, options->priv->align_layers);
break;
@ -570,30 +540,6 @@ gimp_align_options_gui (GimpToolOptions *tool_options)
gimp_align_options_button_new (options, GIMP_DISTRIBUTE_EVEN_VERTICAL_GAP, hbox,
_("Distribute vertically with even vertical gaps"));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (section_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new (_("Offset X:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
spinbutton = gimp_prop_spin_button_new (config, "offset-x",
1, 20, 0);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (section_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new (_("Offset Y:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
spinbutton = gimp_prop_spin_button_new (config, "offset-y",
1, 20, 0);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
g_signal_connect (gimp_get_user_context (GIMP_CONTEXT (options)->gimp),
"image-changed",
G_CALLBACK (gimp_align_options_image_changed),

View File

@ -39,8 +39,6 @@ struct _GimpAlignOptions
GimpToolOptions parent_instance;
GimpAlignReferenceType align_reference;
gdouble offset_x;
gdouble offset_y;
GimpAlignOptionsPrivate *priv;
};

View File

@ -764,7 +764,6 @@ gimp_align_tool_align (GimpAlignTool *align_tool,
GObject *reference_object = NULL;
GList *objects;
GList *list;
gint offset = 0;
gdouble align_x = 0.0;
gdouble align_y = 0.0;
@ -775,28 +774,6 @@ gimp_align_tool_align (GimpAlignTool *align_tool,
image = gimp_context_get_image (gimp_get_user_context (GIMP_CONTEXT (options)->gimp));
switch (align_type)
{
case GIMP_ALIGN_LEFT:
case GIMP_ALIGN_HCENTER:
case GIMP_ALIGN_RIGHT:
case GIMP_ALIGN_TOP:
case GIMP_ALIGN_VCENTER:
case GIMP_ALIGN_BOTTOM:
case GIMP_DISTRIBUTE_EVEN_HORIZONTAL_GAP:
case GIMP_DISTRIBUTE_EVEN_VERTICAL_GAP:
offset = 0;
break;
case GIMP_ARRANGE_HFILL:
offset = options->offset_x;
break;
case GIMP_ARRANGE_VFILL:
offset = options->offset_y;
break;
}
/* if only one object is selected, use the image as reference
* if multiple objects are selected, use the first one as reference if
* "set_reference" is TRUE, otherwise use NULL.
@ -815,8 +792,7 @@ gimp_align_tool_align (GimpAlignTool *align_tool,
align_x, align_y,
reference_object,
align_type,
gimp_align_options_align_contents (options),
offset);
gimp_align_options_align_contents (options));
gimp_draw_tool_resume (GIMP_DRAW_TOOL (align_tool));