--- plug-ins/common/align_layers.c.orig Tue Mar 14 11:21:00 2000 +++ plug-ins/common/align_layers.c Tue Mar 14 11:24:15 2000 @@ -217,7 +217,7 @@ align_layers (gint32 image_id) { gint layer_num = 0; - gint visible_layer_num = 1; + gint visible_layer_num = 0; gint *layers = NULL; gint index, vindex; gint step_x = 0; @@ -230,8 +230,10 @@ gint offset_y = 0; gint base_x = 0; gint base_y =0; + gint bgindex = 0; layers = gimp_image_get_layers (image_id, &layer_num); + bgindex = layer_num - 1; for (index = 0; index < layer_num; index++) if (gimp_layer_get_visible (layers[index])) visible_layer_num++; @@ -239,7 +241,8 @@ if (VALS.ignore_bottom) { layer_num--; - visible_layer_num--; + if (gimp_layer_get_visible (layers[bgindex])) + visible_layer_num--; } if (0 < visible_layer_num) @@ -261,7 +264,7 @@ if (unintialzied) { - base_x = min_x = max_y = orig_x; + base_x = min_x = max_x = orig_x; base_y = min_y = max_y = orig_y; unintialzied = 0; } @@ -275,12 +278,12 @@ } if (VALS.base_is_bottom_layer) { - gimp_drawable_offsets (layers[layer_num], &orig_x, &orig_y); - align_layers_get_align_offsets (layers[layer_num], &offset_x, &offset_y); + gimp_drawable_offsets (layers[bgindex], &orig_x, &orig_y); + align_layers_get_align_offsets (layers[bgindex], &offset_x, &offset_y); orig_x += offset_x; orig_y += offset_y; - base_x = min_x = max_y = orig_x; - base_y = min_y = max_y = orig_y; + base_x = min_x = orig_x; + base_y = min_y = orig_y; } if (1 < visible_layer_num) { @@ -317,7 +320,7 @@ x = (base_x + vindex * step_x) - offset_x; break; case RIGHT2LEFT: - x = (base_x + (visible_layer_num - vindex) * step_x) - offset_x; + x = (base_x + (visible_layer_num - 1 - vindex) * step_x) - offset_x; break; case SNAP2HGRID: x = VALS.grid_size @@ -337,7 +340,7 @@ y = (base_y + vindex * step_y) - offset_y; break; case BOTTOM2TOP: - y = (base_y + (visible_layer_num - vindex) * step_y) - offset_y; + y = (base_y + (visible_layer_num - 1 - vindex) * step_y) - offset_y; break; case SNAP2VGRID: y = VALS.grid_size