branchitem.cpp
changeset 790 133e2ed6b9c5
parent 788 78ba80b54bc4
child 791 f1006de05c54
     1.1 --- a/branchitem.cpp	Mon Aug 24 14:39:07 2009 +0000
     1.2 +++ b/branchitem.cpp	Thu Sep 03 08:52:00 2009 +0000
     1.3 @@ -1,6 +1,7 @@
     1.4  #include "branchitem.h"
     1.5  #include "branchobj.h"
     1.6  #include "vymmodel.h"
     1.7 +#include "xlinkitem.h"
     1.8  
     1.9  #include <iostream>
    1.10  #include <QDir>
    1.11 @@ -87,15 +88,13 @@
    1.12  	} else
    1.13  		areaAttr="";
    1.14  	
    1.15 -	/*	
    1.16 -	// FIXME-3 Providing an ID for a branch makes export to XHTML easier
    1.17 +	// Provide an ID for a branch makes export to XHTML easier
    1.18  	QString idAttr;
    1.19 -	if (countXLinks()>0)
    1.20 -		idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
    1.21 +	if (xlinkCount()>0)
    1.22 +		idAttr=attribut ("id",model->getSelectString(this)); 
    1.23  	else
    1.24  		idAttr="";
    1.25  
    1.26 -	*/
    1.27  	QString elementName;
    1.28  	if (parentItem==rootItem)
    1.29  		elementName="mapcenter";
    1.30 @@ -106,8 +105,8 @@
    1.31  		+getMapAttr()
    1.32  		+getGeneralAttr()
    1.33  		+scrolledAttr 
    1.34 -	//	+areaAttr 
    1.35 -	//	+idAttr 
    1.36 +	//	+areaAttr	// FIXME-2
    1.37 +		+idAttr 
    1.38  		+getIncludeImageAttr() 
    1.39  		);
    1.40      incIndent();
    1.41 @@ -141,13 +140,12 @@
    1.42  		ti=getBranchNum(i);
    1.43  	}	
    1.44  
    1.45 -	/*
    1.46 -	// Save XLinks
    1.47 +	// Save XLinks 
    1.48  	QString ol;	// old link
    1.49  	QString cl;	// current link
    1.50 -	for (int i=0; i<xlink.size(); ++i)
    1.51 +	for (int i=0; i<xlinkCount(); ++i)
    1.52  	{
    1.53 -		cl=xlink.at(i)->saveToDir();
    1.54 +		cl=getXLinkNum(i)->saveToDir();
    1.55  		if (cl!=ol)
    1.56  		{
    1.57  			s+=cl;
    1.58 @@ -157,7 +155,6 @@
    1.59  			qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
    1.60  		}
    1.61  	}	
    1.62 -	*/
    1.63  
    1.64      decIndent();
    1.65      s+=endElement   (elementName);
    1.66 @@ -373,7 +370,7 @@
    1.67  	return NULL;
    1.68  }
    1.69  
    1.70 -TreeItem* BranchItem::findID (QString sid)
    1.71 +TreeItem* BranchItem::findID (QString sid)	//FIXME-3 move to TreeItem	//FIXME-4 search images
    1.72  {
    1.73  	// Search branches
    1.74      TreeItem *ti;
    1.75 @@ -388,7 +385,7 @@
    1.76  
    1.77  
    1.78  /*
    1.79 -	// Search float images //FIXME-4
    1.80 +	// Search float images 
    1.81      for (int i=0; i<floatimage.size(); ++i )
    1.82  		if (floatimage.at(i)->inBox(p) && 
    1.83  			(floatimage.at(i) != excludeLMO) && 
    1.84 @@ -417,8 +414,7 @@
    1.85  BranchObj* BranchItem::createMapObj(QGraphicsScene *scene)	// FIXME-4 maybe move this into MapEditor to get rid of scene in VymModel?
    1.86  {
    1.87  	BranchObj *newbo;
    1.88 -	newbo=new BranchObj(scene);
    1.89 -	newbo->setTreeItem (this);
    1.90 +	newbo=new BranchObj(scene,this);
    1.91  	lmo=newbo;
    1.92  
    1.93  	if (parentItem==rootItem)