summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e2df9e)
raw | patch | inline | side by side (parent: 4e2df9e)
author | acspike <acspike@users.sourceforge.net> | |
Fri, 28 Apr 2006 04:14:59 +0000 (04:14 +0000) | ||
committer | acspike <acspike@users.sourceforge.net> | |
Fri, 28 Apr 2006 04:14:59 +0000 (04:14 +0000) |
the translation is now preserved across save by translating all child elements of the root
instead of just translating the root itself.
instead of just translating the root itself.
src/document.cpp | patch | blob | history | |
src/sp-item-group.cpp | patch | blob | history | |
src/sp-item-group.h | patch | blob | history |
diff --git a/src/document.cpp b/src/document.cpp
index ef04735ef6252f78aeaf95c658eb0e04abbfe617..eca4ab2dcae09a1be42a916789ee1fe4eeb0e487 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
#include "prefs-utils.h"
#include "libavoid/router.h"
#include "libnr/nr-rect.h"
-#include "sp-item-transform.h"
+#include "sp-item-group.h"
#include "display/nr-arena-item.h"
sp_document_set_height(this, h, &unit);
NR::translate tr = NR::translate::translate(-rect.x0,-(rect.y0 + (h - old_height)));
- sp_item_move_rel((SPItem *) root, tr);
+ static_cast<SPGroup *>(root)->translateChildItems(tr);
}
void sp_document_set_uri(SPDocument *document, gchar const *uri)
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index cd11b3c41be974c2e4e3ae95da4a2855e9debbb5..b5f6881b72e73909f6f9e2f3ba4b755b08bb4585 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
#include "document.h"
#include "style.h"
#include "attributes.h"
+#include "sp-item-transform.h"
#include "sp-root.h"
#include "sp-use.h"
}
}
+void SPGroup::translateChildItems(NR::translate const &tr)
+{
+ if (this->hasChildren())
+ {
+ SPObject *o = NULL;
+ for (o = sp_object_first_child(SP_OBJECT(this)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) {
+ if (SP_IS_ITEM (o)) {
+ sp_item_move_rel(static_cast<SPItem *>(o), tr);
+ }
+ }
+ }
+}
+
CGroup::CGroup(SPGroup *group) {
_group = group;
}
diff --git a/src/sp-item-group.h b/src/sp-item-group.h
index ebf5c040272fe4b21a7490a8250e8b93e74db6d9..b78291074697f8c30af899a26d164bf3b461703a 100644 (file)
--- a/src/sp-item-group.h
+++ b/src/sp-item-group.h
class CGroup;
+namespace NR{ struct translate; }
+
struct SPGroup : public SPItem {
enum LayerMode { GROUP, LAYER };
LayerMode layerDisplayMode(unsigned int display_key) const;
void setLayerDisplayMode(unsigned int display_key, LayerMode mode);
+ void translateChildItems(NR::translate const &tr);
CGroup *group;