Merge lp:~caldoria+inkscape.dev/inkscape/clonetiler-absolute-units into lp:~inkscape.dev/inkscape/trunk
- clonetiler-absolute-units
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~caldoria+inkscape.dev/inkscape/clonetiler-absolute-units |
Merge into: | lp:~inkscape.dev/inkscape/trunk |
Diff against target: |
864 lines (+411/-277) 3 files modified
src/ui/dialog/clonetiler.cpp (+355/-276) src/ui/dialog/clonetiler.h (+52/-0) src/ui/widget/labelled.cpp (+4/-1) |
To merge this branch: | bzr merge lp:~caldoria+inkscape.dev/inkscape/clonetiler-absolute-units |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Inkscape Developers | Pending | ||
Review via email: mp+276948@code.launchpad.net |
Commit message
Description of the change
I've changed the clonetiler dialog so that absolute units can be used for both shifting and scaling. So far only dimensionless units (percent) could be used for this.
Absolute units help when trying to place irregular objects on a regular grid, where it is inconvenient to specify the grid spacing as a multiple of the object size.
Note that this is my first contribution to Inkscape, so I am not sure if this is the avenue you guys prefer for contributions. I find the various wiki pages and instructions a little unclear, using the procedure detailed on http://
- 14453. By jabiertxof<email address hidden>
-
Spray Tool: Change hide invisibe by over visible and over invisible, sugested by Ivan Louette
- 14454. By Jabiertxof <email address hidden>
-
Improvements to the over visible/invisible to minimize the colisions, sprayed items fit on background whith overlap visible or invisible areas
Add option in picker mode to compute the center/or average area of sprayed item
Now reverse work without adbanced trace dialog inverting the color. By this all buttons have a utility in advanced and in normal mode - 14455. By Jabiertxof <email address hidden>
-
Add option to spray tool to no overlap between colors
- 14456. By Jabiertxof <email address hidden>
-
Remove unused functions
- 14457. By jabiertxof<email address hidden>
-
Improve offseting calculation
Improve no picoverlap feature - 14458. By jabiertxof<email address hidden>
-
Refactor of code, minor bugs fixed.
- 14459. By jabiertxof<email address hidden>
-
Add erase mode to spray. Bugfixes.
- 14460. By jabiertxof<email address hidden>
-
Fix a warn on launch
- 14461. By jabiertxof<email address hidden>
-
Fix crashes in erase mode of spray
- 14462. By jabiertxof<email address hidden>
-
Fix a bug on bspline, duplicating end nodes
- 14463. By Kris
-
static code analysis
- 14464. By Kris
-
static code analysis
- 14465. By Alexandre Prokoudine
-
Update Russian translation
- 14466. By Alexandre Prokoudine
-
Update Russian translation
- 14467. By Alexandre Prokoudine
-
Some sane defaults for spray offset, subject to further tweaking
- 14468. By Alexandre Prokoudine
-
Update Russian translation
- 14469. By Jabiertxof <email address hidden>
-
Fix erase mode in no overlap mode, pointed by Ivan Louette
- 14470. By Hasan Kiran
-
Translation. Turkish translation update.
- 14471. By Jabiertxof <email address hidden>
-
Fixed roughen LPE
- 14472. By Janis Eisaks
-
Latvian translation update
- 14473. By Firas Hanife
-
Translations. Italian translation update.
- 14474. By Kris
-
static code analysis
- 14475. By Mc
-
removes warnings when compiling with c++11 using uniqueptr instead of autoptr
- 14476. By Kris
-
Fix potentential null pointer dereference
- 14477. By Hasan Kiran
-
Translations. Turkish translation update.
- 14478. By Mc
-
fix for bug 1517740 (crash in some cases in selection sets)
- 14479. By insaner
-
window/task bar icon missing when installed in non-standard location
- 14480. By Alex Valavanis
-
Compile against external libpotrace
- 14481. By Alex Valavanis
-
src/Makefile.am: Rm notes about tests that have been fixed
- 14482. By su_v
-
packaging/macosx: update scripts for potrace switch to external dependency
- 14483. By caldoria <email address hidden>
-
Enabled absolute units for clonetiler shift and scale functions. Addressed first reviewer comments, removed some dead code.
Mark (caldoria) wrote : | # |
Hi,
Thanks for reviewing the code. I've tried to address your comments. There seem to be no conflicts at the moment.
As to what I did in the code, I changed the widgets in the clonetiler dialog to be able to deal with units. Before one could only input dimensionless quantities via that dialog. I have only changed the "Shift" and "Scale" pages, as these seem to me to be the only ones that would reasonably benefit from unit quantities. This mainly meant replacing the relevant input widgets with UI::Widget:
I also made a small change to the "Labelled" widget. Before a label would be placed into the layout manager even if no label (empty string) is specified, which could yield an unsightly space. I've made this conditional on non-empty strings. I've done this because the ScalarUnit widget is a Labelled, and while I don't want to label the widget, I do want to make use of the unit capabilities.
Thanks,
Mark
Mc (mc...) wrote : | # |
I tested the branch, and got into those problems:
-> by default, there is no unit selected, not even "%" (blank choice)
-> "reset" does not work as expected (or at all in some tabs, and does not reset units to %)
-> default % setting set 100% randomness...
-> Not sure the unit choice is ideally placed (since you have to choose the unit before the values)
Unmerged revisions
- 14483. By caldoria <email address hidden>
-
Enabled absolute units for clonetiler shift and scale functions. Addressed first reviewer comments, removed some dead code.
Preview Diff
1 | === modified file 'src/ui/dialog/clonetiler.cpp' |
2 | --- src/ui/dialog/clonetiler.cpp 2015-11-08 09:49:26 +0000 |
3 | +++ src/ui/dialog/clonetiler.cpp 2015-11-21 20:12:56 +0000 |
4 | @@ -81,7 +81,48 @@ |
5 | dlg(NULL), |
6 | desktop(NULL), |
7 | deskTrack(), |
8 | - table_row_labels(NULL) |
9 | + table_row_labels(NULL), |
10 | + |
11 | + // Shift page |
12 | + _scalar_shift_x_row ("", _("Shift in x coordinate per row"), UNIT_TYPE_LINEAR, "", "", &_units_shift), |
13 | + _scalar_shift_x_column ("", _("Shift in x coordinate per column"), UNIT_TYPE_LINEAR, "", "", &_units_shift), |
14 | + _scalar_shift_x_randomize ("", _("Randomization of x coordinate per shift"), UNIT_TYPE_LINEAR, "", "", &_units_shift), |
15 | + |
16 | + _scalar_shift_y_row ("", _("Shift in y coordinate per row"), UNIT_TYPE_LINEAR, "", "", &_units_shift), |
17 | + _scalar_shift_y_column ("", _("Shift in y coordinate per column"), UNIT_TYPE_LINEAR, "", "", &_units_shift), |
18 | + _scalar_shift_y_randomize ("", _("Randomization of y coordinate per shift"), UNIT_TYPE_LINEAR, "", "", &_units_shift), |
19 | + |
20 | + _scalar_shift_exponent_row ("", _("Whether rows are spaced evenly (1), diverge (> 1) or converge (< 1)"), UNIT_TYPE_DIMENSIONLESS, "", ""), |
21 | + _scalar_shift_exponent_column ("", _("Whether columns are spaced evenly (1), diverge (> 1) or converge (< 1)"), UNIT_TYPE_DIMENSIONLESS, "", ""), |
22 | + |
23 | + _check_shift_alternate_row ("", _("Alternate sign of shifts for each row")), |
24 | + _check_shift_alternate_column ("", _("Alternate sign of shifts for each column")), |
25 | + _check_shift_cumulate_row ("", _("Combine shifts cumulatively for each row")), |
26 | + _check_shift_cumulate_column ("", _("Combine shifts cumulatively for each column")), |
27 | + _check_shift_exclude_row ("", _("Exclude tile width from row shifts")), |
28 | + _check_shift_exclude_column ("", _("Exclude tile height from column shifts")), |
29 | + |
30 | + |
31 | + // Scale page |
32 | + _scalar_scale_x_row ("", _("Horizontal scale per row"), UNIT_TYPE_LINEAR, "", "", &_units_scale), |
33 | + _scalar_scale_x_column ("", _("Horizontal scale per column"), UNIT_TYPE_LINEAR, "", "", &_units_scale), |
34 | + _scalar_scale_x_randomize ("", _("Randomize the horizontal scale"), UNIT_TYPE_LINEAR, "", "", &_units_scale), |
35 | + |
36 | + _scalar_scale_y_row ("", _("Vertical scale per row"), UNIT_TYPE_LINEAR, "", "", &_units_scale), |
37 | + _scalar_scale_y_column ("", _("Vertical scale per column"), UNIT_TYPE_LINEAR, "", "", &_units_scale), |
38 | + _scalar_scale_y_randomize ("", _("Randomize the vertical scale"), UNIT_TYPE_LINEAR, "", "", &_units_scale), |
39 | + |
40 | + _scalar_scale_exponent_row ("", _("Whether row scaling is uniform (1), converges (< 1) or diverges (> 1)"), UNIT_TYPE_DIMENSIONLESS, "", ""), |
41 | + _scalar_scale_exponent_column ("", _("Whether column scaling is uniform (1), converges (< 1) or diverges (> 1)"), UNIT_TYPE_DIMENSIONLESS, "", ""), |
42 | + |
43 | + _scalar_scale_base_row ("", _("Base for a logarithmic spiral: not used (0), convergent (< 1) or divergent (> 1)"), UNIT_TYPE_DIMENSIONLESS, "", ""), |
44 | + _scalar_scale_base_column ("", _("Base for a logarithmic spiral: not used (0), convergent (< 1) or divergent (> 1)"), UNIT_TYPE_DIMENSIONLESS, "", ""), |
45 | + |
46 | + _check_scale_alternate_row ("", _("Alternate sign of scales across rows")), |
47 | + _check_scale_alternate_column ("", _("Alternate sign of scales across columns")), |
48 | + _check_scale_cumulate_row ("", _("Cumulate scales across rows")), |
49 | + _check_scale_cumulate_column ("", _("Cumulate scales across columns")) |
50 | + |
51 | { |
52 | Gtk::Box *contents = _getContents(); |
53 | contents->set_spacing(0); |
54 | @@ -173,14 +214,15 @@ |
55 | |
56 | table_row_labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
57 | |
58 | - // Shift |
59 | + // Shift page |
60 | { |
61 | GtkWidget *vb = clonetiler_new_tab (nb, _("S_hift")); |
62 | |
63 | GtkWidget *table = clonetiler_table_x_y_rand (3); |
64 | gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0); |
65 | - |
66 | - // X |
67 | + prepareUnitMenu(_units_shift, "shiftx_per_j", "px"); |
68 | + |
69 | + // X Label |
70 | { |
71 | GtkWidget *l = gtk_label_new (""); |
72 | // TRANSLATORS: "shift" means: the tiles will be shifted (offset) horizontally by this amount |
73 | @@ -190,59 +232,40 @@ |
74 | clonetiler_table_attach (table, l, 1, 2, 1); |
75 | } |
76 | |
77 | - { |
78 | - GtkWidget *l = clonetiler_spinbox ( |
79 | - // xgettext:no-c-format |
80 | - _("Horizontal shift per row (in % of tile width)"), "shiftx_per_j", |
81 | - -10000, 10000, "%"); |
82 | - clonetiler_table_attach (table, l, 0, 2, 2); |
83 | - } |
84 | - |
85 | - { |
86 | - GtkWidget *l = clonetiler_spinbox ( |
87 | - // xgettext:no-c-format |
88 | - _("Horizontal shift per column (in % of tile width)"), "shiftx_per_i", |
89 | - -10000, 10000, "%"); |
90 | - clonetiler_table_attach (table, l, 0, 2, 3); |
91 | - } |
92 | - |
93 | - { |
94 | - GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand", |
95 | - 0, 1000, "%"); |
96 | - clonetiler_table_attach (table, l, 0, 2, 4); |
97 | - } |
98 | - |
99 | - // Y |
100 | + // Y Label |
101 | { |
102 | GtkWidget *l = gtk_label_new (""); |
103 | - // TRANSLATORS: "shift" means: the tiles will be shifted (offset) vertically by this amount |
104 | + // TRANSLATORS: "shift" means: the tiles will be shifted (offset) horizontally by this amount |
105 | // xgettext:no-c-format |
106 | gtk_label_set_markup (GTK_LABEL(l), _("<b>Shift Y:</b>")); |
107 | gtk_size_group_add_widget(table_row_labels, l); |
108 | clonetiler_table_attach (table, l, 1, 3, 1); |
109 | } |
110 | |
111 | - { |
112 | - GtkWidget *l = clonetiler_spinbox ( |
113 | - // xgettext:no-c-format |
114 | - _("Vertical shift per row (in % of tile height)"), "shifty_per_j", |
115 | - -10000, 10000, "%"); |
116 | - clonetiler_table_attach (table, l, 0, 3, 2); |
117 | - } |
118 | - |
119 | - { |
120 | - GtkWidget *l = clonetiler_spinbox ( |
121 | - // xgettext:no-c-format |
122 | - _("Vertical shift per column (in % of tile height)"), "shifty_per_i", |
123 | - -10000, 10000, "%"); |
124 | - clonetiler_table_attach (table, l, 0, 3, 3); |
125 | - } |
126 | - |
127 | - { |
128 | - GtkWidget *l = clonetiler_spinbox ( |
129 | - _("Randomize the vertical shift by this percentage"), "shifty_rand", |
130 | - 0, 1000, "%"); |
131 | - clonetiler_table_attach (table, l, 0, 3, 4); |
132 | + // X and Y Shifts |
133 | + { |
134 | + prepareScalarUnit(_scalar_shift_x_row, "shiftx_per_j", 0); |
135 | + prepareScalarUnit(_scalar_shift_x_column, "shiftx_per_i", 0); |
136 | + prepareScalarUnit(_scalar_shift_x_randomize, "shiftx_rand", 0); |
137 | + prepareScalarUnit(_scalar_shift_y_row, "shifty_per_j", 0); |
138 | + prepareScalarUnit(_scalar_shift_y_column, "shifty_per_i", 0); |
139 | + prepareScalarUnit(_scalar_shift_y_randomize, "shifty_rand", 0); |
140 | + |
141 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_x_row.gobj(), 0, 2, 2); |
142 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_x_column.gobj(), 0, 2, 3); |
143 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_x_randomize.gobj(), 0, 2, 4); |
144 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_y_row.gobj(), 0, 3, 2); |
145 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_y_column.gobj(), 0, 3, 3); |
146 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_y_randomize.gobj(), 0, 3, 4); |
147 | + } |
148 | + |
149 | + // UnitMenu |
150 | + { |
151 | + GtkWidget *l = gtk_label_new(""); |
152 | + gtk_label_set_markup(GTK_LABEL(l), _("<b>Units:</b>")); |
153 | + gtk_size_group_add_widget(table_row_labels, l); |
154 | + clonetiler_table_attach(table, l, 1, 4, 1); |
155 | + clonetiler_table_attach(table, (GtkWidget*)_units_shift.gobj(), 0, 4, 2); |
156 | } |
157 | |
158 | // Exponent |
159 | @@ -250,86 +273,72 @@ |
160 | GtkWidget *l = gtk_label_new (""); |
161 | gtk_label_set_markup (GTK_LABEL(l), _("<b>Exponent:</b>")); |
162 | gtk_size_group_add_widget(table_row_labels, l); |
163 | - clonetiler_table_attach (table, l, 1, 4, 1); |
164 | - } |
165 | - |
166 | - { |
167 | - GtkWidget *l = clonetiler_spinbox ( |
168 | - _("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "shifty_exp", |
169 | - 0, 10, "", true); |
170 | - clonetiler_table_attach (table, l, 0, 4, 2); |
171 | - } |
172 | - |
173 | - { |
174 | - GtkWidget *l = clonetiler_spinbox ( |
175 | - _("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "shiftx_exp", |
176 | - 0, 10, "", true); |
177 | - clonetiler_table_attach (table, l, 0, 4, 3); |
178 | - } |
179 | - |
180 | - { // alternates |
181 | + clonetiler_table_attach (table, l, 1, 5, 1); |
182 | + } |
183 | + |
184 | + { |
185 | + prepareScalar(_scalar_shift_exponent_row, "shifty_exp", 1); |
186 | + prepareScalar(_scalar_shift_exponent_column, "shiftx_exp", 1); |
187 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_exponent_row.gobj(), 0, 5, 2); |
188 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_shift_exponent_column.gobj(), 0, 5, 3); |
189 | + } |
190 | + |
191 | + // Alternate |
192 | + { |
193 | GtkWidget *l = gtk_label_new (""); |
194 | // TRANSLATORS: "Alternate" is a verb here |
195 | gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>")); |
196 | gtk_size_group_add_widget(table_row_labels, l); |
197 | - clonetiler_table_attach (table, l, 1, 5, 1); |
198 | - } |
199 | - |
200 | - { |
201 | - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate"); |
202 | - clonetiler_table_attach (table, l, 0, 5, 2); |
203 | - } |
204 | - |
205 | - { |
206 | - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate"); |
207 | - clonetiler_table_attach (table, l, 0, 5, 3); |
208 | - } |
209 | - |
210 | - { // Cumulate |
211 | + clonetiler_table_attach (table, l, 1, 6, 1); |
212 | + } |
213 | + |
214 | + { |
215 | + prepareCheckButton(_check_shift_alternate_row, "shifty_alternate"); |
216 | + prepareCheckButton(_check_shift_alternate_column, "shiftx_alternate"); |
217 | + clonetiler_table_attach (table, (GtkWidget*)_check_shift_alternate_row.gobj(), 0.5, 6, 2); |
218 | + clonetiler_table_attach (table, (GtkWidget*)_check_shift_alternate_column.gobj(), 0.5, 6, 3); |
219 | + } |
220 | + |
221 | + // Cumulate |
222 | + { |
223 | GtkWidget *l = gtk_label_new (""); |
224 | // TRANSLATORS: "Cumulate" is a verb here |
225 | gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>")); |
226 | gtk_size_group_add_widget(table_row_labels, l); |
227 | - clonetiler_table_attach (table, l, 1, 6, 1); |
228 | - } |
229 | - |
230 | - { |
231 | - GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate"); |
232 | - clonetiler_table_attach (table, l, 0, 6, 2); |
233 | - } |
234 | - |
235 | - { |
236 | - GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate"); |
237 | - clonetiler_table_attach (table, l, 0, 6, 3); |
238 | - } |
239 | - |
240 | - { // Exclude tile width and height in shift |
241 | + clonetiler_table_attach (table, l, 1, 7, 1); |
242 | + } |
243 | + |
244 | + { |
245 | + prepareCheckButton(_check_shift_cumulate_row, "shifty_cumulate"); |
246 | + prepareCheckButton(_check_shift_cumulate_column, "shiftx_cumulate"); |
247 | + clonetiler_table_attach (table, (GtkWidget*)_check_shift_cumulate_row.gobj(), 0.5, 7, 2); |
248 | + clonetiler_table_attach (table, (GtkWidget*)_check_shift_cumulate_column.gobj(), 0.5, 7, 3); |
249 | + } |
250 | + |
251 | + // Exclude |
252 | + { |
253 | GtkWidget *l = gtk_label_new (""); |
254 | - // TRANSLATORS: "Cumulate" is a verb here |
255 | gtk_label_set_markup (GTK_LABEL(l), _("<small>Exclude tile:</small>")); |
256 | gtk_size_group_add_widget(table_row_labels, l); |
257 | - clonetiler_table_attach (table, l, 1, 7, 1); |
258 | - } |
259 | - |
260 | - { |
261 | - GtkWidget *l = clonetiler_checkbox (_("Exclude tile height in shift"), "shifty_excludeh"); |
262 | - clonetiler_table_attach (table, l, 0, 7, 2); |
263 | - } |
264 | - |
265 | - { |
266 | - GtkWidget *l = clonetiler_checkbox (_("Exclude tile width in shift"), "shiftx_excludew"); |
267 | - clonetiler_table_attach (table, l, 0, 7, 3); |
268 | + clonetiler_table_attach (table, l, 1, 8, 1); |
269 | + } |
270 | + |
271 | + { |
272 | + prepareCheckButton(_check_shift_exclude_row, "shifty_excludeh"); |
273 | + prepareCheckButton(_check_shift_exclude_column, "shiftx_excludew"); |
274 | + clonetiler_table_attach (table, (GtkWidget*)_check_shift_exclude_row.gobj(), 0.5, 8, 2); |
275 | + clonetiler_table_attach (table, (GtkWidget*)_check_shift_exclude_column.gobj(), 0.5, 8, 3); |
276 | } |
277 | |
278 | } |
279 | |
280 | - |
281 | - // Scale |
282 | + // Scale page |
283 | { |
284 | GtkWidget *vb = clonetiler_new_tab (nb, _("Sc_ale")); |
285 | |
286 | GtkWidget *table = clonetiler_table_x_y_rand (2); |
287 | gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0); |
288 | + prepareUnitMenu(_units_scale, "scalex_per_j", "px"); |
289 | |
290 | // X |
291 | { |
292 | @@ -339,28 +348,6 @@ |
293 | clonetiler_table_attach (table, l, 1, 2, 1); |
294 | } |
295 | |
296 | - { |
297 | - GtkWidget *l = clonetiler_spinbox ( |
298 | - // xgettext:no-c-format |
299 | - _("Horizontal scale per row (in % of tile width)"), "scalex_per_j", |
300 | - -100, 1000, "%"); |
301 | - clonetiler_table_attach (table, l, 0, 2, 2); |
302 | - } |
303 | - |
304 | - { |
305 | - GtkWidget *l = clonetiler_spinbox ( |
306 | - // xgettext:no-c-format |
307 | - _("Horizontal scale per column (in % of tile width)"), "scalex_per_i", |
308 | - -100, 1000, "%"); |
309 | - clonetiler_table_attach (table, l, 0, 2, 3); |
310 | - } |
311 | - |
312 | - { |
313 | - GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand", |
314 | - 0, 1000, "%"); |
315 | - clonetiler_table_attach (table, l, 0, 2, 4); |
316 | - } |
317 | - |
318 | // Y |
319 | { |
320 | GtkWidget *l = gtk_label_new (""); |
321 | @@ -368,47 +355,45 @@ |
322 | gtk_size_group_add_widget(table_row_labels, l); |
323 | clonetiler_table_attach (table, l, 1, 3, 1); |
324 | } |
325 | - |
326 | - { |
327 | - GtkWidget *l = clonetiler_spinbox ( |
328 | - // xgettext:no-c-format |
329 | - _("Vertical scale per row (in % of tile height)"), "scaley_per_j", |
330 | - -100, 1000, "%"); |
331 | - clonetiler_table_attach (table, l, 0, 3, 2); |
332 | - } |
333 | - |
334 | - { |
335 | - GtkWidget *l = clonetiler_spinbox ( |
336 | - // xgettext:no-c-format |
337 | - _("Vertical scale per column (in % of tile height)"), "scaley_per_i", |
338 | - -100, 1000, "%"); |
339 | - clonetiler_table_attach (table, l, 0, 3, 3); |
340 | - } |
341 | - |
342 | - { |
343 | - GtkWidget *l = clonetiler_spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand", |
344 | - 0, 1000, "%"); |
345 | - clonetiler_table_attach (table, l, 0, 3, 4); |
346 | - } |
347 | - |
348 | + |
349 | + { |
350 | + prepareScalarUnit(_scalar_scale_x_row, "scalex_per_j", 0); |
351 | + prepareScalarUnit(_scalar_scale_x_column, "scalex_per_i", 0); |
352 | + prepareScalarUnit(_scalar_scale_x_randomize, "scalex_rand", 0); |
353 | + prepareScalarUnit(_scalar_scale_y_row, "scaley_per_j", 0); |
354 | + prepareScalarUnit(_scalar_scale_y_column, "scaley_per_i", 0); |
355 | + prepareScalarUnit(_scalar_scale_y_randomize, "scaley_rand", 0); |
356 | + |
357 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_x_row.gobj(), 0, 2, 2); |
358 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_x_column.gobj(), 0, 2, 3); |
359 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_x_randomize.gobj(), 0, 2, 4); |
360 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_y_row.gobj(), 0, 3, 2); |
361 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_y_column.gobj(), 0, 3, 3); |
362 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_y_randomize.gobj(), 0, 3, 4); |
363 | + } |
364 | + |
365 | + // UnitMenu |
366 | + { |
367 | + GtkWidget *l = gtk_label_new(""); |
368 | + gtk_label_set_markup(GTK_LABEL(l), _("<b>Units:</b>")); |
369 | + gtk_size_group_add_widget(table_row_labels, l); |
370 | + clonetiler_table_attach(table, l, 1, 4, 1); |
371 | + clonetiler_table_attach(table, (GtkWidget*)_units_scale.gobj(), 0, 4, 2); |
372 | + } |
373 | + |
374 | // Exponent |
375 | { |
376 | GtkWidget *l = gtk_label_new (""); |
377 | gtk_label_set_markup (GTK_LABEL(l), _("<b>Exponent:</b>")); |
378 | gtk_size_group_add_widget(table_row_labels, l); |
379 | - clonetiler_table_attach (table, l, 1, 4, 1); |
380 | - } |
381 | - |
382 | - { |
383 | - GtkWidget *l = clonetiler_spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp", |
384 | - 0, 10, "", true); |
385 | - clonetiler_table_attach (table, l, 0, 4, 2); |
386 | - } |
387 | - |
388 | - { |
389 | - GtkWidget *l = clonetiler_spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp", |
390 | - 0, 10, "", true); |
391 | - clonetiler_table_attach (table, l, 0, 4, 3); |
392 | + clonetiler_table_attach (table, l, 1, 5, 1); |
393 | + } |
394 | + |
395 | + { |
396 | + prepareScalar(_scalar_scale_exponent_row, "scaley_exp", 1); |
397 | + prepareScalar(_scalar_scale_exponent_column, "scalex_exp", 1); |
398 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_exponent_row.gobj(), 0, 5, 2); |
399 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_exponent_column.gobj(), 0, 5, 3); |
400 | } |
401 | |
402 | // Logarithmic (as in logarithmic spiral) |
403 | @@ -416,19 +401,14 @@ |
404 | GtkWidget *l = gtk_label_new (""); |
405 | gtk_label_set_markup (GTK_LABEL(l), _("<b>Base:</b>")); |
406 | gtk_size_group_add_widget(table_row_labels, l); |
407 | - clonetiler_table_attach (table, l, 1, 5, 1); |
408 | - } |
409 | - |
410 | - { |
411 | - GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log", |
412 | - 0, 10, "", false); |
413 | - clonetiler_table_attach (table, l, 0, 5, 2); |
414 | - } |
415 | - |
416 | - { |
417 | - GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log", |
418 | - 0, 10, "", false); |
419 | - clonetiler_table_attach (table, l, 0, 5, 3); |
420 | + clonetiler_table_attach (table, l, 1, 6, 1); |
421 | + } |
422 | + |
423 | + { |
424 | + prepareScalar(_scalar_scale_base_row, "scaley_log", 0); |
425 | + prepareScalar(_scalar_scale_base_column, "scalex_log", 0); |
426 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_base_row.gobj(), 0, 6, 2); |
427 | + clonetiler_table_attach(table, (GtkWidget*)_scalar_scale_base_column.gobj(), 0, 6, 3); |
428 | } |
429 | |
430 | { // alternates |
431 | @@ -436,17 +416,14 @@ |
432 | // TRANSLATORS: "Alternate" is a verb here |
433 | gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>")); |
434 | gtk_size_group_add_widget(table_row_labels, l); |
435 | - clonetiler_table_attach (table, l, 1, 6, 1); |
436 | - } |
437 | - |
438 | - { |
439 | - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate"); |
440 | - clonetiler_table_attach (table, l, 0, 6, 2); |
441 | - } |
442 | - |
443 | - { |
444 | - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate"); |
445 | - clonetiler_table_attach (table, l, 0, 6, 3); |
446 | + clonetiler_table_attach (table, l, 1, 7, 1); |
447 | + } |
448 | + |
449 | + { |
450 | + prepareCheckButton(_check_scale_alternate_row, "scaley_alternate"); |
451 | + prepareCheckButton(_check_scale_alternate_column, "scalex_alternate"); |
452 | + clonetiler_table_attach(table, (GtkWidget*)_check_scale_alternate_row.gobj(), 0.5, 7, 2); |
453 | + clonetiler_table_attach(table, (GtkWidget*)_check_scale_alternate_column.gobj(), 0.5, 7, 3); |
454 | } |
455 | |
456 | { // Cumulate |
457 | @@ -454,22 +431,17 @@ |
458 | // TRANSLATORS: "Cumulate" is a verb here |
459 | gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>")); |
460 | gtk_size_group_add_widget(table_row_labels, l); |
461 | - clonetiler_table_attach (table, l, 1, 7, 1); |
462 | - } |
463 | - |
464 | - { |
465 | - GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each row"), "scaley_cumulate"); |
466 | - clonetiler_table_attach (table, l, 0, 7, 2); |
467 | - } |
468 | - |
469 | - { |
470 | - GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each column"), "scalex_cumulate"); |
471 | - clonetiler_table_attach (table, l, 0, 7, 3); |
472 | - } |
473 | - |
474 | + clonetiler_table_attach (table, l, 1, 8, 1); |
475 | + } |
476 | + |
477 | + { |
478 | + prepareCheckButton(_check_scale_cumulate_row, "scaley_cumulate"); |
479 | + prepareCheckButton(_check_scale_cumulate_column, "scalex_cumulate"); |
480 | + clonetiler_table_attach(table, (GtkWidget*)_check_scale_cumulate_row.gobj(), 0.5, 8, 2); |
481 | + clonetiler_table_attach(table, (GtkWidget*)_check_scale_cumulate_column.gobj(), 0.5, 8, 3); |
482 | + } |
483 | } |
484 | - |
485 | - |
486 | + |
487 | // Rotation |
488 | { |
489 | GtkWidget *vb = clonetiler_new_tab (nb, _("_Rotation")); |
490 | @@ -1324,6 +1296,68 @@ |
491 | deskTrack.setBase(desktop); |
492 | } |
493 | |
494 | +void CloneTiler::prepareScalarUnit(UI::Widget::ScalarUnit &item, const char* attr, double def) { |
495 | + item.initScalar(-1e5, 1e5); |
496 | + item.setDigits(3); |
497 | + |
498 | + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); |
499 | + double number = prefs->getDouble(prefs_path + attr, def); |
500 | + Glib::ustring unit = prefs->getUnit(prefs_path + attr); |
501 | + |
502 | + item.setValue(number, unit); |
503 | + item.signal_value_changed().connect( |
504 | + sigc::bind(sigc::mem_fun(*this, &CloneTiler::onUnitValueChanged), sigc::ref(item), attr) |
505 | + ); |
506 | +} |
507 | + |
508 | +void CloneTiler::prepareScalar(UI::Widget::Scalar &item, const char* attr, double def) { |
509 | + item.setRange(-1e5, 1e5); |
510 | + item.setDigits(3); |
511 | + item.setIncrements(0.01, 1); |
512 | + |
513 | + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); |
514 | + double number = prefs->getDouble(prefs_path + attr, def); |
515 | + |
516 | + item.setValue(number); |
517 | + item.signal_value_changed().connect( |
518 | + sigc::bind(&CloneTiler::clonetiler_value_changed, |
519 | + (GtkAdjustment*)((Gtk::SpinButton*)item.getWidget())->get_adjustment()->gobj(), |
520 | + (gpointer)attr) |
521 | + ); |
522 | +} |
523 | + |
524 | +void CloneTiler::prepareCheckButton(UI::Widget::CheckButton &item, const char* attr) { |
525 | + |
526 | + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); |
527 | + bool state = prefs->getBool(prefs_path + attr); |
528 | + |
529 | + item.set_active(state); |
530 | + |
531 | + item.signal_toggled().connect( |
532 | + sigc::bind(&CloneTiler::clonetiler_checkbox_toggled, |
533 | + (GtkToggleButton*)item.gobj(), |
534 | + (gpointer*)attr) |
535 | + ); |
536 | +} |
537 | + |
538 | +void CloneTiler::prepareUnitMenu(UI::Widget::UnitMenu &item, const char* attr, Glib::ustring def) { |
539 | + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); |
540 | + Glib::ustring unit = prefs->getUnit(prefs_path + attr); |
541 | + |
542 | + if (unit == "") unit = def; |
543 | + |
544 | + item.setUnitType(UNIT_TYPE_DIMENSIONLESS); |
545 | + item.setUnitType(UNIT_TYPE_LINEAR); |
546 | + item.setUnit(unit); |
547 | +} |
548 | + |
549 | +void CloneTiler::onUnitValueChanged(UI::Widget::ScalarUnit &item, const char* attr) { |
550 | + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); |
551 | + Glib::ustring unit_abbr = item.getUnit()->abbr; |
552 | + double number = item.getValue(unit_abbr); |
553 | + prefs->setDoubleUnit(prefs_path + attr, number, unit_abbr); |
554 | +} |
555 | + |
556 | void CloneTiler::setTargetDesktop(SPDesktop *desktop) |
557 | { |
558 | if (this->desktop != desktop) { |
559 | @@ -2258,14 +2292,97 @@ |
560 | |
561 | clonetiler_remove (NULL, dlg, false); |
562 | |
563 | - double scale_units = Inkscape::Util::Quantity::convert(1, "px", &desktop->getDocument()->getSVGUnit()); |
564 | - |
565 | - double shiftx_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_i", 0, -10000, 10000); |
566 | - double shifty_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_i", 0, -10000, 10000); |
567 | - double shiftx_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_j", 0, -10000, 10000); |
568 | - double shifty_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_j", 0, -10000, 10000); |
569 | - double shiftx_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_rand", 0, 0, 1000); |
570 | - double shifty_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_rand", 0, 0, 1000); |
571 | + bool keepbbox = prefs->getBool(prefs_path + "keepbbox", true); |
572 | + bool dotrace = prefs->getBool(prefs_path + "dotrace"); |
573 | + |
574 | + SPItem *item = dynamic_cast<SPItem *>(obj); |
575 | + if (dotrace) { |
576 | + clonetiler_trace_setup (desktop->getDocument(), 1.0, item); |
577 | + } |
578 | + |
579 | + Geom::Point center; |
580 | + double w = 0; |
581 | + double h = 0; |
582 | + double x0 = 0; |
583 | + double y0 = 0; |
584 | + |
585 | + Util::Unit svg_unit = desktop->getDocument()->getSVGUnit(); |
586 | + double scale_units = Inkscape::Util::Quantity::convert(1, "px", &svg_unit); |
587 | + |
588 | + if (keepbbox && |
589 | + obj_repr->attribute("inkscape:tile-w") && |
590 | + obj_repr->attribute("inkscape:tile-h") && |
591 | + obj_repr->attribute("inkscape:tile-x0") && |
592 | + obj_repr->attribute("inkscape:tile-y0") && |
593 | + obj_repr->attribute("inkscape:tile-cx") && |
594 | + obj_repr->attribute("inkscape:tile-cy")) { |
595 | + |
596 | + double cx = 0; |
597 | + double cy = 0; |
598 | + sp_repr_get_double (obj_repr, "inkscape:tile-cx", &cx); |
599 | + sp_repr_get_double (obj_repr, "inkscape:tile-cy", &cy); |
600 | + center = Geom::Point (cx, cy); |
601 | + |
602 | + sp_repr_get_double (obj_repr, "inkscape:tile-w", &w); |
603 | + sp_repr_get_double (obj_repr, "inkscape:tile-h", &h); |
604 | + sp_repr_get_double (obj_repr, "inkscape:tile-x0", &x0); |
605 | + sp_repr_get_double (obj_repr, "inkscape:tile-y0", &y0); |
606 | + } else { |
607 | + bool prefs_bbox = prefs->getBool("/tools/bounding_box", false); |
608 | + SPItem::BBoxType bbox_type = ( !prefs_bbox ? |
609 | + SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX ); |
610 | + Geom::OptRect r = item->documentBounds(bbox_type); |
611 | + if (r) { |
612 | + w = scale_units*r->dimensions()[Geom::X]; |
613 | + h = scale_units*r->dimensions()[Geom::Y]; |
614 | + x0 = scale_units*r->min()[Geom::X]; |
615 | + y0 = scale_units*r->min()[Geom::Y]; |
616 | + center = scale_units*desktop->dt2doc(item->getCenter()); |
617 | + |
618 | + sp_repr_set_svg_double(obj_repr, "inkscape:tile-cx", center[Geom::X]); |
619 | + sp_repr_set_svg_double(obj_repr, "inkscape:tile-cy", center[Geom::Y]); |
620 | + sp_repr_set_svg_double(obj_repr, "inkscape:tile-w", w); |
621 | + sp_repr_set_svg_double(obj_repr, "inkscape:tile-h", h); |
622 | + sp_repr_set_svg_double(obj_repr, "inkscape:tile-x0", x0); |
623 | + sp_repr_set_svg_double(obj_repr, "inkscape:tile-y0", y0); |
624 | + } else { |
625 | + center = Geom::Point(0, 0); |
626 | + w = h = 0; |
627 | + x0 = y0 = 0; |
628 | + } |
629 | + } |
630 | + |
631 | + /* Now we have w and h in SVG units. */ |
632 | + |
633 | + Glib::ustring svg_unit_abbr = svg_unit.abbr; |
634 | + double prefactor_w = 1.0/w; |
635 | + double prefactor_h = 1.0/h; |
636 | + |
637 | + const Util::Unit *shift_unit = unit_table.getUnit(prefs->getUnit(prefs_path + "shiftx_per_i")); |
638 | + if (!shift_unit->isAbsolute()) { |
639 | + // Deal with dimensionless (percentage) shift. |
640 | + svg_unit_abbr = "%"; |
641 | + prefactor_w = prefactor_h = 0.01; |
642 | + } |
643 | + |
644 | + // double scale_units = Inkscape::Util::Quantity::convert(1, "px", &desktop->getDocument()->getSVGUnit()); |
645 | + |
646 | + // double shiftx_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_i", 0, -10000, 10000); |
647 | + // double shifty_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_i", 0, -10000, 10000); |
648 | + // double shiftx_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_per_j", 0, -10000, 10000); |
649 | + // double shifty_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_per_j", 0, -10000, 10000); |
650 | + // double shiftx_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "shiftx_rand", 0, 0, 1000); |
651 | + // double shifty_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "shifty_rand", 0, 0, 1000); |
652 | + |
653 | + /* Get quantities in px since width and height will be sent in px. */ |
654 | + double shiftx_per_i = prefactor_w * prefs->getDouble(prefs_path + "shiftx_per_i", 0, svg_unit_abbr); |
655 | + double shifty_per_i = prefactor_h * prefs->getDouble(prefs_path + "shifty_per_i", 0, svg_unit_abbr); |
656 | + double shiftx_per_j = prefactor_w * prefs->getDouble(prefs_path + "shiftx_per_j", 0, svg_unit_abbr); |
657 | + double shifty_per_j = prefactor_h * prefs->getDouble(prefs_path + "shifty_per_j", 0, svg_unit_abbr); |
658 | + |
659 | + double shiftx_rand = prefactor_w * prefs->getDouble(prefs_path + "shiftx_rand", 0, svg_unit_abbr); |
660 | + double shifty_rand = prefactor_h * prefs->getDouble(prefs_path + "shifty_rand", 0, svg_unit_abbr); |
661 | + |
662 | double shiftx_exp = prefs->getDoubleLimited(prefs_path + "shiftx_exp", 1, 0, 10); |
663 | double shifty_exp = prefs->getDoubleLimited(prefs_path + "shifty_exp", 1, 0, 10); |
664 | bool shiftx_alternate = prefs->getBool(prefs_path + "shiftx_alternate"); |
665 | @@ -2275,12 +2392,30 @@ |
666 | bool shiftx_excludew = prefs->getBool(prefs_path + "shiftx_excludew"); |
667 | bool shifty_excludeh = prefs->getBool(prefs_path + "shifty_excludeh"); |
668 | |
669 | - double scalex_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_per_i", 0, -100, 1000); |
670 | - double scaley_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_per_i", 0, -100, 1000); |
671 | - double scalex_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_per_j", 0, -100, 1000); |
672 | - double scaley_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_per_j", 0, -100, 1000); |
673 | - double scalex_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_rand", 0, 0, 1000); |
674 | - double scaley_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_rand", 0, 0, 1000); |
675 | + const Util::Unit *scale_unit = unit_table.getUnit(prefs->getUnit(prefs_path + "scalex_per_i")); |
676 | + if (scale_unit->isAbsolute()) { |
677 | + svg_unit_abbr = svg_unit.abbr; |
678 | + prefactor_w = 1.0/w; |
679 | + prefactor_h = 1.0/h; |
680 | + } else { |
681 | + prefactor_w = prefactor_h = 0.01; |
682 | + svg_unit_abbr = "%"; |
683 | + } |
684 | + |
685 | + // double scalex_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_per_i", 0, -100, 1000); |
686 | + // double scaley_per_i = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_per_i", 0, -100, 1000); |
687 | + // double scalex_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_per_j", 0, -100, 1000); |
688 | + // double scaley_per_j = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_per_j", 0, -100, 1000); |
689 | + // double scalex_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "scalex_rand", 0, 0, 1000); |
690 | + // double scaley_rand = 0.01 * prefs->getDoubleLimited(prefs_path + "scaley_rand", 0, 0, 1000); |
691 | + |
692 | + double scalex_per_i = prefactor_w * prefs->getDouble(prefs_path + "scalex_per_i", 0, svg_unit_abbr); |
693 | + double scaley_per_i = prefactor_h * prefs->getDouble(prefs_path + "scaley_per_i", 0, svg_unit_abbr); |
694 | + double scalex_per_j = prefactor_w * prefs->getDouble(prefs_path + "scalex_per_j", 0, svg_unit_abbr); |
695 | + double scaley_per_j = prefactor_h * prefs->getDouble(prefs_path + "scaley_per_j", 0, svg_unit_abbr); |
696 | + double scalex_rand = prefactor_w * prefs->getDouble(prefs_path + "scalex_rand", 0, svg_unit_abbr); |
697 | + double scaley_rand = prefactor_h * prefs->getDouble(prefs_path + "scaley_rand", 0, svg_unit_abbr); |
698 | + |
699 | double scalex_exp = prefs->getDoubleLimited(prefs_path + "scalex_exp", 1, 0, 10); |
700 | double scaley_exp = prefs->getDoubleLimited(prefs_path + "scaley_exp", 1, 0, 10); |
701 | double scalex_log = prefs->getDoubleLimited(prefs_path + "scalex_log", 0, 0, 10); |
702 | @@ -2324,7 +2459,6 @@ |
703 | bool color_alternatei = prefs->getBool(prefs_path + "color_alternatei"); |
704 | |
705 | int type = prefs->getInt(prefs_path + "symmetrygroup", 0); |
706 | - bool keepbbox = prefs->getBool(prefs_path + "keepbbox", true); |
707 | int imax = prefs->getInt(prefs_path + "imax", 2); |
708 | int jmax = prefs->getInt(prefs_path + "jmax", 2); |
709 | |
710 | @@ -2332,7 +2466,6 @@ |
711 | double fillwidth = scale_units*prefs->getDoubleLimited(prefs_path + "fillwidth", 50, 0, 1e6); |
712 | double fillheight = scale_units*prefs->getDoubleLimited(prefs_path + "fillheight", 50, 0, 1e6); |
713 | |
714 | - bool dotrace = prefs->getBool(prefs_path + "dotrace"); |
715 | int pick = prefs->getInt(prefs_path + "pick"); |
716 | bool pick_to_presence = prefs->getBool(prefs_path + "pick_to_presence"); |
717 | bool pick_to_size = prefs->getBool(prefs_path + "pick_to_size"); |
718 | @@ -2342,60 +2475,6 @@ |
719 | bool invert_picked = prefs->getBool(prefs_path + "invert_picked"); |
720 | double gamma_picked = prefs->getDoubleLimited(prefs_path + "gamma_picked", 0, -10, 10); |
721 | |
722 | - SPItem *item = dynamic_cast<SPItem *>(obj); |
723 | - if (dotrace) { |
724 | - clonetiler_trace_setup (desktop->getDocument(), 1.0, item); |
725 | - } |
726 | - |
727 | - Geom::Point center; |
728 | - double w = 0; |
729 | - double h = 0; |
730 | - double x0 = 0; |
731 | - double y0 = 0; |
732 | - |
733 | - if (keepbbox && |
734 | - obj_repr->attribute("inkscape:tile-w") && |
735 | - obj_repr->attribute("inkscape:tile-h") && |
736 | - obj_repr->attribute("inkscape:tile-x0") && |
737 | - obj_repr->attribute("inkscape:tile-y0") && |
738 | - obj_repr->attribute("inkscape:tile-cx") && |
739 | - obj_repr->attribute("inkscape:tile-cy")) { |
740 | - |
741 | - double cx = 0; |
742 | - double cy = 0; |
743 | - sp_repr_get_double (obj_repr, "inkscape:tile-cx", &cx); |
744 | - sp_repr_get_double (obj_repr, "inkscape:tile-cy", &cy); |
745 | - center = Geom::Point (cx, cy); |
746 | - |
747 | - sp_repr_get_double (obj_repr, "inkscape:tile-w", &w); |
748 | - sp_repr_get_double (obj_repr, "inkscape:tile-h", &h); |
749 | - sp_repr_get_double (obj_repr, "inkscape:tile-x0", &x0); |
750 | - sp_repr_get_double (obj_repr, "inkscape:tile-y0", &y0); |
751 | - } else { |
752 | - bool prefs_bbox = prefs->getBool("/tools/bounding_box", false); |
753 | - SPItem::BBoxType bbox_type = ( !prefs_bbox ? |
754 | - SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX ); |
755 | - Geom::OptRect r = item->documentBounds(bbox_type); |
756 | - if (r) { |
757 | - w = scale_units*r->dimensions()[Geom::X]; |
758 | - h = scale_units*r->dimensions()[Geom::Y]; |
759 | - x0 = scale_units*r->min()[Geom::X]; |
760 | - y0 = scale_units*r->min()[Geom::Y]; |
761 | - center = scale_units*desktop->dt2doc(item->getCenter()); |
762 | - |
763 | - sp_repr_set_svg_double(obj_repr, "inkscape:tile-cx", center[Geom::X]); |
764 | - sp_repr_set_svg_double(obj_repr, "inkscape:tile-cy", center[Geom::Y]); |
765 | - sp_repr_set_svg_double(obj_repr, "inkscape:tile-w", w); |
766 | - sp_repr_set_svg_double(obj_repr, "inkscape:tile-h", h); |
767 | - sp_repr_set_svg_double(obj_repr, "inkscape:tile-x0", x0); |
768 | - sp_repr_set_svg_double(obj_repr, "inkscape:tile-y0", y0); |
769 | - } else { |
770 | - center = Geom::Point(0, 0); |
771 | - w = h = 0; |
772 | - x0 = y0 = 0; |
773 | - } |
774 | - } |
775 | - |
776 | Geom::Point cur(0, 0); |
777 | Geom::Rect bbox_original (Geom::Point (x0, y0), Geom::Point (x0 + w, y0 + h)); |
778 | double perimeter_original = (w + h)/4; |
779 | |
780 | === modified file 'src/ui/dialog/clonetiler.h' |
781 | --- src/ui/dialog/clonetiler.h 2015-10-30 16:45:39 +0000 |
782 | +++ src/ui/dialog/clonetiler.h 2015-11-21 20:12:56 +0000 |
783 | @@ -15,6 +15,8 @@ |
784 | #include "ui/dialog/desktop-tracker.h" |
785 | #include "ui/widget/color-picker.h" |
786 | #include "sp-root.h" |
787 | +#include "ui/widget/scalar-unit.h" |
788 | +#include "ui/widget/button.h" |
789 | |
790 | namespace Inkscape { |
791 | namespace UI { |
792 | @@ -108,6 +110,56 @@ |
793 | ); |
794 | |
795 | |
796 | + // Shift page |
797 | + UI::Widget::UnitMenu _units_shift; |
798 | + |
799 | + UI::Widget::ScalarUnit _scalar_shift_x_row; |
800 | + UI::Widget::ScalarUnit _scalar_shift_x_column; |
801 | + UI::Widget::ScalarUnit _scalar_shift_x_randomize; |
802 | + |
803 | + UI::Widget::ScalarUnit _scalar_shift_y_row; |
804 | + UI::Widget::ScalarUnit _scalar_shift_y_column; |
805 | + UI::Widget::ScalarUnit _scalar_shift_y_randomize; |
806 | + |
807 | + UI::Widget::Scalar _scalar_shift_exponent_row; |
808 | + UI::Widget::Scalar _scalar_shift_exponent_column; |
809 | + |
810 | + UI::Widget::CheckButton _check_shift_alternate_row; |
811 | + UI::Widget::CheckButton _check_shift_alternate_column; |
812 | + UI::Widget::CheckButton _check_shift_cumulate_row; |
813 | + UI::Widget::CheckButton _check_shift_cumulate_column; |
814 | + UI::Widget::CheckButton _check_shift_exclude_row; |
815 | + UI::Widget::CheckButton _check_shift_exclude_column; |
816 | + |
817 | + // Scale page |
818 | + UI::Widget::UnitMenu _units_scale; |
819 | + |
820 | + UI::Widget::ScalarUnit _scalar_scale_x_row; |
821 | + UI::Widget::ScalarUnit _scalar_scale_x_column; |
822 | + UI::Widget::ScalarUnit _scalar_scale_x_randomize; |
823 | + |
824 | + UI::Widget::ScalarUnit _scalar_scale_y_row; |
825 | + UI::Widget::ScalarUnit _scalar_scale_y_column; |
826 | + UI::Widget::ScalarUnit _scalar_scale_y_randomize; |
827 | + |
828 | + UI::Widget::Scalar _scalar_scale_exponent_row; |
829 | + UI::Widget::Scalar _scalar_scale_exponent_column; |
830 | + UI::Widget::Scalar _scalar_scale_base_row; |
831 | + UI::Widget::Scalar _scalar_scale_base_column; |
832 | + |
833 | + UI::Widget::CheckButton _check_scale_alternate_row; |
834 | + UI::Widget::CheckButton _check_scale_alternate_column; |
835 | + UI::Widget::CheckButton _check_scale_cumulate_row; |
836 | + UI::Widget::CheckButton _check_scale_cumulate_column; |
837 | + |
838 | + void prepareScalarUnit(UI::Widget::ScalarUnit &item, const char* attr, double def); |
839 | + void prepareScalar(UI::Widget::Scalar &item, const char* attr, double def); |
840 | + void prepareCheckButton(UI::Widget::CheckButton &item, const char* attr); |
841 | + void prepareUnitMenu(UI::Widget::UnitMenu &item, const char* attr, Glib::ustring def); |
842 | + |
843 | + // Signal handlers |
844 | + void onUnitValueChanged(UI::Widget::ScalarUnit& item, const char* attr); |
845 | + |
846 | private: |
847 | CloneTiler(CloneTiler const &d); |
848 | CloneTiler& operator=(CloneTiler const &d); |
849 | |
850 | === modified file 'src/ui/widget/labelled.cpp' |
851 | --- src/ui/widget/labelled.cpp 2014-03-27 01:33:44 +0000 |
852 | +++ src/ui/widget/labelled.cpp 2015-11-21 20:12:56 +0000 |
853 | @@ -36,7 +36,10 @@ |
854 | _icon = sp_icon_get_icon(icon.c_str(), Inkscape::ICON_SIZE_LARGE_TOOLBAR); |
855 | pack_start(*Gtk::manage(_icon), Gtk::PACK_SHRINK); |
856 | } |
857 | - pack_start(*Gtk::manage(_label), Gtk::PACK_EXPAND_WIDGET, 6); |
858 | + if (label != "") { |
859 | + // The label takes up some space otherwise. |
860 | + pack_start(*Gtk::manage(_label), Gtk::PACK_EXPAND_WIDGET, 6); |
861 | + } |
862 | pack_start(*Gtk::manage(_widget), Gtk::PACK_SHRINK, 6); |
863 | if (mnemonic) { |
864 | _label->set_mnemonic_widget(*_widget); |
Hi,
there are a lot of conflicts with current trunk since jabier's work, could you update to trunk and fix these ?
Also, can you roughly explain what you changed in the code (a high-level explanation) ?
Thanks.
Mc