Code

No more NRMatrix or NRPoint.
[inkscape.git] / src / dialogs / clonetiler.cpp
index 64edcbfd59e920fd9bec0d2369e2da44424ff981..64583b9f2acc0befc36b10dff2feb9f85e44464b 100644 (file)
@@ -5,14 +5,16 @@
  *
  * Authors:
  *   bulia byak <buliabyak@users.sf.net>
+ *   Johan Engelen <goejendaagh@zonnet.nl>
  *
- * Copyright (C) 2004-2005 Authors
+ * Copyright (C) 2004-2006 Authors
  * Released under GNU GPL
  */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
+#include <glib/gmem.h>
 #include <gtk/gtk.h>
 #include <glibmm/i18n.h>
 
 
 #include "ui/widget/color-picker.h"
 
+#include "../sp-filter.h"
+#include "../filter-chemistry.h"
+
+#define MIN_ONSCREEN_DISTANCE 50
+
 static GtkWidget *dlg = NULL;
 static win_data wd;
 
@@ -88,7 +95,7 @@ static sigc::connection _color_changed_connection;
 static Inkscape::UI::Widget::ColorPicker *color_picker;
 
 static void
-clonetiler_dialog_destroy (GtkObject *object, gpointer data)
+clonetiler_dialog_destroy( GtkObject */*object*/, gpointer /*data*/ )
 {
     if (Inkscape::NSApplication::Application::getNewGui())
     {
@@ -102,14 +109,14 @@ clonetiler_dialog_destroy (GtkObject *object, gpointer data)
     _color_changed_connection.disconnect();
 
     delete color_picker;
-    
+
     wd.win = dlg = NULL;
     wd.stop = 0;
 
 }
 
 static gboolean
-clonetiler_dialog_delete (GtkObject *object, GdkEvent * /*event*/, gpointer data)
+clonetiler_dialog_delete (GtkObject */*object*/, GdkEvent * /*event*/, gpointer /*data*/)
 {
     gtk_window_get_position ((GtkWindow *) dlg, &x, &y);
     gtk_window_get_size ((GtkWindow *) dlg, &w, &h);
@@ -142,7 +149,7 @@ on_picker_color_changed (guint rgba)
 
     Inkscape::XML::Node *repr = inkscape_get_repr(INKSCAPE, prefs_path);
     gchar c[32];
-    sp_svg_write_color(c, 32, rgba);
+    sp_svg_write_color(c, sizeof(c), rgba);
     repr->setAttribute("initial_color", c);
 
     is_updating = false;
@@ -214,80 +221,205 @@ enum {
 
 
 static NR::Matrix
-clonetiler_get_transform ( 
+clonetiler_get_transform (
+
     // symmetry group
     int type,
+
     // row, column
-    int x, int y,
+    int i, int j,
+
     // center, width, height of the tile
     double cx, double cy,
-    double w, double h,
+    double w,  double h,
 
     // values from the dialog:
-    double d_x_per_x, double d_y_per_x, double d_x_per_y, double d_y_per_y,
-    int alternate_x, int alternate_y, double rand_x, double rand_y,
-    double d_per_x_exp, double d_per_y_exp,
-    double d_rot_per_x, double d_rot_per_y, int alternate_rotx, int alternate_roty, double rand_rot,
-    double d_scalex_per_x, double d_scaley_per_x, double d_scalex_per_y, double d_scaley_per_y,
-    int alternate_scalex, int alternate_scaley, double rand_scalex, double rand_scaley
+    // Shift
+    double shiftx_per_i,      double shifty_per_i,
+    double shiftx_per_j,      double shifty_per_j,
+    double shiftx_rand,       double shifty_rand,
+    double shiftx_exp,        double shifty_exp,
+    int    shiftx_alternate,  int    shifty_alternate,
+    int    shiftx_cumulate,   int    shifty_cumulate,
+    int    shiftx_excludew,   int    shifty_excludeh,
+
+    // Scale
+    double scalex_per_i,      double scaley_per_i,
+    double scalex_per_j,      double scaley_per_j,
+    double scalex_rand,       double scaley_rand,
+    double scalex_exp,        double scaley_exp,
+    double scalex_log,        double scaley_log,
+    int    scalex_alternate,  int    scaley_alternate,
+    int    scalex_cumulate,   int    scaley_cumulate,
+
+    // Rotation
+    double rotate_per_i,      double rotate_per_j,
+    double rotate_rand,
+    int    rotate_alternatei, int    rotate_alternatej,
+    int    rotate_cumulatei,  int    rotate_cumulatej
     )
 {
-    // in abs units
-    double eff_x = (alternate_x? (x%2) : pow ((double) x, d_per_x_exp));
-    double eff_y = (alternate_y? (y%2) : pow ((double) y, d_per_y_exp));
-    double dx = d_x_per_x * w * eff_x + d_x_per_y  * w * eff_y + rand_x * w * g_random_double_range (-1, 1);
-    double dy = d_y_per_x * h * eff_x + d_y_per_y  * h * eff_y + rand_y * h * g_random_double_range (-1, 1);
-
-    NR::Matrix rect_translate (NR::translate (w * pow ((double) x, d_per_x_exp) + dx, h * pow ((double) y, d_per_y_exp) + dy));
-
-    // in deg
-    double eff_x_rot = (alternate_rotx? (x%2) : (x));
-    double eff_y_rot = (alternate_roty? (y%2) : (y));
-    double drot = d_rot_per_x * eff_x_rot + d_rot_per_y * eff_y_rot + rand_rot * 180 * g_random_double_range (-1, 1);
-
-    // times the original
-    double eff_x_s = (alternate_scalex? (x%2) : (x));
-    double eff_y_s = (alternate_scaley? (y%2) : (y));
-    double rand_scale_x, rand_scale_y;
-    if (rand_scaley == rand_scalex) {
-        // if rands are equal, scale proportionally
-        rand_scale_x = rand_scale_y = rand_scalex * 1 * g_random_double_range (-1, 1);
+
+    // Shift (in units of tile width or height) -------------
+    double delta_shifti = 0.0;
+    double delta_shiftj = 0.0;
+
+    if( shiftx_alternate ) {
+        delta_shifti = (double)(i%2);
     } else {
-        rand_scale_x = rand_scalex * 1 * g_random_double_range (-1, 1);
-        rand_scale_y = rand_scaley * 1 * g_random_double_range (-1, 1);
+        if( shiftx_cumulate ) {  // Should the delta shifts be cumulative (i.e. 1, 1+2, 1+2+3, ...)
+            delta_shifti = (double)(i*i);
+        } else {
+            delta_shifti = (double)i;
+        }
+    }
+
+    if( shifty_alternate ) {
+        delta_shiftj = (double)(j%2);
+    } else {
+        if( shifty_cumulate ) {
+            delta_shiftj = (double)(j*j);
+        } else {
+            delta_shiftj = (double)j;
+        }
     }
-    double dscalex = 1 + d_scalex_per_x * eff_x_s + d_scalex_per_y * eff_y_s + rand_scale_x;
-    if (dscalex < 0) dscalex = 0;
-    double dscaley = 1 + d_scaley_per_x * eff_x_s + d_scaley_per_y * eff_y_s + rand_scale_y;
-    if (dscaley < 0) dscaley = 0;
 
-    NR::Matrix drot_c = NR::translate(-cx, -cy) * NR::rotate (M_PI*drot/180) * NR::translate(cx, cy);
+    // Random shift, only calculate if non-zero.
+    double delta_shiftx_rand = 0.0;
+    double delta_shifty_rand = 0.0;
+    if( shiftx_rand != 0.0 ) delta_shiftx_rand = shiftx_rand * g_random_double_range (-1, 1);
+    if( shifty_rand != 0.0 ) delta_shifty_rand = shifty_rand * g_random_double_range (-1, 1);
 
-    NR::Matrix dscale_c = NR::translate(-cx, -cy) * NR::scale (dscalex, dscaley) * NR::translate(cx, cy);
+
+    // Delta shift (units of tile width/height)
+    double di = shiftx_per_i * delta_shifti  + shiftx_per_j * delta_shiftj + delta_shiftx_rand;
+    double dj = shifty_per_i * delta_shifti  + shifty_per_j * delta_shiftj + delta_shifty_rand;
+
+    // Shift in actual x and y, used below
+    double dx = w * di;
+    double dy = h * dj;
+
+    double shifti = di;
+    double shiftj = dj;
+
+    // Include tile width and height in shift if required
+    if( !shiftx_excludew ) shifti += i;
+    if( !shifty_excludeh ) shiftj += j;
+
+    // Add exponential shift if necessary
+    if ( shiftx_exp != 1.0 ) shifti = pow( shifti, shiftx_exp );
+    if ( shifty_exp != 1.0 ) shiftj = pow( shiftj, shifty_exp );
+
+    // Final shift
+    NR::Matrix rect_translate (NR::translate (w * shifti, h * shiftj));
+
+    // Rotation (in degrees) ------------
+    double delta_rotationi = 0.0;
+    double delta_rotationj = 0.0;
+
+    if( rotate_alternatei ) {
+        delta_rotationi = (double)(i%2);
+    } else {
+        if( rotate_cumulatei ) {
+            delta_rotationi = (double)(i*i + i)/2.0;
+        } else {
+            delta_rotationi = (double)i;
+        }
+    }
+
+    if( rotate_alternatej ) {
+        delta_rotationj = (double)(j%2);
+    } else {
+        if( rotate_cumulatej ) {
+            delta_rotationj = (double)(j*j + j)/2.0;
+        } else {
+            delta_rotationj = (double)j;
+        }
+    }
+
+    double delta_rotate_rand = 0.0;
+    if( rotate_rand != 0.0 ) delta_rotate_rand = rotate_rand * 180.0 * g_random_double_range (-1, 1);
+
+    double dr = rotate_per_i * delta_rotationi + rotate_per_j * delta_rotationj + delta_rotate_rand;
+
+    // Scale (times the original) -----------
+    double delta_scalei = 0.0;
+    double delta_scalej = 0.0;
+
+    if( scalex_alternate ) {
+        delta_scalei = (double)(i%2);
+    } else {
+        if( scalex_cumulate ) {  // Should the delta scales be cumulative (i.e. 1, 1+2, 1+2+3, ...)
+            delta_scalei = (double)(i*i + i)/2.0;
+        } else {
+            delta_scalei = (double)i;
+        }
+    }
+
+    if( scaley_alternate ) {
+        delta_scalej = (double)(j%2);
+    } else {
+        if( scaley_cumulate ) {
+            delta_scalej = (double)(j*j + j)/2.0;
+        } else {
+            delta_scalej = (double)j;
+        }
+    }
+
+    // Random scale, only calculate if non-zero.
+    double delta_scalex_rand = 0.0;
+    double delta_scaley_rand = 0.0;
+    if( scalex_rand != 0.0 ) delta_scalex_rand = scalex_rand * g_random_double_range (-1, 1);
+    if( scaley_rand != 0.0 ) delta_scaley_rand = scaley_rand * g_random_double_range (-1, 1);
+    // But if random factors are same, scale x and y proportionally
+    if( scalex_rand == scaley_rand ) delta_scalex_rand = delta_scaley_rand;
+
+    // Total delta scale
+    double scalex = 1.0 + scalex_per_i * delta_scalei  + scalex_per_j * delta_scalej + delta_scalex_rand;
+    double scaley = 1.0 + scaley_per_i * delta_scalei  + scaley_per_j * delta_scalej + delta_scaley_rand;
+
+    if( scalex < 0.0 ) scalex = 0.0;
+    if( scaley < 0.0 ) scaley = 0.0;
+
+    // Add exponential scale if necessary
+    if ( scalex_exp != 1.0 ) scalex = pow( scalex, scalex_exp );
+    if ( scaley_exp != 1.0 ) scaley = pow( scaley, scaley_exp );
+
+    // Add logarithmic factor if necessary
+    if ( scalex_log  > 0.0 ) scalex = pow( scalex_log, scalex - 1.0 );
+    if ( scaley_log  > 0.0 ) scaley = pow( scaley_log, scaley - 1.0 );
+    // Alternative using rotation angle
+    //if ( scalex_log  != 1.0 ) scalex *= pow( scalex_log, M_PI*dr/180 );
+    //if ( scaley_log  != 1.0 ) scaley *= pow( scaley_log, M_PI*dr/180 );
+
+
+    // Calculate transformation matrices, translating back to "center of tile" (rotation center) before transforming
+    NR::Matrix drot_c   = NR::translate(-cx, -cy) * NR::rotate (M_PI*dr/180)    * NR::translate(cx, cy);
+
+    NR::Matrix dscale_c = NR::translate(-cx, -cy) * NR::scale (scalex, scaley)  * NR::translate(cx, cy);
 
     NR::Matrix d_s_r = dscale_c * drot_c;
 
-    NR::Matrix rotate_180_c = NR::translate(-cx, -cy) * NR::rotate (M_PI) * NR::translate(cx, cy);
+    NR::Matrix rotate_180_c  = NR::translate(-cx, -cy) * NR::rotate (M_PI)      * NR::translate(cx, cy);
 
-    NR::Matrix rotate_90_c = NR::translate(-cx, -cy) * NR::rotate (-M_PI/2) * NR::translate(cx, cy);
-    NR::Matrix rotate_m90_c = NR::translate(-cx, -cy) * NR::rotate (M_PI/2) * NR::translate(cx, cy);
+    NR::Matrix rotate_90_c   = NR::translate(-cx, -cy) * NR::rotate (-M_PI/2)   * NR::translate(cx, cy);
+    NR::Matrix rotate_m90_c  = NR::translate(-cx, -cy) * NR::rotate ( M_PI/2)   * NR::translate(cx, cy);
 
-    NR::Matrix rotate_120_c = NR::translate(-cx, -cy) * NR::rotate (-2*M_PI/3) * NR::translate(cx, cy);
-    NR::Matrix rotate_m120_c = NR::translate(-cx, -cy) * NR::rotate (2*M_PI/3) * NR::translate(cx, cy);
+    NR::Matrix rotate_120_c  = NR::translate(-cx, -cy) * NR::rotate (-2*M_PI/3) * NR::translate(cx, cy);
+    NR::Matrix rotate_m120_c = NR::translate(-cx, -cy) * NR::rotate ( 2*M_PI/3) * NR::translate(cx, cy);
 
-    NR::Matrix rotate_60_c = NR::translate(-cx, -cy) * NR::rotate (-M_PI/3) * NR::translate(cx, cy);
-    NR::Matrix rotate_m60_c = NR::translate(-cx, -cy) * NR::rotate (M_PI/3) * NR::translate(cx, cy);
+    NR::Matrix rotate_60_c   = NR::translate(-cx, -cy) * NR::rotate (-M_PI/3)   * NR::translate(cx, cy);
+    NR::Matrix rotate_m60_c  = NR::translate(-cx, -cy) * NR::rotate ( M_PI/3)   * NR::translate(cx, cy);
 
-    double cos60 = cos(M_PI/3);
-    double sin60 = sin(M_PI/3);
-    double cos30 = cos(M_PI/6);
-    double sin30 = sin(M_PI/6);
+    NR::Matrix flip_x        = NR::translate(-cx, -cy) * NR::scale (-1, 1)      * NR::translate(cx, cy);
+    NR::Matrix flip_y        = NR::translate(-cx, -cy) * NR::scale (1, -1)      * NR::translate(cx, cy);
 
-    NR::Matrix flip_x = NR::translate(-cx, -cy) * NR::scale (-1, 1) * NR::translate(cx, cy);
-    NR::Matrix flip_y = NR::translate(-cx, -cy) * NR::scale (1, -1) * NR::translate(cx, cy);
 
-    x = (int) pow ((double) x, d_per_x_exp);
-    y = (int) pow ((double) y, d_per_y_exp);
+    // Create tile with required symmetry
+    const double cos60 = cos(M_PI/3);
+    const double sin60 = sin(M_PI/3);
+    const double cos30 = cos(M_PI/6);
+    const double sin30 = sin(M_PI/6);
 
     switch (type) {
 
@@ -296,7 +428,7 @@ clonetiler_get_transform (
         break;
 
     case TILE_P2:
-        if (x % 2 == 0) {
+        if (i % 2 == 0) {
             return d_s_r * rect_translate;
         } else {
             return d_s_r * rotate_180_c * rect_translate;
@@ -304,7 +436,7 @@ clonetiler_get_transform (
         break;
 
     case TILE_PM:
-        if (x % 2 == 0) {
+        if (i % 2 == 0) {
             return d_s_r * rect_translate;
         } else {
             return d_s_r * flip_x * rect_translate;
@@ -312,7 +444,7 @@ clonetiler_get_transform (
         break;
 
     case TILE_PG:
-        if (y % 2 == 0) {
+        if (j % 2 == 0) {
             return d_s_r * rect_translate;
         } else {
             return d_s_r * flip_x * rect_translate;
@@ -320,7 +452,7 @@ clonetiler_get_transform (
         break;
 
     case TILE_CM:
-        if ((x + y) % 2 == 0) {
+        if ((i + j) % 2 == 0) {
             return d_s_r * rect_translate;
         } else {
             return d_s_r * flip_x * rect_translate;
@@ -328,14 +460,14 @@ clonetiler_get_transform (
         break;
 
     case TILE_PMM:
-        if (y % 2 == 0) {
-            if (x % 2 == 0) {
+        if (j % 2 == 0) {
+            if (i % 2 == 0) {
                 return d_s_r * rect_translate;
             } else {
                 return d_s_r * flip_x * rect_translate;
             }
         } else {
-            if (x % 2 == 0) {
+            if (i % 2 == 0) {
                 return d_s_r * flip_y * rect_translate;
             } else {
                 return d_s_r * flip_x * flip_y * rect_translate;
@@ -344,26 +476,30 @@ clonetiler_get_transform (
         break;
 
     case TILE_PMG:
-        if (y % 4 == 0) {
-            return d_s_r * rect_translate;
-        } else if (y % 4 == 1) {
-            return d_s_r * flip_y * rect_translate;
-        } else if (y % 4 == 2) {
-            return d_s_r * flip_x * rect_translate;
-        } else if (y % 4 == 3) {
-            return d_s_r * flip_x * flip_y * rect_translate;
+        if (j % 2 == 0) {
+            if (i % 2 == 0) {
+                return d_s_r * rect_translate;
+            } else {
+                return d_s_r * rotate_180_c * rect_translate;
+            }
+        } else {
+            if (i % 2 == 0) {
+                return d_s_r * flip_y * rect_translate;
+            } else {
+                return d_s_r * rotate_180_c * flip_y * rect_translate;
+            }
         }
         break;
 
     case TILE_PGG:
-        if (y % 2 == 0) {
-            if (x % 2 == 0) {
+        if (j % 2 == 0) {
+            if (i % 2 == 0) {
                 return d_s_r * rect_translate;
             } else {
                 return d_s_r * flip_y * rect_translate;
             }
         } else {
-            if (x % 2 == 0) {
+            if (i % 2 == 0) {
                 return d_s_r * rotate_180_c * rect_translate;
             } else {
                 return d_s_r * rotate_180_c * flip_y * rect_translate;
@@ -372,26 +508,26 @@ clonetiler_get_transform (
         break;
 
     case TILE_CMM:
-        if (y % 4 == 0) {
-            if (x % 2 == 0) {
+        if (j % 4 == 0) {
+            if (i % 2 == 0) {
                 return d_s_r * rect_translate;
             } else {
                 return d_s_r * flip_x * rect_translate;
             }
-        } else if (y % 4 == 1) {
-            if (x % 2 == 0) {
+        } else if (j % 4 == 1) {
+            if (i % 2 == 0) {
                 return d_s_r * flip_y * rect_translate;
             } else {
                 return d_s_r * flip_x * flip_y * rect_translate;
             }
-        } else if (y % 4 == 2) {
-            if (x % 2 == 1) {
+        } else if (j % 4 == 2) {
+            if (i % 2 == 1) {
                 return d_s_r * rect_translate;
             } else {
                 return d_s_r * flip_x * rect_translate;
             }
         } else {
-            if (x % 2 == 1) {
+            if (i % 2 == 1) {
                 return d_s_r * flip_y * rect_translate;
             } else {
                 return d_s_r * flip_x * flip_y * rect_translate;
@@ -401,17 +537,17 @@ clonetiler_get_transform (
 
     case TILE_P4:
     {
-        NR::Matrix ori (NR::translate ((w + h) * (x/2) + dx,  (h + w) * (y/2) + dy));
+        NR::Matrix ori  (NR::translate ((w + h) * pow((i/2), shiftx_exp) + dx,  (h + w) * pow((j/2), shifty_exp) + dy));
         NR::Matrix dia1 (NR::translate (w/2 + h/2, -h/2 + w/2));
         NR::Matrix dia2 (NR::translate (-w/2 + h/2, h/2 + w/2));
-        if (y % 2 == 0) {
-            if (x % 2 == 0) {
+        if (j % 2 == 0) {
+            if (i % 2 == 0) {
                 return d_s_r * ori;
             } else {
                 return d_s_r * rotate_m90_c * dia1 * ori;
             }
         } else {
-            if (x % 2 == 0) {
+            if (i % 2 == 0) {
                 return d_s_r * rotate_90_c * dia2 * ori;
             } else {
                 return d_s_r * rotate_180_c * dia1 * dia2 * ori;
@@ -423,27 +559,27 @@ clonetiler_get_transform (
     case TILE_P4M:
     {
         double max = MAX(w, h);
-        NR::Matrix ori (NR::translate ((max + max) * (x/4) + dx,  (max + max) * (y/2) + dy));
-        NR::Matrix dia1 (NR::translate (w/2 - h/2, h/2 - w/2));
+        NR::Matrix ori (NR::translate ((max + max) * pow((i/4), shiftx_exp) + dx,  (max + max) * pow((j/2), shifty_exp) + dy));
+        NR::Matrix dia1 (NR::translate ( w/2 - h/2, h/2 - w/2));
         NR::Matrix dia2 (NR::translate (-h/2 + w/2, w/2 - h/2));
-        if (y % 2 == 0) {
-            if (x % 4 == 0) {
+        if (j % 2 == 0) {
+            if (i % 4 == 0) {
                 return d_s_r * ori;
-            } else if (x % 4 == 1) {
+            } else if (i % 4 == 1) {
                 return d_s_r * flip_y * rotate_m90_c * dia1 * ori;
-            } else if (x % 4 == 2) {
+            } else if (i % 4 == 2) {
                 return d_s_r * rotate_m90_c * dia1 * NR::translate (h, 0) * ori;
-            } else if (x % 4 == 3) {
+            } else if (i % 4 == 3) {
                 return d_s_r * flip_x * NR::translate (w, 0) * ori;
             }
         } else {
-            if (x % 4 == 0) {
+            if (i % 4 == 0) {
                 return d_s_r * flip_y * NR::translate(0, h) * ori;
-            } else if (x % 4 == 1) {
+            } else if (i % 4 == 1) {
                 return d_s_r * rotate_90_c * dia2 * NR::translate(0, h) * ori;
-            } else if (x % 4 == 2) {
+            } else if (i % 4 == 2) {
                 return d_s_r * flip_y * rotate_90_c * dia2 * NR::translate(h, 0) * NR::translate(0, h) * ori;
-            } else if (x % 4 == 3) {
+            } else if (i % 4 == 3) {
                 return d_s_r * flip_y * flip_x * NR::translate(w, 0) * NR::translate(0, h) * ori;
             }
         }
@@ -453,27 +589,27 @@ clonetiler_get_transform (
     case TILE_P4G:
     {
         double max = MAX(w, h);
-        NR::Matrix ori (NR::translate ((max + max) * (x/4) + dx,  (max + max) * y + dy));
-        NR::Matrix dia1 (NR::translate (w/2 + h/2, h/2 - w/2));
+        NR::Matrix ori (NR::translate ((max + max) * pow((i/4), shiftx_exp) + dx,  (max + max) * pow(j, shifty_exp) + dy));
+        NR::Matrix dia1 (NR::translate ( w/2 + h/2, h/2 - w/2));
         NR::Matrix dia2 (NR::translate (-h/2 + w/2, w/2 + h/2));
-        if (((x/4) + y) % 2 == 0) {
-            if (x % 4 == 0) {
+        if (((i/4) + j) % 2 == 0) {
+            if (i % 4 == 0) {
                 return d_s_r * ori;
-            } else if (x % 4 == 1) {
+            } else if (i % 4 == 1) {
                 return d_s_r * rotate_m90_c * dia1 * ori;
-            } else if (x % 4 == 2) {
+            } else if (i % 4 == 2) {
                 return d_s_r * rotate_90_c * dia2 * ori;
-            } else if (x % 4 == 3) {
+            } else if (i % 4 == 3) {
                 return d_s_r * rotate_180_c * dia1 * dia2 * ori;
             }
         } else {
-            if (x % 4 == 0) {
+            if (i % 4 == 0) {
                 return d_s_r * flip_y * NR::translate (0, h) * ori;
-            } else if (x % 4 == 1) {
+            } else if (i % 4 == 1) {
                 return d_s_r * flip_y * rotate_m90_c * dia1 * NR::translate (-h, 0) * ori;
-            } else if (x % 4 == 2) {
+            } else if (i % 4 == 2) {
                 return d_s_r * flip_y * rotate_90_c * dia2 * NR::translate (h, 0) * ori;
-            } else if (x % 4 == 3) {
+            } else if (i % 4 == 3) {
                 return d_s_r * flip_x * NR::translate (w, 0) * ori;
             }
         }
@@ -487,7 +623,7 @@ clonetiler_get_transform (
         NR::Matrix dia1;
         NR::Matrix dia2;
         if (w > h) {
-            width = w + w * cos60;
+            width  = w + w * cos60;
             height = 2 * w * sin60;
             dia1 = NR::Matrix (NR::translate (w/2 + w/2 * cos60, -(w/2 * sin60)));
             dia2 = dia1 * NR::Matrix (NR::translate (0, 2 * (w/2 * sin60)));
@@ -497,12 +633,12 @@ clonetiler_get_transform (
             dia1 = NR::Matrix (NR::translate (h/2 * cos30, -(h/2 * sin30)));
             dia2 = dia1 * NR::Matrix (NR::translate (0, h/2));
         }
-        NR::Matrix ori (NR::translate (width * (2*(x/3) + y%2) + dx,  (height/2) * y + dy));
-        if (x % 3 == 0) {
+        NR::Matrix ori (NR::translate (width * pow((2*(i/3) + j%2), shiftx_exp) + dx,  (height/2) * pow(j, shifty_exp) + dy));
+        if (i % 3 == 0) {
             return d_s_r * ori;
-        } else if (x % 3 == 1) {
+        } else if (i % 3 == 1) {
             return d_s_r * rotate_m120_c * dia1 * ori;
-        } else if (x % 3 == 2) {
+        } else if (i % 3 == 2) {
             return d_s_r * rotate_120_c * dia2 * ori;
         }
     }
@@ -516,29 +652,29 @@ clonetiler_get_transform (
         NR::Matrix dia3;
         NR::Matrix dia4;
         if (w > h) {
-            ori = NR::Matrix(NR::translate (w * (x/6) + w/2 * (y%2) + dx,  (w * cos30) * y + dy));
+            ori = NR::Matrix(NR::translate (w * pow((i/6) + 0.5*(j%2), shiftx_exp) + dx,  (w * cos30) * pow(j, shifty_exp) + dy));
             dia1 = NR::Matrix (NR::translate (0, h/2) * NR::translate (w/2, 0) * NR::translate (w/2 * cos60, -w/2 * sin60) * NR::translate (-h/2 * cos30, -h/2 * sin30) );
             dia2 = dia1 * NR::Matrix (NR::translate (h * cos30, h * sin30));
             dia3 = dia2 * NR::Matrix (NR::translate (0, 2 * (w/2 * sin60 - h/2 * sin30)));
             dia4 = dia3 * NR::Matrix (NR::translate (-h * cos30, h * sin30));
         } else {
-            ori  = NR::Matrix (NR::translate (2*h * cos30  * (x/6 + 0.5*(y%2)) + dx,  (2*h - h * sin30) * y + dy));
+            ori  = NR::Matrix (NR::translate (2*h * cos30  * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx,  (2*h - h * sin30) * pow(j, shifty_exp) + dy));
             dia1 = NR::Matrix (NR::translate (0, -h/2) * NR::translate (h/2 * cos30, h/2 * sin30));
             dia2 = dia1 * NR::Matrix (NR::translate (h * cos30, h * sin30));
             dia3 = dia2 * NR::Matrix (NR::translate (0, h/2));
             dia4 = dia3 * NR::Matrix (NR::translate (-h * cos30, h * sin30));
         }
-        if (x % 6 == 0) {
+        if (i % 6 == 0) {
             return d_s_r * ori;
-        } else if (x % 6 == 1) {
+        } else if (i % 6 == 1) {
             return d_s_r * flip_y * rotate_m120_c * dia1 * ori;
-        } else if (x % 6 == 2) {
+        } else if (i % 6 == 2) {
             return d_s_r * rotate_m120_c * dia2 * ori;
-        } else if (x % 6 == 3) {
+        } else if (i % 6 == 3) {
             return d_s_r * flip_y * rotate_120_c * dia3 * ori;
-        } else if (x % 6 == 4) {
+        } else if (i % 6 == 4) {
             return d_s_r * rotate_120_c * dia4 * ori;
-        } else if (x % 6 == 5) {
+        } else if (i % 6 == 5) {
             return d_s_r * flip_y * NR::translate(0, h) * ori;
         }
     }
@@ -567,18 +703,18 @@ clonetiler_get_transform (
             dia3 = dia2 * NR::Matrix (NR::translate (0, h/2));
             dia4 = dia3 * NR::Matrix (NR::translate (-h * cos30, h * sin30));
         }
-        NR::Matrix ori (NR::translate (width * (2*(x/6) + y%2) + dx,  (height/2) * y + dy));
-        if (x % 6 == 0) {
+        NR::Matrix ori (NR::translate (width * pow((2*(i/6) + j%2), shiftx_exp) + dx,  (height/2) * pow(j, shifty_exp) + dy));
+        if (i % 6 == 0) {
             return d_s_r * ori;
-        } else if (x % 6 == 1) {
+        } else if (i % 6 == 1) {
             return d_s_r * flip_y * rotate_m120_c * dia1 * ori;
-        } else if (x % 6 == 2) {
+        } else if (i % 6 == 2) {
             return d_s_r * rotate_m120_c * dia2 * ori;
-        } else if (x % 6 == 3) {
+        } else if (i % 6 == 3) {
             return d_s_r * flip_y * rotate_120_c * dia3 * ori;
-        } else if (x % 6 == 4) {
+        } else if (i % 6 == 4) {
             return d_s_r * rotate_120_c * dia4 * ori;
-        } else if (x % 6 == 5) {
+        } else if (i % 6 == 5) {
             return d_s_r * flip_y * NR::translate(0, h) * ori;
         }
     }
@@ -593,31 +729,31 @@ clonetiler_get_transform (
         NR::Matrix dia4;
         NR::Matrix dia5;
         if (w > h) {
-            ori = NR::Matrix(NR::translate (2*w * (x/6) + w * (y%2) + dx,  (2*w * sin60) * y + dy));
+            ori = NR::Matrix(NR::translate (w * pow((2*(i/6) + (j%2)), shiftx_exp) + dx,  (2*w * sin60) * pow(j, shifty_exp) + dy));
             dia1 = NR::Matrix (NR::translate (w/2 * cos60, -w/2 * sin60));
             dia2 = dia1 * NR::Matrix (NR::translate (w/2, 0));
             dia3 = dia2 * NR::Matrix (NR::translate (w/2 * cos60, w/2 * sin60));
             dia4 = dia3 * NR::Matrix (NR::translate (-w/2 * cos60, w/2 * sin60));
             dia5 = dia4 * NR::Matrix (NR::translate (-w/2, 0));
         } else {
-            ori = NR::Matrix(NR::translate (2*h * cos30 * (x/6 + 0.5*(y%2)) + dx,  (h + h * sin30) * y + dy));
+            ori = NR::Matrix(NR::translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx,  (h + h * sin30) * pow(j, shifty_exp) + dy));
             dia1 = NR::Matrix (NR::translate (-w/2, -h/2) * NR::translate (h/2 * cos30, -h/2 * sin30) * NR::translate (w/2 * cos60, w/2 * sin60));
             dia2 = dia1 * NR::Matrix (NR::translate (-w/2 * cos60, -w/2 * sin60) * NR::translate (h/2 * cos30, -h/2 * sin30) * NR::translate (h/2 * cos30, h/2 * sin30) * NR::translate (-w/2 * cos60, w/2 * sin60));
             dia3 = dia2 * NR::Matrix (NR::translate (w/2 * cos60, -w/2 * sin60) * NR::translate (h/2 * cos30, h/2 * sin30) * NR::translate (-w/2, h/2));
             dia4 = dia3 * dia1.inverse();
             dia5 = dia3 * dia2.inverse();
         }
-        if (x % 6 == 0) {
+        if (i % 6 == 0) {
             return d_s_r * ori;
-        } else if (x % 6 == 1) {
+        } else if (i % 6 == 1) {
             return d_s_r * rotate_m60_c * dia1 * ori;
-        } else if (x % 6 == 2) {
+        } else if (i % 6 == 2) {
             return d_s_r * rotate_m120_c * dia2 * ori;
-        } else if (x % 6 == 3) {
+        } else if (i % 6 == 3) {
             return d_s_r * rotate_180_c * dia3 * ori;
-        } else if (x % 6 == 4) {
+        } else if (i % 6 == 4) {
             return d_s_r * rotate_120_c * dia4 * ori;
-        } else if (x % 6 == 5) {
+        } else if (i % 6 == 5) {
             return d_s_r * rotate_60_c * dia5 * ori;
         }
     }
@@ -629,7 +765,7 @@ clonetiler_get_transform (
         NR::Matrix ori;
         NR::Matrix dia1, dia2, dia3, dia4, dia5, dia6, dia7, dia8, dia9, dia10;
         if (w > h) {
-            ori = NR::Matrix(NR::translate (2*w * (x/12) + w * (y%2) + dx,  (2*w * sin60) * y + dy));
+            ori = NR::Matrix(NR::translate (w * pow((2*(i/12) + (j%2)), shiftx_exp) + dx,  (2*w * sin60) * pow(j, shifty_exp) + dy));
             dia1 = NR::Matrix (NR::translate (w/2, h/2) * NR::translate (-w/2 * cos60, -w/2 * sin60) * NR::translate (-h/2 * cos30, h/2 * sin30));
             dia2 = dia1 * NR::Matrix (NR::translate (h * cos30, -h * sin30));
             dia3 = dia2 * NR::Matrix (NR::translate (-h/2 * cos30, h/2 * sin30) * NR::translate (w * cos60, 0) * NR::translate (-h/2 * cos30, -h/2 * sin30));
@@ -641,7 +777,7 @@ clonetiler_get_transform (
             dia9 = dia6 * dia3.inverse();
             dia10 = dia6 * dia4.inverse();
         } else {
-            ori = NR::Matrix(NR::translate (4*h * cos30 * (x/12 + 0.5*(y%2)) + dx,  (2*h  + 2*h * sin30) * y + dy));
+            ori = NR::Matrix(NR::translate (4*h * cos30 * pow((i/12 + 0.5*(j%2)), shiftx_exp) + dx,  (2*h  + 2*h * sin30) * pow(j, shifty_exp) + dy));
             dia1 = NR::Matrix (NR::translate (-w/2, -h/2) * NR::translate (h/2 * cos30, -h/2 * sin30) * NR::translate (w/2 * cos60, w/2 * sin60));
             dia2 = dia1 * NR::Matrix (NR::translate (h * cos30, -h * sin30));
             dia3 = dia2 * NR::Matrix (NR::translate (-w/2 * cos60, -w/2 * sin60) * NR::translate (h * cos30, 0) * NR::translate (-w/2 * cos60, w/2 * sin60));
@@ -653,29 +789,29 @@ clonetiler_get_transform (
             dia9 = dia6 * dia3.inverse();
             dia10 = dia6 * dia4.inverse();
         }
-        if (x % 12 == 0) {
+        if (i % 12 == 0) {
             return d_s_r * ori;
-        } else if (x % 12 == 1) {
+        } else if (i % 12 == 1) {
             return d_s_r * flip_y * rotate_m60_c * dia1 * ori;
-        } else if (x % 12 == 2) {
+        } else if (i % 12 == 2) {
             return d_s_r * rotate_m60_c * dia2 * ori;
-        } else if (x % 12 == 3) {
+        } else if (i % 12 == 3) {
             return d_s_r * flip_y * rotate_m120_c * dia3 * ori;
-        } else if (x % 12 == 4) {
+        } else if (i % 12 == 4) {
             return d_s_r * rotate_m120_c * dia4 * ori;
-        } else if (x % 12 == 5) {
+        } else if (i % 12 == 5) {
             return d_s_r * flip_x * dia5 * ori;
-        } else if (x % 12 == 6) {
+        } else if (i % 12 == 6) {
             return d_s_r * flip_x * flip_y * dia6 * ori;
-        } else if (x % 12 == 7) {
+        } else if (i % 12 == 7) {
             return d_s_r * flip_y * rotate_120_c * dia7 * ori;
-        } else if (x % 12 == 8) {
+        } else if (i % 12 == 8) {
             return d_s_r * rotate_120_c * dia8 * ori;
-        } else if (x % 12 == 9) {
+        } else if (i % 12 == 9) {
             return d_s_r * flip_y * rotate_60_c * dia9 * ori;
-        } else if (x % 12 == 10) {
+        } else if (i % 12 == 10) {
             return d_s_r * rotate_60_c * dia10 * ori;
-        } else if (x % 12 == 11) {
+        } else if (i % 12 == 11) {
             return d_s_r * flip_y * NR::translate (0, h) * ori;
         }
     }
@@ -738,11 +874,11 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original)
     trace_arena = NRArena::create();
     /* Create ArenaItem and set transform */
     trace_visionkey = sp_item_display_key_new(1);
-    trace_root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT (doc)), 
+    trace_root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT (doc)),
                                       (NRArena *) trace_arena, trace_visionkey, SP_ITEM_SHOW_DISPLAY);
 
     // hide the (current) original and any tiled clones, we only want to pick the background
-    sp_item_invoke_hide(original, trace_visionkey); 
+    sp_item_invoke_hide(original, trace_visionkey);
     clonetiler_trace_hide_tiled_clones_recursively (SP_OBJECT(SP_DOCUMENT_ROOT (doc)));
 
     sp_document_root (doc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -757,11 +893,10 @@ clonetiler_trace_pick (NR::Rect box)
     if (!trace_arena)
         return 0;
 
-    NRMatrix t;
-    nr_matrix_set_scale(&t, trace_zoom, trace_zoom);
+    NR::Matrix t(NR::scale(trace_zoom, trace_zoom));
     nr_arena_item_set_transform(trace_root, &t);
     NRGC gc(NULL);
-    nr_matrix_set_identity(&gc.transform);
+    gc.transform.set_identity();
     nr_arena_item_invoke_update( trace_root, NULL, &gc,
                                  NR_ARENA_ITEM_STATE_ALL,
                                  NR_ARENA_ITEM_STATE_NONE );
@@ -778,7 +913,12 @@ clonetiler_trace_pick (NR::Rect box)
     int height = ibox.y1 - ibox.y0;
 
     /* Set up pixblock */
-    guchar *px = nr_new(guchar, 4 * width * height);
+    guchar *px = g_new(guchar, 4 * width * height);
+
+    if (px == NULL) {
+        return 0; // buffer is too big or too small, cannot pick, so return 0
+    }
+
     memset(px, 0x00, 4 * width * height);
 
     /* Render */
@@ -786,7 +926,7 @@ clonetiler_trace_pick (NR::Rect box)
     nr_pixblock_setup_extern( &pb, NR_PIXBLOCK_MODE_R8G8B8A8N,
                               ibox.x0, ibox.y0, ibox.x1, ibox.y1,
                               px, 4 * width, FALSE, FALSE );
-    nr_arena_item_invoke_render( trace_root, &ibox, &pb,
+    nr_arena_item_invoke_render(NULL, trace_root, &ibox, &pb,
                                  NR_ARENA_ITEM_RENDER_NO_CACHE );
 
     double R = 0, G = 0, B = 0, A = 0;
@@ -831,7 +971,7 @@ clonetiler_trace_finish ()
 }
 
 static void
-clonetiler_unclump (GtkWidget *widget, void *)
+clonetiler_unclump( GtkWidget */*widget*/, void * )
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
@@ -862,7 +1002,8 @@ clonetiler_unclump (GtkWidget *widget, void *)
 
     g_slist_free (to_unclump);
 
-    sp_document_done (sp_desktop_document (desktop));
+    sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER,
+                      _("Unclump tiled clones"));
 }
 
 static guint
@@ -882,7 +1023,7 @@ clonetiler_number_of_clones (SPObject *obj)
 }
 
 static void
-clonetiler_remove (GtkWidget *widget, void *, bool do_undo = true)
+clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true )
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
@@ -914,7 +1055,8 @@ clonetiler_remove (GtkWidget *widget, void *, bool do_undo = true)
     clonetiler_change_selection (NULL, selection, dlg);
 
     if (do_undo)
-        sp_document_done (sp_desktop_document (desktop));
+        sp_document_done (sp_desktop_document (desktop), SP_VERB_DIALOG_CLONETILER,
+                          _("Delete tiled clones"));
 }
 
 static NR::Rect
@@ -928,10 +1070,10 @@ transform_rect(NR::Rect const &r, NR::Matrix const &m)
     NR::Point const p4 = r.corner(4) * m;
     return NR::Rect(
         NR::Point(
-            std::min(std::min(p1[X], p2[X]), std::min(p3[X], p4[X])), 
-            std::min(std::min(p1[Y], p2[Y]), std::min(p3[Y], p4[Y]))), 
+            std::min(std::min(p1[X], p2[X]), std::min(p3[X], p4[X])),
+            std::min(std::min(p1[Y], p2[Y]), std::min(p3[Y], p4[Y]))),
         NR::Point(
-            std::max(std::max(p1[X], p2[X]), std::max(p3[X], p4[X])), 
+            std::max(std::max(p1[X], p2[X]), std::max(p3[X], p4[X])),
             std::max(std::max(p1[Y], p2[Y]), std::max(p3[Y], p4[Y]))));
 }
 
@@ -950,7 +1092,7 @@ randomize01 (double val, double rand)
 
 
 static void
-clonetiler_apply (GtkWidget *widget, void *)
+clonetiler_apply( GtkWidget */*widget*/, void * )
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
@@ -977,61 +1119,79 @@ clonetiler_apply (GtkWidget *widget, void *)
 
     clonetiler_remove (NULL, NULL, false);
 
-    double d_x_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_x_per_x", 0, -100, 1000);
-    double d_y_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_y_per_x", 0, -100, 1000);
-    double d_per_x_exp = prefs_get_double_attribute_limited (prefs_path, "d_per_x_exp", 1, 0, 10);
-    double d_x_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_x_per_y", 0, -100, 1000);
-    double d_y_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_y_per_y", 0, -100, 1000);
-    double d_per_y_exp = prefs_get_double_attribute_limited (prefs_path, "d_per_y_exp", 1, 0, 10);
-    int alternate_x = prefs_get_int_attribute (prefs_path, "alternate_x", 0);
-    int alternate_y = prefs_get_int_attribute (prefs_path, "alternate_y", 0);
-    double rand_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_x", 0, 0, 1000);
-    double rand_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_y", 0, 0, 1000);
-
-    double d_scalex_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_scalex_per_x", 0, -100, 1000);
-    double d_scaley_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_scaley_per_x", 0, -100, 1000);
-    double d_scalex_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_scalex_per_y", 0, -100, 1000);
-    double d_scaley_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_scaley_per_y", 0, -100, 1000);
-    int alternate_scalex = prefs_get_int_attribute (prefs_path, "alternate_scalex", 0);
-    int alternate_scaley = prefs_get_int_attribute (prefs_path, "alternate_scaley", 0);
-    double rand_scalex = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_scalex", 0, 0, 1000);
-    double rand_scaley = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_scaley", 0, 0, 1000);
-
-    double d_rot_per_x = prefs_get_double_attribute_limited (prefs_path, "d_rot_per_x", 0, -180, 180);
-    double d_rot_per_y = prefs_get_double_attribute_limited (prefs_path, "d_rot_per_y", 0, -180, 180);
-    int alternate_rotx = prefs_get_int_attribute (prefs_path, "alternate_rotx", 0);
-    int alternate_roty = prefs_get_int_attribute (prefs_path, "alternate_roty", 0);
-    double rand_rot = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_rot", 0, 0, 100);
-
-    double d_opacity_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_opacity_per_y", 0, 0, 100);
-    double d_opacity_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_opacity_per_x", 0, 0, 100);
-    int alternate_opacityy = prefs_get_int_attribute (prefs_path, "alternate_opacityy", 0);
-    int alternate_opacityx = prefs_get_int_attribute (prefs_path, "alternate_opacityx", 0);
-    double rand_opacity = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_opacity", 0, 0, 100);
-
-    const gchar *initial_color = prefs_get_string_attribute (prefs_path, "initial_color");
-    double d_hue_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_hue_per_y", 0, -100, 100);
-    double d_hue_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_hue_per_x", 0, -100, 100);
-    double rand_hue = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_hue", 0, 0, 100);
-    double d_saturation_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_saturation_per_y", 0, -100, 100);
-    double d_saturation_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_saturation_per_x", 0, -100, 100);
-    double rand_saturation = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_saturation", 0, 0, 100);
-    double d_lightness_per_y = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_lightness_per_y", 0, -100, 100);
-    double d_lightness_per_x = 0.01 * prefs_get_double_attribute_limited (prefs_path, "d_lightness_per_x", 0, -100, 100);
-    double rand_lightness = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_lightness", 0, 0, 100);
-    int alternate_color_y = prefs_get_int_attribute (prefs_path, "alternate_color_y", 0);
-    int alternate_color_x = prefs_get_int_attribute (prefs_path, "alternate_color_x", 0);
+    double shiftx_per_i = 0.01 * prefs_get_double_attribute_limited (prefs_path, "shiftx_per_i", 0, -100, 1000);
+    double shifty_per_i = 0.01 * prefs_get_double_attribute_limited (prefs_path, "shifty_per_i", 0, -100, 1000);
+    double shiftx_per_j = 0.01 * prefs_get_double_attribute_limited (prefs_path, "shiftx_per_j", 0, -100, 1000);
+    double shifty_per_j = 0.01 * prefs_get_double_attribute_limited (prefs_path, "shifty_per_j", 0, -100, 1000);
+    double shiftx_rand  = 0.01 * prefs_get_double_attribute_limited (prefs_path, "shiftx_rand", 0, 0, 1000);
+    double shifty_rand  = 0.01 * prefs_get_double_attribute_limited (prefs_path, "shifty_rand", 0, 0, 1000);
+    double shiftx_exp   =        prefs_get_double_attribute_limited (prefs_path, "shiftx_exp",   1, 0, 10);
+    double shifty_exp   =        prefs_get_double_attribute_limited (prefs_path, "shifty_exp", 1, 0, 10);
+    int    shiftx_alternate =    prefs_get_int_attribute (prefs_path, "shiftx_alternate", 0);
+    int    shifty_alternate =    prefs_get_int_attribute (prefs_path, "shifty_alternate", 0);
+    int    shiftx_cumulate  =    prefs_get_int_attribute (prefs_path, "shiftx_cumulate", 0);
+    int    shifty_cumulate  =    prefs_get_int_attribute (prefs_path, "shifty_cumulate", 0);
+    int    shiftx_excludew  =    prefs_get_int_attribute (prefs_path, "shiftx_excludew", 0);
+    int    shifty_excludeh  =    prefs_get_int_attribute (prefs_path, "shifty_excludeh", 0);
+
+    double scalex_per_i = 0.01 * prefs_get_double_attribute_limited (prefs_path, "scalex_per_i", 0, -100, 1000);
+    double scaley_per_i = 0.01 * prefs_get_double_attribute_limited (prefs_path, "scaley_per_i", 0, -100, 1000);
+    double scalex_per_j = 0.01 * prefs_get_double_attribute_limited (prefs_path, "scalex_per_j", 0, -100, 1000);
+    double scaley_per_j = 0.01 * prefs_get_double_attribute_limited (prefs_path, "scaley_per_j", 0, -100, 1000);
+    double scalex_rand  = 0.01 * prefs_get_double_attribute_limited (prefs_path, "scalex_rand",  0, 0, 1000);
+    double scaley_rand  = 0.01 * prefs_get_double_attribute_limited (prefs_path, "scaley_rand",  0, 0, 1000);
+    double scalex_exp   =        prefs_get_double_attribute_limited (prefs_path, "scalex_exp",   1, 0, 10);
+    double scaley_exp   =        prefs_get_double_attribute_limited (prefs_path, "scaley_exp",   1, 0, 10);
+    double scalex_log       =    prefs_get_double_attribute_limited (prefs_path, "scalex_log",   0, 0, 10);
+    double scaley_log       =    prefs_get_double_attribute_limited (prefs_path, "scaley_log",   0, 0, 10);
+    int    scalex_alternate =    prefs_get_int_attribute (prefs_path, "scalex_alternate", 0);
+    int    scaley_alternate =    prefs_get_int_attribute (prefs_path, "scaley_alternate", 0);
+    int    scalex_cumulate  =    prefs_get_int_attribute (prefs_path, "scalex_cumulate", 0);
+    int    scaley_cumulate  =    prefs_get_int_attribute (prefs_path, "scaley_cumulate", 0);
+
+    double rotate_per_i =        prefs_get_double_attribute_limited (prefs_path, "rotate_per_i", 0, -180, 180);
+    double rotate_per_j =        prefs_get_double_attribute_limited (prefs_path, "rotate_per_j", 0, -180, 180);
+    double rotate_rand =  0.01 * prefs_get_double_attribute_limited (prefs_path, "rotate_rand", 0, 0, 100);
+    int    rotate_alternatei   = prefs_get_int_attribute (prefs_path, "rotate_alternatei", 0);
+    int    rotate_alternatej   = prefs_get_int_attribute (prefs_path, "rotate_alternatej", 0);
+    int    rotate_cumulatei    = prefs_get_int_attribute (prefs_path, "rotate_cumulatei", 0);
+    int    rotate_cumulatej    = prefs_get_int_attribute (prefs_path, "rotate_cumulatej", 0);
+
+    double blur_per_i =   0.01 * prefs_get_double_attribute_limited (prefs_path, "blur_per_i", 0, 0, 100);
+    double blur_per_j =   0.01 * prefs_get_double_attribute_limited (prefs_path, "blur_per_j", 0, 0, 100);
+    int    blur_alternatei =     prefs_get_int_attribute (prefs_path, "blur_alternatei", 0);
+    int    blur_alternatej =     prefs_get_int_attribute (prefs_path, "blur_alternatej", 0);
+    double blur_rand =    0.01 * prefs_get_double_attribute_limited (prefs_path, "blur_rand", 0, 0, 100);
+
+    double opacity_per_i = 0.01 * prefs_get_double_attribute_limited (prefs_path, "opacity_per_i", 0, 0, 100);
+    double opacity_per_j = 0.01 * prefs_get_double_attribute_limited (prefs_path, "opacity_per_j", 0, 0, 100);
+    int    opacity_alternatei =   prefs_get_int_attribute (prefs_path, "opacity_alternatei", 0);
+    int    opacity_alternatej =   prefs_get_int_attribute (prefs_path, "opacity_alternatej", 0);
+    double opacity_rand =  0.01 * prefs_get_double_attribute_limited (prefs_path, "opacity_rand", 0, 0, 100);
+
+    const gchar *initial_color =     prefs_get_string_attribute (prefs_path, "initial_color");
+    double hue_per_j =        0.01 * prefs_get_double_attribute_limited (prefs_path, "hue_per_j", 0, -100, 100);
+    double hue_per_i =        0.01 * prefs_get_double_attribute_limited (prefs_path, "hue_per_i", 0, -100, 100);
+    double hue_rand  =        0.01 * prefs_get_double_attribute_limited (prefs_path, "hue_rand", 0, 0, 100);
+    double saturation_per_j = 0.01 * prefs_get_double_attribute_limited (prefs_path, "saturation_per_j", 0, -100, 100);
+    double saturation_per_i = 0.01 * prefs_get_double_attribute_limited (prefs_path, "saturation_per_i", 0, -100, 100);
+    double saturation_rand =  0.01 * prefs_get_double_attribute_limited (prefs_path, "saturation_rand", 0, 0, 100);
+    double lightness_per_j =  0.01 * prefs_get_double_attribute_limited (prefs_path, "lightness_per_j", 0, -100, 100);
+    double lightness_per_i =  0.01 * prefs_get_double_attribute_limited (prefs_path, "lightness_per_i", 0, -100, 100);
+    double lightness_rand =   0.01 * prefs_get_double_attribute_limited (prefs_path, "lightness_rand", 0, 0, 100);
+    int    color_alternatej = prefs_get_int_attribute (prefs_path, "color_alternatej", 0);
+    int    color_alternatei = prefs_get_int_attribute (prefs_path, "color_alternatei", 0);
 
     int type = prefs_get_int_attribute (prefs_path, "symmetrygroup", 0);
 
     int keepbbox = prefs_get_int_attribute (prefs_path, "keepbbox", 1);
 
-    int xmax = prefs_get_int_attribute (prefs_path, "xmax", 2);
-    int ymax = prefs_get_int_attribute (prefs_path, "ymax", 2);
+    int imax = prefs_get_int_attribute (prefs_path, "imax", 2);
+    int jmax = prefs_get_int_attribute (prefs_path, "jmax", 2);
 
     int fillrect = prefs_get_int_attribute (prefs_path, "fillrect", 0);
-    double fillwidth = prefs_get_double_attribute_limited (prefs_path, "fillwidth", 50, 0, 6000);
-    double fillheight = prefs_get_double_attribute_limited (prefs_path, "fillheight", 50, 0, 6000);
+    double fillwidth = prefs_get_double_attribute_limited (prefs_path, "fillwidth", 50, 0, 1e6);
+    double fillheight = prefs_get_double_attribute_limited (prefs_path, "fillheight", 50, 0, 1e6);
 
     int dotrace = prefs_get_int_attribute (prefs_path, "dotrace", 0);
     int pick = prefs_get_int_attribute (prefs_path, "pick", 0);
@@ -1047,60 +1207,97 @@ clonetiler_apply (GtkWidget *widget, void *)
         clonetiler_trace_setup (sp_desktop_document(desktop), 1.0, SP_ITEM (obj));
     }
 
-    NR::Point c;
+    NR::Point center;
     double w;
     double h;
+    double x0;
+    double y0;
 
     if (keepbbox &&
         obj_repr->attribute("inkscape:tile-w") &&
         obj_repr->attribute("inkscape:tile-h") &&
+        obj_repr->attribute("inkscape:tile-x0") &&
+        obj_repr->attribute("inkscape:tile-y0") &&
         obj_repr->attribute("inkscape:tile-cx") &&
         obj_repr->attribute("inkscape:tile-cy")) {
 
         double cx = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-cx", 0);
         double cy = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-cy", 0);
-
-        c = NR::Point (cx, cy);
+        center = NR::Point (cx, cy);
 
         w = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-w", 0);
         h = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-h", 0);
+        x0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-x0", 0);
+        y0 = sp_repr_get_double_attribute (obj_repr, "inkscape:tile-y0", 0);
     } else {
-        NR::Rect const r = SP_ITEM(obj)->invokeBbox(sp_item_i2doc_affine(SP_ITEM(obj)));
-        c = r.midpoint();
-        w = r.dimensions()[NR::X];
-        h = r.dimensions()[NR::Y];
-
-        sp_repr_set_svg_double(obj_repr, "inkscape:tile-w", w);
-        sp_repr_set_svg_double(obj_repr, "inkscape:tile-h", h);
-        sp_repr_set_svg_double(obj_repr, "inkscape:tile-cx", c[NR::X]);
-        sp_repr_set_svg_double(obj_repr, "inkscape:tile-cy", c[NR::Y]);
+        NR::Maybe<NR::Rect> r = SP_ITEM(obj)->getBounds(sp_item_i2doc_affine(SP_ITEM(obj)),
+                                                        SPItem::GEOMETRIC_BBOX);
+        /* impl: Use of GEOMETRIC_BBOX is so that the stroke of rectangles will be shared
+         * (overlapped) rather than effectively doubled in width.
+         *
+         * (If you wish to change this, then please consider discussing at bug #1722238.) */
+
+        if (r) {
+            w = r->dimensions()[NR::X];
+            h = r->dimensions()[NR::Y];
+            x0 = r->min()[NR::X];
+            y0 = r->min()[NR::Y];
+            center = desktop->dt2doc(SP_ITEM(obj)->getCenter());
+
+            sp_repr_set_svg_double(obj_repr, "inkscape:tile-cx", center[NR::X]);
+            sp_repr_set_svg_double(obj_repr, "inkscape:tile-cy", center[NR::Y]);
+            sp_repr_set_svg_double(obj_repr, "inkscape:tile-w", w);
+            sp_repr_set_svg_double(obj_repr, "inkscape:tile-h", h);
+            sp_repr_set_svg_double(obj_repr, "inkscape:tile-x0", x0);
+            sp_repr_set_svg_double(obj_repr, "inkscape:tile-y0", y0);
+        } else {
+            center = NR::Point(0, 0);
+            w = h = 0;
+            x0 = y0 = 0;
+        }
     }
 
     NR::Point cur = NR::Point (0, 0);
-    NR::Rect bbox_original = NR::Rect (NR::Point (c[NR::X] - w/2, c[NR::Y] - h/2), NR::Point (c[NR::X] + w/2, c[NR::Y] + h/2));
+    NR::Rect bbox_original = NR::Rect (NR::Point (x0, y0), NR::Point (x0 + w, y0 + h));
+    double perimeter_original = (w + h)/4;
 
-    for (int x = 0;
+    // The integers i and j are reserved for tile column and row.
+    // The doubles x and y are used for coordinates
+    for (int i = 0;
          fillrect?
-             (fabs(cur[NR::X]) < fillwidth && x < 200) // prevent "freezing" with too large fillrect, arbitrarily limit rows
-             : (x < xmax);
-         x ++) {
-        for (int y = 0;
+             (fabs(cur[NR::X]) < fillwidth && i < 200) // prevent "freezing" with too large fillrect, arbitrarily limit rows
+             : (i < imax);
+         i ++) {
+        for (int j = 0;
              fillrect?
-                 (fabs(cur[NR::Y]) < fillheight && y < 200) // prevent "freezing" with too large fillrect, arbitrarily limit cols
-                 : (y < ymax);
-             y ++) {
+                 (fabs(cur[NR::Y]) < fillheight && j < 200) // prevent "freezing" with too large fillrect, arbitrarily limit cols
+                 : (j < jmax);
+             j ++) {
 
             // Note: We create a clone at 0,0 too, right over the original, in case our clones are colored
 
             // Get transform from symmetry, shift, scale, rotation
-            NR::Matrix t = clonetiler_get_transform (type, x, y, c[NR::X], c[NR::Y], w, h,
-                                                     d_x_per_x, d_y_per_x, d_x_per_y, d_y_per_y, alternate_x, alternate_y, rand_x, rand_y,
-                                                     d_per_x_exp, d_per_y_exp,
-                                                     d_rot_per_x, d_rot_per_y, alternate_rotx, alternate_roty, rand_rot,
-                                                     d_scalex_per_x, d_scaley_per_x, d_scalex_per_y, d_scaley_per_y,
-                                                     alternate_scalex, alternate_scaley, rand_scalex, rand_scaley);
-
-            cur = c * t - c;
+            NR::Matrix t = clonetiler_get_transform (type, i, j, center[NR::X], center[NR::Y], w, h,
+                                                     shiftx_per_i,     shifty_per_i,
+                                                     shiftx_per_j,     shifty_per_j,
+                                                     shiftx_rand,      shifty_rand,
+                                                     shiftx_exp,       shifty_exp,
+                                                     shiftx_alternate, shifty_alternate,
+                                                     shiftx_cumulate,  shifty_cumulate,
+                                                     shiftx_excludew,  shifty_excludeh,
+                                                     scalex_per_i,     scaley_per_i,
+                                                     scalex_per_j,     scaley_per_j,
+                                                     scalex_rand,      scaley_rand,
+                                                     scalex_exp,       scaley_exp,
+                                                     scalex_log,       scaley_log,
+                                                     scalex_alternate, scaley_alternate,
+                                                     scalex_cumulate,  scaley_cumulate,
+                                                     rotate_per_i,     rotate_per_j,
+                                                     rotate_rand,
+                                                     rotate_alternatei, rotate_alternatej,
+                                                     rotate_cumulatei,  rotate_cumulatej      );
+
+            cur = center * t - center;
             if (fillrect) {
                 if ((cur[NR::X] > fillwidth) || (cur[NR::Y] > fillheight)) { // off limits
                     continue;
@@ -1115,28 +1312,39 @@ clonetiler_apply (GtkWidget *widget, void *)
                 float hsl[3];
                 sp_color_rgb_to_hsl_floatv (hsl, SP_RGBA32_R_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_B_F(rgba));
 
-                double eff_x = (alternate_color_x? (x%2) : (x));
-                double eff_y = (alternate_color_y? (y%2) : (y));
+                double eff_i = (color_alternatei? (i%2) : (i));
+                double eff_j = (color_alternatej? (j%2) : (j));
 
-                hsl[0] += d_hue_per_x * eff_x + d_hue_per_y * eff_y + rand_hue * g_random_double_range (-1, 1);
-                if (hsl[0] < 0) hsl[0] += 1;
-                if (hsl[0] > 1) hsl[0] -= 1;
-                hsl[1] += d_saturation_per_x * eff_x + d_saturation_per_y * eff_y + rand_saturation * g_random_double_range (-1, 1);
+                hsl[0] += hue_per_i * eff_i + hue_per_j * eff_j + hue_rand * g_random_double_range (-1, 1);
+                double notused;
+                hsl[0] = modf( hsl[0], &notused ); // Restrict to 0-1
+                hsl[1] += saturation_per_i * eff_i + saturation_per_j * eff_j + saturation_rand * g_random_double_range (-1, 1);
                 hsl[1] = CLAMP (hsl[1], 0, 1);
-                hsl[2] += d_lightness_per_x * eff_x + d_lightness_per_y * eff_y + rand_lightness * g_random_double_range (-1, 1);
+                hsl[2] += lightness_per_i * eff_i + lightness_per_j * eff_j + lightness_rand * g_random_double_range (-1, 1);
                 hsl[2] = CLAMP (hsl[2], 0, 1);
 
                 float rgb[3];
                 sp_color_hsl_to_rgb_floatv (rgb, hsl[0], hsl[1], hsl[2]);
-                sp_svg_write_color(color_string, 32, SP_RGBA32_F_COMPOSE(rgb[0], rgb[1], rgb[2], 1.0));
+                sp_svg_write_color(color_string, sizeof(color_string), SP_RGBA32_F_COMPOSE(rgb[0], rgb[1], rgb[2], 1.0));
             }
 
-            // Opacity tab
+            // Blur
+            double blur = 0.0;
+            {
+            int eff_i = (blur_alternatei? (i%2) : (i));
+            int eff_j = (blur_alternatej? (j%2) : (j));
+            blur =  (blur_per_i * eff_i + blur_per_j * eff_j + blur_rand * g_random_double_range (-1, 1));
+            blur = CLAMP (blur, 0, 1);
+            }
+
+            // Opacity
             double opacity = 1.0;
-            int eff_x = (alternate_opacityx? (x%2) : (x));
-            int eff_y = (alternate_opacityy? (y%2) : (y));
-            opacity = 1 - (d_opacity_per_x * eff_x + d_opacity_per_y * eff_y + rand_opacity * g_random_double_range (-1, 1));
+            {
+            int eff_i = (opacity_alternatei? (i%2) : (i));
+            int eff_j = (opacity_alternatej? (j%2) : (j));
+            opacity = 1 - (opacity_per_i * eff_i + opacity_per_j * eff_j + opacity_rand * g_random_double_range (-1, 1));
             opacity = CLAMP (opacity, 0, 1);
+            }
 
             // Trace tab
             if (dotrace) {
@@ -1222,13 +1430,13 @@ clonetiler_apply (GtkWidget *widget, void *)
                     }
                 }
                 if (pick_to_size) {
-                    t = NR::translate(-c[NR::X], -c[NR::Y]) * NR::scale (val, val) * NR::translate(c[NR::X], c[NR::Y]) * t;
+                    t = NR::translate(-center[NR::X], -center[NR::Y]) * NR::scale (val, val) * NR::translate(center[NR::X], center[NR::Y]) * t;
                 }
                 if (pick_to_opacity) {
                     opacity *= val;
                 }
                 if (pick_to_color) {
-                    sp_svg_write_color(color_string, 32, rgba);
+                    sp_svg_write_color(color_string, sizeof(color_string), rgba);
                 }
             }
 
@@ -1241,7 +1449,7 @@ clonetiler_apply (GtkWidget *widget, void *)
             }
 
             // Create the clone
-            Inkscape::XML::Node *clone = sp_repr_new("svg:use");
+            Inkscape::XML::Node *clone = obj_repr->document()->createElement("svg:use");
             clone->setAttribute("x", "0");
             clone->setAttribute("y", "0");
             clone->setAttribute("inkscape:tiled-clone-of", id_href);
@@ -1254,12 +1462,9 @@ clonetiler_apply (GtkWidget *widget, void *)
                 center_set = true;
             }
 
-            gchar affinestr[80];
-            if (sp_svg_transform_write(affinestr, 79, t)) {
-                clone->setAttribute("transform", affinestr);
-            } else {
-                clone->setAttribute("transform", NULL);
-            }
+            gchar *affinestr=sp_svg_transform_write(t);
+            clone->setAttribute("transform", affinestr);
+            g_free(affinestr);
 
             if (opacity < 1.0) {
                 sp_repr_set_css_double(clone, "opacity", opacity);
@@ -1273,6 +1478,20 @@ clonetiler_apply (GtkWidget *widget, void *)
             // add the new clone to the top of the original's parent
             SP_OBJECT_REPR(parent)->appendChild(clone);
 
+            if (blur > 0.0) {
+                SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone);
+                double perimeter = perimeter_original * NR::expansion(t);
+                double radius = blur * perimeter;
+                // this is necessary for all newly added clones to have correct bboxes,
+                // otherwise filters won't work:
+                sp_document_ensure_up_to_date(sp_desktop_document(desktop));
+                // it's hard to figure out exact width/height of the tile without having an object
+                // that we can take bbox of; however here we only need a lower bound so that blur
+                // margins are not too small, and the perimeter should work
+                SPFilter *constructed = new_filter_gaussian_blur(sp_desktop_document(desktop), radius, NR::expansion(t), NR::expansionX(t), NR::expansionY(t), perimeter, perimeter);
+                sp_style_set_property_url (clone_object, "filter", SP_OBJECT(constructed), false);
+            }
+
             if (center_set) {
                 SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone);
                 if (clone_object && SP_IS_ITEM(clone_object)) {
@@ -1293,7 +1512,8 @@ clonetiler_apply (GtkWidget *widget, void *)
 
     clonetiler_change_selection (NULL, selection, dlg);
 
-    sp_document_done(sp_desktop_document(desktop));
+    sp_document_done(sp_desktop_document(desktop), SP_VERB_DIALOG_CLONETILER,
+                     _("Create tiled clones"));
 }
 
 static GtkWidget *
@@ -1385,7 +1605,7 @@ clonetiler_spinbox (GtkTooltips *tt, const char *tip, const char *attr, double l
 }
 
 static void
-clonetiler_symgroup_changed (GtkMenuItem *item, gpointer data)
+clonetiler_symgroup_changed( GtkMenuItem */*item*/, gpointer data )
 {
     gint group_new = GPOINTER_TO_INT (data);
     prefs_set_int_attribute ( prefs_path, "symmetrygroup", group_new );
@@ -1399,7 +1619,7 @@ clonetiler_xy_changed (GtkAdjustment *adj, gpointer data)
 }
 
 static void
-clonetiler_keep_bbox_toggled (GtkToggleButton *tb, gpointer data)
+clonetiler_keep_bbox_toggled( GtkToggleButton *tb, gpointer /*data*/ )
 {
     prefs_set_int_attribute (prefs_path, "keepbbox", gtk_toggle_button_get_active (tb));
 }
@@ -1448,7 +1668,7 @@ clonetiler_reset_recursive (GtkWidget *w)
 }
 
 static void
-clonetiler_reset (GtkWidget *widget, void *)
+clonetiler_reset( GtkWidget */*widget*/, void * )
 {
     clonetiler_reset_recursive (dlg);
 }
@@ -1505,7 +1725,7 @@ clonetiler_table_x_y_rand (int values)
 }
 
 static void
-clonetiler_pick_switched (GtkToggleButton *tb, gpointer data)
+clonetiler_pick_switched( GtkToggleButton */*tb*/, gpointer data )
 {
     guint v = GPOINTER_TO_INT (data);
     prefs_set_int_attribute (prefs_path, "pick", v);
@@ -1513,7 +1733,7 @@ clonetiler_pick_switched (GtkToggleButton *tb, gpointer data)
 
 
 static void
-clonetiler_switch_to_create (GtkToggleButton *tb, GtkWidget *dlg)
+clonetiler_switch_to_create( GtkToggleButton */*tb*/, GtkWidget *dlg )
 {
     GtkWidget *rowscols = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "rowscols");
     GtkWidget *widthheight = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "widthheight");
@@ -1530,7 +1750,7 @@ clonetiler_switch_to_create (GtkToggleButton *tb, GtkWidget *dlg)
 
 
 static void
-clonetiler_switch_to_fill (GtkToggleButton *tb, GtkWidget *dlg)
+clonetiler_switch_to_fill( GtkToggleButton */*tb*/, GtkWidget *dlg )
 {
     GtkWidget *rowscols = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "rowscols");
     GtkWidget *widthheight = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "widthheight");
@@ -1570,7 +1790,7 @@ clonetiler_fill_height_changed (GtkAdjustment *adj, GtkWidget *u)
 
 
 static void
-clonetiler_do_pick_toggled (GtkToggleButton *tb, gpointer data)
+clonetiler_do_pick_toggled( GtkToggleButton *tb, gpointer /*data*/ )
 {
     GtkWidget *vvb = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "dotrace");
 
@@ -1593,36 +1813,36 @@ clonetiler_dialog (void)
 
         dlg = sp_window_new (title, TRUE);
         if (x == -1000 || y == -1000) {
-            x = prefs_get_int_attribute (prefs_path, "x", 0);
-            y = prefs_get_int_attribute (prefs_path, "y", 0);
+            x = prefs_get_int_attribute (prefs_path, "x", -1000);
+            y = prefs_get_int_attribute (prefs_path, "y", -1000);
         }
-        
+
         if (w ==0 || h == 0) {
             w = prefs_get_int_attribute (prefs_path, "w", 0);
             h = prefs_get_int_attribute (prefs_path, "h", 0);
         }
-        
-        if (x<0) x=0;
-        if (y<0) y=0;
 
-        if (x != 0 || y != 0) {
+//        if (x<0) x=0;
+//        if (y<0) y=0;
+
+        if (w && h) {
+            gtk_window_resize ((GtkWindow *) dlg, w, h);
+        }
+        if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) {
             gtk_window_move ((GtkWindow *) dlg, x, y);
-        
+
         } else {
             gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER);
         }
-        
-        if (w && h) {
-            gtk_window_resize ((GtkWindow *) dlg, w, h);
-        }
-        
+
+
         sp_transientize (dlg);
         wd.win = dlg;
         wd.stop = 0;
-        
-                             
+
+
         gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg);
-        
+
         gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (clonetiler_dialog_destroy), dlg);
         gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (clonetiler_dialog_delete), dlg);
 
@@ -1632,7 +1852,7 @@ clonetiler_dialog (void)
             _dialogs_hidden_connection = Inkscape::NSApplication::Editor::connectDialogsHidden (sigc::bind (&on_dialog_hide, dlg));
             _dialogs_unhidden_connection = Inkscape::NSApplication::Editor::connectDialogsUnhidden (sigc::bind (&on_dialog_unhide, dlg));
             _desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::bind (&on_transientize, &wd));
-        } else {            
+        } else {
             g_signal_connect   ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (clonetiler_dialog_delete), dlg);
             g_signal_connect   ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg);
             g_signal_connect   ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg);
@@ -1734,7 +1954,7 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Horizontal shift per row (in % of tile width)"), "d_x_per_y",
+                                                   _("Horizontal shift per row (in % of tile width)"), "shiftx_per_j",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 2, 2);
             }
@@ -1742,14 +1962,14 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Horizontal shift per column (in % of tile width)"), "d_x_per_x",
+                                                   _("Horizontal shift per column (in % of tile width)"), "shiftx_per_i",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 2, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the horizontal shift by this percentage"), "rand_x",
+                                                   _("Randomize the horizontal shift by this percentage"), "shiftx_rand",
                                                    0, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 2, 4);
             }
@@ -1767,7 +1987,7 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Vertical shift per row (in % of tile height)"), "d_y_per_y",
+                                                   _("Vertical shift per row (in % of tile height)"), "shifty_per_j",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 3, 2);
             }
@@ -1775,14 +1995,14 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Vertical shift per column (in % of tile height)"), "d_y_per_x",
+                                                   _("Vertical shift per column (in % of tile height)"), "shifty_per_i",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 3, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the vertical shift by this percentage"), "rand_y",
+                                                   _("Randomize the vertical shift by this percentage"), "shifty_rand",
                                                    0, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 3, 4);
             }
@@ -1797,14 +2017,14 @@ clonetiler_dialog (void)
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "d_per_y_exp",
+                                                   _("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "shifty_exp",
                                                    0, 10, "", true);
                 clonetiler_table_attach (table, l, 0, 4, 2);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "d_per_x_exp",
+                                                   _("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "shiftx_exp",
                                                    0, 10, "", true);
                 clonetiler_table_attach (table, l, 0, 4, 3);
             }
@@ -1818,15 +2038,51 @@ clonetiler_dialog (void)
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of shifts for each row"), "alternate_y");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of shifts for each row"), "shifty_alternate");
                 clonetiler_table_attach (table, l, 0, 5, 2);
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of shifts for each column"), "alternate_x");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of shifts for each column"), "shiftx_alternate");
                 clonetiler_table_attach (table, l, 0, 5, 3);
             }
 
+            { // Cumulate
+                GtkWidget *l = gtk_label_new ("");
+                // TRANSLATORS: "Cumulate" is a verb here
+                gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 6, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the shifts for each row"), "shifty_cumulate");
+                clonetiler_table_attach (table, l, 0, 6, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the shifts for each column"), "shiftx_cumulate");
+                clonetiler_table_attach (table, l, 0, 6, 3);
+            }
+
+            { // Exclude tile width and height in shift
+                GtkWidget *l = gtk_label_new ("");
+                // TRANSLATORS: "Cumulate" is a verb here
+                gtk_label_set_markup (GTK_LABEL(l), _("<small>Exclude tile:</small>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 7, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Exclude tile height in shift"), "shifty_excludeh");
+                clonetiler_table_attach (table, l, 0, 7, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Exclude tile width in shift"), "shiftx_excludew");
+                clonetiler_table_attach (table, l, 0, 7, 3);
+            }
+
         }
 
 
@@ -1848,7 +2104,7 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Horizontal scale per row (in % of tile width)"), "d_scalex_per_y",
+                                                   _("Horizontal scale per row (in % of tile width)"), "scalex_per_j",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 2, 2);
             }
@@ -1856,14 +2112,14 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Horizontal scale per column (in % of tile width)"), "d_scalex_per_x",
+                                                   _("Horizontal scale per column (in % of tile width)"), "scalex_per_i",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 2, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the horizontal scale by this percentage"), "rand_scalex",
+                                                   _("Randomize the horizontal scale by this percentage"), "scalex_rand",
                                                    0, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 2, 4);
             }
@@ -1879,7 +2135,7 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Vertical scale per row (in % of tile height)"), "d_scaley_per_y",
+                                                   _("Vertical scale per row (in % of tile height)"), "scaley_per_j",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 3, 2);
             }
@@ -1887,36 +2143,98 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Vertical scale per column (in % of tile height)"), "d_scaley_per_x",
+                                                   _("Vertical scale per column (in % of tile height)"), "scaley_per_i",
                                                    -100, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 3, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the vertical scale by this percentage"), "rand_scaley",
+                                                   _("Randomize the vertical scale by this percentage"), "scaley_rand",
                                                    0, 1000, "%");
                 clonetiler_table_attach (table, l, 0, 3, 4);
             }
 
-            { // alternates
+            // Exponent
+            {
                 GtkWidget *l = gtk_label_new ("");
-                // TRANSLATORS: "Alternate" is a verb here
-                gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
+                gtk_label_set_markup (GTK_LABEL(l), _("<b>Exponent:</b>"));
                 gtk_size_group_add_widget(table_row_labels, l);
                 clonetiler_table_attach (table, l, 1, 4, 1);
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each row"), "alternate_scaley");
+                GtkWidget *l = clonetiler_spinbox (tt,
+                                                   _("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp",
+                                                   0, 10, "", true);
                 clonetiler_table_attach (table, l, 0, 4, 2);
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each column"), "alternate_scalex");
+                GtkWidget *l = clonetiler_spinbox (tt,
+                                                   _("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp",
+                                                   0, 10, "", true);
                 clonetiler_table_attach (table, l, 0, 4, 3);
             }
 
+            // Logarithmic (as in logarithmic spiral)
+            {
+                GtkWidget *l = gtk_label_new ("");
+                gtk_label_set_markup (GTK_LABEL(l), _("<b>Base:</b>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 5, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_spinbox (tt,
+                                                   _("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log",
+                                                   0, 10, "", false);
+                clonetiler_table_attach (table, l, 0, 5, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_spinbox (tt,
+                                                   _("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log",
+                                                   0, 10, "", false);
+                clonetiler_table_attach (table, l, 0, 5, 3);
+            }
+
+            { // alternates
+                GtkWidget *l = gtk_label_new ("");
+                // TRANSLATORS: "Alternate" is a verb here
+                gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 6, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each row"), "scaley_alternate");
+                clonetiler_table_attach (table, l, 0, 6, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each column"), "scalex_alternate");
+                clonetiler_table_attach (table, l, 0, 6, 3);
+            }
+
+            { // Cumulate
+                GtkWidget *l = gtk_label_new ("");
+                // TRANSLATORS: "Cumulate" is a verb here
+                gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 7, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the scales for each row"), "scaley_cumulate");
+                clonetiler_table_attach (table, l, 0, 7, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the scales for each column"), "scalex_cumulate");
+                clonetiler_table_attach (table, l, 0, 7, 3);
+            }
+
         }
 
 
@@ -1938,7 +2256,7 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Rotate tiles by this angle for each row"), "d_rot_per_y",
+                                                   _("Rotate tiles by this angle for each row"), "rotate_per_j",
                                                    -180, 180, "&#176;");
                 clonetiler_table_attach (table, l, 0, 2, 2);
             }
@@ -1946,14 +2264,14 @@ clonetiler_dialog (void)
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
                     // xgettext:no-c-format
-                                                   _("Rotate tiles by this angle for each column"), "d_rot_per_x",
+                                                   _("Rotate tiles by this angle for each column"), "rotate_per_i",
                                                    -180, 180, "&#176;");
                 clonetiler_table_attach (table, l, 0, 2, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the rotation angle by this percentage"), "rand_rot",
+                                                   _("Randomize the rotation angle by this percentage"), "rotate_rand",
                                                    0, 100, "%");
                 clonetiler_table_attach (table, l, 0, 2, 4);
             }
@@ -1967,49 +2285,69 @@ clonetiler_dialog (void)
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the rotation direction for each row"), "alternate_roty");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the rotation direction for each row"), "rotate_alternatej");
                 clonetiler_table_attach (table, l, 0, 3, 2);
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the rotation direction for each column"), "alternate_rotx");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the rotation direction for each column"), "rotate_alternatei");
                 clonetiler_table_attach (table, l, 0, 3, 3);
             }
+
+            { // Cumulate
+                GtkWidget *l = gtk_label_new ("");
+                // TRANSLATORS: "Cumulate" is a verb here
+                gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 4, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the rotation for each row"), "rotate_cumulatej");
+                clonetiler_table_attach (table, l, 0, 4, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Cumulate the rotation for each column"), "rotate_cumulatei");
+                clonetiler_table_attach (table, l, 0, 4, 3);
+            }
+
         }
 
 
-// Opacity
+// Blur and opacity
         {
-            GtkWidget *vb = clonetiler_new_tab (nb, _("_Opacity"));
+            GtkWidget *vb = clonetiler_new_tab (nb, _("_Blur & opacity"));
 
             GtkWidget *table = clonetiler_table_x_y_rand (1);
             gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0);
 
-            // Dissolve
+
+            // Blur
             {
                 GtkWidget *l = gtk_label_new ("");
-                gtk_label_set_markup (GTK_LABEL(l), _("<b>Fade out:</b>"));
+                gtk_label_set_markup (GTK_LABEL(l), _("<b>Blur:</b>"));
                 gtk_size_group_add_widget(table_row_labels, l);
                 clonetiler_table_attach (table, l, 1, 2, 1);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Decrease tile opacity by this percentage for each row"), "d_opacity_per_y",
+                                                   _("Blur tiles by this percentage for each row"), "blur_per_j",
                                                    0, 100, "%");
                 clonetiler_table_attach (table, l, 0, 2, 2);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Decrease tile opacity by this percentage for each column"), "d_opacity_per_x",
+                                                   _("Blur tiles by this percentage for each column"), "blur_per_i",
                                                    0, 100, "%");
                 clonetiler_table_attach (table, l, 0, 2, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the tile opacity by this percentage"), "rand_opacity",
+                                                   _("Randomize the tile blur by this percentage"), "blur_rand",
                                                    0, 100, "%");
                 clonetiler_table_attach (table, l, 0, 2, 4);
             }
@@ -2023,14 +2361,63 @@ clonetiler_dialog (void)
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of opacity change for each row"), "alternate_opacityy");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of blur change for each row"), "blur_alternatej");
                 clonetiler_table_attach (table, l, 0, 3, 2);
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of opacity change for each column"), "alternate_opacityx");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of blur change for each column"), "blur_alternatei");
                 clonetiler_table_attach (table, l, 0, 3, 3);
             }
+
+
+
+            // Dissolve
+            {
+                GtkWidget *l = gtk_label_new ("");
+                gtk_label_set_markup (GTK_LABEL(l), _("<b>Fade out:</b>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 4, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_spinbox (tt,
+                                                   _("Decrease tile opacity by this percentage for each row"), "opacity_per_j",
+                                                   0, 100, "%");
+                clonetiler_table_attach (table, l, 0, 4, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_spinbox (tt,
+                                                   _("Decrease tile opacity by this percentage for each column"), "opacity_per_i",
+                                                   0, 100, "%");
+                clonetiler_table_attach (table, l, 0, 4, 3);
+            }
+
+            {
+                GtkWidget *l = clonetiler_spinbox (tt,
+                                                   _("Randomize the tile opacity by this percentage"), "opacity_rand",
+                                                   0, 100, "%");
+                clonetiler_table_attach (table, l, 0, 4, 4);
+            }
+
+            { // alternates
+                GtkWidget *l = gtk_label_new ("");
+                // TRANSLATORS: "Alternate" is a verb here
+                gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
+                gtk_size_group_add_widget(table_row_labels, l);
+                clonetiler_table_attach (table, l, 1, 5, 1);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of opacity change for each row"), "opacity_alternatej");
+                clonetiler_table_attach (table, l, 0, 5, 2);
+            }
+
+            {
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of opacity change for each column"), "opacity_alternatei");
+                clonetiler_table_attach (table, l, 0, 5, 3);
+            }
         }
 
 
@@ -2067,21 +2454,21 @@ clonetiler_dialog (void)
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Change the tile hue by this percentage for each row"), "d_hue_per_y",
+                                                   _("Change the tile hue by this percentage for each row"), "hue_per_j",
                                                    -100, 100, "%");
                 clonetiler_table_attach (table, l, 0, 2, 2);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Change the tile hue by this percentage for each column"), "d_hue_per_x",
+                                                   _("Change the tile hue by this percentage for each column"), "hue_per_i",
                                                    -100, 100, "%");
                 clonetiler_table_attach (table, l, 0, 2, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the tile hue by this percentage"), "rand_hue",
+                                                   _("Randomize the tile hue by this percentage"), "hue_rand",
                                                    0, 100, "%");
                 clonetiler_table_attach (table, l, 0, 2, 4);
             }
@@ -2097,21 +2484,21 @@ clonetiler_dialog (void)
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Change the color saturation by this percentage for each row"), "d_saturation_per_y",
+                                                   _("Change the color saturation by this percentage for each row"), "saturation_per_j",
                                                    -100, 100, "%");
                 clonetiler_table_attach (table, l, 0, 3, 2);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Change the color saturation by this percentage for each column"), "d_saturation_per_x",
+                                                   _("Change the color saturation by this percentage for each column"), "saturation_per_i",
                                                    -100, 100, "%");
                 clonetiler_table_attach (table, l, 0, 3, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the color saturation by this percentage"), "rand_saturation",
+                                                   _("Randomize the color saturation by this percentage"), "saturation_rand",
                                                    0, 100, "%");
                 clonetiler_table_attach (table, l, 0, 3, 4);
             }
@@ -2126,21 +2513,21 @@ clonetiler_dialog (void)
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Change the color lightness by this percentage for each row"), "d_lightness_per_y",
+                                                   _("Change the color lightness by this percentage for each row"), "lightness_per_j",
                                                    -100, 100, "%");
                 clonetiler_table_attach (table, l, 0, 4, 2);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Change the color lightness by this percentage for each column"), "d_lightness_per_x",
+                                                   _("Change the color lightness by this percentage for each column"), "lightness_per_i",
                                                    -100, 100, "%");
                 clonetiler_table_attach (table, l, 0, 4, 3);
             }
 
             {
                 GtkWidget *l = clonetiler_spinbox (tt,
-                                                   _("Randomize the color lightness by this percentage"), "rand_lightness",
+                                                   _("Randomize the color lightness by this percentage"), "lightness_rand",
                                                    0, 100, "%");
                 clonetiler_table_attach (table, l, 0, 4, 4);
             }
@@ -2154,12 +2541,12 @@ clonetiler_dialog (void)
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of color changes for each row"), "alternate_color_y");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of color changes for each row"), "color_alternatej");
                 clonetiler_table_attach (table, l, 0, 5, 2);
             }
 
             {
-                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of color changes for each column"), "alternate_color_x");
+                GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of color changes for each column"), "color_alternatei");
                 clonetiler_table_attach (table, l, 0, 5, 3);
             }
 
@@ -2243,7 +2630,7 @@ clonetiler_dialog (void)
                     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_B);
                 }
                 {
-                    //TRANSLATORS: only translate "string" in "context|string". 
+                    //TRANSLATORS: only translate "string" in "context|string".
                     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
                     radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), Q_("clonetiler|H"));
                     gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the hue of the color"), NULL);
