started to save data like positions outside of MapObj & Co
authorinsilmaril
Wed Apr 29 18:46:31 2009 +0000 (2009-04-29)
changeset 76059614eaf5fbb
parent 759 bf3ea1f1520b
child 761 0301e6109702
started to save data like positions outside of MapObj & Co
branchitem.cpp
branchitem.h
branchobj.cpp
branchobj.h
linkablemapobj.cpp
mapcenteritem.cpp
mapcenteritem.h
mapcenterobj.cpp
mapcenterobj.h
mapeditor.cpp
mapitem.cpp
mapitem.h
noteobj.cpp
ornamentedobj.h
treeitem.cpp
treeitem.h
treemodel.cpp
vym.pro
vymmodel.cpp
vymmodel.h
xml-base.cpp
xml-vym.cpp
     1.1 --- a/branchitem.cpp	Tue Apr 28 20:53:44 2009 +0000
     1.2 +++ b/branchitem.cpp	Wed Apr 29 18:46:31 2009 +0000
     1.3 @@ -13,6 +13,7 @@
     1.4  
     1.5  	scrolled=false;
     1.6  	tmpUnscrolled=false;
     1.7 +	type=Branch;
     1.8  }
     1.9  
    1.10  BranchItem::~BranchItem()
    1.11 @@ -44,15 +45,16 @@
    1.12  	branchCounter++;
    1.13  }
    1.14  
    1.15 -QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
    1.16 +QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-1
    1.17  {
    1.18 +		cout << "BI::saveToDir: "<<getHeadingStd()<<endl;
    1.19  	// Cloudy stuff can be hidden during exports
    1.20  	if (hidden) return QString();
    1.21  
    1.22      QString s,a;
    1.23  	BranchObj *bo=(BranchObj*)lmo;
    1.24  
    1.25 -	/* FIXME-1
    1.26 +	/* 
    1.27  	// Update of note is usually done while unselecting a branch
    1.28  	if (isNoteInEditor) getNoteFromTextEditor();
    1.29  	
    1.30 @@ -114,10 +116,14 @@
    1.31  		s+=note.saveToDir();
    1.32  	
    1.33  	// Save branches
    1.34 -	TreeItem *ti=getFirstBranch();
    1.35 -	TreeItem *last=getLastBranch();
    1.36 -	while (ti && ti!=last) 
    1.37 -		s+=ti->saveToDir(tmpdir,prefix,offset);
    1.38 +	int i=0;
    1.39 +	TreeItem *ti=getBranchNum(i);
    1.40 +	while (ti)
    1.41 +	{
    1.42 +		s+=getBranchNum(i)->saveToDir(tmpdir,prefix,offset);
    1.43 +		i++;
    1.44 +		ti=getBranchNum(i);
    1.45 +	}	
    1.46  
    1.47  	/*
    1.48  	// Save XLinks
    1.49 @@ -334,10 +340,12 @@
    1.50  {
    1.51  	// Initialize BranchObj, order of things is important...
    1.52      BranchObj* newbo=new BranchObj(scene);
    1.53 +	lmo=newbo;
    1.54      newbo->setParObj(parent()->getLMO() );
    1.55  	newbo->setTreeItem (this);
    1.56  	newbo->setDefAttr(BranchObj::NewBranch);
    1.57  	
    1.58 +	initLMO();
    1.59  
    1.60  	if (!getHeading().isEmpty() ) 
    1.61  	{
    1.62 @@ -348,7 +356,6 @@
    1.63  		
    1.64  	//newbo->updateLink();	//FIXME-3
    1.65  
    1.66 -	lmo=newbo;
    1.67  	return newbo;
    1.68  }
    1.69  
     2.1 --- a/branchitem.h	Tue Apr 28 20:53:44 2009 +0000
     2.2 +++ b/branchitem.h	Wed Apr 29 18:46:31 2009 +0000
     2.3 @@ -19,7 +19,6 @@
     2.4  
     2.5  	QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
     2.6  
     2.7 -	
     2.8  	virtual void updateVisibility();
     2.9  
    2.10  protected:
    2.11 @@ -44,8 +43,8 @@
    2.12  	TreeItem* findMapItem (QPointF p,TreeItem* excludeTI);	//! search map for branches or images. Ignore excludeTI, where search is started 
    2.13  	virtual TreeItem* findID (QString sid);		//! search map for object with ID string
    2.14  
    2.15 -	BranchObj* getBranchObj();	
    2.16 -	BranchObj* createMapObj(QGraphicsScene *scene);		//! Create classic object in GraphicsView
    2.17 +	virtual BranchObj* getBranchObj();	
    2.18 +	virtual BranchObj* createMapObj(QGraphicsScene *scene);		//! Create classic object in GraphicsView
    2.19  };
    2.20  
    2.21  #endif
     3.1 --- a/branchobj.cpp	Tue Apr 28 20:53:44 2009 +0000
     3.2 +++ b/branchobj.cpp	Wed Apr 29 18:46:31 2009 +0000
     3.3 @@ -100,14 +100,6 @@
     3.4  {
     3.5      OrnamentedObj::copy(other);
     3.6  
     3.7 -/* FIXME-3 not needed
     3.8 -	for (int i=0; i<other->treeItem->branchCount(); ++i)
     3.9 -		// Make deep copy of b
    3.10 -		// Because addBranch again calls copy for the children,
    3.11 -		// Those will get a deep copy, too
    3.12 -		addBranch(other->branch.at(i) );	
    3.13 -*/		
    3.14 -
    3.15  	for (int i=0; i<other->floatimage.size(); ++i)
    3.16  		addFloatImage  (other->floatimage.at(i));
    3.17  	
    3.18 @@ -682,92 +674,11 @@
    3.19  	heading->setFont(font );
    3.20  
    3.21  	if (mod==NewBranch)
    3.22 -		setColor (((BranchObj*)(parObj))->getColor());
    3.23 -	
    3.24 +		setColor (treeItem->getHeadingColor() );
    3.25  	calcBBoxSize();
    3.26  }
    3.27  
    3.28 -BranchObj* BranchObj::addBranch()	// FIXME-3 still needed?
    3.29 -{
    3.30 -    BranchObj* newbo=new BranchObj(scene,this);
    3.31 -    newbo->setParObj(this);
    3.32 -	newbo->setDefAttr(NewBranch);
    3.33 -	/* FIXME-2 treeItem not set yet!!!
    3.34 -	if ( ((BranchItem*)treeItem)->isScrolled() )
    3.35 -		newbo->setVisibility (false);
    3.36 -	else	
    3.37 -		newbo->setVisibility(visible);
    3.38 -	*/	
    3.39 -	newbo->updateLink();	
    3.40 -	requestReposition();
    3.41 -	return newbo;
    3.42 -}
    3.43 -
    3.44 -BranchObj* BranchObj::addBranch(BranchObj* bo)
    3.45 -{
    3.46 -    BranchObj* newbo=new BranchObj(scene,this);
    3.47 -    //FIXME-1 branch.append (newbo);
    3.48 -    newbo->copy(bo);
    3.49 -    newbo->setParObj(this);
    3.50 -	newbo->setDefAttr(MovedBranch);
    3.51 -	if ( ((BranchItem*)treeItem)->isScrolled() )
    3.52 -		newbo->setVisibility (false);
    3.53 -	else	
    3.54 -		newbo->setVisibility(bo->visible);
    3.55 -	newbo->updateLink();	
    3.56 -	requestReposition();
    3.57 -	return newbo;
    3.58 -}
    3.59 -
    3.60 -BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
    3.61 -{
    3.62 -	//FIXME-1 branch.append (bo);
    3.63 -	bo->setParObj (this);
    3.64 -	//FIXME-2 bo->depth=depth+1;
    3.65 -	bo->setDefAttr(MovedBranch);
    3.66 -	BranchItem *bi=(BranchItem*)treeItem;
    3.67 -	if ( bi->isScrolled() ) bi->tmpUnscroll();
    3.68 -	//setLastSelectedBranch (bo);	//FIXME-3 needed?
    3.69 -	return bo;
    3.70 -}
    3.71 -
    3.72 -BranchObj* BranchObj::insertBranch(int pos)
    3.73 -{
    3.74 -	savePosInAngle();
    3.75 -	// Add new bo and resort branches
    3.76 -	BranchObj *newbo=addBranch ();
    3.77 -	newbo->angle=pos-0.5;
    3.78 -	//FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
    3.79 -	return newbo;
    3.80 -}
    3.81 -
    3.82 -BranchObj* BranchObj::insertBranch(BranchObj* bo, int pos)
    3.83 -{
    3.84 -	savePosInAngle();
    3.85 -	// Add new bo and resort branches
    3.86 -	bo->angle=pos-0.5;
    3.87 -	BranchObj *newbo=addBranch (bo);
    3.88 -	//FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
    3.89 -	return newbo;
    3.90 -}
    3.91 -
    3.92 -BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
    3.93 -{
    3.94 -	savePosInAngle();
    3.95 -	// Add new bo and resort branches
    3.96 -	bo->angle=pos-0.5;
    3.97 -	//FIXME-4 branch.append (bo);
    3.98 -	bo->setParObj (this);
    3.99 -	//FIXME-2 bo->depth=depth+1;
   3.100 -	bo->setDefAttr (MovedBranch);
   3.101 -	BranchItem *bi=(BranchItem*)treeItem;
   3.102 -	if ( bi->isScrolled() ) bi->tmpUnscroll();
   3.103 -	//setLastSelectedBranch (bo); //FIXME-3 needed?
   3.104 -	//FIXME-2 qSort (branch.begin(),branch.end(), isAbove);
   3.105 -	return bo;
   3.106 -}
   3.107 -
   3.108 -void BranchObj::removeBranchHere(BranchObj* borem)	// FIXME-1 getNum no longer available
   3.109 +void BranchObj::removeBranchHere(BranchObj* borem)	// FIXME-2 getNum no longer available
   3.110  {
   3.111  /*
   3.112  	// This removes the branch bo from list, but 
   3.113 @@ -789,7 +700,7 @@
   3.114  	clear();
   3.115  }
   3.116  
   3.117 -void BranchObj::removeBranch(BranchObj* bo)	// FIXME-1 not needed here
   3.118 +void BranchObj::removeBranch(BranchObj* bo)	// FIXME-2 not needed here
   3.119  {
   3.120  /*
   3.121      // if bo is not in branch remove returns false, we
   3.122 @@ -806,7 +717,7 @@
   3.123  	*/
   3.124  }
   3.125  
   3.126 -void BranchObj::removeBranchPtr(BranchObj* bo)	// FIXME-1 not needed here
   3.127 +void BranchObj::removeBranchPtr(BranchObj* bo)	// FIXME-3 not needed here
   3.128  {
   3.129  /*
   3.130  	int i=branch.indexOf(bo);
   3.131 @@ -819,9 +730,9 @@
   3.132  */	
   3.133  }
   3.134  
   3.135 -bool BranchObj::canMoveBranchUp() 
   3.136 +bool BranchObj::canMoveBranchUp() // FIXME-1 move to BranchItem
   3.137  {
   3.138 -	/* FIXME-1 move to BranchItem
   3.139 +/*
   3.140  	if (!parObj || depth==1) return false;
   3.141  	BranchObj* par=(BranchObj*)parObj;
   3.142  	if (this==par->getTreeItem()->getFirstBranch())
   3.143 @@ -848,9 +759,9 @@
   3.144  		return NULL;
   3.145  }
   3.146  
   3.147 -bool BranchObj::canMoveBranchDown() 
   3.148 +bool BranchObj::canMoveBranchDown() //FIXME-1 move to BranchItem
   3.149  {
   3.150 -	/* FIXME-1 move to BranchItem
   3.151 +	/* 
   3.152  	if (!parObj|| depth==1) return false;
   3.153  	BranchObj* par=(BranchObj*)parObj;
   3.154  	if (this==par->getTreeItem()->getLastBranch())
   3.155 @@ -879,7 +790,7 @@
   3.156  		return NULL;
   3.157  }
   3.158  
   3.159 -void BranchObj::sortChildren() //FIXME-1  
   3.160 +void BranchObj::sortChildren() //FIXME-2  
   3.161  {
   3.162  /*
   3.163  	int childCount=branch.count(); 
   3.164 @@ -901,42 +812,6 @@
   3.165  */
   3.166  }
   3.167  
   3.168 -
   3.169 -BranchObj* BranchObj::linkTo (BranchObj* dst, int pos)
   3.170 -{
   3.171 -	// Find current parent and 
   3.172 -	// remove pointer to myself there
   3.173 -	if (!dst) return NULL;
   3.174 -	BranchObj *par=(BranchObj*)parObj;
   3.175 -	if (par)
   3.176 -		par->removeBranchPtr (this);
   3.177 -	else
   3.178 -		return NULL;
   3.179 -
   3.180 -/* FIXME-1
   3.181 -	// Create new pointer to myself at dst
   3.182 -	if (pos<0||dst->getDepth()==0)
   3.183 -	{	
   3.184 -		// links myself as last branch at dst
   3.185 -		dst->addBranchPtr (this);
   3.186 -		updateLink();
   3.187 -		return this;
   3.188 -	} else
   3.189 -	{
   3.190 -		// inserts me at pos in parent of dst
   3.191 -		if (par)
   3.192 -		{
   3.193 -			BranchObj *bo=dst->insertBranchPtr (this,pos);
   3.194 -			bo->setDefAttr(MovedBranch);
   3.195 -			updateLink();
   3.196 -			return bo;
   3.197 -
   3.198 -		} else
   3.199 -			return NULL;
   3.200 -	}	
   3.201 -*/	
   3.202 -}
   3.203 -
   3.204  void BranchObj::alignRelativeTo (QPointF ref,bool alignSelf)
   3.205  {
   3.206  	qreal th = bboxTotal.height();	
     4.1 --- a/branchobj.h	Tue Apr 28 20:53:44 2009 +0000
     4.2 +++ b/branchobj.h	Wed Apr 29 18:46:31 2009 +0000
     4.3 @@ -73,13 +73,8 @@
     4.4  	virtual void savePosInAngle();					// write pos in angle for resorting			
     4.5  public:	
     4.6  	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
     4.7 -    virtual BranchObj* addBranch();
     4.8 -    virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
     4.9 -    virtual BranchObj* addBranchPtr(BranchObj*);	// just adds pointer
    4.10 -    virtual BranchObj* insertBranch(int);
    4.11 -    virtual BranchObj* insertBranch(BranchObj*,int);
    4.12 -    virtual BranchObj* insertBranchPtr (BranchObj*,int);
    4.13 -    virtual void removeBranchHere(BranchObj*);  
    4.14 +
    4.15 +    virtual void removeBranchHere(BranchObj*);  //FIXME-3
    4.16      virtual void removeChildren();  
    4.17      virtual void removeBranch(BranchObj*);  
    4.18      virtual void removeBranchPtr (BranchObj*);  
    4.19 @@ -90,7 +85,6 @@
    4.20      virtual BranchObj* moveBranchDown(BranchObj*);
    4.21  
    4.22      virtual void sortChildren();
    4.23 -    virtual BranchObj* linkTo (BranchObj*, int);
    4.24      virtual void alignRelativeTo(const QPointF, bool alignSelf=false );
    4.25  	virtual void reposition();
    4.26  	virtual void unsetAllRepositionRequests();
     5.1 --- a/linkablemapobj.cpp	Tue Apr 28 20:53:44 2009 +0000
     5.2 +++ b/linkablemapobj.cpp	Wed Apr 29 18:46:31 2009 +0000
     5.3 @@ -140,7 +140,7 @@
     5.4  void LinkableMapObj::setParObj(LinkableMapObj* o)
     5.5  {
     5.6      parObj=o;
     5.7 -	model=parObj->getModel();	
     5.8 +	if (parObj) model=parObj->getModel();
     5.9  }
    5.10  
    5.11  void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int)	// FIXME-3 make pure virtual
     6.1 --- a/mapcenteritem.cpp	Tue Apr 28 20:53:44 2009 +0000
     6.2 +++ b/mapcenteritem.cpp	Wed Apr 29 18:46:31 2009 +0000
     6.3 @@ -6,8 +6,7 @@
     6.4  
     6.5  MapCenterItem::MapCenterItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
     6.6  {
     6.7 -	scrolled=false;
     6.8 -	tmpUnscrolled=false;
     6.9 +	type=MapCenter;
    6.10  }
    6.11  
    6.12  MapCenterItem::~MapCenterItem()
    6.13 @@ -16,15 +15,17 @@
    6.14      qDeleteAll(childItems);
    6.15  }
    6.16  
    6.17 -QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
    6.18 +QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)	//FIXME-1
    6.19  {
    6.20 +	cout << "MCI::saveToDir: "<<getHeadingStd()<<endl;
    6.21 +
    6.22  	// Cloudy stuff can be hidden during exports
    6.23  	if (hidden) return QString();
    6.24  
    6.25      QString s,a;
    6.26  	BranchObj *bo=(BranchObj*)lmo;
    6.27  
    6.28 -	/* FIXME-1
    6.29 +	/* 
    6.30  	// Update of note is usually done while unselecting a branch
    6.31  	if (isNoteInEditor) getNoteFromTextEditor();
    6.32  	
    6.33 @@ -55,7 +56,7 @@
    6.34  		idAttr="";
    6.35  
    6.36  	*/
    6.37 -    s=beginElement ("branch" 
    6.38 +    s=beginElement ("mapcenter" 
    6.39  	//	+getOrnXMLAttr() 
    6.40  	//	+scrolledAttr 
    6.41  	//	+areaAttr 
    6.42 @@ -86,10 +87,15 @@
    6.43  		s+=note.saveToDir();
    6.44  	
    6.45  	// Save branches
    6.46 -	TreeItem *ti=getFirstBranch();
    6.47 -	TreeItem *last=getLastBranch();
    6.48 -	while (ti && ti!=last) 
    6.49 -		s+=ti->saveToDir(tmpdir,prefix,offset);
    6.50 +	int i=0;
    6.51 +	TreeItem *ti=getBranchNum(i);
    6.52 +	while (ti)
    6.53 +	{
    6.54 +		s+=getBranchNum(i)->saveToDir(tmpdir,prefix,offset);
    6.55 +		i++;
    6.56 +		ti=getBranchNum(i);
    6.57 +	}	
    6.58 +
    6.59  
    6.60  	/*
    6.61  	// Save XLinks
    6.62 @@ -110,9 +116,32 @@
    6.63  	*/
    6.64  
    6.65      decIndent();
    6.66 -    s+=endElement   ("branch");
    6.67 +    s+=endElement   ("mapcenter");
    6.68      return s;
    6.69  }
    6.70  
    6.71 +BranchObj* MapCenterItem::createMapObj(QGraphicsScene *scene)	
    6.72 +{
    6.73 +	cout <<"MCI  parent->model="<<parent()->getModel()<<endl;
    6.74 +	// Initialize MapCenterObj, order of things is important...
    6.75 +    MapCenterObj* mco=new MapCenterObj(scene);
    6.76 +	lmo=mco;
    6.77 +    mco->setParObj(NULL);
    6.78 +	mco->setModel (model);
    6.79 +	mco->setTreeItem (this);
    6.80 +	mco->setDefAttr(BranchObj::NewBranch);
    6.81  
    6.82 +	initLMO();
    6.83  
    6.84 +	if (!getHeading().isEmpty() ) 
    6.85 +	{
    6.86 +		mco->updateHeading();
    6.87 +		mco->setColor (headingColor);
    6.88 +	}	
    6.89 +		
    6.90 +	//mco->updateLink();	//FIXME-3
    6.91 +
    6.92 +	return mco;
    6.93 +}
    6.94 +
    6.95 +
     7.1 --- a/mapcenteritem.h	Tue Apr 28 20:53:44 2009 +0000
     7.2 +++ b/mapcenteritem.h	Wed Apr 29 18:46:31 2009 +0000
     7.3 @@ -11,6 +11,7 @@
     7.4      virtual ~MapCenterItem();
     7.5  
     7.6  	QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
     7.7 +	virtual BranchObj* createMapObj (QGraphicsScene *scene);
     7.8  };
     7.9  
    7.10  #endif
     8.1 --- a/mapcenterobj.cpp	Tue Apr 28 20:53:44 2009 +0000
     8.2 +++ b/mapcenterobj.cpp	Wed Apr 29 18:46:31 2009 +0000
     8.3 @@ -45,7 +45,7 @@
     8.4  	// TODO this should be done in TextObj later...
     8.5  	//QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
     8.6  	//heading->setFont(font);
     8.7 -	setDefAttr(MovedBranch);
     8.8 +	//FIXME-2 no treeitem yet:  setDefAttr(MovedBranch);
     8.9  
    8.10  	frame->setFrameType (FrameObj::Rectangle);
    8.11  }
    8.12 @@ -108,29 +108,6 @@
    8.13  	if (repositionRequest) reposition();
    8.14  }
    8.15  
    8.16 -LinkableMapObj* MapCenterObj::findMapObj(QPointF p, LinkableMapObj *excludeLMO)
    8.17 -	{
    8.18 -	/* FIXME-1 should not be necessary
    8.19 -	LinkableMapObj *lmo;
    8.20 -
    8.21 -	// Search through child branches
    8.22 -	for (int i=0; i<treeItem->branchCount(); ++i)
    8.23 -	{	
    8.24 -		lmo = treeItem->getBranchObjNum(i)->findMapObj(p, excludeLMO);
    8.25 -		if (lmo!= NULL) return lmo;
    8.26 -	}
    8.27 -	// is p in MapCenter?
    8.28 -	if (inBox (p,clickBox) && (this != excludeLMO) ) return this;
    8.29 -
    8.30 -	// Search float images
    8.31 -	for (int i=0; i<floatimage.size(); ++i)
    8.32 -		if (inBox(p,floatimage.at(i)->getClickBox()) && (floatimage.at(i) != excludeLMO) && floatimage.at(i)->getParObj()!= excludeLMO) return floatimage.at(i);
    8.33 -
    8.34 -	// nothing found
    8.35 -	*/
    8.36 -	return NULL;
    8.37 -}
    8.38 -
    8.39  QString MapCenterObj::saveToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset)
    8.40  {
    8.41      QString s,a;
     9.1 --- a/mapcenterobj.h	Tue Apr 28 20:53:44 2009 +0000
     9.2 +++ b/mapcenterobj.h	Wed Apr 29 18:46:31 2009 +0000
     9.3 @@ -27,7 +27,6 @@
     9.4      virtual void moveAllBy (double,double);
     9.5      virtual void updateLink();
     9.6      virtual void updateRelPositions();
     9.7 -    LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
     9.8  	virtual QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
     9.9  	void setVersion(const  QString &);
    9.10  	void setAuthor  (const QString &);
    10.1 --- a/mapeditor.cpp	Tue Apr 28 20:53:44 2009 +0000
    10.2 +++ b/mapeditor.cpp	Wed Apr 29 18:46:31 2009 +0000
    10.3 @@ -798,7 +798,6 @@
    10.4  {
    10.5      QPointF p = mapToScene(e->pos());
    10.6  	TreeItem *seli=model->getSelectedItem();
    10.7 -	LinkableMapObj *lmosel=seli->getLMO();	// FIXME-2 get rid of lmosel
    10.8  
    10.9  	TreeItem *dsti=findMapItem(p, seli);
   10.10  	LinkableMapObj* dst=NULL;
   10.11 @@ -811,7 +810,7 @@
   10.12  		pickingColor=false;
   10.13  		setCursor (Qt::ArrowCursor);
   10.14  		// Check if we are over another branch
   10.15 -		if (dsti && lmosel) 
   10.16 +		if (dsti && seli) 
   10.17  		{	
   10.18  			if (e->state() & Qt::ShiftModifier)
   10.19  				model->colorBranch (((BranchObj*)dst)->getColor());
   10.20 @@ -826,7 +825,7 @@
   10.21  	{
   10.22  		drawingLink=false;
   10.23  		// Check if we are over another branch
   10.24 -		if (dsti && lmosel && dsti->isBranchLikeType() ) 
   10.25 +		if (dsti && seli && dsti->isBranchLikeType() ) 
   10.26  		{	
   10.27  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
   10.28  			tmpXLink->updateXLink();
   10.29 @@ -893,7 +892,9 @@
   10.30  	
   10.31  		if (seli->getType() == TreeItem::Branch )
   10.32  		{	// A branch was moved
   10.33 -			
   10.34 +			LinkableMapObj* lmosel=NULL;		//FIXME-2 get rid of lmosel
   10.35 +			lmosel=seli->getLMO();
   10.36 +				
   10.37  			// save the position in case we link to mapcenter
   10.38  			QPointF savePos=QPointF (lmosel->getAbsPos()  );
   10.39  
   10.40 @@ -918,19 +919,16 @@
   10.41  				if (e->state() & Qt::ShiftModifier && dst->getParObj())
   10.42  				{	// Link above dst
   10.43  					preDstParStr=model->getSelectString (dst->getParObj());
   10.44 -					bsel->linkTo ( (BranchObj*)(bdst->getParObj()), seli->num());	//FIXME-2 not needed
   10.45  					model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)dsti)->num());
   10.46  				} else 
   10.47  				if (e->state() & Qt::ControlModifier && dst->getParObj())
   10.48  				{
   10.49  					// Link below dst
   10.50  					preDstParStr=model->getSelectString (dst->getParObj());
   10.51 -					bsel->linkTo ( (BranchObj*)(bdst->getParObj()), seli->num()+1);//FIXME-2 not needed
   10.52  					model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)seli)->num()+1);
   10.53  				} else	
   10.54  				{	// Append to dst
   10.55  					preDstParStr=model->getSelectString(dst);
   10.56 -					bsel->linkTo (bdst,-1);//FIXME-2 not needed
   10.57  					model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti);
   10.58  					if (dsti->depth()==0) bsel->move (savePos);
   10.59  				} 
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/mapitem.cpp	Wed Apr 29 18:46:31 2009 +0000
    11.3 @@ -0,0 +1,58 @@
    11.4 +#include "mapitem.h"
    11.5 +
    11.6 +#include "linkablemapobj.h"
    11.7 +#include "ornamentedobj.h"
    11.8 +
    11.9 +#include <iostream>
   11.10 +using namespace std;
   11.11 +
   11.12 +MapItem::MapItem()
   11.13 +{
   11.14 +	lmo=NULL;
   11.15 +	posMode=Unused;
   11.16 +}
   11.17 +
   11.18 +void MapItem::setRelPos (const QPointF &p)
   11.19 +{
   11.20 +	posMode=Relative;
   11.21 +	pos=p;
   11.22 +	if (lmo)
   11.23 +	{
   11.24 +		((OrnamentedObj*)lmo)->setUseRelPos (true);
   11.25 +		((OrnamentedObj*)lmo)->move2RelPos(p);
   11.26 +	}
   11.27 +}
   11.28 +
   11.29 +void MapItem::setAbsPos (const QPointF &p)
   11.30 +{
   11.31 +	posMode=Absolute;
   11.32 +	pos=p;
   11.33 +	if (lmo) lmo->move (p);
   11.34 +}
   11.35 +
   11.36 +LinkableMapObj* MapItem::getLMO()
   11.37 +{
   11.38 +	return lmo;
   11.39 +}
   11.40 +
   11.41 +void MapItem::setLMO(LinkableMapObj *l)
   11.42 +{
   11.43 +	lmo=l;
   11.44 +}
   11.45 +
   11.46 +void MapItem::initLMO()
   11.47 +{
   11.48 +	if (!lmo) return;
   11.49 +	switch (posMode)
   11.50 +	{
   11.51 +		case Relative:	
   11.52 +			lmo->setRelPos (pos);
   11.53 +			break;
   11.54 +		case Absolute:	
   11.55 +			lmo->move (pos);
   11.56 +			break;
   11.57 +		default:
   11.58 +			break;
   11.59 +	}
   11.60 +}
   11.61 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/mapitem.h	Wed Apr 29 18:46:31 2009 +0000
    12.3 @@ -0,0 +1,45 @@
    12.4 +#ifndef MAPITEM_H
    12.5 +#define MAPITEM_H
    12.6 +
    12.7 +#include <QPointF>
    12.8 +
    12.9 +class LinkableMapObj;
   12.10 +
   12.11 +/*! /brief MapItem is used to store information of MapObj and inherited
   12.12 +   classes.
   12.13 + 
   12.14 +	This is done even while no QGraphicsView is availabe, e.g. on a
   12.15 +	mobile device.
   12.16 +*/
   12.17 +
   12.18 +class MapItem
   12.19 +{
   12.20 +protected:
   12.21 +	enum PositionMode {Unused,Absolute,Relative};
   12.22 +	QPointF pos;
   12.23 +	PositionMode posMode;
   12.24 +
   12.25 +public:
   12.26 +	MapItem();
   12.27 +
   12.28 +	/*! Used to save relative position while map is not in QGraphicsView */
   12.29 +	virtual void setRelPos(const QPointF&);	
   12.30 +
   12.31 +	/*! Used to save absolute position while map is not in QGraphicsView */
   12.32 +	virtual void setAbsPos(const QPointF&);	
   12.33 +
   12.34 +protected:
   12.35 +	LinkableMapObj *lmo;
   12.36 +public:
   12.37 +	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
   12.38 +	virtual LinkableMapObj* getLMO();
   12.39 +
   12.40 +	/*! Set pointer to related LinkableMapObj in QGraphicsView */
   12.41 +	virtual void setLMO (LinkableMapObj*);
   12.42 +
   12.43 +	/*! Initialize LinkableMapObj with data in MapItem */
   12.44 +	virtual void initLMO();
   12.45 +};
   12.46 +
   12.47 +
   12.48 +#endif
    13.1 --- a/noteobj.cpp	Tue Apr 28 20:53:44 2009 +0000
    13.2 +++ b/noteobj.cpp	Wed Apr 29 18:46:31 2009 +0000
    13.3 @@ -95,7 +95,7 @@
    13.4  	r.replace (rx,indent);
    13.5  	r=indent + r;	// Don't forget first line
    13.6  
    13.7 -/* FIXME-2	wrap text at width
    13.8 +/* FIXME-5	wrap text at width
    13.9  	if (fonthint !="fixed")
   13.10  	{
   13.11  	}
    14.1 --- a/ornamentedobj.h	Tue Apr 28 20:53:44 2009 +0000
    14.2 +++ b/ornamentedobj.h	Wed Apr 29 18:46:31 2009 +0000
    14.3 @@ -72,7 +72,7 @@
    14.4  	virtual void updateSystemFlags();
    14.5  	virtual void updateFlagsToolbar();
    14.6  
    14.7 -	//virtual void getNoteFromTextEditor ();// FIXME should move to vymview?!
    14.8 +	//virtual void getNoteFromTextEditor ();// FIXME-3 should move to vymview?!
    14.9  	virtual QString getOrnXMLAttr();		// get attributes for saveToDir
   14.10  
   14.11  protected:
   14.12 @@ -82,7 +82,7 @@
   14.13  	FrameObj *frame;				// frame around object
   14.14  	QRectF ornamentsBBox;			// bbox of flags and heading
   14.15  	QString url;					// url to external doc
   14.16 -	QString vymLink;				// path to another map  // FIXME-1 remove this
   14.17 +	QString vymLink;				// path to another map  // FIXME-3 remove this
   14.18  	QList <Attribute> attributes;	// List with attributes
   14.19  };
   14.20  
    15.1 --- a/treeitem.cpp	Tue Apr 28 20:53:44 2009 +0000
    15.2 +++ b/treeitem.cpp	Wed Apr 29 18:46:31 2009 +0000
    15.3 @@ -5,12 +5,13 @@
    15.4  
    15.5  #include "branchobj.h"
    15.6  #include "branchitem.h"
    15.7 +#include "mapcenteritem.h"
    15.8  #include "vymmodel.h"
    15.9  
   15.10  using namespace std;
   15.11  
   15.12  
   15.13 -TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
   15.14 +TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent):MapItem()
   15.15  {
   15.16  	init();
   15.17      parentItem = parent;
   15.18 @@ -46,7 +47,6 @@
   15.19  
   15.20      parentItem = NULL;
   15.21      itemData.clear();
   15.22 -	lmo=NULL;	
   15.23  
   15.24  	branchOffset=0;
   15.25  	branchCounter=0;
   15.26 @@ -60,8 +60,6 @@
   15.27  
   15.28  	// Reset ID
   15.29  	objID="";
   15.30 -
   15.31 -
   15.32  }
   15.33  
   15.34  QString TreeItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
   15.35 @@ -377,41 +375,6 @@
   15.36  		parentItem->lastSelectedBranchNum=parentItem->childItems.indexOf(this);
   15.37  }
   15.38  
   15.39 -TreeItem* TreeItem::findBySelectString (const QString &s)  //FIXME-1
   15.40 -{
   15.41 -/*
   15.42 -	LinkableMapObj *lmo=this;
   15.43 -	QString part;
   15.44 -	QString typ;
   15.45 -	QString num;
   15.46 -	while (!s.isEmpty() )
   15.47 -	{
   15.48 -		part=s.section(",",0,0);
   15.49 -		typ=part.left (3);
   15.50 -		num=part.right(part.length() - 3);
   15.51 -		if (typ=="mc:")
   15.52 -		{
   15.53 -			if (depth>0)
   15.54 -				return false;	// in a subtree there is no center
   15.55 -			else
   15.56 -				break;
   15.57 -		} else
   15.58 -			if (typ=="bo:")
   15.59 -				lmo=lmo->getTreeItem()->getBranchObjNum (num.toInt());
   15.60 -			else
   15.61 -				if (typ=="fi:")
   15.62 -					lmo=((BranchObj*)lmo)->getFloatImageNum (num.toUInt());
   15.63 -		if (!lmo) break;
   15.64 -		
   15.65 -		if (s.contains(","))
   15.66 -			s=s.right(s.length() - part.length() -1 );
   15.67 -		else	
   15.68 -			break;
   15.69 -	}
   15.70 -	*/
   15.71 -	return NULL;
   15.72 -}
   15.73 -
   15.74  void TreeItem::setLastSelectedBranch(int i)
   15.75  {
   15.76  		lastSelectedBranchNum=i;
   15.77 @@ -510,13 +473,4 @@
   15.78  }	
   15.79  
   15.80  
   15.81 -LinkableMapObj* TreeItem::getLMO()	// FIXME-3  VM should be unnecessary in the end
   15.82 -{
   15.83 -	return lmo;
   15.84 -}
   15.85  
   15.86 -void TreeItem::setLMO(LinkableMapObj *l)
   15.87 -{
   15.88 -	lmo=l;
   15.89 -}
   15.90 -
    16.1 --- a/treeitem.h	Tue Apr 28 20:53:44 2009 +0000
    16.2 +++ b/treeitem.h	Wed Apr 29 18:46:31 2009 +0000
    16.3 @@ -5,17 +5,16 @@
    16.4  #include <QList>
    16.5  #include <QVariant>
    16.6  
    16.7 +#include "mapitem.h"
    16.8  #include "noteobj.h"
    16.9  #include "xmlobj.h"
   16.10  
   16.11  class LinkableMapObj;
   16.12  class BranchObj;
   16.13  class BranchItem;
   16.14 -
   16.15 -
   16.16  class VymModel;
   16.17  
   16.18 -class TreeItem:public XMLObj
   16.19 +class TreeItem:public XMLObj, public MapItem
   16.20  {
   16.21  public:
   16.22  	enum Type {Undefined,MapCenter,Branch,Image};
   16.23 @@ -77,7 +76,6 @@
   16.24      virtual QString getNoteASCII();			// returns note	(ASCII)
   16.25      virtual QString getNoteOpenDoc();		// returns note	(OpenDoc)
   16.26  
   16.27 -
   16.28  protected:
   16.29  	Type type;
   16.30  public:	
   16.31 @@ -101,7 +99,6 @@
   16.32  	virtual void setLastSelectedBranch();		//! Set myself as last selected in parent
   16.33  	virtual void setLastSelectedBranch(int i);	//! Set last selected branch directly
   16.34  	virtual TreeItem* getLastSelectedBranch();
   16.35 -	virtual TreeItem* findBySelectString (const QString &);	
   16.36  
   16.37  	virtual void setHideTmp (HideTmpMode);
   16.38  	virtual bool hasHiddenExportParent ();
   16.39 @@ -110,10 +107,6 @@
   16.40  	virtual bool isHidden ();		
   16.41  
   16.42  	
   16.43 -	// Relation to map objects in graphicsscene	// FIXME-4 should be obsolete
   16.44 -	virtual LinkableMapObj* getLMO();
   16.45 -	virtual void setLMO (LinkableMapObj*);
   16.46 -
   16.47  protected:
   16.48  	VymModel *model;
   16.49  
   16.50 @@ -121,8 +114,6 @@
   16.51      QList<QVariant> itemData;
   16.52      TreeItem *parentItem;
   16.53   
   16.54 -	LinkableMapObj *lmo;
   16.55 -
   16.56  	int branchOffset;
   16.57  	int branchCounter;
   16.58  	int lastSelectedBranchNum;
    17.1 --- a/treemodel.cpp	Tue Apr 28 20:53:44 2009 +0000
    17.2 +++ b/treemodel.cpp	Wed Apr 29 18:46:31 2009 +0000
    17.3 @@ -183,7 +183,6 @@
    17.4  	int last=row+count-1;
    17.5      TreeItem *pi= getItem (parent);
    17.6  	TreeItem *ti;
    17.7 -	beginRemoveRows (parent,row,last);
    17.8  
    17.9  	for (int i=row; i<=last; i++)
   17.10  	{
   17.11 @@ -202,7 +201,6 @@
   17.12  				break;
   17.13  		}
   17.14  	}
   17.15 -	endRemoveRows ();
   17.16  	return true;
   17.17  }
   17.18  
    18.1 --- a/vym.pro	Tue Apr 28 20:53:44 2009 +0000
    18.2 +++ b/vym.pro	Wed Apr 29 18:46:31 2009 +0000
    18.3 @@ -58,6 +58,7 @@
    18.4  	mapcenterobj.h \
    18.5  	mapcenteritem.h \
    18.6  	mapeditor.h \
    18.7 +	mapitem.h \
    18.8  	mapobj.h \
    18.9  	misc.h \
   18.10  	noteobj.h \
   18.11 @@ -117,6 +118,7 @@
   18.12  	mapcenteritem.cpp \
   18.13  	mapcenterobj.cpp \
   18.14  	mapeditor.cpp \
   18.15 +	mapitem.cpp \
   18.16  	mapobj.cpp \
   18.17  	misc.cpp \
   18.18  	noteobj.cpp \
    19.1 --- a/vymmodel.cpp	Tue Apr 28 20:53:44 2009 +0000
    19.2 +++ b/vymmodel.cpp	Wed Apr 29 18:46:31 2009 +0000
    19.3 @@ -240,6 +240,7 @@
    19.4  	// TODO constr. of FIO creates lots of objects, better do this in some other way...
    19.5  	FloatImageObj (mapScene).resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe...
    19.6  
    19.7 +	cout << "VM::saveToDir 0 " <<saveSel<<endl;
    19.8  	// Build xml recursivly
    19.9  	if (!saveSel || saveSel->getType()==TreeItem::MapCenter)
   19.10  		// Save all mapcenters as complete map, if saveSel not set
   19.11 @@ -254,9 +255,11 @@
   19.12  			//s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
   19.13  	}
   19.14  
   19.15 +	cout << "VM::saveToDir 1 \n";
   19.16  	// Save local settings
   19.17  	s+=settings.getDataXML (destPath);
   19.18  
   19.19 +	cout << "VM::saveToDir 2 \n";
   19.20  	// Save selection
   19.21  	if (getSelectedItem() && !saveSel ) 
   19.22  		s+=xml.valueElement("select",getSelectString());
   19.23 @@ -1232,7 +1235,7 @@
   19.24  
   19.25  	if (blockSaveState) return;
   19.26  
   19.27 -	if (debug) cout << "ME::saveState() for  "<<qPrintable (mapName)<<endl;
   19.28 +	if (debug) cout << "VM::saveState() for  "<<qPrintable (mapName)<<endl;
   19.29  	
   19.30  	// Find out current undo directory
   19.31  	if (undosAvail<stepsTotal) undosAvail++;
   19.32 @@ -1263,6 +1266,7 @@
   19.33  		undoCommand.replace ("PATH",bakMapPath);
   19.34  	}
   19.35  
   19.36 +
   19.37  	if (!backupXML.isEmpty())
   19.38  		// Write XML Data to disk
   19.39  		saveStringToDisk (bakMapPath,backupXML);
   19.40 @@ -1329,7 +1333,7 @@
   19.41  		undoSel);
   19.42  }
   19.43  
   19.44 -void VymModel::saveStateRemovingPart(TreeItem*redoSel, const QString &comment)
   19.45 +void VymModel::saveStateRemovingPart(TreeItem* redoSel, const QString &comment)
   19.46  {
   19.47  	if (!redoSel)
   19.48  	{
   19.49 @@ -1397,8 +1401,9 @@
   19.50  	return mapScene;
   19.51  }
   19.52  
   19.53 -TreeItem* VymModel::findBySelectString(const QString &s)
   19.54 -{
   19.55 +TreeItem* VymModel::findBySelectString(const QString &s)	//FIXME-0
   19.56 +{
   19.57 +	return NULL;
   19.58  	if (!s.isEmpty() )
   19.59  	{
   19.60  		QString part;
   19.61 @@ -1414,7 +1419,7 @@
   19.62  	TreeItem *ti;
   19.63  	for (int i=0; i<rootItem->branchCount(); i++)
   19.64  	{
   19.65 -		ti=rootItem->getBranchNum(i)->findBySelectString(s);
   19.66 +		// ti=rootItem->getBranchNum(i)->findBySelectString(s);
   19.67  		if (ti) return ti;
   19.68  	}	
   19.69  	return NULL;
   19.70 @@ -2066,8 +2071,7 @@
   19.71  
   19.72  	QList<QVariant> cData;
   19.73  	cData << "VM:addMapCenter" << "undef"<<"undef";
   19.74 -	MapCenterItem *mci=new MapCenterItem (cData,rootItem);
   19.75 -	mci->setType (TreeItem::MapCenter);
   19.76 +	MapCenterItem *mci=new MapCenterItem (cData);
   19.77  	mci->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
   19.78  	rootItem->appendChild (mci);
   19.79  
   19.80 @@ -2076,7 +2080,20 @@
   19.81  	emit (layoutChanged() );
   19.82  
   19.83  	// Create MapObj
   19.84 -	MapCenterObj *mapCenter = new MapCenterObj(mapScene,this);
   19.85 +	BranchObj *newbo=mci->createMapObj(mapScene);
   19.86 +		
   19.87 +	/*
   19.88 +
   19.89 +	if (!mci->getHeading().isEmpty() ) 
   19.90 +	{
   19.91 +		newbo->updateHeading();
   19.92 +		newbo->setColor (headingColor);
   19.93 +	}	
   19.94 +*/
   19.95 +		
   19.96 +	//newbo->updateLink();	//FIXME-3
   19.97 +
   19.98 +/*
   19.99  	//mapCenter->setMapEditor(mapEditor);		//FIXME-3 VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects
  19.100  	mapCenter->setTreeItem (mci);	// TreeItem needs to exist before setVisibility
  19.101  	mci->setLMO (mapCenter);
  19.102 @@ -2084,39 +2101,10 @@
  19.103  	mapCenter->move (absPos);
  19.104      mapCenter->setVisibility (true);
  19.105  	//mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
  19.106 -	// Testing
  19.107 -/*
  19.108 -	qWarning ("MW::insertRow a");
  19.109 -    if (!insertRow(0, parix))
  19.110 -	{
  19.111 -		std::cout << "  war nix...\n";
  19.112 -	}	
  19.113 -	qWarning ("MW::insertRow b");
  19.114  */
  19.115 -
  19.116  	return mci;
  19.117  }
  19.118  
  19.119 -MapCenterItem* VymModel::removeMapCenter(MapCenterItem* mci) //FIXME-2
  19.120 -{
  19.121 -/*
  19.122 -	int i=mapCenters.indexOf (mco);
  19.123 -	if (i>=0)
  19.124 -	{
  19.125 -		mapCenters.removeAt (i);
  19.126 -		delete (mco);
  19.127 -		if (i>0) return rootItem->getBranchNum(i-1);	// Return previous MCO
  19.128 -	}
  19.129 -*/	
  19.130 -	return NULL;
  19.131 -}
  19.132 -
  19.133 -MapCenterObj* VymModel::getLastMapCenter()		// FIXME-3 still needed?
  19.134 -{
  19.135 -	return (MapCenterObj*)rootItem->getLastBranch();
  19.136 -}
  19.137 -
  19.138 -
  19.139  BranchItem* VymModel::addNewBranchInt(int num)
  19.140  {
  19.141  	// Depending on pos:
  19.142 @@ -2142,7 +2130,6 @@
  19.143  			emit (layoutAboutToBeChanged() );
  19.144  			beginInsertRows (parix,n,n+1);	//FIXME-1 check if n is correct: should be index below _last_ branch...
  19.145  			bi=new BranchItem (cData);	
  19.146 -			bi->setType (TreeItem::Branch);
  19.147  			bi->setHeading (QApplication::translate("Heading of new branch in map", "new"));
  19.148  
  19.149  			parbi->appendChild (bi);	
  19.150 @@ -2286,60 +2273,21 @@
  19.151  
  19.152  	if (!selbi) return;
  19.153  
  19.154 -	QModelIndex ix=index (selbi);
  19.155 -	if (!ix.isValid() ) return;
  19.156 -
  19.157 -	QModelIndex parentIndex=parent(ix);
  19.158 -/*
  19.159 -	if (!parentIndex.isValid()) 
  19.160 -	{
  19.161 -	cout << "VM::delete no valid parent ix\n";
  19.162 -	return;
  19.163 -	}
  19.164 -*/	
  19.165 +	TreeItem *pi=selbi->parent();
  19.166 +	QModelIndex parentIndex=index(pi);
  19.167  	
  19.168 -	/*
  19.169 -	if (selbi->getType()==TreeItem::MapCenter)	
  19.170 -	{
  19.171 -	//	BranchObj* par=(BranchObj*)(bo->getParObj());
  19.172 -		//selection.unselect();
  19.173 -		// FIXME-1 VM Note:  does saveStateRemovingPart work for MCO? (No parent!)
  19.174 -		//saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
  19.175 -		emit (layoutAboutToBeChanged() );
  19.176 -
  19.177 -		parentIndex=parent(index(selbi));
  19.178 -		cout << "VM::delete  selbi="<<selbi<<"  row="<<ix.row()<<"  parIndex.valid="<<parentIndex.isValid()<<endl;
  19.179 -		int n=ix.row();
  19.180 -		beginRemoveRows (parentIndex,n,n);
  19.181 -		removeRows (n,1,parentIndex);
  19.182 -		MapCenterItem *mci=removeMapCenter (selbi);
  19.183 -		endRemoveRows();
  19.184 -		if (mci) 
  19.185 -		{
  19.186 -			select (mci);
  19.187 -			ensureSelectionVisible();
  19.188 -			reposition();
  19.189 -		}	
  19.190 -
  19.191 -		emit (layoutChanged() );
  19.192 -	}
  19.193 -	if (selbi->getType()==TreeItem::Branch)
  19.194 -	*/
  19.195  	if (selbi->isBranchLikeType() )
  19.196  	{
  19.197 -
  19.198 -		BranchObj* par=(BranchObj*)bo->getParObj();
  19.199  		unselect();
  19.200 -		saveStateRemovingPart (selbi, QString ("Delete %1").arg(getObjectName(bo)));
  19.201 +		saveStateRemovingPart (selbi, QString ("Delete %1").arg(getObjectName(selbi)));
  19.202  
  19.203  		emit (layoutAboutToBeChanged() );
  19.204  
  19.205 -		parentIndex=parent(index(selbi));
  19.206 -		int n=ix.row();
  19.207 +		int n=selbi->childNum();
  19.208  		beginRemoveRows (parentIndex,n,n);
  19.209  		removeRows (n,1,parentIndex);
  19.210  		endRemoveRows();
  19.211 -		select (par);
  19.212 +		select (pi);
  19.213  		ensureSelectionVisible();
  19.214  		reposition();
  19.215  
  19.216 @@ -3971,7 +3919,7 @@
  19.217  
  19.218  void VymModel::updateRelPositions()		//FIXME-2 VM should have no need to updateRelPos
  19.219  {
  19.220 -	cout << "VM::updateRelPos...\n";
  19.221 +	//cout << "VM::updateRelPos...\n";
  19.222  	for (int i=0; i<rootItem->branchCount(); i++)
  19.223  		((MapCenterObj*)rootItem->getBranchObjNum(i))->updateRelPositions();
  19.224  }
    20.1 --- a/vymmodel.h	Tue Apr 28 20:53:44 2009 +0000
    20.2 +++ b/vymmodel.h	Wed Apr 29 18:46:31 2009 +0000
    20.3 @@ -293,8 +293,6 @@
    20.4  	MapCenterItem* addMapCenter();
    20.5  private:	
    20.6  	MapCenterItem* addMapCenter(QPointF absPos);
    20.7 -public:	
    20.8 -	MapCenterItem* removeMapCenter(MapCenterItem *mci);
    20.9  
   20.10  	/*! \brief Add new branch
   20.11  
   20.12 @@ -306,7 +304,6 @@
   20.13  		0..n	insert at a specific position in selections parent
   20.14  		(needed for free relinking)
   20.15  	*/	
   20.16 -	MapCenterObj* getLastMapCenter();		//!< get last added MapCenter, used for context menu
   20.17  
   20.18  private:	
   20.19      BranchItem* addNewBranchInt(int);		// pos allows to add above/below selection
    21.1 --- a/xml-base.cpp	Tue Apr 28 20:53:44 2009 +0000
    21.2 +++ b/xml-base.cpp	Wed Apr 29 18:46:31 2009 +0000
    21.3 @@ -72,7 +72,7 @@
    21.4  		QStringList sl=QStringList::split ("\n",s);
    21.5  		int i=1;
    21.6  		QStringList::Iterator it = sl.begin();
    21.7 -		while (i<exception.lineNumber()-1)
    21.8 +		while (i<exception.lineNumber())
    21.9  		{
   21.10  			it++;
   21.11  			i++;
    22.1 --- a/xml-vym.cpp	Tue Apr 28 20:53:44 2009 +0000
    22.2 +++ b/xml-vym.cpp	Wed Apr 29 18:46:31 2009 +0000
    22.3 @@ -410,8 +410,7 @@
    22.4  
    22.5  bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
    22.6  {
    22.7 -	BranchObj *bo=(BranchObj*)lastBranchItem->getLMO();
    22.8 -	if (bo)
    22.9 +	if (lastBranchItem)
   22.10  	{
   22.11  		bool okx,oky;
   22.12  		float x,y;
   22.13 @@ -422,10 +421,7 @@
   22.14  				x=a.value("relPosX").toFloat (&okx);
   22.15  				y=a.value("relPosY").toFloat (&oky);
   22.16  				if (okx && oky  )
   22.17 -				{
   22.18 -					bo->setUseRelPos (true);
   22.19 -					bo->move2RelPos (x,y);
   22.20 -				}	
   22.21 +					lastBranchItem->setRelPos (QPointF(x,y));
   22.22  				else
   22.23  					return false;   // Couldn't read relPos
   22.24  			}           
   22.25 @@ -437,7 +433,7 @@
   22.26  				x=a.value("absPosX").toFloat (&okx);
   22.27  				y=a.value("absPosY").toFloat (&oky);
   22.28  				if (okx && oky  )
   22.29 -					bo->move(x,y);
   22.30 +					lastBranchItem->setAbsPos (QPointF(x,y));
   22.31  				else
   22.32  					return false;   // Couldn't read absPos
   22.33  			}