summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2823f12)
raw | patch | inline | side by side (parent: 2823f12)
author | sasilver <sasilver@users.sourceforge.net> | |
Sat, 31 May 2008 15:16:57 +0000 (15:16 +0000) | ||
committer | sasilver <sasilver@users.sourceforge.net> | |
Sat, 31 May 2008 15:16:57 +0000 (15:16 +0000) |
diff --git a/src/desktop.cpp b/src/desktop.cpp
index eee0446dbcbcad8288bcec2c709f66de49ea3f15..5796ed6386ba810fa01aef91ed359249c94f47d8 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
set_display_area(*d, 10);
}
+/**
+ * Scroll canvas by specific coordinate amount in svg coordinates.
+ */
+void
+SPDesktop::scroll_world_in_svg_coords (double dx, double dy, bool is_scrolling)
+{
+ double scale = expansion(_d2w);
+ scroll_world(dx*scale, dy*scale, is_scrolling);
+}
+
/**
* Scroll canvas by specific coordinate amount.
*/
diff --git a/src/desktop.h b/src/desktop.h
index df9848282b42ce571122ff7c0896bdd6f2fae008..af0d41b2a573ff7335480670e114e1faee43ab77 100644 (file)
--- a/src/desktop.h
+++ b/src/desktop.h
using NR::Y;
scroll_world(scroll[X], scroll[Y], is_scrolling);
}
+ void scroll_world_in_svg_coords (double dx, double dy, bool is_scrolling = false);
void getWindowGeometry (gint &x, gint &y, gint &w, gint &h);
void setWindowPosition (NR::Point p);
diff --git a/src/document.cpp b/src/document.cpp
index d0792ab8a7c5c01931638528d1088cd38f43b417..bf5ef089e625fb186c80860ce4e1fbf7a5020fea 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
#include "inkscape-private.h"
#include "inkscape_version.h"
#include "sp-object-repr.h"
+#include "sp-namedview.h"
+#include "desktop.h"
#include "document-private.h"
#include "dir-util.h"
#include "unit-constants.h"
NR::translate const tr(NR::Point(0, (old_height - h))
- rect.min());
SP_GROUP(root)->translateChildItems(tr);
+ SPNamedView *nv = sp_document_namedview(this, 0);
+ if(nv) {
+ NR::translate tr2(-rect.min());
+ nv->translateGuides(tr2);
+
+ // update the viewport so the drawing appears to stay where it was
+ nv->scrollAllDesktops(-tr2[0], tr2[1], false);
+ }
}
void sp_document_set_uri(SPDocument *document, gchar const *uri)
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 3575ce6aeaf5fa79a831971e1bb64be036a12798..3f52232cb52d78f1cca3c5aced43c7a5732ceb05 100644 (file)
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -1063,6 +1063,23 @@ Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedvie
return NULL;
}
+void SPNamedView::translateGuides(NR::translate const &tr) {
+ for (GSList *l = guides; l != NULL; l = l->next) {
+ SPGuide &guide = *SP_GUIDE(l->data);
+ Geom::Point point_on_line = guide.point_on_line;
+ point_on_line[0] += tr[0];
+ point_on_line[1] += tr[1];
+ sp_guide_moveto(guide, point_on_line, true);
+ }
+}
+
+void SPNamedView::scrollAllDesktops(double dx, double dy, bool is_scrolling) {
+ for(GSList *l = views; l; l = l->next) {
+ SPDesktop *desktop = static_cast<SPDesktop *>(l->data);
+ desktop->scroll_world_in_svg_coords(dx, dy, is_scrolling);
+ }
+}
+
/*
Local Variables:
diff --git a/src/sp-namedview.h b/src/sp-namedview.h
index 6055f5c71e8c45f0e90dfcdb5445509327c20d00..cfc57d1c4cab6688481796e6f86932f6312622b3 100644 (file)
--- a/src/sp-namedview.h
+++ b/src/sp-namedview.h
guint getViewCount();
GSList const *getViewList() const;
SPMetric getDefaultMetric() const;
+
+ void translateGuides(NR::translate const &translation);
+ void scrollAllDesktops(double dx, double dy, bool is_scrolling);
};
struct SPNamedViewClass {