diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-04-07 23:42:04 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-04-07 23:42:04 +0000 |
| commit | 945ce419c806c73d70203dec33ececafbe108a92 (patch) | |
| tree | cfcdb59bf47e9db7f9e01f7eebb59924bdeaea94 /src/dialogs | |
| parent | Merge from trunk (again) (diff) | |
| parent | Extensions. SVG+media fix (see Bug #400356). (diff) | |
| download | inkscape-945ce419c806c73d70203dec33ececafbe108a92.tar.gz inkscape-945ce419c806c73d70203dec33ececafbe108a92.zip | |
Merge from trunk
(bzr r9508.1.73)
Diffstat (limited to 'src/dialogs')
| -rw-r--r-- | src/dialogs/clonetiler.cpp | 234 | ||||
| -rw-r--r-- | src/dialogs/export.cpp | 6 | ||||
| -rw-r--r-- | src/dialogs/find.cpp | 64 | ||||
| -rw-r--r-- | src/dialogs/item-properties.cpp | 2 | ||||
| -rw-r--r-- | src/dialogs/object-attributes.cpp | 3 | ||||
| -rw-r--r-- | src/dialogs/spellcheck.cpp | 2 | ||||
| -rw-r--r-- | src/dialogs/text-edit.cpp | 12 | ||||
| -rw-r--r-- | src/dialogs/xml-tree.cpp | 15 |
8 files changed, 187 insertions, 151 deletions
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 6e03f87e3..81204f27b 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -197,7 +197,7 @@ enum { }; -static Geom::Matrix +static Geom::Affine clonetiler_get_transform ( // symmetry group @@ -288,7 +288,7 @@ clonetiler_get_transform ( if ( shifty_exp != 1.0 ) shiftj = pow( shiftj, shifty_exp ); // Final shift - Geom::Matrix rect_translate (Geom::Translate (w * shifti, h * shiftj)); + Geom::Affine rect_translate (Geom::Translate (w * shifti, h * shiftj)); // Rotation (in degrees) ------------ double delta_rotationi = 0.0; @@ -371,25 +371,25 @@ clonetiler_get_transform ( // Calculate transformation matrices, translating back to "center of tile" (rotation center) before transforming - Geom::Matrix drot_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI*dr/180) * Geom::Translate(cx, cy); + Geom::Affine drot_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI*dr/180) * Geom::Translate(cx, cy); - Geom::Matrix dscale_c = Geom::Translate(-cx, -cy) * Geom::Scale (scalex, scaley) * Geom::Translate(cx, cy); + Geom::Affine dscale_c = Geom::Translate(-cx, -cy) * Geom::Scale (scalex, scaley) * Geom::Translate(cx, cy); - Geom::Matrix d_s_r = dscale_c * drot_c; + Geom::Affine d_s_r = dscale_c * drot_c; - Geom::Matrix rotate_180_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI) * Geom::Translate(cx, cy); + Geom::Affine rotate_180_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI) * Geom::Translate(cx, cy); - Geom::Matrix rotate_90_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/2) * Geom::Translate(cx, cy); - Geom::Matrix rotate_m90_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/2) * Geom::Translate(cx, cy); + Geom::Affine rotate_90_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/2) * Geom::Translate(cx, cy); + Geom::Affine rotate_m90_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/2) * Geom::Translate(cx, cy); - Geom::Matrix rotate_120_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-2*M_PI/3) * Geom::Translate(cx, cy); - Geom::Matrix rotate_m120_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( 2*M_PI/3) * Geom::Translate(cx, cy); + Geom::Affine rotate_120_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-2*M_PI/3) * Geom::Translate(cx, cy); + Geom::Affine rotate_m120_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( 2*M_PI/3) * Geom::Translate(cx, cy); - Geom::Matrix rotate_60_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/3) * Geom::Translate(cx, cy); - Geom::Matrix rotate_m60_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/3) * Geom::Translate(cx, cy); + Geom::Affine rotate_60_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/3) * Geom::Translate(cx, cy); + Geom::Affine rotate_m60_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/3) * Geom::Translate(cx, cy); - Geom::Matrix flip_x = Geom::Translate(-cx, -cy) * Geom::Scale (-1, 1) * Geom::Translate(cx, cy); - Geom::Matrix flip_y = Geom::Translate(-cx, -cy) * Geom::Scale (1, -1) * Geom::Translate(cx, cy); + Geom::Affine flip_x = Geom::Translate(-cx, -cy) * Geom::Scale (-1, 1) * Geom::Translate(cx, cy); + Geom::Affine flip_y = Geom::Translate(-cx, -cy) * Geom::Scale (1, -1) * Geom::Translate(cx, cy); // Create tile with required symmetry @@ -514,9 +514,9 @@ clonetiler_get_transform ( case TILE_P4: { - Geom::Matrix ori (Geom::Translate ((w + h) * pow((i/2), shiftx_exp) + dx, (h + w) * pow((j/2), shifty_exp) + dy)); - Geom::Matrix dia1 (Geom::Translate (w/2 + h/2, -h/2 + w/2)); - Geom::Matrix dia2 (Geom::Translate (-w/2 + h/2, h/2 + w/2)); + Geom::Affine ori (Geom::Translate ((w + h) * pow((i/2), shiftx_exp) + dx, (h + w) * pow((j/2), shifty_exp) + dy)); + Geom::Affine dia1 (Geom::Translate (w/2 + h/2, -h/2 + w/2)); + Geom::Affine dia2 (Geom::Translate (-w/2 + h/2, h/2 + w/2)); if (j % 2 == 0) { if (i % 2 == 0) { return d_s_r * ori; @@ -536,9 +536,9 @@ clonetiler_get_transform ( case TILE_P4M: { double max = MAX(w, h); - Geom::Matrix ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow((j/2), shifty_exp) + dy)); - Geom::Matrix dia1 (Geom::Translate ( w/2 - h/2, h/2 - w/2)); - Geom::Matrix dia2 (Geom::Translate (-h/2 + w/2, w/2 - h/2)); + Geom::Affine ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow((j/2), shifty_exp) + dy)); + Geom::Affine dia1 (Geom::Translate ( w/2 - h/2, h/2 - w/2)); + Geom::Affine dia2 (Geom::Translate (-h/2 + w/2, w/2 - h/2)); if (j % 2 == 0) { if (i % 4 == 0) { return d_s_r * ori; @@ -566,9 +566,9 @@ clonetiler_get_transform ( case TILE_P4G: { double max = MAX(w, h); - Geom::Matrix ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow(j, shifty_exp) + dy)); - Geom::Matrix dia1 (Geom::Translate ( w/2 + h/2, h/2 - w/2)); - Geom::Matrix dia2 (Geom::Translate (-h/2 + w/2, w/2 + h/2)); + Geom::Affine ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow(j, shifty_exp) + dy)); + Geom::Affine dia1 (Geom::Translate ( w/2 + h/2, h/2 - w/2)); + Geom::Affine dia2 (Geom::Translate (-h/2 + w/2, w/2 + h/2)); if (((i/4) + j) % 2 == 0) { if (i % 4 == 0) { return d_s_r * ori; @@ -597,20 +597,20 @@ clonetiler_get_transform ( { double width; double height; - Geom::Matrix dia1; - Geom::Matrix dia2; + Geom::Affine dia1; + Geom::Affine dia2; if (w > h) { width = w + w * cos60; height = 2 * w * sin60; - dia1 = Geom::Matrix (Geom::Translate (w/2 + w/2 * cos60, -(w/2 * sin60))); - dia2 = dia1 * Geom::Matrix (Geom::Translate (0, 2 * (w/2 * sin60))); + dia1 = Geom::Affine (Geom::Translate (w/2 + w/2 * cos60, -(w/2 * sin60))); + dia2 = dia1 * Geom::Affine (Geom::Translate (0, 2 * (w/2 * sin60))); } else { width = h * cos (M_PI/6); height = h; - dia1 = Geom::Matrix (Geom::Translate (h/2 * cos30, -(h/2 * sin30))); - dia2 = dia1 * Geom::Matrix (Geom::Translate (0, h/2)); + dia1 = Geom::Affine (Geom::Translate (h/2 * cos30, -(h/2 * sin30))); + dia2 = dia1 * Geom::Affine (Geom::Translate (0, h/2)); } - Geom::Matrix ori (Geom::Translate (width * pow((2*(i/3) + j%2), shiftx_exp) + dx, (height/2) * pow(j, shifty_exp) + dy)); + Geom::Affine ori (Geom::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 (i % 3 == 1) { @@ -623,23 +623,23 @@ clonetiler_get_transform ( case TILE_P31M: { - Geom::Matrix ori; - Geom::Matrix dia1; - Geom::Matrix dia2; - Geom::Matrix dia3; - Geom::Matrix dia4; + Geom::Affine ori; + Geom::Affine dia1; + Geom::Affine dia2; + Geom::Affine dia3; + Geom::Affine dia4; if (w > h) { - ori = Geom::Matrix(Geom::Translate (w * pow((i/6) + 0.5*(j%2), shiftx_exp) + dx, (w * cos30) * pow(j, shifty_exp) + dy)); - dia1 = Geom::Matrix (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) ); - dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30))); - dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30)); + ori = Geom::Affine(Geom::Translate (w * pow((i/6) + 0.5*(j%2), shiftx_exp) + dx, (w * cos30) * pow(j, shifty_exp) + dy)); + dia1 = Geom::Affine (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) ); + dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30)); + dia3 = dia2 * Geom::Affine (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30))); + dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30)); } else { - ori = Geom::Matrix (Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (2*h - h * sin30) * pow(j, shifty_exp) + dy)); - dia1 = Geom::Matrix (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30)); - dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (0, h/2)); - dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30)); + ori = Geom::Affine (Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (2*h - h * sin30) * pow(j, shifty_exp) + dy)); + dia1 = Geom::Affine (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30)); + dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30)); + dia3 = dia2 * Geom::Affine (Geom::Translate (0, h/2)); + dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30)); } if (i % 6 == 0) { return d_s_r * ori; @@ -661,26 +661,26 @@ clonetiler_get_transform ( { double width; double height; - Geom::Matrix dia1; - Geom::Matrix dia2; - Geom::Matrix dia3; - Geom::Matrix dia4; + Geom::Affine dia1; + Geom::Affine dia2; + Geom::Affine dia3; + Geom::Affine dia4; if (w > h) { width = w + w * cos60; height = 2 * w * sin60; - dia1 = Geom::Matrix (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) ); - dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30))); - dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30)); + dia1 = Geom::Affine (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) ); + dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30)); + dia3 = dia2 * Geom::Affine (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30))); + dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30)); } else { width = 2 * h * cos (M_PI/6); height = 2 * h; - dia1 = Geom::Matrix (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30)); - dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (0, h/2)); - dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30)); + dia1 = Geom::Affine (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30)); + dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30)); + dia3 = dia2 * Geom::Affine (Geom::Translate (0, h/2)); + dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30)); } - Geom::Matrix ori (Geom::Translate (width * pow((2*(i/6) + j%2), shiftx_exp) + dx, (height/2) * pow(j, shifty_exp) + dy)); + Geom::Affine ori (Geom::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 (i % 6 == 1) { @@ -699,24 +699,24 @@ clonetiler_get_transform ( case TILE_P6: { - Geom::Matrix ori; - Geom::Matrix dia1; - Geom::Matrix dia2; - Geom::Matrix dia3; - Geom::Matrix dia4; - Geom::Matrix dia5; + Geom::Affine ori; + Geom::Affine dia1; + Geom::Affine dia2; + Geom::Affine dia3; + Geom::Affine dia4; + Geom::Affine dia5; if (w > h) { - ori = Geom::Matrix(Geom::Translate (w * pow((2*(i/6) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy)); - dia1 = Geom::Matrix (Geom::Translate (w/2 * cos60, -w/2 * sin60)); - dia2 = dia1 * Geom::Matrix (Geom::Translate (w/2, 0)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (w/2 * cos60, w/2 * sin60)); - dia4 = dia3 * Geom::Matrix (Geom::Translate (-w/2 * cos60, w/2 * sin60)); - dia5 = dia4 * Geom::Matrix (Geom::Translate (-w/2, 0)); + ori = Geom::Affine(Geom::Translate (w * pow((2*(i/6) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy)); + dia1 = Geom::Affine (Geom::Translate (w/2 * cos60, -w/2 * sin60)); + dia2 = dia1 * Geom::Affine (Geom::Translate (w/2, 0)); + dia3 = dia2 * Geom::Affine (Geom::Translate (w/2 * cos60, w/2 * sin60)); + dia4 = dia3 * Geom::Affine (Geom::Translate (-w/2 * cos60, w/2 * sin60)); + dia5 = dia4 * Geom::Affine (Geom::Translate (-w/2, 0)); } else { - ori = Geom::Matrix(Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (h + h * sin30) * pow(j, shifty_exp) + dy)); - dia1 = Geom::Matrix (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60)); - dia2 = dia1 * Geom::Matrix (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2)); + ori = Geom::Affine(Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (h + h * sin30) * pow(j, shifty_exp) + dy)); + dia1 = Geom::Affine (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60)); + dia2 = dia1 * Geom::Affine (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60)); + dia3 = dia2 * Geom::Affine (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2)); dia4 = dia3 * dia1.inverse(); dia5 = dia3 * dia2.inverse(); } @@ -739,28 +739,28 @@ clonetiler_get_transform ( case TILE_P6M: { - Geom::Matrix ori; - Geom::Matrix dia1, dia2, dia3, dia4, dia5, dia6, dia7, dia8, dia9, dia10; + Geom::Affine ori; + Geom::Affine dia1, dia2, dia3, dia4, dia5, dia6, dia7, dia8, dia9, dia10; if (w > h) { - ori = Geom::Matrix(Geom::Translate (w * pow((2*(i/12) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy)); - dia1 = Geom::Matrix (Geom::Translate (w/2, h/2) * Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, h/2 * sin30)); - dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, -h * sin30)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (-h/2 * cos30, h/2 * sin30) * Geom::Translate (w * cos60, 0) * Geom::Translate (-h/2 * cos30, -h/2 * sin30)); - dia4 = dia3 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30)); - dia5 = dia4 * Geom::Matrix (Geom::Translate (-h/2 * cos30, -h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60) * Geom::Translate (w/2, -h/2)); - dia6 = dia5 * Geom::Matrix (Geom::Translate (0, h)); + ori = Geom::Affine(Geom::Translate (w * pow((2*(i/12) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy)); + dia1 = Geom::Affine (Geom::Translate (w/2, h/2) * Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, h/2 * sin30)); + dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, -h * sin30)); + dia3 = dia2 * Geom::Affine (Geom::Translate (-h/2 * cos30, h/2 * sin30) * Geom::Translate (w * cos60, 0) * Geom::Translate (-h/2 * cos30, -h/2 * sin30)); + dia4 = dia3 * Geom::Affine (Geom::Translate (h * cos30, h * sin30)); + dia5 = dia4 * Geom::Affine (Geom::Translate (-h/2 * cos30, -h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60) * Geom::Translate (w/2, -h/2)); + dia6 = dia5 * Geom::Affine (Geom::Translate (0, h)); dia7 = dia6 * dia1.inverse(); dia8 = dia6 * dia2.inverse(); dia9 = dia6 * dia3.inverse(); dia10 = dia6 * dia4.inverse(); } else { - ori = Geom::Matrix(Geom::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 = Geom::Matrix (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60)); - dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, -h * sin30)); - dia3 = dia2 * Geom::Matrix (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h * cos30, 0) * Geom::Translate (-w/2 * cos60, w/2 * sin60)); - dia4 = dia3 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30)); - dia5 = dia4 * Geom::Matrix (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2)); - dia6 = dia5 * Geom::Matrix (Geom::Translate (0, h)); + ori = Geom::Affine(Geom::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 = Geom::Affine (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60)); + dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, -h * sin30)); + dia3 = dia2 * Geom::Affine (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h * cos30, 0) * Geom::Translate (-w/2 * cos60, w/2 * sin60)); + dia4 = dia3 * Geom::Affine (Geom::Translate (h * cos30, h * sin30)); + dia5 = dia4 * Geom::Affine (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2)); + dia6 = dia5 * Geom::Affine (Geom::Translate (0, h)); dia7 = dia6 * dia1.inverse(); dia8 = dia6 * dia2.inverse(); dia9 = dia6 * dia3.inverse(); @@ -804,27 +804,29 @@ clonetiler_get_transform ( static bool clonetiler_is_a_clone_of (SPObject *tile, SPObject *obj) { + bool result = false; char *id_href = NULL; if (obj) { - Inkscape::XML::Node *obj_repr = SP_OBJECT_REPR(obj); + Inkscape::XML::Node *obj_repr = obj->getRepr(); id_href = g_strdup_printf("#%s", obj_repr->attribute("id")); } if (SP_IS_USE(tile) && - SP_OBJECT_REPR(tile)->attribute("xlink:href") && - (!id_href || !strcmp(id_href, SP_OBJECT_REPR(tile)->attribute("xlink:href"))) && - SP_OBJECT_REPR(tile)->attribute("inkscape:tiled-clone-of") && - (!id_href || !strcmp(id_href, SP_OBJECT_REPR(tile)->attribute("inkscape:tiled-clone-of")))) + tile->getRepr()->attribute("xlink:href") && + (!id_href || !strcmp(id_href, tile->getRepr()->attribute("xlink:href"))) && + tile->getRepr()->attribute("inkscape:tiled-clone-of") && + (!id_href || !strcmp(id_href, tile->getRepr()->attribute("inkscape:tiled-clone-of")))) { - if (id_href) - g_free (id_href); - return true; + result = true; } else { - if (id_href) - g_free (id_href); - return false; + result = false; } + if (id_href) { + g_free(id_href); + id_href = 0; + } + return result; } static NRArena const *trace_arena = NULL; @@ -857,7 +859,7 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) // hide the (current) original and any tiled clones, we only want to pick the background original->invoke_hide(trace_visionkey); - clonetiler_trace_hide_tiled_clones_recursively(SP_OBJECT(trace_doc->getRoot())); + clonetiler_trace_hide_tiled_clones_recursively(trace_doc->getRoot()); trace_doc->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); trace_doc->ensureUpToDate(); @@ -871,7 +873,7 @@ clonetiler_trace_pick (Geom::Rect box) if (!trace_arena) return 0; - Geom::Matrix t(Geom::Scale(trace_zoom, trace_zoom)); + Geom::Affine t(Geom::Scale(trace_zoom, trace_zoom)); nr_arena_item_set_transform(trace_root, &t); NRGC gc(NULL); gc.transform.setIdentity(); @@ -931,8 +933,8 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) return; } - SPObject *obj = SP_OBJECT(selection->singleItem()); - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *obj = selection->singleItem(); + SPObject *parent = obj->parent; GSList *to_unclump = NULL; // not including the original @@ -955,7 +957,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) static guint clonetiler_number_of_clones (SPObject *obj) { - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *parent = obj->parent; guint n = 0; @@ -983,8 +985,8 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) return; } - SPObject *obj = SP_OBJECT(selection->singleItem()); - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *obj = selection->singleItem(); + SPObject *parent = obj->parent; // remove old tiling GSList *to_delete = NULL; @@ -1007,7 +1009,7 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) } static Geom::Rect -transform_rect( Geom::Rect const &r, Geom::Matrix const &m) +transform_rect( Geom::Rect const &r, Geom::Affine const &m) { using Geom::X; using Geom::Y; @@ -1068,10 +1070,10 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) gtk_widget_queue_draw(GTK_WIDGET(status)); gdk_window_process_all_updates(); - SPObject *obj = SP_OBJECT(selection->singleItem()); - Inkscape::XML::Node *obj_repr = SP_OBJECT_REPR(obj); + SPObject *obj = selection->singleItem(); + Inkscape::XML::Node *obj_repr = obj->getRepr(); const char *id_href = g_strdup_printf("#%s", obj_repr->attribute("id")); - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *parent = obj->parent; clonetiler_remove (NULL, NULL, false); @@ -1229,7 +1231,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) // 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 - Geom::Matrix t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h, + Geom::Affine t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h, shiftx_per_i, shifty_per_i, shiftx_per_j, shifty_per_j, shiftx_rand, shifty_rand, @@ -1428,7 +1430,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) } // add the new clone to the top of the original's parent - SP_OBJECT_REPR(parent)->appendChild(clone); + parent->getRepr()->appendChild(clone); if (blur > 0.0) { SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone); @@ -1441,7 +1443,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) // 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, t.descrim(), t.expansionX(), t.expansionY(), perimeter, perimeter); - sp_style_set_property_url (clone_object, "filter", SP_OBJECT(constructed), false); + sp_style_set_property_url (clone_object, "filter", constructed, false); } if (center_set) { @@ -2336,7 +2338,7 @@ clonetiler_dialog (void) // Dissolve { GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL(l), _("<b>Fade out:</b>")); + gtk_label_set_markup (GTK_LABEL(l), _("<b>Opacity:</b>")); gtk_size_group_add_widget(table_row_labels, l); clonetiler_table_attach (table, l, 1, 4, 1); } diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 7e99c2496..b05f6589a 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -620,7 +620,7 @@ sp_export_dialog (void) { Gtk::HBox* batch_box = new Gtk::HBox(FALSE, 5); - GtkWidget *be = gtk_check_button_new_with_label(_("Batch export all selected objects")); + GtkWidget *be = gtk_check_button_new_with_mnemonic(_("B_atch export all selected objects")); gtk_widget_set_sensitive(GTK_WIDGET(be), TRUE); gtk_object_set_data(GTK_OBJECT(dlg), "batch_checkbox", be); batch_box->pack_start(*Glib::wrap(be), false, false); @@ -632,7 +632,7 @@ sp_export_dialog (void) { Gtk::HBox* hide_box = new Gtk::HBox(FALSE, 5); - GtkWidget *he = gtk_check_button_new_with_label(_("Hide all except selected")); + GtkWidget *he = gtk_check_button_new_with_mnemonic(_("Hide a_ll except selected")); gtk_widget_set_sensitive(GTK_WIDGET(he), TRUE); gtk_object_set_data(GTK_OBJECT(dlg), "hide_checkbox", he); hide_box->pack_start(*Glib::wrap(he), false, false); @@ -683,7 +683,7 @@ sp_export_update_checkbuttons (GtkObject *base) GtkWidget *he = (GtkWidget *)gtk_object_get_data(base, "hide_checkbox"); if (num >= 2) { gtk_widget_set_sensitive (be, true); - gtk_button_set_label (GTK_BUTTON(be), g_strdup_printf (ngettext("Batch export %d selected object","Batch export %d selected objects",num), num)); + gtk_button_set_label (GTK_BUTTON(be), g_strdup_printf (ngettext("B_atch export %d selected object","B_atch export %d selected objects",num), num)); } else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(be), FALSE); gtk_widget_set_sensitive (be, FALSE); diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index fe264892a..c112b3531 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -110,15 +110,18 @@ sp_find_squeeze_window() bool item_id_match (SPItem *item, const gchar *id, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) + if (item->getRepr() == NULL) { return false; + } - if (SP_IS_STRING(item)) // SPStrings have "on demand" ids which are useless for searching + if (SP_IS_STRING(item)) { // SPStrings have "on demand" ids which are useless for searching return false; + } - const gchar *item_id = (SP_OBJECT_REPR (item))->attribute("id"); - if (item_id == NULL) + const gchar *item_id = item->getRepr()->attribute("id"); + if (item_id == NULL) { return false; + } if (exact) { return ((bool) !strcmp(item_id, id)); @@ -131,8 +134,9 @@ item_id_match (SPItem *item, const gchar *id, bool exact) bool item_text_match (SPItem *item, const gchar *text, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) + if (item->getRepr() == NULL) { return false; + } if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { const gchar *item_text = sp_te_get_string_multiline (item); @@ -154,12 +158,14 @@ item_text_match (SPItem *item, const gchar *text, bool exact) bool item_style_match (SPItem *item, const gchar *text, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) + if (item->getRepr() == NULL) { return false; + } - const gchar *item_text = (SP_OBJECT_REPR (item))->attribute("style"); - if (item_text == NULL) + const gchar *item_text = item->getRepr()->attribute("style"); + if (item_text == NULL) { return false; + } if (exact) { return ((bool) !strcmp(item_text, text)); @@ -168,18 +174,18 @@ item_style_match (SPItem *item, const gchar *text, bool exact) } } -bool -item_attr_match (SPItem *item, const gchar *name, bool exact) +bool item_attr_match(SPItem *item, const gchar *name, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) - return false; - - if (exact) { - const gchar *attr_value = (SP_OBJECT_REPR (item))->attribute(name); - return ((bool) (attr_value != NULL)); - } else { - return SP_OBJECT_REPR (item)->matchAttributeName(name); + bool result = false; + if (item->getRepr()) { + if (exact) { + const gchar *attr_value = item->getRepr()->attribute(name); + result = (attr_value != NULL); + } else { + result = item->getRepr()->matchAttributeName(name); + } } + return result; } @@ -288,17 +294,20 @@ all_items (SPObject *r, GSList *l, bool hidden, bool locked) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (SP_IS_DEFS(r)) + if (SP_IS_DEFS(r)) { return l; // we're not interested in items in defs + } - if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata")) + if (!strcmp(r->getRepr()->name(), "svg:metadata")) { return l; // we're not interested in metadata + } for (SPObject *child = r->firstChild(); child; child = child->next) { - if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !desktop->isLayer(SP_ITEM(child))) { - if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { - l = g_slist_prepend (l, child); - } + if ( SP_IS_ITEM(child) && !child->cloned && !desktop->isLayer(child) ) { + SPItem *item = SP_ITEM(child); + if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { + l = g_slist_prepend (l, child); + } } l = all_items (child, l, hidden, locked); } @@ -311,9 +320,10 @@ all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool SPDesktop *desktop = SP_ACTIVE_DESKTOP; for (GSList *i = (GSList *) s->itemList(); i != NULL; i = i->next) { - if (SP_IS_ITEM (i->data) && !SP_OBJECT_IS_CLONED (i->data) && !desktop->isLayer(SP_ITEM(i->data))) { - if (!ancestor || ancestor->isAncestorOf(SP_OBJECT (i->data))) { - if ((hidden || !desktop->itemIsHidden(SP_ITEM(i->data))) && (locked || !SP_ITEM(i->data)->isLocked())) { + if ( SP_IS_ITEM(i->data) && !reinterpret_cast<SPObject*>(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) { + SPItem * item = SP_ITEM(i->data); + if (!ancestor || ancestor->isAncestorOf(item)) { + if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { l = g_slist_prepend (l, i->data); } } diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index 8b5ac1784..94b8b1e98 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -310,7 +310,7 @@ sp_item_widget_setup ( SPWidget *spw, Inkscape::Selection *selection ) w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "hidden")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), item->isExplicitlyHidden()); - if (SP_OBJECT_IS_CLONED (item)) { + if (item->cloned) { /* ID */ w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id")); diff --git a/src/dialogs/object-attributes.cpp b/src/dialogs/object-attributes.cpp index d9a0545e1..57b295e4e 100644 --- a/src/dialogs/object-attributes.cpp +++ b/src/dialogs/object-attributes.cpp @@ -13,6 +13,7 @@ #include <glibmm/i18n.h> #include <string> #include <cstring> +#include <stddef.h> #include <sigc++/connection.h> #include <sigc++/functors/ptr_fun.h> #include <sigc++/adaptors/bind.h> @@ -141,7 +142,7 @@ sp_object_attributes_dialog (SPObject *object, const gchar *tag) if (!strcmp (tag, "Link")) { sp_object_attr_show_dialog (object, anchor_desc, tag); } else if (!strcmp (tag, "Image")) { - Inkscape::XML::Node *ir = SP_OBJECT_REPR(object); + Inkscape::XML::Node *ir = object->getRepr(); const gchar *href = ir->attribute("xlink:href"); if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { sp_object_attr_show_dialog (object, image_nohref_desc, tag); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 4712d9926..f72612420 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -210,7 +210,7 @@ all_text_items (SPObject *r, GSList *l, bool hidden, bool locked) } for (SPObject *child = r->firstChild(); child; child = child->next) { - if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !_desktop->isLayer(SP_ITEM(child))) { + if (SP_IS_ITEM (child) && !child->cloned && !_desktop->isLayer(SP_ITEM(child))) { if ((hidden || !_desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { if (SP_IS_TEXT(child) || SP_IS_FLOWTEXT(child)) l = g_slist_prepend (l, child); diff --git a/src/dialogs/text-edit.cpp b/src/dialogs/text-edit.cpp index 207b9b0d2..7cec16cd7 100644 --- a/src/dialogs/text-edit.cpp +++ b/src/dialogs/text-edit.cpp @@ -49,8 +49,10 @@ extern "C" { #include "svg/css-ostringstream.h" #include "widgets/icon.h" #include <xml/repr.h> +#include "util/ege-appear-time-tracker.h" using Inkscape::DocumentUndo; +using ege::AppearTimeTracker; #define VB_MARGIN 4 #define MIN_ONSCREEN_DISTANCE 50 @@ -139,6 +141,9 @@ text_view_focus_out (GtkWidget */*w*/, GdkEventKey */*event*/, gpointer data) void sp_text_edit_dialog (void) { + bool wantTiming = Inkscape::Preferences::get()->getBool("/dialogs/debug/trackAppear", false); + GTimer *timer = wantTiming ? g_timer_new() : 0; + if (!dlg) { gchar title[500]; @@ -460,6 +465,13 @@ sp_text_edit_dialog (void) sp_text_edit_dialog_read_selection (dlg, TRUE, TRUE); } + if ( wantTiming ) { + // Time tracker takes ownership of the timer. + AppearTimeTracker *tracker = new AppearTimeTracker(timer, GTK_WIDGET(dlg), "DialogText"); + tracker->setAutodelete(true); + timer = 0; + } + gtk_window_present ((GtkWindow *) dlg); } // end of sp_text_edit_dialog() diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index c90cde490..ddb419dcd 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -41,8 +41,10 @@ #include "../widgets/sp-xmlview-attr-list.h" #include "../widgets/sp-xmlview-content.h" #include "../widgets/sp-xmlview-tree.h" +#include "util/ege-appear-time-tracker.h" using Inkscape::DocumentUndo; +using ege::AppearTimeTracker; #define MIN_ONSCREEN_DISTANCE 50 @@ -178,11 +180,13 @@ void attr_reset_context(gint attr) void sp_xml_tree_dialog() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (!desktop) { return; } + bool wantTiming = Inkscape::Preferences::get()->getBool("/dialogs/debug/trackAppear", false); + GTimer *timer = wantTiming ? g_timer_new() : 0; + if (dlg == NULL) { // very long block @@ -604,6 +608,13 @@ void sp_xml_tree_dialog() tree_reset_context(); } // end of if (dlg == NULL) + if ( wantTiming ) { + // Time tracker takes ownership of the timer. + AppearTimeTracker *tracker = new AppearTimeTracker(timer, GTK_WIDGET(dlg), "DialogXMLEditor"); + tracker->setAutodelete(true); + timer = 0; + } + gtk_window_present((GtkWindow *) dlg); g_assert(desktop != NULL); @@ -1591,7 +1602,7 @@ bool in_dt_coordsys(SPObject const &item) if (!SP_IS_ITEM(child)) { return false; } - SPObject const * const parent = SP_OBJECT_PARENT(child); + SPObject const * const parent = child->parent; if (parent == NULL) { break; } |
