clonetiler.cpp revision e42e6130e1aca183d24c4e696c9fae555c49beaa
#define __SP_CLONE_TILER_C__
/*
* Clone tiling dialog
*
* Authors:
* bulia byak <buliabyak@users.sf.net>
*
* Copyright (C) 2004-2005 Authors
* Released under GNU GPL
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "application/application.h"
#include "application/editor.h"
#include "helper/unit-menu.h"
#include "../inkscape.h"
#include "../prefs-utils.h"
#include "dialog-events.h"
#include "../macros.h"
#include "../verbs.h"
#include "../interface.h"
#include "../selection.h"
#include "../style.h"
#include "../desktop.h"
#include "../desktop-handles.h"
#include "../sp-namedview.h"
#include "../document.h"
#include "../message-stack.h"
#include "../sp-use.h"
#include "unclump.h"
#include "svg/svg-color.h"
#include "libnr/nr-matrix-fns.h"
#include "libnr/nr-matrix-ops.h"
#include "libnr/nr-matrix-translate-ops.h"
#include "libnr/nr-translate-ops.h"
#include "libnr/nr-translate-rotate-ops.h"
#include "libnr/nr-translate-scale-ops.h"
#include "display/nr-arena.h"
#include "display/nr-arena-item.h"
#include "ui/widget/color-picker.h"
// impossible original values to make sure they are read from prefs
#define SB_MARGIN 1
#define VB_MARGIN 4
enum {
};
static void
{
{
} else {
}
delete color_picker;
}
static gboolean
{
if (x<0) x=0;
if (y<0) y=0;
return FALSE; // which means, go ahead and destroy it
}
static void on_delete()
{
(void)clonetiler_dialog_delete (0, 0, NULL);
}
static void
{
static bool is_updating = false;
if (is_updating || !SP_ACTIVE_DESKTOP)
return;
is_updating = true;
gchar c[32];
is_updating = false;
}
static void
clonetiler_change_selection (Inkscape::Application * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg)
{
return;
}
return;
}
if (n > 0) {
} else {
}
}
static void
{
}
}
enum {
};
// symmetry group
int type,
// row, column
int x, int y,
// center, width, height of the tile
double w, double h,
// values from the dialog:
double d_per_x_exp, double d_per_y_exp,
)
{
// in abs units
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 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 rand_scale_x, rand_scale_y;
if (rand_scaley == rand_scalex) {
// if rands are equal, scale proportionally
} else {
}
NR::Matrix dscale_c = NR::translate(-cx, -cy) * NR::scale (dscalex, dscaley) * NR::translate(cx, cy);
x = (int) pow ((double) x, d_per_x_exp);
y = (int) pow ((double) y, d_per_y_exp);
switch (type) {
case TILE_P1:
return d_s_r * rect_translate;
break;
case TILE_P2:
if (x % 2 == 0) {
return d_s_r * rect_translate;
} else {
}
break;
case TILE_PM:
if (x % 2 == 0) {
return d_s_r * rect_translate;
} else {
}
break;
case TILE_PG:
if (y % 2 == 0) {
return d_s_r * rect_translate;
} else {
}
break;
case TILE_CM:
if ((x + y) % 2 == 0) {
return d_s_r * rect_translate;
} else {
}
break;
case TILE_PMM:
if (y % 2 == 0) {
if (x % 2 == 0) {
return d_s_r * rect_translate;
} else {
}
} else {
if (x % 2 == 0) {
} else {
}
}
break;
case TILE_PMG:
if (y % 4 == 0) {
return d_s_r * rect_translate;
} else if (y % 4 == 1) {
} else if (y % 4 == 2) {
} else if (y % 4 == 3) {
}
break;
case TILE_PGG:
if (y % 2 == 0) {
if (x % 2 == 0) {
return d_s_r * rect_translate;
} else {
}
} else {
if (x % 2 == 0) {
} else {
}
}
break;
case TILE_CMM:
if (y % 4 == 0) {
if (x % 2 == 0) {
return d_s_r * rect_translate;
} else {
}
} else if (y % 4 == 1) {
if (x % 2 == 0) {
} else {
}
} else if (y % 4 == 2) {
if (x % 2 == 1) {
return d_s_r * rect_translate;
} else {
}
} else {
if (x % 2 == 1) {
} else {
}
}
break;
case TILE_P4:
{
if (y % 2 == 0) {
if (x % 2 == 0) {
} else {
}
} else {
if (x % 2 == 0) {
} else {
}
}
}
break;
case TILE_P4M:
{
if (y % 2 == 0) {
if (x % 4 == 0) {
} else if (x % 4 == 1) {
} else if (x % 4 == 2) {
} else if (x % 4 == 3) {
}
} else {
if (x % 4 == 0) {
} else if (x % 4 == 1) {
} else if (x % 4 == 2) {
} else if (x % 4 == 3) {
}
}
}
break;
case TILE_P4G:
{
if (((x/4) + y) % 2 == 0) {
if (x % 4 == 0) {
} else if (x % 4 == 1) {
} else if (x % 4 == 2) {
} else if (x % 4 == 3) {
}
} else {
if (x % 4 == 0) {
} else if (x % 4 == 1) {
} else if (x % 4 == 2) {
} else if (x % 4 == 3) {
}
}
}
break;
case TILE_P3:
{
double width;
double height;
if (w > h) {
} else {
height = h;
}
if (x % 3 == 0) {
} else if (x % 3 == 1) {
} else if (x % 3 == 2) {
}
}
break;
case TILE_P31M:
{
if (w > h) {
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) );
} else {
ori = NR::Matrix (NR::translate (2*h * cos30 * (x/6 + 0.5*(y%2)) + dx, (2*h - h * sin30) * y + dy));
}
if (x % 6 == 0) {
} else if (x % 6 == 1) {
} else if (x % 6 == 2) {
} else if (x % 6 == 3) {
} else if (x % 6 == 4) {
} else if (x % 6 == 5) {
}
}
break;
case TILE_P3M1:
{
double width;
double height;
if (w > h) {
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) );
} else {
height = 2 * h;
}
if (x % 6 == 0) {
} else if (x % 6 == 1) {
} else if (x % 6 == 2) {
} else if (x % 6 == 3) {
} else if (x % 6 == 4) {
} else if (x % 6 == 5) {
}
}
break;
case TILE_P6:
{
if (w > h) {
} else {
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));
}
if (x % 6 == 0) {
} else if (x % 6 == 1) {
} else if (x % 6 == 2) {
} else if (x % 6 == 3) {
} else if (x % 6 == 4) {
} else if (x % 6 == 5) {
}
}
break;
case TILE_P6M:
{
if (w > h) {
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));
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));
dia5 = dia4 * NR::Matrix (NR::translate (-h/2 * cos30, -h/2 * sin30) * NR::translate (-w/2 * cos60, w/2 * sin60) * NR::translate (w/2, -h/2));
} else {
ori = NR::Matrix(NR::translate (4*h * cos30 * (x/12 + 0.5*(y%2)) + dx, (2*h + 2*h * sin30) * y + 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));
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));
dia5 = dia4 * NR::Matrix (NR::translate (w/2 * cos60, -w/2 * sin60) * NR::translate (h/2 * cos30, h/2 * sin30) * NR::translate (-w/2, h/2));
}
if (x % 12 == 0) {
} else if (x % 12 == 1) {
} else if (x % 12 == 2) {
} else if (x % 12 == 3) {
} else if (x % 12 == 4) {
} else if (x % 12 == 5) {
} else if (x % 12 == 6) {
} else if (x % 12 == 7) {
} else if (x % 12 == 8) {
} else if (x % 12 == 9) {
} else if (x % 12 == 10) {
} else if (x % 12 == 11) {
}
}
break;
default:
break;
}
}
static bool
{
if (obj) {
}
{
if (id_href)
return true;
} else {
if (id_href)
return false;
}
}
static unsigned trace_visionkey;
static NRArenaItem *trace_root;
static gdouble trace_zoom;
static void
{
if (!trace_arena)
return;
}
}
static void
{
/* Create ArenaItem and set transform */
// hide the (current) original and any tiled clones, we only want to pick the background
trace_zoom = zoom;
}
static guint32
{
if (!trace_arena)
return 0;
NRMatrix t;
/* Item integer bbox in points */
/* Find visible area */
/* Set up pixblock */
/* Render */
double R = 0, G = 0, B = 0, A = 0;
double count = 0;
double weight = 0;
count += 1;
R += s[0] / 255.0;
G += s[1] / 255.0;
B += s[2] / 255.0;
A += s[3] / 255.0;
s += 4;
}
}
R = R / weight;
G = G / weight;
B = B / weight;
A = A / count;
return SP_RGBA32_F_COMPOSE (R, G, B, A);
}
static void
{
if (trace_arena) {
trace_arena = NULL;
}
}
static void
{
return;
// check if something is selected
SP_DT_MSGSTACK(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to unclump."));
return;
}
for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) {
}
}
}
static guint
{
guint n = 0;
for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) {
n ++;
}
}
return n;
}
static void
{
return;
// check if something is selected
SP_DT_MSGSTACK(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to remove."));
return;
}
// remove old tiling
for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) {
}
}
}
if (do_undo)
}
{
using NR::X;
using NR::Y;
}
/**
Randomizes \a val by \a rand, with 0 < val < 1 and all values (including 0, 1) having the same
probability of being displaced.
*/
static double
{
return CLAMP(val, 0, 1); // this should be unnecessary with the above provisions, but just in case...
}
static void
{
return;
// check if something is selected
return;
}
// Check if more than one object is selected.
SP_DT_MSGSTACK(desktop)->flash(Inkscape::ERROR_MESSAGE, _("If you want to clone several objects, <b>group</b> them and <b>clone the group</b>."));
return;
}
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_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_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);
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_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);
double rand_opacity = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_opacity", 0, 0, 100);
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 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);
double rand_picked = 0.01 * prefs_get_double_attribute_limited (prefs_path, "rand_picked", 0, 0, 100);
if (dotrace) {
}
double w;
double h;
if (keepbbox &&
} else {
c = r.midpoint();
w = r.dimensions()[NR::X];
h = r.dimensions()[NR::Y];
}
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));
for (int x = 0;
(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::Y]) < fillheight && y < 200) // prevent "freezing" with too large fillrect, arbitrarily limit cols
: (y < ymax);
y ++) {
// 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
cur = c * t - c;
if (fillrect) {
continue;
}
}
// Color tab
if (initial_color) {
float hsl[3];
hsl[1] += d_saturation_per_x * eff_x + d_saturation_per_y * eff_y + rand_saturation * g_random_double_range (-1, 1);
hsl[2] += d_lightness_per_x * eff_x + d_lightness_per_y * eff_y + rand_lightness * g_random_double_range (-1, 1);
float rgb[3];
}
// Opacity tab
double opacity = 1.0;
opacity = 1 - (d_opacity_per_x * eff_x + d_opacity_per_y * eff_y + rand_opacity * g_random_double_range (-1, 1));
// Trace tab
if (dotrace) {
float r = SP_RGBA32_R_F(rgba);
float g = SP_RGBA32_G_F(rgba);
float b = SP_RGBA32_B_F(rgba);
float a = SP_RGBA32_A_F(rgba);
float hsl[3];
sp_color_rgb_to_hsl_floatv (hsl, r, g, b);
switch (pick) {
case PICK_COLOR:
break;
case PICK_OPACITY:
val = a;
break;
case PICK_R:
val = r;
break;
case PICK_G:
val = g;
break;
case PICK_B:
val = b;
break;
case PICK_H:
break;
case PICK_S:
break;
case PICK_L:
break;
default:
break;
}
if (rand_picked > 0) {
r = randomize01 (r, rand_picked);
g = randomize01 (g, rand_picked);
b = randomize01 (b, rand_picked);
}
if (gamma_picked != 0) {
double power;
if (gamma_picked < 0)
else
}
if (invert_picked) {
r = 1 - r;
g = 1 - g;
b = 1 - b;
}
r = CLAMP (r, 0, 1);
g = CLAMP (g, 0, 1);
b = CLAMP (b, 0, 1);
// recompose tweaked color
rgba = SP_RGBA32_F_COMPOSE(r, g, b, a);
if (pick_to_presence) {
continue; // skip!
}
}
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;
}
if (pick_to_opacity) {
}
if (pick_to_color) {
}
}
continue;
}
continue;
}
// Create the clone
bool center_set = false;
if (obj_repr->attribute("inkscape:transform-center-x") || obj_repr->attribute("inkscape:transform-center-y")) {
center_set = true;
}
} else {
}
if (opacity < 1.0) {
}
if (*color_string) {
}
// add the new clone to the top of the original's parent
if (center_set) {
}
}
}
}
if (dotrace) {
}
}
static GtkWidget *
{
return vb;
}
static void
{
}
static GtkWidget *
{
GtkWidget *b = gtk_check_button_new ();
return hb;
}
static void
{
}
static GtkWidget *
clonetiler_spinbox (GtkTooltips *tt, const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false)
{
{
GtkObject *a;
if (exponent)
else
if (exponent)
else
double value = prefs_get_double_attribute_limited (prefs_path, attr, exponent? 1 : 0, lower, upper);
if (exponent)
else
}
{
}
return hb;
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
if (w && GTK_IS_OBJECT(w)) {
{
if (r && GTK_IS_SPIN_BUTTON(w)) { // spinbutton
gtk_adjustment_set_value (a, 0);
}
}
{
if (r && GTK_IS_SPIN_BUTTON(w)) { // spinbutton
gtk_adjustment_set_value (a, 1);
}
}
{
if (r && GTK_IS_TOGGLE_BUTTON(w)) { // checkbox
}
}
}
if (GTK_IS_CONTAINER(w)) {
}
g_list_free (ch);
}
}
static void
{
}
static void
{
gtk_table_attach ( GTK_TABLE (table), a, col, col + 1, row, row + 1, (GtkAttachOptions)4, (GtkAttachOptions)0, 0, 0 );
}
static GtkWidget *
{
{
}
{
}
{
}
return table;
}
static void
{
}
static void
{
if (rowscols) {
}
if (widthheight) {
}
}
static void
{
if (rowscols) {
}
if (widthheight) {
}
}
static void
{
}
static void
{
}
static void
{
if (vvb)
}
void
clonetiler_dialog (void)
{
if (!dlg)
{
if (x == -1000 || y == -1000) {
}
if (w ==0 || h == 0) {
}
if (x<0) x=0;
if (y<0) y=0;
if (x != 0 || y != 0) {
} else {
}
if (w && h) {
}
{
_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 {
g_signal_connect ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd);
}
// Symmetry
{
/* TRANSLATORS: For the following 17 symmetry groups, see
* http://www.bib.ulb.ac.be/coursmath/doc/17.htm (visual examples);
* http://www.clarku.edu/~djoyce/wallpaper/seventeen.html (English vocabulary); or
* http://membres.lycos.fr/villemingerard/Geometri/Sym1D.htm (French vocabulary).
*/
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), om, _("Select one of the 17 symmetry groups for the tiling"), NULL);
GtkWidget *m = gtk_menu_new ();
struct SymGroups {
int group;
} const sym_groups[] = {
// TRANSLATORS: "translation" means "shift" / "displacement" here.
{TILE_P1, _("<b>P1</b>: simple translation")},
{TILE_P2, _("<b>P2</b>: 180° rotation")},
{TILE_PM, _("<b>PM</b>: reflection")},
// TRANSLATORS: "glide reflection" is a reflection and a translation combined.
// For more info, see http://mathforum.org/sum95/suzanne/symsusan.html
{TILE_PG, _("<b>PG</b>: glide reflection")},
{TILE_CM, _("<b>CM</b>: reflection + glide reflection")},
{TILE_PMM, _("<b>PMM</b>: reflection + reflection")},
{TILE_PMG, _("<b>PMG</b>: reflection + 180° rotation")},
{TILE_PGG, _("<b>PGG</b>: glide reflection + 180° rotation")},
{TILE_CMM, _("<b>CMM</b>: reflection + reflection + 180° rotation")},
{TILE_P4, _("<b>P4</b>: 90° rotation")},
{TILE_P4M, _("<b>P4M</b>: 90° rotation + 45° reflection")},
{TILE_P4G, _("<b>P4G</b>: 90° rotation + 90° reflection")},
{TILE_P3, _("<b>P3</b>: 120° rotation")},
{TILE_P31M, _("<b>P31M</b>: reflection + 120° rotation, dense")},
{TILE_P3M1, _("<b>P3M1</b>: reflection + 120° rotation, sparse")},
{TILE_P6, _("<b>P6</b>: 60° rotation")},
{TILE_P6M, _("<b>P6M</b>: reflection + 60° rotation")},
};
for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) {
}
}
// Shift
{
// X
{
// TRANSLATORS: "shift" means: the tiles will be shifted (offset) horizontally by this amount
// xgettext:no-c-format
}
{
// xgettext:no-c-format
_("Horizontal shift per row (in % of tile width)"), "d_x_per_y",
-100, 1000, "%");
}
{
// xgettext:no-c-format
_("Horizontal shift per column (in % of tile width)"), "d_x_per_x",
-100, 1000, "%");
}
{
_("Randomize the horizontal shift by this percentage"), "rand_x",
0, 1000, "%");
}
// Y
{
// TRANSLATORS: "shift" means: the tiles will be shifted (offset) vertically by this amount
// xgettext:no-c-format
}
{
// xgettext:no-c-format
_("Vertical shift per row (in % of tile height)"), "d_y_per_y",
-100, 1000, "%");
}
{
// xgettext:no-c-format
_("Vertical shift per column (in % of tile height)"), "d_y_per_x",
-100, 1000, "%");
}
{
_("Randomize the vertical shift by this percentage"), "rand_y",
0, 1000, "%");
}
// Exponent
{
}
{
_("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "d_per_y_exp",
0, 10, "", true);
}
{
_("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "d_per_x_exp",
0, 10, "", true);
}
{ // alternates
// TRANSLATORS: "Alternate" is a verb here
}
{
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 column"), "alternate_x");
}
}
// Scale
{
// X
{
}
{
// xgettext:no-c-format
_("Horizontal scale per row (in % of tile width)"), "d_scalex_per_y",
-100, 1000, "%");
}
{
// xgettext:no-c-format
_("Horizontal scale per column (in % of tile width)"), "d_scalex_per_x",
-100, 1000, "%");
}
{
_("Randomize the horizontal scale by this percentage"), "rand_scalex",
0, 1000, "%");
}
// Y
{
}
{
// xgettext:no-c-format
_("Vertical scale per row (in % of tile height)"), "d_scaley_per_y",
-100, 1000, "%");
}
{
// xgettext:no-c-format
_("Vertical scale per column (in % of tile height)"), "d_scaley_per_x",
-100, 1000, "%");
}
{
_("Randomize the vertical scale by this percentage"), "rand_scaley",
0, 1000, "%");
}
{ // alternates
// TRANSLATORS: "Alternate" is a verb here
}
{
GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each row"), "alternate_scaley");
}
{
GtkWidget *l = clonetiler_checkbox (tt, _("Alternate the sign of scales for each column"), "alternate_scalex");
}
}
// Rotation
{
// Angle
{
}
{
// xgettext:no-c-format
_("Rotate tiles by this angle for each row"), "d_rot_per_y",
-180, 180, "°");
}
{
// xgettext:no-c-format
_("Rotate tiles by this angle for each column"), "d_rot_per_x",
-180, 180, "°");
}
{
_("Randomize the rotation angle by this percentage"), "rand_rot",
0, 100, "%");
}
{ // alternates
// TRANSLATORS: "Alternate" is a verb here
}
{
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 column"), "alternate_rotx");
}
}
// Opacity
{
// Dissolve
{
}
{
_("Decrease tile opacity by this percentage for each row"), "d_opacity_per_y",
0, 100, "%");
}
{
_("Decrease tile opacity by this percentage for each column"), "d_opacity_per_x",
0, 100, "%");
}
{
_("Randomize the tile opacity by this percentage"), "rand_opacity",
0, 100, "%");
}
{ // alternates
// TRANSLATORS: "Alternate" is a verb here
}
{
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 opacity change for each column"), "alternate_opacityx");
}
}
// Color
{
{
guint32 rgba = 0x000000ff | sp_svg_read_color (prefs_get_string_attribute(prefs_path, "initial_color"), 0x000000ff);
color_picker = new Inkscape::UI::Widget::ColorPicker (*new Glib::ustring(_("Initial color of tiled clones")), *new Glib::ustring(_("Initial color for clones (works only if the original has unset fill or stroke)")), rgba, false);
gtk_box_pack_start (GTK_BOX (hb), reinterpret_cast<GtkWidget*>(color_picker->gobj()), FALSE, FALSE, 0);
}
// Hue
{
}
{
_("Change the tile hue by this percentage for each row"), "d_hue_per_y",
-100, 100, "%");
}
{
_("Change the tile hue by this percentage for each column"), "d_hue_per_x",
-100, 100, "%");
}
{
_("Randomize the tile hue by this percentage"), "rand_hue",
0, 100, "%");
}
// Saturation
{
}
{
_("Change the color saturation by this percentage for each row"), "d_saturation_per_y",
-100, 100, "%");
}
{
_("Change the color saturation by this percentage for each column"), "d_saturation_per_x",
-100, 100, "%");
}
{
_("Randomize the color saturation by this percentage"), "rand_saturation",
0, 100, "%");
}
// Lightness
{
}
{
_("Change the color lightness by this percentage for each row"), "d_lightness_per_y",
-100, 100, "%");
}
{
_("Change the color lightness by this percentage for each column"), "d_lightness_per_x",
-100, 100, "%");
}
{
_("Randomize the color lightness by this percentage"), "rand_lightness",
0, 100, "%");
}
{ // alternates
}
{
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 column"), "alternate_color_x");
}
}
// Trace
{
{
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("For each clone, pick a value from the drawing in that clone's location and apply it to the clone"), NULL);
}
{
{
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_COLOR);
}
{
radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Opacity"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_OPACITY);
}
{
radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("R"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_R);
}
{
radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("G"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_G);
}
{
radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("B"));
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".
// 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_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".
// 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_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".
// 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_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs_get_int_attribute(prefs_path, "pick", 0) == PICK_L);
}
}
{
{
}
{
_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked",
-10, 10, "");
}
{
}
{
_("Randomize the picked value by this percentage"), "rand_picked",
0, 100, "%");
}
{
}
{
}
}
{
{
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone is created with the probability determined by the picked value in that point"), NULL);
}
{
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone's size is determined by the picked value in that point"), NULL);
}
{
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)"), NULL);
}
{
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Each clone's opacity is determined by the picked value in that point"), NULL);
}
}
}
}
{
{
{
}
{
}
{
}
}
{
// unitmenu
{
// Width spinbutton
GtkObject *a = gtk_adjustment_new (0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0);
}
{
}
{
// Height spinbutton
GtkObject *a = gtk_adjustment_new (0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0);
}
}
// Switch
{
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Create the specified number of rows and columns"), NULL);
gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_create), (gpointer) dlg);
}
}
{
radio = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (radio)), _("Width, height: "));
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), radio, _("Fill the specified width and height with the tiling"), NULL);
gtk_signal_connect (GTK_OBJECT (radio), "toggled", GTK_SIGNAL_FUNC (clonetiler_switch_to_fill), (gpointer) dlg);
}
}
}
// Use saved pos
{
gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Pretend that the size and position of the tile are the same as the last time you tiled it (if any), instead of using the current size"), NULL);
}
// Statusbar
{
}
// Buttons
{
{
GtkWidget *b = gtk_button_new ();
gtk_container_add (GTK_CONTAINER(b), l);
}
{ // buttons which are enabled only when there are tiled clones
{
// TRANSLATORS: if a group of objects are "clumped" together, then they
// are unevenly spread in the given amount of space - as shown in the
// diagrams on the left in the following screenshot:
// So unclumping is the process of spreading a number of objects out more evenly.
gtk_tooltips_set_tip (tt, b, _("Spread out clones to reduce clumping; can be applied repeatedly"), NULL);
}
{
gtk_tooltips_set_tip (tt, b, _("Remove existing tiled clones of the selected object (siblings only)"), NULL);
}
// connect to global selection changed signal (so we can change desktops) and
// external_change (so we're not fooled by undo)
g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (clonetiler_change_selection), dlg);
g_signal_connect (G_OBJECT (INKSCAPE), "external_change", G_CALLBACK (clonetiler_external_change), dlg);
g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), G_OBJECT (INKSCAPE));
// update now
}
{
// TRANSLATORS: "change" is a noun here
gtk_tooltips_set_tip (tt, b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero"), NULL);
}
}
} // end of if (!dlg)
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :