summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b75c8c0)
raw | patch | inline | side by side (parent: b75c8c0)
author | speleo3 <speleo3@users.sourceforge.net> | |
Mon, 8 Dec 2008 21:54:37 +0000 (21:54 +0000) | ||
committer | speleo3 <speleo3@users.sourceforge.net> | |
Mon, 8 Dec 2008 21:54:37 +0000 (21:54 +0000) |
See http://wiki.inkscape.org/wiki/index.php/ViewBoxToDo
14 files changed:
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 50d348e7b408783396df625a64333732bef6604f..d7982e979d2e4a494c1dddf7cf20f0fa45440957 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
ac->item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
Inkscape::GC::release(repr);
- ac->item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
+ ac->item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
ac->item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
index 8260456d4bad10d9e563249582a461a495b22c5a..372918b80b4626461857773c202364ad79379698 100644 (file)
}
/* Now we have to go back to item coordinates at last */
- c->transform(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc)));
+ c->transform(sp_desktop_dt2doc_affine(SP_EVENT_CONTEXT_DESKTOP(cc)));
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
SPDocument *doc = sp_desktop_document(desktop);
cc->newconn = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
cc->selection->set(repr);
Inkscape::GC::release(repr);
- cc->newconn->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer());
+ cc->newconn->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
cc->newconn->updateRepr();
bool connection = false;
diff --git a/src/context-fns.cpp b/src/context-fns.cpp
index 399e8515451788708dc824bc8798b02f4168d4b2..54b07a02a76f05287b7a8b2fce27a78b85902344 100644 (file)
--- a/src/context-fns.cpp
+++ b/src/context-fns.cpp
@@ -207,8 +207,8 @@ Geom::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item
desktop->snapindicator->set_new_snaptarget(snappoint);
}
- p[0] = sp_desktop_dt2root_xy_point(desktop, p[0]);
- p[1] = sp_desktop_dt2root_xy_point(desktop, p[1]);
+ p[0] = sp_desktop_dt2doc_xy_point(desktop, p[0]);
+ p[1] = sp_desktop_dt2doc_xy_point(desktop, p[1]);
return Geom::Rect(Geom::Point(MIN(p[0][Geom::X], p[1][Geom::X]), MIN(p[0][Geom::Y], p[1][Geom::Y])),
Geom::Point(MAX(p[0][Geom::X], p[1][Geom::X]), MAX(p[0][Geom::Y], p[1][Geom::Y])));
diff --git a/src/desktop-affine.cpp b/src/desktop-affine.cpp
index 25c5c99b8aebe338530d0201973a34f163b2bbf4..95640c957e93e7a0d00815a2e7600da256471e6d 100644 (file)
--- a/src/desktop-affine.cpp
+++ b/src/desktop-affine.cpp
*/
#include "desktop.h"
-#include "document.h"
-#include "sp-root.h"
+//#include "document.h"
+//#include "sp-root.h"
//#include "libnr/nr-matrix-ops.h"
+Geom::Matrix const sp_desktop_dt2doc_affine (SPDesktop const *dt)
+{
+ return dt->doc2dt().inverse();
+}
+
+Geom::Point sp_desktop_dt2doc_xy_point(SPDesktop const *dt, Geom::Point const p)
+{
+ return p * sp_desktop_dt2doc_affine(dt);
+}
+
+#if 0
Geom::Matrix const sp_desktop_root2dt_affine (SPDesktop const *dt)
{
SPRoot const *root = SP_ROOT(SP_DOCUMENT_ROOT(dt->doc()));
{
return p * sp_desktop_dt2root_affine(dt);
}
+#endif
diff --git a/src/desktop-affine.h b/src/desktop-affine.h
index a5e84d5c7bd9956af818d82daa8c95bbc1673ae8..87d31c751da88aa1c621dcb7a7e9a27c2fbe8ab6 100644 (file)
--- a/src/desktop-affine.h
+++ b/src/desktop-affine.h
#include "forward.h"
#include <2geom/forward.h>
+Geom::Matrix const sp_desktop_dt2doc_affine (SPDesktop const *dt);
+
+Geom::Point sp_desktop_dt2doc_xy_point(SPDesktop const *dt, Geom::Point const p);
+
+#if 0
Geom::Matrix const sp_desktop_root2dt_affine(SPDesktop const *dt);
Geom::Matrix const sp_desktop_dt2root_affine(SPDesktop const *dt);
Geom::Point sp_desktop_root2dt_xy_point(SPDesktop const *dt, const Geom::Point p);
Geom::Point sp_desktop_dt2root_xy_point(SPDesktop const *dt, const Geom::Point p);
+#endif
#endif
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 74b6e8d52695f40b9a3e0ab368a010d59ba835a3..7fdda437c391263de727bd0d453dfd891d2ce7b8 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
/* Now we have to go back to item coordinates at last */
c->transform( dc->white_item
? sp_item_dt2i_affine(dc->white_item)
- : to_2geom(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) );
+ : to_2geom(sp_desktop_dt2doc_affine(SP_EVENT_CONTEXT_DESKTOP(dc))) );
SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
SPDocument *doc = sp_desktop_document(desktop);
dc->selection->set(repr);
Inkscape::GC::release(repr);
- item->transform = i2i_affine(desktop->currentRoot(), desktop->currentLayer());
+ item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
item->updateRepr();
}
index e22520ecb7b493a549eb49dfb851d556d17e8555..5ad5f0f3f54a92450fbfedf4c818093d659a6213 100644 (file)
SPItem *item=SP_ITEM(desktop->currentLayer()->appendChildRepr(dc->repr));
Inkscape::GC::release(dc->repr);
- item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
+ item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
item->updateRepr();
}
- Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2root_affine(desktop);
+ Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2doc_affine(desktop);
gchar *str = sp_svg_write_path(pathv);
g_assert( str != NULL );
dc->repr->setAttribute("d", str);
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 96d6b559142813a6c7824fc4c00deb17563a9c46..17e69c6aca8dcbecfad38eeca2132a337f4063cb 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
SPItem *item=SP_ITEM(desktop->currentLayer()->appendChildRepr(dc->repr));
Inkscape::GC::release(dc->repr);
- item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
+ item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
item->updateRepr();
}
- Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2root_affine(desktop);
+ Geom::PathVector pathv = dc->accumulated->get_pathvector() * sp_desktop_dt2doc_affine(desktop);
gchar *str = sp_svg_write_path(pathv);
g_assert( str != NULL );
dc->repr->setAttribute("d", str);
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index 5d2a353d924a5127ebf24e6638ebf38306eee89e..1d8e8c12b02cc6c3207dedff98e8238bfad7fe93 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
rc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
Inkscape::GC::release(repr);
- rc.item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
+ rc.item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
rc.item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
index f6920c2a347db8bef972fcb11e306dcea7b30524..4e93c48326b11598d875275c0ebf6297972bf084 100644 (file)
// bottommost object, after sorting
SPObject *parent = SP_OBJECT_PARENT (items->data);
- Geom::Matrix parent_transform (sp_item_i2root_affine(SP_ITEM(parent)));
+ Geom::Matrix parent_transform (sp_item_i2doc_affine(SP_ITEM(parent)));
// remember the position of the first item
gint pos = SP_OBJECT_REPR (items->data)->position();
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index e0f9b34729111ea5c170c6d9375c177a9cfbebf2..9280b604f9d04c7e839851a1fc1005b4a623ac4c 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -697,8 +697,8 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0,
SPObject *rect = doc->getObjectByRepr(rect_repr);
- p0 = sp_desktop_dt2root_xy_point(desktop, p0);
- p1 = sp_desktop_dt2root_xy_point(desktop, p1);
+ p0 = sp_desktop_dt2doc_xy_point(desktop, p0);
+ p1 = sp_desktop_dt2doc_xy_point(desktop, p1);
using Geom::X;
using Geom::Y;
Geom::Coord const x0 = MIN(p0[X], p1[X]);
@@ -724,6 +724,8 @@ SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0,
Inkscape::GC::release(para_repr);
Inkscape::GC::release(rect_repr);
+ ft_item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
+
return ft_item;
}
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 090c8d2760b8c9272b6ce2a00582f7ca4c6afb73..9944e86b4a99d76a77754acc257d34465e6fe2e7 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
sc->item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
Inkscape::GC::release(repr);
- sc->item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
+ sc->item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
sc->item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
Geom::Point pt2g = to_2geom(p);
m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g);
- Geom::Point const p0 = to_2geom(sp_desktop_dt2root_xy_point(desktop, sc->center));
- Geom::Point const p1 = to_2geom(sp_desktop_dt2root_xy_point(desktop, from_2geom(pt2g)));
+ Geom::Point const p0 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, sc->center));
+ Geom::Point const p1 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, from_2geom(pt2g)));
SPSpiral *spiral = SP_SPIRAL(sc->item);
diff --git a/src/star-context.cpp b/src/star-context.cpp
index a18170346de17cef9e7c87d445348e8cc7e968c7..33224d7fdc3b69ddbfaf3b0d49444a121c57ecb9 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
sc->item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
Inkscape::GC::release(repr);
- sc->item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
+ sc->item->transform = sp_item_i2doc_affine(SP_ITEM(desktop->currentLayer())).inverse();
sc->item->updateRepr();
sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
Geom::Point pt2g = to_2geom(p);
m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g);
- Geom::Point const p0 = to_2geom(sp_desktop_dt2root_xy_point(desktop, sc->center));
- Geom::Point const p1 = to_2geom(sp_desktop_dt2root_xy_point(desktop, from_2geom(pt2g)));
+ Geom::Point const p0 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, sc->center));
+ Geom::Point const p1 = to_2geom(sp_desktop_dt2doc_xy_point(desktop, from_2geom(pt2g)));
SPStar *star = SP_STAR(sc->item);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index e87e87abeffceb3ede717ae271839ed7634c4b13..96fa716cf997eef6d98e53ed5bf19a3e723d9d28 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
/* yes, it's immediate .. why does it matter? */
sp_desktop_selection(ec->desktop)->set(text_item);
Inkscape::GC::release(rtext);
- text_item->transform = SP_ITEM(ec->desktop->currentRoot())->getRelativeTransform(ec->desktop->currentLayer());
-
- // bug #168777 (consider root transform and viewBox)
- // TODO: more generic solution desirable
- // see http://wiki.inkscape.org/wiki/index.php/ViewBoxToDo
- Geom::Matrix root_transform = sp_item_i2doc_affine(SP_ITEM(ec->desktop->currentRoot()));
- if (!root_transform.isIdentity()) {
- text_item->transform = root_transform.inverse() * text_item->transform;
- Geom::Point pdoc = tc->pdoc * root_transform;
- sp_repr_set_svg_double(rtext, "x", pdoc[Geom::X]);
- sp_repr_set_svg_double(rtext, "y", pdoc[Geom::Y]);
- }
+ text_item->transform = sp_item_i2doc_affine(SP_ITEM(ec->desktop->currentLayer())).inverse();
text_item->updateRepr();
sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT,
@@ -697,7 +686,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons
/* Button 1, set X & Y & new item */
sp_desktop_selection(desktop)->clear();
Geom::Point dtp = desktop->w2d(Geom::Point(event->button.x, event->button.y));
- tc->pdoc = sp_desktop_dt2root_xy_point(desktop, dtp);
+ tc->pdoc = sp_desktop_dt2doc_xy_point(desktop, dtp);
tc->show = TRUE;
tc->phase = 1;