# HG changeset patch
# User insilmaril
# Date 1241092369 0
# Node ID ffb95cd03156bfc672bd38a4b32300e978e4d661
# Parent  0301e61097022ae44439f5b2ed8b7d84a764b27f
further speedup during load. positions of branches are saved (again)

diff -r 0301e6109702 -r ffb95cd03156 branchitem.cpp
--- a/branchitem.cpp	Wed Apr 29 21:40:37 2009 +0000
+++ b/branchitem.cpp	Thu Apr 30 11:52:49 2009 +0000
@@ -86,6 +86,7 @@
 
 	*/
     s=beginElement ("branch" 
+		+getAttr()
 	//	+getOrnXMLAttr() 
 	//	+scrolledAttr 
 	//	+areaAttr 
diff -r 0301e6109702 -r ffb95cd03156 mapcenteritem.cpp
--- a/mapcenteritem.cpp	Wed Apr 29 21:40:37 2009 +0000
+++ b/mapcenteritem.cpp	Thu Apr 30 11:52:49 2009 +0000
@@ -57,6 +57,7 @@
 
 	*/
     s=beginElement ("mapcenter" 
+		+getAttr()
 	//	+getOrnXMLAttr() 
 	//	+scrolledAttr 
 	//	+areaAttr 
diff -r 0301e6109702 -r ffb95cd03156 mapitem.cpp
--- a/mapitem.cpp	Wed Apr 29 21:40:37 2009 +0000
+++ b/mapitem.cpp	Thu Apr 30 11:52:49 2009 +0000
@@ -56,3 +56,25 @@
 	}
 }
 
+QString MapItem::getAttr()
+{
+	switch (posMode)
+	{
+		case Relative:	
+			if (lmo) pos=lmo->getRelPos();
+			return
+				attribut("relPosX",QString().setNum(pos.x())) +
+				attribut("relPosY",QString().setNum(pos.y())); 
+			break;
+		case Absolute:	
+			if (lmo) pos=lmo->getAbsPos();
+			return
+				attribut("absPosX",QString().setNum(pos.x())) +
+				attribut("absPosY",QString().setNum(pos.y())); 
+			break;
+		default:
+			return QString();
+			break;
+	}
+}
+
diff -r 0301e6109702 -r ffb95cd03156 mapitem.h
--- a/mapitem.h	Wed Apr 29 21:40:37 2009 +0000
+++ b/mapitem.h	Thu Apr 30 11:52:49 2009 +0000
@@ -3,16 +3,19 @@
 
 #include <QPointF>
 
+#include "xmlobj.h"
+
 class LinkableMapObj;
 
 /*! /brief MapItem is used to store information of MapObj and inherited
    classes.
  
-	This is done even while no QGraphicsView is availabe, e.g. on a
-	mobile device.
+	This is done even while no QGraphicsView is availabe. This is useful
+	if e.g. on a small device like a cellphone te full map is not used,
+	but just a treeview instead.
 */
 
-class MapItem
+class MapItem: public XMLObj
 {
 protected:
 	enum PositionMode {Unused,Absolute,Relative};
@@ -39,6 +42,9 @@
 
 	/*! Initialize LinkableMapObj with data in MapItem */
 	virtual void initLMO();
+
+	/*! Return data as attributes for saving in XML */
+	virtual QString getAttr();
 };
 
 
diff -r 0301e6109702 -r ffb95cd03156 treeitem.h
--- a/treeitem.h	Wed Apr 29 21:40:37 2009 +0000
+++ b/treeitem.h	Thu Apr 30 11:52:49 2009 +0000
@@ -14,7 +14,7 @@
 class BranchItem;
 class VymModel;
 
-class TreeItem:public XMLObj, public MapItem
+class TreeItem:public MapItem
 {
 public:
 	enum Type {Undefined,MapCenter,Branch,Image};
diff -r 0301e6109702 -r ffb95cd03156 vymmodel.cpp
--- a/vymmodel.cpp	Wed Apr 29 21:40:37 2009 +0000
+++ b/vymmodel.cpp	Thu Apr 30 11:52:49 2009 +0000
@@ -445,6 +445,7 @@
 		bool blockSaveStateOrg=blockSaveState;
 		blockReposition=true;
 		blockSaveState=true;
+		mapEditor->setViewportUpdateMode (QGraphicsView::NoViewportUpdate);
 		QXmlInputSource source( file);
 		QXmlSimpleReader reader;
 		reader.setContentHandler( handler );
@@ -464,6 +465,7 @@
 		bool ok = reader.parse( source );
 		blockReposition=false;
 		blockSaveState=blockSaveStateOrg;
+		mapEditor->setViewportUpdateMode (QGraphicsView::MinimalViewportUpdate);
 		file.close();
 		if ( ok ) 
 		{