@@ -2253,7 +2640,7 @@ clonetiler_dialog (void)
                     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_H);
                 }
                 {
-                    //TRANSLATORS: only translate "string" in "context|string". 
+                    //TRANSLATORS: only translate "string" in "context|string".
                     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
                     radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), Q_("clonetiler|S"));
                     gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the saturation of the color"), NULL);
@@ -2263,7 +2650,7 @@ clonetiler_dialog (void)
                     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_S);
                 }
                 {
-                    //TRANSLATORS: only translate "string" in "context|string". 
+                    //TRANSLATORS: only translate "string" in "context|string".
                     // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
                     radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), Q_("clonetiler|L"));
                     gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Pick the lightness of the color"), NULL);
@@ -2387,7 +2774,7 @@ clonetiler_dialog (void)
 
                 {
                     GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 10);
-                    int value = prefs_get_int_attribute (prefs_path, "ymax", 2);
+                    int value = prefs_get_int_attribute (prefs_path, "jmax", 2);
                     gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value);
                     GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0);
                     gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, _("How many rows in the tiling"), NULL);
@@ -2395,7 +2782,7 @@ clonetiler_dialog (void)
                     gtk_box_pack_start (GTK_BOX (hb), sb, TRUE, TRUE, 0);
 
                     gtk_signal_connect(GTK_OBJECT(a), "value_changed",
-                                       GTK_SIGNAL_FUNC(clonetiler_xy_changed), (gpointer) "ymax");
+                                       GTK_SIGNAL_FUNC(clonetiler_xy_changed), (gpointer) "jmax");
                 }
 
                 {
@@ -2407,7 +2794,7 @@ clonetiler_dialog (void)
 
                 {
                     GtkObject *a = gtk_adjustment_new(0.0, 1, 500, 1, 10, 10);
-                    int value = prefs_get_int_attribute (prefs_path, "xmax", 2);
+                    int value = prefs_get_int_attribute (prefs_path, "imax", 2);
                     gtk_adjustment_set_value (GTK_ADJUSTMENT (a), value);
                     GtkWidget *sb = gtk_spin_button_new (GTK_ADJUSTMENT (a), 1.0, 0);
                     gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), sb, _("How many columns in the tiling"), NULL);
@@ -2415,7 +2802,7 @@ clonetiler_dialog (void)
                     gtk_box_pack_start (GTK_BOX (hb), sb, TRUE, TRUE, 0);
 
                     gtk_signal_connect(GTK_OBJECT(a), "value_changed",
-                                       GTK_SIGNAL_FUNC(clonetiler_xy_changed), (gpointer) "xmax");
+                                       GTK_SIGNAL_FUNC(clonetiler_xy_changed), (gpointer) "imax");
                 }
 
                 clonetiler_table_attach (table, hb, 0.0, 1, 2);
@@ -2428,10 +2815,10 @@ clonetiler_dialog (void)
                 // unitmenu
                 GtkWidget *u = sp_unit_selector_new (SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
                 sp_unit_selector_set_unit (SP_UNIT_SELECTOR(u), sp_desktop_namedview(SP_ACTIVE_DESKTOP)->doc_units);
-    
+
                 {
-                    // Width spinbutton 
-                    GtkObject *a = gtk_adjustment_new (0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0);
+                    // Width spinbutton
+                    GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 10.0);
                     sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a));
 
                     double value = prefs_get_double_attribute (prefs_path, "fillwidth", 50);
@@ -2455,7 +2842,7 @@ clonetiler_dialog (void)
 
                 {
                     // Height spinbutton
-                    GtkObject *a = gtk_adjustment_new (0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0);
+                    GtkObject *a = gtk_adjustment_new (0.0, -1e6, 1e6, 1.0, 10.0, 10.0);
                     sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a));
 
                     double value = prefs_get_double_attribute (prefs_path, "fillheight", 50);