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)
     2.1 --- a/branchitem.h	Mon Aug 24 14:39:07 2009 +0000
     2.2 +++ b/branchitem.h	Thu Sep 03 08:52:00 2009 +0000
     2.3 @@ -5,8 +5,9 @@
     2.4  
     2.5  
     2.6  class QString;
     2.7 +class QGraphicsScene;
     2.8  class BranchObj;
     2.9 -class QGraphicsScene;
    2.10 +class XLinkItem;
    2.11  
    2.12  class BranchItem:public MapItem
    2.13  {
     3.1 --- a/branchobj.cpp	Mon Aug 24 14:39:07 2009 +0000
     3.2 +++ b/branchobj.cpp	Thu Sep 03 08:52:00 2009 +0000
     3.3 @@ -13,21 +13,16 @@
     3.4  // BranchObj
     3.5  /////////////////////////////////////////////////////////////////
     3.6  
     3.7 -BranchObj::BranchObj () :OrnamentedObj()	// FIXME-3 needed at all?
     3.8 -{
     3.9 -//    cout << "Const BranchObj ()\n";
    3.10 -    setParObj (this);	
    3.11 -    init();
    3.12 -}
    3.13 -
    3.14 -BranchObj::BranchObj (QGraphicsScene* s):OrnamentedObj (s)// FIXME-3 needed at all?
    3.15 +BranchObj::BranchObj (QGraphicsScene* s,TreeItem *ti):OrnamentedObj (s)
    3.16  {
    3.17  //    cout << "Const BranchObj (s)  \n";
    3.18  	parObj=NULL;
    3.19      scene=s;
    3.20 +	treeItem=ti;
    3.21  	init();
    3.22  }
    3.23  
    3.24 +/*
    3.25  BranchObj::BranchObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s)// FIXME-3 needed at all?
    3.26  {
    3.27  //    cout << "Const BranchObj (s,p)\n";
    3.28 @@ -41,6 +36,7 @@
    3.29  								(y() - parObj->getChildPos().y() ) ) );
    3.30      init();
    3.31  }
    3.32 +*/
    3.33  
    3.34  BranchObj::~BranchObj ()
    3.35  {
    3.36 @@ -210,8 +206,8 @@
    3.37  		int i;
    3.38  		for (i=0; i<treeItem->imageCount(); ++i)
    3.39  			treeItem->getImageObjNum(i)->setVisibility (v);
    3.40 -		for (i=0; i<xlink.size(); ++i)	
    3.41 -			xlink.at(i)->setVisibility ();	
    3.42 +		for (i=0; i<treeItem->xlinkCount(); ++i)	
    3.43 +			treeItem->getXLinkObjNum(i)->setVisibility ();	
    3.44  
    3.45  		// Only change children, if I am not scrolled
    3.46  		if (! bi->isScrolled() && (bi->depth() < toDepth))
    3.47 @@ -299,9 +295,13 @@
    3.48  	// set the frame
    3.49  	frame->setRect(QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
    3.50  
    3.51 -	// Update links to other branches
    3.52 -	for (int i=0; i<xlink.size(); ++i)
    3.53 -		xlink.at(i)->updateXLink();
    3.54 +	//Update links to other branches
    3.55 +	XLinkObj *xlo;
    3.56 +	for (int i=0; i<treeItem->xlinkCount(); ++i)	
    3.57 +	{
    3.58 +		xlo=treeItem->getXLinkObjNum(i);
    3.59 +		if (xlo) xlo->updateXLink();
    3.60 +	}	
    3.61  }
    3.62  
    3.63  void BranchObj::calcBBoxSize()
    3.64 @@ -472,105 +472,6 @@
    3.65  	updateContentSize();
    3.66  }
    3.67  
    3.68 -
    3.69 -void BranchObj::addXLink (XLinkObj *xlo)
    3.70 -{
    3.71 -	xlink.append (xlo);
    3.72 -	
    3.73 -}
    3.74 -
    3.75 -void BranchObj::removeXLinkRef (XLinkObj *xlo)
    3.76 -{
    3.77 -	xlink.removeAt (xlink.indexOf(xlo));
    3.78 -}
    3.79 -
    3.80 -void BranchObj::deleteXLink(XLinkObj *xlo)
    3.81 -{
    3.82 -	xlo->deactivate();
    3.83 -	if (!xlo->isUsed()) delete (xlo);
    3.84 -}
    3.85 -
    3.86 -void BranchObj::deleteXLinkAt (int i)
    3.87 -{
    3.88 -	XLinkObj *xlo=xlink.at(i);
    3.89 -	xlo->deactivate();
    3.90 -	if (!xlo->isUsed()) delete(xlo);
    3.91 -}
    3.92 -
    3.93 -XLinkObj* BranchObj::XLinkAt (int i)
    3.94 -{
    3.95 -	return xlink.at(i);
    3.96 -}
    3.97 -
    3.98 -BranchObj* BranchObj::XLinkTargetAt (int i)
    3.99 -{
   3.100 -	if (i>=0 && i<xlink.size())
   3.101 -	{
   3.102 -		if (xlink.at(i))
   3.103 -			return xlink.at(i)->otherBranch (this);
   3.104 -	}
   3.105 -	return NULL;
   3.106 -}
   3.107 -
   3.108 - 
   3.109 -// FIXME-3 FloatImageObj* BranchObj::addFloatImage ()
   3.110 -/*
   3.111 -{
   3.112 -	FloatImageObj *newfi=new FloatImageObj (scene,this);
   3.113 -	floatimage.append (newfi);
   3.114 -	if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem) )
   3.115 -		newfi->setVisibility (false);
   3.116 -	else	
   3.117 -		newfi->setVisibility(visible);
   3.118 -	//calcBBoxSize();
   3.119 -	//positionBBox();
   3.120 -	requestReposition();
   3.121 -	return newfi;
   3.122 -}
   3.123 -*/
   3.124 -
   3.125 -//FIXME-3 FloatImageObj* BranchObj::addFloatImage (FloatImageObj *fio)
   3.126 -/*
   3.127 -{
   3.128 -	FloatImageObj *newfi=new FloatImageObj (scene,this);
   3.129 -	floatimage.append (newfi);
   3.130 -	newfi->copy (fio);
   3.131 -	if (((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem) )
   3.132 -		newfi->setVisibility (false);
   3.133 -	else	
   3.134 -		newfi->setVisibility(visible);
   3.135 -	//calcBBoxSize();
   3.136 -	//positionBBox();
   3.137 -	requestReposition();
   3.138 -	return newfi;
   3.139 -}
   3.140 -*/
   3.141 -
   3.142 -/* FIXME-3 FloatImageObj* BranchObj::getFirstFloatImage ()
   3.143 -{
   3.144 -    return floatimage.first();
   3.145 -}
   3.146 -
   3.147 -FloatImageObj* BranchObj::getLastFloatImage ()
   3.148 -{
   3.149 -    return floatimage.last();
   3.150 -}
   3.151 -
   3.152 -FIXME -3 FloatImageObj* BranchObj::getFloatImageNum (const uint &i)
   3.153 -{
   3.154 -    return floatimage.at(i);
   3.155 -}
   3.156 -
   3.157 -void BranchObj::removeFloatImage (FloatImageObj *fio)
   3.158 -{
   3.159 -	int i=floatimage.indexOf (fio);
   3.160 -	if (i>-1) delete (floatimage.takeAt (i));
   3.161 -	calcBBoxSize();
   3.162 -	positionBBox();
   3.163 -	requestReposition();
   3.164 -}
   3.165 -*/
   3.166 -
   3.167  void BranchObj::savePosInAngle ()
   3.168  {
   3.169  	// Save position in angle
     4.1 --- a/branchobj.h	Mon Aug 24 14:39:07 2009 +0000
     4.2 +++ b/branchobj.h	Thu Sep 03 08:52:00 2009 +0000
     4.3 @@ -17,10 +17,7 @@
     4.4  	/*! New branches will get use same color for heading as parent */
     4.5  	enum BranchModification {NewBranch, MovedBranch};
     4.6  
     4.7 -
     4.8 -    BranchObj ();
     4.9 -    BranchObj (QGraphicsScene*);
    4.10 -    BranchObj (QGraphicsScene*, LinkableMapObj* parent);
    4.11 +    BranchObj (QGraphicsScene*,TreeItem *ti=NULL);
    4.12      ~BranchObj ();
    4.13  	bool operator< ( const BranchObj & );
    4.14  	bool operator== ( const BranchObj & );
    4.15 @@ -47,21 +44,6 @@
    4.16      
    4.17      virtual void updateData();	//! Update represantatio of heading, flags, etc.
    4.18  
    4.19 -	virtual void addXLink (XLinkObj*);
    4.20 -	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
    4.21 -	virtual void deleteXLink (XLinkObj*);	// remove references and delete XLinkObj 
    4.22 -	virtual void deleteXLinkAt (int);		// remove references and delete XLinkObj 
    4.23 -	virtual XLinkObj* XLinkAt (int);		// return reference of XLinkObj 
    4.24 -	virtual BranchObj* XLinkTargetAt (int);
    4.25 -
    4.26 -/* FIXME-3
    4.27 -	virtual FloatImageObj* addFloatImage();
    4.28 -	virtual FloatImageObj* addFloatImage(FloatImageObj*);
    4.29 -	virtual void removeFloatImage(FloatImageObj*);
    4.30 -    virtual FloatImageObj* getFirstFloatImage();
    4.31 -    virtual FloatImageObj* getLastFloatImage();
    4.32 -*/	
    4.33 -//FIXME-3	virtual FloatImageObj* getFloatImageNum(const uint &);
    4.34  protected:	
    4.35  	virtual void savePosInAngle();					// write pos in angle for resorting			
    4.36  public:	
    4.37 @@ -82,7 +64,6 @@
    4.38  	virtual bool animate();
    4.39  
    4.40  protected:
    4.41 -	//FIXME-3 QList<FloatImageObj*> floatimage;// child images
    4.42  	QList<XLinkObj*> xlink;			// xlinks to other branches
    4.43  
    4.44  	AnimPoint anim;
     5.1 --- a/editxlinkdialog.cpp	Mon Aug 24 14:39:07 2009 +0000
     5.2 +++ b/editxlinkdialog.cpp	Thu Sep 03 08:52:00 2009 +0000
     5.3 @@ -3,13 +3,15 @@
     5.4  #include <typeinfo>
     5.5  #include <QColorDialog>
     5.6  
     5.7 +#include "branchitem.h"
     5.8 +
     5.9  EditXLinkDialog::EditXLinkDialog (QWidget *parent):QDialog (parent)
    5.10  {
    5.11  	ui.setupUi (this);
    5.12  
    5.13  	delink=false;
    5.14 -	xlo=false;
    5.15 -	selection=NULL;
    5.16 +	xli=NULL;
    5.17 +	selbi=NULL;
    5.18  
    5.19  	connect ( ui.widthBox, SIGNAL (valueChanged( int)), this, SLOT (widthChanged (int)));
    5.20  	connect ( ui.colorButton, SIGNAL (clicked( )), this, SLOT (colorButtonPressed()));
    5.21 @@ -31,47 +33,43 @@
    5.22  
    5.23  void EditXLinkDialog::widthChanged( int  w)
    5.24  {
    5.25 -	xlo->setWidth(w);
    5.26 +	xli->setWidth(w);
    5.27  }
    5.28  
    5.29 -void EditXLinkDialog::setXLink( XLinkObj * xo)
    5.30 +void EditXLinkDialog::setXLink( XLinkItem * xi)
    5.31  {
    5.32 -	xlo=xo;
    5.33 -	ui.colorButton->setPaletteBackgroundColor (xlo->getColor() );
    5.34 -	ui.widthBox->setValue(xlo->getWidth());
    5.35 +	xli=xi;
    5.36 +	ui.colorButton->setPaletteBackgroundColor (xli->getColor() );
    5.37 +	ui.widthBox->setValue(xli->getWidth());
    5.38  }
    5.39  
    5.40 -void EditXLinkDialog::setSelection(LinkableMapObj *s)
    5.41 +void EditXLinkDialog::setSelection(BranchItem *bi)
    5.42  {
    5.43 -	selection=s;
    5.44 +	selbi=bi;
    5.45  }
    5.46  
    5.47  void EditXLinkDialog::colorButtonPressed()
    5.48  {
    5.49 -	if (xlo)
    5.50 +	if (xli)
    5.51  	{	
    5.52 -		QColor col = QColorDialog::getColor(xlo->getColor(), this );
    5.53 +		QColor col = QColorDialog::getColor(xli->getColor(), this );
    5.54  		if ( !col.isValid() ) return;
    5.55 -		xlo->setColor( col );
    5.56 +		xli->setColor( col );
    5.57  		ui.colorButton->setPaletteBackgroundColor (col);
    5.58  	}
    5.59  }
    5.60  
    5.61 -void EditXLinkDialog::setColorHeadingButtonPressed()	//FIXME-2
    5.62 +void EditXLinkDialog::setColorHeadingButtonPressed()	
    5.63  {
    5.64 -/*
    5.65 -	if (xlo)
    5.66 +	if (xli)
    5.67  	{	
    5.68 -		if (selection && 
    5.69 -			(typid(*selection) == typid(BranchObj) || 
    5.70 -			typid(*selection) == typid(MapCenterObj))  )
    5.71 +		if (selbi)
    5.72  		{
    5.73 -			QColor col=((BranchObj*)(selection))->getColor();
    5.74 -			xlo->setColor(col);
    5.75 +			QColor col=selbi->getHeadingColor();
    5.76 +			xli->setColor(col);
    5.77  			ui.colorButton->setPaletteBackgroundColor (col);
    5.78  		}
    5.79  	}
    5.80 -	*/
    5.81  }
    5.82  
    5.83  bool EditXLinkDialog::useSettingsGlobal ()
     6.1 --- a/editxlinkdialog.h	Mon Aug 24 14:39:07 2009 +0000
     6.2 +++ b/editxlinkdialog.h	Thu Sep 03 08:52:00 2009 +0000
     6.3 @@ -10,13 +10,15 @@
     6.4  where you want to have crossreferences which don't fit on the same visible area
     6.5  */
     6.6  
     6.7 +class BranchItem;
     6.8 +
     6.9  class EditXLinkDialog:public QDialog
    6.10  {
    6.11  	Q_OBJECT
    6.12  public:
    6.13  	EditXLinkDialog (QWidget *parent=0);
    6.14 -	void setXLink (XLinkObj *);
    6.15 -	void setSelection (LinkableMapObj *);
    6.16 +	void setXLink (XLinkItem *);
    6.17 +	void setSelection (BranchItem*);
    6.18  	bool useSettingsGlobal();
    6.19  	bool deleteXLink();
    6.20  
    6.21 @@ -29,8 +31,8 @@
    6.22  private:
    6.23  	Ui::EditXLinkDialog ui;
    6.24  	bool delink;
    6.25 -	XLinkObj *xlo;
    6.26 -	LinkableMapObj *selection;
    6.27 +	XLinkItem *xli;
    6.28 +	BranchItem *selbi;
    6.29  };
    6.30  
    6.31  #endif // EDITXLINKDIALOG_H
     7.1 --- a/editxlinkdialog.ui	Mon Aug 24 14:39:07 2009 +0000
     7.2 +++ b/editxlinkdialog.ui	Thu Sep 03 08:52:00 2009 +0000
     7.3 @@ -1,126 +1,120 @@
     7.4 -<ui version="4.0" >
     7.5 - <author></author>
     7.6 - <comment></comment>
     7.7 - <exportmacro></exportmacro>
     7.8 +<?xml version="1.0" encoding="UTF-8"?>
     7.9 +<ui version="4.0">
    7.10   <class>EditXLinkDialog</class>
    7.11 - <widget class="QDialog" name="EditXLinkDialog" >
    7.12 -  <property name="geometry" >
    7.13 + <widget class="QDialog" name="EditXLinkDialog">
    7.14 +  <property name="geometry">
    7.15     <rect>
    7.16      <x>0</x>
    7.17      <y>0</y>
    7.18 -    <width>393</width>
    7.19 -    <height>206</height>
    7.20 +    <width>383</width>
    7.21 +    <height>167</height>
    7.22     </rect>
    7.23    </property>
    7.24 -  <property name="sizePolicy" >
    7.25 -   <sizepolicy>
    7.26 -    <hsizetype>5</hsizetype>
    7.27 -    <vsizetype>5</vsizetype>
    7.28 +  <property name="sizePolicy">
    7.29 +   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
    7.30      <horstretch>0</horstretch>
    7.31      <verstretch>0</verstretch>
    7.32     </sizepolicy>
    7.33    </property>
    7.34 -  <property name="windowTitle" >
    7.35 +  <property name="windowTitle">
    7.36     <string>Edit XLink</string>
    7.37    </property>
    7.38 -  <layout class="QVBoxLayout" >
    7.39 -   <property name="margin" >
    7.40 +  <layout class="QVBoxLayout">
    7.41 +   <property name="spacing">
    7.42 +    <number>6</number>
    7.43 +   </property>
    7.44 +   <property name="margin">
    7.45      <number>11</number>
    7.46     </property>
    7.47 -   <property name="spacing" >
    7.48 -    <number>6</number>
    7.49 -   </property>
    7.50     <item>
    7.51 -    <layout class="QGridLayout" >
    7.52 -     <property name="margin" >
    7.53 +    <layout class="QGridLayout">
    7.54 +     <property name="margin">
    7.55        <number>0</number>
    7.56       </property>
    7.57 -     <property name="spacing" >
    7.58 +     <property name="spacing">
    7.59        <number>6</number>
    7.60       </property>
    7.61 -     <item row="0" column="1" >
    7.62 -      <widget class="QSpinBox" name="widthBox" >
    7.63 -       <property name="sizePolicy" >
    7.64 -        <sizepolicy>
    7.65 -         <hsizetype>0</hsizetype>
    7.66 -         <vsizetype>0</vsizetype>
    7.67 +     <item row="0" column="1">
    7.68 +      <widget class="QSpinBox" name="widthBox">
    7.69 +       <property name="sizePolicy">
    7.70 +        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
    7.71           <horstretch>0</horstretch>
    7.72           <verstretch>0</verstretch>
    7.73          </sizepolicy>
    7.74         </property>
    7.75 -       <property name="maximum" >
    7.76 +       <property name="minimum">
    7.77 +        <number>1</number>
    7.78 +       </property>
    7.79 +       <property name="maximum">
    7.80          <number>15</number>
    7.81         </property>
    7.82 -       <property name="minimum" >
    7.83 -        <number>1</number>
    7.84 -       </property>
    7.85        </widget>
    7.86       </item>
    7.87 -     <item row="0" column="0" >
    7.88 -      <widget class="QLabel" name="textLabel1" >
    7.89 -       <property name="text" >
    7.90 +     <item row="0" column="0">
    7.91 +      <widget class="QLabel" name="textLabel1">
    7.92 +       <property name="text">
    7.93          <string>XLink width:</string>
    7.94         </property>
    7.95 -       <property name="alignment" >
    7.96 +       <property name="alignment">
    7.97          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    7.98         </property>
    7.99        </widget>
   7.100       </item>
   7.101 -     <item row="1" column="4" >
   7.102 -      <widget class="QPushButton" name="setColorHeadingButton" >
   7.103 -       <property name="maximumSize" >
   7.104 +     <item row="1" column="4">
   7.105 +      <widget class="QPushButton" name="setColorHeadingButton">
   7.106 +       <property name="maximumSize">
   7.107          <size>
   7.108           <width>32767</width>
   7.109           <height>20</height>
   7.110          </size>
   7.111         </property>
   7.112 -       <property name="text" >
   7.113 +       <property name="text">
   7.114          <string>Set color of heading</string>
   7.115         </property>
   7.116        </widget>
   7.117       </item>
   7.118 -     <item row="1" column="1" >
   7.119 -      <widget class="QPushButton" name="colorButton" >
   7.120 -       <property name="enabled" >
   7.121 +     <item row="1" column="1">
   7.122 +      <widget class="QPushButton" name="colorButton">
   7.123 +       <property name="enabled">
   7.124          <bool>true</bool>
   7.125         </property>
   7.126 -       <property name="maximumSize" >
   7.127 +       <property name="maximumSize">
   7.128          <size>
   7.129           <width>50</width>
   7.130           <height>20</height>
   7.131          </size>
   7.132         </property>
   7.133 -       <property name="text" >
   7.134 +       <property name="text">
   7.135          <string/>
   7.136         </property>
   7.137        </widget>
   7.138       </item>
   7.139 -     <item row="2" column="1" colspan="2" >
   7.140 -      <widget class="QCheckBox" name="useSettings" >
   7.141 -       <property name="text" >
   7.142 +     <item row="2" column="1" colspan="2">
   7.143 +      <widget class="QCheckBox" name="useSettings">
   7.144 +       <property name="text">
   7.145          <string/>
   7.146         </property>
   7.147        </widget>
   7.148       </item>
   7.149 -     <item row="1" column="0" >
   7.150 -      <widget class="QLabel" name="textLabel2" >
   7.151 -       <property name="text" >
   7.152 +     <item row="1" column="0">
   7.153 +      <widget class="QLabel" name="textLabel2">
   7.154 +       <property name="text">
   7.155          <string>XLink color:</string>
   7.156         </property>
   7.157 -       <property name="alignment" >
   7.158 +       <property name="alignment">
   7.159          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
   7.160         </property>
   7.161        </widget>
   7.162       </item>
   7.163 -     <item row="1" column="2" colspan="2" >
   7.164 +     <item row="1" column="2" colspan="2">
   7.165        <spacer>
   7.166 -       <property name="orientation" >
   7.167 +       <property name="orientation">
   7.168          <enum>Qt::Horizontal</enum>
   7.169         </property>
   7.170 -       <property name="sizeType" >
   7.171 +       <property name="sizeType">
   7.172          <enum>QSizePolicy::Expanding</enum>
   7.173         </property>
   7.174 -       <property name="sizeHint" >
   7.175 +       <property name="sizeHint" stdset="0">
   7.176          <size>
   7.177           <width>285</width>
   7.178           <height>20</height>
   7.179 @@ -128,15 +122,15 @@
   7.180         </property>
   7.181        </spacer>
   7.182       </item>
   7.183 -     <item row="0" column="2" colspan="2" >
   7.184 +     <item row="0" column="2" colspan="2">
   7.185        <spacer>
   7.186 -       <property name="orientation" >
   7.187 +       <property name="orientation">
   7.188          <enum>Qt::Horizontal</enum>
   7.189         </property>
   7.190 -       <property name="sizeType" >
   7.191 +       <property name="sizeType">
   7.192          <enum>QSizePolicy::Expanding</enum>
   7.193         </property>
   7.194 -       <property name="sizeHint" >
   7.195 +       <property name="sizeHint" stdset="0">
   7.196          <size>
   7.197           <width>280</width>
   7.198           <height>20</height>
   7.199 @@ -144,25 +138,25 @@
   7.200         </property>
   7.201        </spacer>
   7.202       </item>
   7.203 -     <item row="2" column="0" >
   7.204 -      <widget class="QLabel" name="textLabel1_2" >
   7.205 -       <property name="text" >
   7.206 +     <item row="2" column="0">
   7.207 +      <widget class="QLabel" name="textLabel1_2">
   7.208 +       <property name="text">
   7.209          <string>Use as default:</string>
   7.210         </property>
   7.211 -       <property name="alignment" >
   7.212 +       <property name="alignment">
   7.213          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
   7.214         </property>
   7.215        </widget>
   7.216       </item>
   7.217 -     <item row="2" column="3" colspan="2" >
   7.218 +     <item row="2" column="3" colspan="2">
   7.219        <spacer>
   7.220 -       <property name="orientation" >
   7.221 +       <property name="orientation">
   7.222          <enum>Qt::Horizontal</enum>
   7.223         </property>
   7.224 -       <property name="sizeType" >
   7.225 +       <property name="sizeType">
   7.226          <enum>QSizePolicy::Expanding</enum>
   7.227         </property>
   7.228 -       <property name="sizeHint" >
   7.229 +       <property name="sizeHint" stdset="0">
   7.230          <size>
   7.231           <width>241</width>
   7.232           <height>20</height>
   7.233 @@ -174,13 +168,13 @@
   7.234     </item>
   7.235     <item>
   7.236      <spacer>
   7.237 -     <property name="orientation" >
   7.238 +     <property name="orientation">
   7.239        <enum>Qt::Vertical</enum>
   7.240       </property>
   7.241 -     <property name="sizeType" >
   7.242 +     <property name="sizeType">
   7.243        <enum>QSizePolicy::Expanding</enum>
   7.244       </property>
   7.245 -     <property name="sizeHint" >
   7.246 +     <property name="sizeHint" stdset="0">
   7.247        <size>
   7.248         <width>20</width>
   7.249         <height>16</height>
   7.250 @@ -189,29 +183,29 @@
   7.251      </spacer>
   7.252     </item>
   7.253     <item>
   7.254 -    <layout class="QHBoxLayout" >
   7.255 -     <property name="margin" >
   7.256 +    <layout class="QHBoxLayout">
   7.257 +     <property name="spacing">
   7.258 +      <number>6</number>
   7.259 +     </property>
   7.260 +     <property name="margin">
   7.261        <number>0</number>
   7.262       </property>
   7.263 -     <property name="spacing" >
   7.264 -      <number>6</number>
   7.265 -     </property>
   7.266       <item>
   7.267 -      <widget class="QPushButton" name="deleteButton" >
   7.268 -       <property name="text" >
   7.269 +      <widget class="QPushButton" name="deleteButton">
   7.270 +       <property name="text">
   7.271          <string>Quit and delete XLink</string>
   7.272         </property>
   7.273        </widget>
   7.274       </item>
   7.275       <item>
   7.276        <spacer>
   7.277 -       <property name="orientation" >
   7.278 +       <property name="orientation">
   7.279          <enum>Qt::Horizontal</enum>
   7.280         </property>
   7.281 -       <property name="sizeType" >
   7.282 +       <property name="sizeType">
   7.283          <enum>QSizePolicy::Expanding</enum>
   7.284         </property>
   7.285 -       <property name="sizeHint" >
   7.286 +       <property name="sizeHint" stdset="0">
   7.287          <size>
   7.288           <width>100</width>
   7.289           <height>20</height>
   7.290 @@ -220,8 +214,8 @@
   7.291        </spacer>
   7.292       </item>
   7.293       <item>
   7.294 -      <widget class="QPushButton" name="okButton" >
   7.295 -       <property name="text" >
   7.296 +      <widget class="QPushButton" name="okButton">
   7.297 +       <property name="text">
   7.298          <string>Ok</string>
   7.299         </property>
   7.300        </widget>
   7.301 @@ -230,11 +224,11 @@
   7.302     </item>
   7.303    </layout>
   7.304   </widget>
   7.305 - <layoutdefault spacing="6" margin="11" />
   7.306 + <layoutdefault spacing="6" margin="11"/>
   7.307   <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
   7.308   <includes>
   7.309 -  <include location="local" >xlinkobj.h</include>
   7.310 -  <include location="local" >linkablemapobj.h</include>
   7.311 +  <include location="local">xlinkitem.h</include>
   7.312 +  <include location="local">linkablemapobj.h</include>
   7.313   </includes>
   7.314   <resources/>
   7.315   <connections>
   7.316 @@ -244,11 +238,11 @@
   7.317     <receiver>EditXLinkDialog</receiver>
   7.318     <slot>accept()</slot>
   7.319     <hints>
   7.320 -    <hint type="sourcelabel" >
   7.321 +    <hint type="sourcelabel">
   7.322       <x>338</x>
   7.323       <y>180</y>
   7.324      </hint>
   7.325 -    <hint type="destinationlabel" >
   7.326 +    <hint type="destinationlabel">
   7.327       <x>196</x>
   7.328       <y>102</y>
   7.329      </hint>
     8.1 --- a/floatimageobj.cpp	Mon Aug 24 14:39:07 2009 +0000
     8.2 +++ b/floatimageobj.cpp	Thu Sep 03 08:52:00 2009 +0000
     8.3 @@ -8,25 +8,29 @@
     8.4  // FloatImageObj
     8.5  /////////////////////////////////////////////////////////////////
     8.6  
     8.7 +/* FIXME-3
     8.8  FloatImageObj::FloatImageObj ():FloatObj()
     8.9  {
    8.10  //    cout << "Const FloatImageObj ()\n";
    8.11      setParObj (this);	
    8.12      init();
    8.13  }
    8.14 +*/
    8.15  
    8.16 -FloatImageObj::FloatImageObj (QGraphicsScene* s):FloatObj(s)
    8.17 +FloatImageObj::FloatImageObj (QGraphicsScene* s,TreeItem *ti):FloatObj(s,ti)
    8.18  {
    8.19 -//   cout << "Const FloatImageObj (s)  called from MapCenterObj (s)\n";
    8.20 +   //cout << "Const FloatImageObj s="<<s<<"  ti="<<ti<<endl;
    8.21      setParObj (this);	
    8.22      init();
    8.23  }
    8.24  
    8.25 +/* FIXME-3 needed
    8.26  FloatImageObj::FloatImageObj (QGraphicsScene *s, OrnamentedObj* p):FloatObj(s,p)
    8.27  {
    8.28   //   cout << "Const FloatImageObj (c,p)\n";
    8.29      init();
    8.30  }
    8.31 +*/
    8.32  
    8.33  FloatImageObj::~FloatImageObj ()
    8.34  {
     9.1 --- a/floatimageobj.h	Mon Aug 24 14:39:07 2009 +0000
     9.2 +++ b/floatimageobj.h	Thu Sep 03 08:52:00 2009 +0000
     9.3 @@ -5,15 +5,16 @@
     9.4  //Added by qt3to4:
     9.5  #include <QPixmap>
     9.6  
     9.7 +class TreeItem;
     9.8  /*! \brief A pixmap which can be positioned freely as FlagObj  on the map.  */
     9.9  
    9.10  
    9.11  /////////////////////////////////////////////////////////////////////////////
    9.12  class FloatImageObj:public FloatObj {
    9.13  public:
    9.14 -    FloatImageObj ();
    9.15 -    FloatImageObj (QGraphicsScene*);
    9.16 -    FloatImageObj (QGraphicsScene*, OrnamentedObj* parent);
    9.17 +    //FIXME-3 FloatImageObj ();
    9.18 +    FloatImageObj (QGraphicsScene*,TreeItem *ti=NULL);
    9.19 +    //FIXME-3 FloatImageObj (QGraphicsScene*, OrnamentedObj* parent);
    9.20      ~FloatImageObj ();
    9.21      virtual void init ();
    9.22      virtual void copy (FloatImageObj*);
    10.1 --- a/floatobj.cpp	Mon Aug 24 14:39:07 2009 +0000
    10.2 +++ b/floatobj.cpp	Thu Sep 03 08:52:00 2009 +0000
    10.3 @@ -1,30 +1,19 @@
    10.4  #include "floatobj.h"
    10.5  
    10.6 +#include <iostream>
    10.7 +using namespace std;
    10.8 +
    10.9  /////////////////////////////////////////////////////////////////
   10.10  // FloatObj
   10.11  /////////////////////////////////////////////////////////////////
   10.12  
   10.13 -FloatObj::FloatObj ():OrnamentedObj() 
   10.14 +FloatObj::FloatObj (QGraphicsScene* s, TreeItem *ti):OrnamentedObj(s,ti)
   10.15  {
   10.16 -//    cout << "Const FloatObj ()\n";
   10.17 +	cout << "Const FloatObj s="<<s<<"  ti="<<ti<<"  treeItem="<<treeItem<<endl;
   10.18      setParObj (this);	
   10.19      init();
   10.20  }
   10.21  
   10.22 -FloatObj::FloatObj (QGraphicsScene* s):OrnamentedObj(s)
   10.23 -{
   10.24 -//	cout << "Const FloatObj (s)  called from MapCenterObj (s)\n";
   10.25 -    setParObj (this);	
   10.26 -    init();
   10.27 -}
   10.28 -
   10.29 -FloatObj::FloatObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s)
   10.30 -{
   10.31 -//    cout << "Const FloatObj (s,p)\n";
   10.32 -    setParObj (p);	
   10.33 -    init();
   10.34 -}
   10.35 -
   10.36  FloatObj::~FloatObj ()
   10.37  {
   10.38  //   cout << "Destr FloatObj\n";
    11.1 --- a/floatobj.h	Mon Aug 24 14:39:07 2009 +0000
    11.2 +++ b/floatobj.h	Thu Sep 03 08:52:00 2009 +0000
    11.3 @@ -9,9 +9,7 @@
    11.4  /////////////////////////////////////////////////////////////////////////////
    11.5  class FloatObj:public OrnamentedObj {
    11.6  public:
    11.7 -    FloatObj ();
    11.8 -    FloatObj (QGraphicsScene*);
    11.9 -    FloatObj (QGraphicsScene*, LinkableMapObj* parent);
   11.10 +    FloatObj (QGraphicsScene*,TreeItem *ti=NULL);
   11.11      ~FloatObj ();
   11.12      virtual void init ();
   11.13      virtual void copy (FloatObj*);
    12.1 --- a/imageitem.cpp	Mon Aug 24 14:39:07 2009 +0000
    12.2 +++ b/imageitem.cpp	Thu Sep 03 08:52:00 2009 +0000
    12.3 @@ -52,8 +52,7 @@
    12.4  
    12.5  FloatImageObj* ImageItem::createMapObj(QGraphicsScene *scene)
    12.6  {
    12.7 -	FloatImageObj *fio=new FloatImageObj (scene);
    12.8 -	fio->setTreeItem (this);
    12.9 +	FloatImageObj *fio=new FloatImageObj (scene,this);
   12.10  	lmo=fio;
   12.11  	fio->setParObj ( ((MapItem*)parentItem)->getLMO());
   12.12  	if (((BranchItem*)parentItem)->isScrolled() || !((MapItem*)parentItem)->getLMO()->isVisibleObj() )
   12.13 @@ -61,6 +60,7 @@
   12.14  	initLMO();
   12.15  	fio->setZValue(zValue);
   12.16  	fio->setRelPos (pos);
   12.17 +	cout << "II::createMO   fio="<<fio<<"   tI="<<fio->getTreeItem()<<endl;
   12.18  	return fio;
   12.19  }
   12.20  
    13.1 --- a/linkablemapobj.cpp	Mon Aug 24 14:39:07 2009 +0000
    13.2 +++ b/linkablemapobj.cpp	Thu Sep 03 08:52:00 2009 +0000
    13.3 @@ -11,15 +11,17 @@
    13.4  // LinkableMapObj
    13.5  /////////////////////////////////////////////////////////////////
    13.6  
    13.7 +/* FIXME-3
    13.8  LinkableMapObj::LinkableMapObj():MapObj()
    13.9  {
   13.10    //  cout << "Const LinkableMapObj ()\n";
   13.11      init ();
   13.12  }
   13.13 +*/
   13.14  
   13.15 -LinkableMapObj::LinkableMapObj(QGraphicsScene* s) :MapObj(s)
   13.16 +LinkableMapObj::LinkableMapObj(QGraphicsScene* s, TreeItem *ti) :MapObj(s,ti)
   13.17  {
   13.18 -//    cout << "Const LinkableMapObj (s)\n";
   13.19 +//    cout << "Const LinkableMapObj s="<<s<<"  ti="<<ti<<"  treeItem="<<treeItem<<endl;
   13.20      init ();
   13.21  }
   13.22  
   13.23 @@ -86,9 +88,6 @@
   13.24  	// Rel Positions
   13.25  	relPos=QPointF(0,0);
   13.26  	useRelPos=false;
   13.27 -
   13.28 -	// Crossreference to treemodel
   13.29 -	treeItem=NULL;
   13.30  }
   13.31  
   13.32  void LinkableMapObj::copy (LinkableMapObj* other)
   13.33 @@ -101,16 +100,6 @@
   13.34  	treeItem=other->treeItem;
   13.35  }
   13.36  
   13.37 -void LinkableMapObj::setTreeItem (TreeItem *ti)
   13.38 -{
   13.39 -	treeItem=ti;
   13.40 -}
   13.41 -
   13.42 -TreeItem* LinkableMapObj::getTreeItem () const
   13.43 -{
   13.44 -	return treeItem;
   13.45 -}
   13.46 -
   13.47  void LinkableMapObj::setParObj(LinkableMapObj* o)
   13.48  {
   13.49      parObj=o;
    14.1 --- a/linkablemapobj.h	Mon Aug 24 14:39:07 2009 +0000
    14.2 +++ b/linkablemapobj.h	Thu Sep 03 08:52:00 2009 +0000
    14.3 @@ -5,13 +5,11 @@
    14.4  #include "noteobj.h"
    14.5  #include "headingobj.h"
    14.6  #include "flagrowobj.h"
    14.7 -#include "treeitem.h"
    14.8  
    14.9  #define MAX_DEPTH 999
   14.10  
   14.11  class VymModel;
   14.12 -
   14.13 -
   14.14 +class TreeItem;
   14.15  
   14.16  /*! \brief This class adds links to MapObj 
   14.17  
   14.18 @@ -50,16 +48,13 @@
   14.19  	};
   14.20  
   14.21      LinkableMapObj ();
   14.22 -    LinkableMapObj (QGraphicsScene*);
   14.23 +    LinkableMapObj (QGraphicsScene*, TreeItem *ti=NULL);
   14.24      LinkableMapObj (LinkableMapObj*);
   14.25      ~LinkableMapObj ();
   14.26  	virtual void delLink();
   14.27      virtual void init ();
   14.28      virtual void copy (LinkableMapObj*);
   14.29  
   14.30 -	virtual void setTreeItem(TreeItem *);
   14.31 -	virtual TreeItem* getTreeItem() const;
   14.32 -
   14.33      void setChildObj (LinkableMapObj*);
   14.34      virtual void setParObj (LinkableMapObj*);
   14.35      virtual void setParObjTmp (LinkableMapObj*,QPointF,int);	// Only for moving Obj around
   14.36 @@ -146,6 +141,5 @@
   14.37  	QPointF	 relPos;				// position relative to childPos of parent
   14.38  	bool useRelPos;
   14.39  
   14.40 -	TreeItem *treeItem;				// Crossrefence to treemodel
   14.41  };
   14.42  #endif
    15.1 --- a/mainwindow.cpp	Mon Aug 24 14:39:07 2009 +0000
    15.2 +++ b/mainwindow.cpp	Thu Sep 03 08:52:00 2009 +0000
    15.3 @@ -21,6 +21,7 @@
    15.4  #include "settings.h"
    15.5  #include "texteditor.h"
    15.6  #include "warningdialog.h"
    15.7 +#include "xlinkitem.h"
    15.8  
    15.9  #if defined(Q_OS_WIN32)
   15.10  // Define only this structure as opposed to
   15.11 @@ -3382,26 +3383,21 @@
   15.12  				actionFormatHideLinkUnselected->setEnabled (true);
   15.13  			}
   15.14  
   15.15 -			if (selbi)	// FIXME-4 many properties of former BranchObj are in TreeItem meanwhile...
   15.16 +			if (selbi)	
   15.17  			{
   15.18 -				// Take care of links  // updateActions: FIXME-1
   15.19 -				/*
   15.20 -				if (bo->countXLinks()==0)
   15.21 +				// Take care of xlinks  
   15.22 +				branchXLinksContextMenuEdit->clear();
   15.23 +				branchXLinksContextMenuFollow->clear();
   15.24 +				if (selbi->xlinkCount()>0)
   15.25  				{
   15.26 -					branchXLinksContextMenuEdit->clear();
   15.27 -					branchXLinksContextMenuFollow->clear();
   15.28 -				} else
   15.29 -				{
   15.30 -					BranchObj *bot;
   15.31 +					BranchItem *bi;
   15.32  					QString s;
   15.33 -					branchXLinksContextMenuEdit->clear();
   15.34 -					branchXLinksContextMenuFollow->clear();
   15.35 -					for (int i=0; i<=bo->countXLinks();i++)
   15.36 +					for (int i=0; i<selbi->xlinkCount();++i)
   15.37  					{
   15.38 -						bot=bo->XLinkTargetAt(i);
   15.39 -						if (bot)
   15.40 +						bi=selbi->getXLinkNum(i)->getPartnerBranch();
   15.41 +						if (bi)
   15.42  						{
   15.43 -							s=bot->getHeading();
   15.44 +							s=bi->getHeading();
   15.45  							if (s.length()>xLinkMenuWidth)
   15.46  								s=s.left(xLinkMenuWidth)+"...";
   15.47  							branchXLinksContextMenuFollow->addAction (s);
   15.48 @@ -3409,7 +3405,6 @@
   15.49  						}	
   15.50  					}
   15.51  				}
   15.52 -				*/
   15.53  				//Standard Flags
   15.54  				standardFlagsMaster->updateToolBar (selbi->activeStandardFlagNames() );
   15.55  
    16.1 --- a/mainwindow.h	Mon Aug 24 14:39:07 2009 +0000
    16.2 +++ b/mainwindow.h	Thu Sep 03 08:52:00 2009 +0000
    16.3 @@ -16,6 +16,7 @@
    16.4  #include "texteditor.h"
    16.5  #include "vymview.h"
    16.6  
    16.7 +
    16.8  class Main : public QMainWindow 
    16.9  {
   16.10      Q_OBJECT
    17.1 --- a/mapeditor.cpp	Mon Aug 24 14:39:07 2009 +0000
    17.2 +++ b/mapeditor.cpp	Thu Sep 03 08:52:00 2009 +0000
    17.3 @@ -10,6 +10,7 @@
    17.4  #include "mainwindow.h"
    17.5  #include "misc.h"
    17.6  #include "warningdialog.h"
    17.7 +#include "xlinkitem.h"
    17.8  
    17.9  
   17.10  extern int statusbarTime;
   17.11 @@ -881,6 +882,7 @@
   17.12      LinkableMapObj* lmo=NULL;
   17.13  	if (ti) lmo=((MapItem*)ti)->getLMO();
   17.14  	
   17.15 +	
   17.16  	e->accept();
   17.17  
   17.18  	//Take care of  system flags _or_ modifier modes
   17.19 @@ -923,22 +925,15 @@
   17.20  		} 
   17.21  		if (mainWindow->getModMode()==Main::ModModeXLink)
   17.22  		{	
   17.23 -			BranchObj *bo_begin=NULL;
   17.24 -			if (lmo)
   17.25 -				bo_begin=(BranchObj*)(lmo);
   17.26 -			else	
   17.27 -				bo_begin=model->getSelectedBranchObj();
   17.28 -			if (bo_begin)	
   17.29 +			BranchItem *bi_begin=model->getSelectedBranch();
   17.30 +			if (bi_begin)	
   17.31  			{
   17.32  				drawingLink=true;
   17.33 -				linkingObj_src=bo_begin;
   17.34 -				tmpXLink=new XLinkObj (mapScene);
   17.35 -				tmpXLink->setBegin (bo_begin);
   17.36 -				tmpXLink->setEnd   (p);
   17.37 +				tmpXLink=model->createXLink(bi_begin,true);
   17.38  				tmpXLink->setColor(model->getMapDefXLinkColor());
   17.39  				tmpXLink->setWidth(model->getMapDefXLinkWidth());
   17.40 +				tmpXLink->setEnd   (p);
   17.41  				tmpXLink->updateXLink();
   17.42 -				tmpXLink->setVisibility (true);
   17.43  				return;
   17.44  			} 
   17.45  		}
   17.46 @@ -1192,13 +1187,13 @@
   17.47  		// Check if we are over another branch
   17.48  		if (dsti)
   17.49  		{	
   17.50 -			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
   17.51 +			tmpXLink->setEnd ( ((BranchItem*)dsti) );
   17.52  			tmpXLink->updateXLink();
   17.53 -			tmpXLink->activate(); //FIXME-2 savestate missing
   17.54 -			//model->saveStateComplete(QString("Activate xLink from %1 to %2").arg(model->getObjectName(tmpXLink->getBegin())).arg(model->getObjectName(tmpXLink->getEnd())) );	
   17.55 +			tmpXLink->activate(); 
   17.56 +			//FIXME-0 model->saveStateComplete(QString("Activate xLink from %1 to %2").arg(model->getObjectName(tmpXLink->getBegin())).arg(model->getObjectName(tmpXLink->getEnd())) );	
   17.57  		} else
   17.58  		{
   17.59 -			delete(tmpXLink);
   17.60 +			model->deleteItem(tmpXLink);
   17.61  			tmpXLink=NULL;
   17.62  		}
   17.63  		return;
    18.1 --- a/mapeditor.h	Mon Aug 24 14:39:07 2009 +0000
    18.2 +++ b/mapeditor.h	Thu Sep 03 08:52:00 2009 +0000
    18.3 @@ -10,9 +10,10 @@
    18.4  #include "ornamentedobj.h"
    18.5  #include "settings.h"
    18.6  #include "vymmodel.h"
    18.7 -#include "xlinkobj.h"
    18.8  
    18.9  
   18.10 +class XLinkItem;
   18.11 +
   18.12  /*! \brief Main widget in vym to display and edit a map */
   18.13  
   18.14  
   18.15 @@ -112,10 +113,9 @@
   18.16  	bool pickingColor;
   18.17  	bool drawingLink;			// true while creating a link
   18.18  	bool copyingObj;			// true while creating a link
   18.19 -	XLinkObj* tmpXLink;
   18.20 +	XLinkItem* tmpXLink;
   18.21  
   18.22  	MapObj* movingObj;				// moving a MapObj
   18.23 -	MapObj* linkingObj_src;			// part of a link
   18.24      QPointF movingObj_orgPos;		// org. pos of mouse before move
   18.25      QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
   18.26      QPointF movingObj_start;		// rel. pos of mouse to absPos 
    19.1 --- a/mapobj.cpp	Mon Aug 24 14:39:07 2009 +0000
    19.2 +++ b/mapobj.cpp	Thu Sep 03 08:52:00 2009 +0000
    19.3 @@ -12,10 +12,11 @@
    19.4      init ();
    19.5  }
    19.6  
    19.7 -MapObj::MapObj (QGraphicsScene *s)
    19.8 +MapObj::MapObj (QGraphicsScene *s, TreeItem *ti)
    19.9  {
   19.10  //  cout << "Const MapObj\n";
   19.11      scene=s;
   19.12 +	treeItem=ti;
   19.13      init ();
   19.14  }
   19.15  
   19.16 @@ -46,6 +47,17 @@
   19.17  	bbox.setSize (QSizeF(other->bbox.width(), other->bbox.height() ) );
   19.18  }
   19.19  
   19.20 +void MapObj::setTreeItem (TreeItem *ti)
   19.21 +{
   19.22 +	treeItem=ti;
   19.23 +}
   19.24 +
   19.25 +TreeItem* MapObj::getTreeItem () const
   19.26 +{
   19.27 +	return treeItem;
   19.28 +}
   19.29 +
   19.30 +
   19.31  QGraphicsScene* MapObj::getScene()
   19.32  {
   19.33  	return scene;
    20.1 --- a/mapobj.h	Mon Aug 24 14:39:07 2009 +0000
    20.2 +++ b/mapobj.h	Thu Sep 03 08:52:00 2009 +0000
    20.3 @@ -16,17 +16,24 @@
    20.4  #define Z_TEXT     100
    20.5  #define Z_LINEEDIT 110
    20.6  
    20.7 +
    20.8 +class TreeItem;
    20.9 +
   20.10  /*! \brief Base class for all objects visible on a map
   20.11  */
   20.12  
   20.13  class MapObj:public XMLObj {
   20.14  public:
   20.15      MapObj ();
   20.16 -    MapObj (QGraphicsScene*);
   20.17 +    MapObj (QGraphicsScene *scene,TreeItem *ti=NULL);
   20.18      MapObj (MapObj*);
   20.19      virtual ~MapObj ();
   20.20      virtual void init ();
   20.21      virtual void copy (MapObj*);
   20.22 +
   20.23 +	virtual void setTreeItem(TreeItem *);
   20.24 +	virtual TreeItem* getTreeItem() const;
   20.25 +
   20.26  	virtual QGraphicsScene* getScene();
   20.27      virtual qreal x();
   20.28      virtual qreal y();
   20.29 @@ -51,6 +58,9 @@
   20.30  	QRectF clickBox;								// area where mouseclicks are found
   20.31      QPointF absPos;							    // Position on canvas
   20.32      bool visible;
   20.33 +
   20.34 +	TreeItem *treeItem;				// Crossrefence to treemodel
   20.35 +
   20.36  };
   20.37  
   20.38  #endif
    21.1 --- a/ornamentedobj.cpp	Mon Aug 24 14:39:07 2009 +0000
    21.2 +++ b/ornamentedobj.cpp	Thu Sep 03 08:52:00 2009 +0000
    21.3 @@ -6,13 +6,8 @@
    21.4  // OrnamentedObj
    21.5  /////////////////////////////////////////////////////////////////
    21.6  
    21.7 -OrnamentedObj::OrnamentedObj():LinkableMapObj()
    21.8 -{
    21.9 -  //  cout << "Const OrnamentedObj ()\n";
   21.10 -    init ();
   21.11 -}
   21.12  
   21.13 -OrnamentedObj::OrnamentedObj(QGraphicsScene* s) :LinkableMapObj(s)
   21.14 +OrnamentedObj::OrnamentedObj(QGraphicsScene* s,TreeItem *ti) :LinkableMapObj(s,ti)
   21.15  {
   21.16  //    cout << "Const OrnamentedObj (s)\n";
   21.17      init ();
    22.1 --- a/ornamentedobj.h	Mon Aug 24 14:39:07 2009 +0000
    22.2 +++ b/ornamentedobj.h	Thu Sep 03 08:52:00 2009 +0000
    22.3 @@ -5,6 +5,8 @@
    22.4  #include "frameobj.h"
    22.5  #include "linkablemapobj.h"
    22.6  
    22.7 +class TreeItem;
    22.8 +
    22.9  /*! \brief Adds various ornaments and data to the class LinkableMapObj
   22.10  
   22.11  The ornaments are:
   22.12 @@ -19,8 +21,7 @@
   22.13  
   22.14  class OrnamentedObj:public LinkableMapObj {
   22.15  public:	
   22.16 -    OrnamentedObj ();
   22.17 -    OrnamentedObj (QGraphicsScene*);
   22.18 +    OrnamentedObj (QGraphicsScene*, TreeItem *ti=NULL);
   22.19      OrnamentedObj (OrnamentedObj*);
   22.20      ~OrnamentedObj ();
   22.21      virtual void init ();
    23.1 --- a/treeitem.cpp	Mon Aug 24 14:39:07 2009 +0000
    23.2 +++ b/treeitem.cpp	Thu Sep 03 08:52:00 2009 +0000
    23.3 @@ -1,11 +1,13 @@
    23.4  #include <iostream>
    23.5  #include <QStringList>
    23.6  
    23.7 -#include "treeitem.h"
    23.8 -
    23.9 +#include "attributeitem.h"
   23.10  #include "branchobj.h"
   23.11  #include "branchitem.h"
   23.12 +#include "treeitem.h"
   23.13  #include "vymmodel.h"
   23.14 +#include "xlinkitem.h"
   23.15 +#include "xlinkobj.h"
   23.16  
   23.17  using namespace std;
   23.18  
   23.19 @@ -53,6 +55,9 @@
   23.20  			case TreeItem::Attribute:
   23.21  				delete (AttributeItem*)ti;
   23.22  				break;
   23.23 +			case TreeItem::XLink:
   23.24 +				delete (XLinkItem*)ti;
   23.25 +				break;
   23.26  			default:
   23.27  				delete ti;
   23.28  				break;
   23.29 @@ -74,6 +79,9 @@
   23.30  	attributeCounter=0;
   23.31  	attributeOffset=0;
   23.32  
   23.33 +	xlinkCounter=0;
   23.34 +	xlinkOffset=0;
   23.35 +
   23.36  	note.setNote(""); 
   23.37  	// note.setFontHint (textEditor->getFontHintDefault() );	//FIXME-3
   23.38  	// isNoteInEditor=false;
   23.39 @@ -114,6 +122,7 @@
   23.40  	switch (item->type)
   23.41  	{
   23.42  		case Attribute: return attributeOffset + attributeCounter;
   23.43 +		case XLink: return xlinkOffset + xlinkCounter;
   23.44  		case Image: return imageOffset + imageCounter;
   23.45  		case MapCenter: return branchOffset + branchCounter;
   23.46  		case Branch: return branchOffset + branchCounter;
   23.47 @@ -132,6 +141,15 @@
   23.48  		// attribute are on top of list
   23.49  		childItems.insert (attributeCounter,item);
   23.50  		attributeCounter++;
   23.51 +		xlinkOffset++;
   23.52 +		imageOffset++;
   23.53 +		branchOffset++;
   23.54 +	}
   23.55 +
   23.56 +	if (item->type == XLink)
   23.57 +	{
   23.58 +		childItems.insert (xlinkCounter+xlinkOffset,item);
   23.59 +		xlinkCounter++;
   23.60  		imageOffset++;
   23.61  		branchOffset++;
   23.62  	}
   23.63 @@ -166,6 +184,13 @@
   23.64  		if (childItems.at(row)->type==Attribute)
   23.65  		{
   23.66  			attributeCounter--;
   23.67 +			xlinkOffset--;
   23.68 +			imageOffset--;
   23.69 +			branchOffset--;
   23.70 +		}	
   23.71 +		if (childItems.at(row)->type==XLink)
   23.72 +		{
   23.73 +			xlinkCounter--;
   23.74  			imageOffset--;
   23.75  			branchOffset--;
   23.76  		}	
   23.77 @@ -226,10 +251,9 @@
   23.78      return imageCounter; 
   23.79  }
   23.80  
   23.81 -int TreeItem::xlinkCount() const // FIXME-2 check if xlinks are stored in a different way (global to model?)
   23.82 +int TreeItem::xlinkCount() const
   23.83  {
   23.84 -	int xlinkCounter=0;
   23.85 -    return xlinkCounter; // FIXME-1 xlinkCounter needs to be calculated...
   23.86 +    return xlinkCounter; 
   23.87  }
   23.88  
   23.89  int TreeItem::attributeCount() const 
   23.90 @@ -283,6 +307,7 @@
   23.91  		case Branch: return parentItem->childItems.indexOf (this) - parentItem->branchOffset;
   23.92  		case Image: return parentItem->childItems.indexOf (this) - parentItem->imageOffset;
   23.93  		case Attribute: return parentItem->childItems.indexOf (this) - parentItem->attributeOffset;
   23.94 +		case XLink: return parentItem->childItems.indexOf (this) - parentItem->xlinkOffset;
   23.95  		default: return -1;
   23.96  	}
   23.97  }
   23.98 @@ -297,6 +322,7 @@
   23.99  		case Branch: return childItems.indexOf (item) - branchOffset;
  23.100  		case Image: return parentItem->childItems.indexOf (item) - imageOffset;
  23.101  		case Attribute: return parentItem->childItems.indexOf (item) - attributeOffset;
  23.102 +		case XLink: return parentItem->childItems.indexOf (item) - xlinkOffset;
  23.103  		default: return -1;
  23.104  	}
  23.105  }
  23.106 @@ -327,6 +353,7 @@
  23.107  		case Branch: return QString ("Branch");
  23.108  		case Image: return QString ("Image");
  23.109  		case Attribute: return QString ("Attribute");
  23.110 +		case XLink: return QString ("XLink");
  23.111  		default: return QString ("TreeItem::getTypeName no typename defined?!");
  23.112  	}
  23.113  }
  23.114 @@ -530,7 +557,6 @@
  23.115  {
  23.116  	switch (type)
  23.117  	{
  23.118 -		case Undefined: return false;
  23.119  		case MapCenter: 
  23.120  		case Branch: 
  23.121  			if (!parentItem) return false;
  23.122 @@ -539,7 +565,6 @@
  23.123  			else
  23.124  				return false;
  23.125  			break;	
  23.126 -		case Image: return false;
  23.127  		default: return false;
  23.128  	}
  23.129  }
  23.130 @@ -623,6 +648,33 @@
  23.131  		return NULL;
  23.132  }
  23.133  
  23.134 +XLinkItem* TreeItem::getXLinkNum (const int &n)	
  23.135 +{
  23.136 +	if (n>=0 && n<xlinkCounter )
  23.137 +		return (XLinkItem*)getChildNum (xlinkOffset +n);
  23.138 +	else
  23.139 +		return NULL;
  23.140 +}
  23.141 +
  23.142 +
  23.143 +XLinkObj* TreeItem::getXLinkObjNum (const int &n)	
  23.144 +{
  23.145 +	if (xlinkCounter>0 )
  23.146 +	{
  23.147 +		XLinkItem *xli=getXLinkNum (n);
  23.148 +		if (!xli) return NULL;
  23.149 +		if (xli->isBegin() )
  23.150 +			return (XLinkObj*)(xli->getLMO());
  23.151 +		else
  23.152 +		{
  23.153 +			xli=xli->getPartnerXLink();
  23.154 +			if (!xli) return NULL;
  23.155 +			return (XLinkObj*)(xli->getLMO());
  23.156 +		}
  23.157 +	}
  23.158 +	return NULL;
  23.159 +}
  23.160 +
  23.161  
  23.162  void TreeItem::setHideTmp (HideTmpMode mode)  //FIXME-2
  23.163  {
    24.1 --- a/treeitem.h	Mon Aug 24 14:39:07 2009 +0000
    24.2 +++ b/treeitem.h	Thu Sep 03 08:52:00 2009 +0000
    24.3 @@ -6,7 +6,6 @@
    24.4  #include <QVariant>
    24.5  
    24.6  #include "flagrow.h"
    24.7 -//#include "mapitem.h"
    24.8  #include "noteobj.h"
    24.9  #include "xmlobj.h"
   24.10  
   24.11 @@ -16,11 +15,13 @@
   24.12  class FloatImageObj;
   24.13  class ImageItem;
   24.14  class VymModel;
   24.15 +class XLinkItem;
   24.16 +class XLinkObj;
   24.17  
   24.18  class TreeItem:public XMLObj
   24.19  {
   24.20  public:
   24.21 -	enum Type {Undefined,MapCenter,Branch,Image,Attribute};	//FIXME-3 MapCenter still needed?
   24.22 +	enum Type {Undefined,MapCenter,Branch,Image,Attribute,XLink};	//FIXME-3 MapCenter still needed?
   24.23  	enum HideTmpMode {HideNone, HideExport};
   24.24  
   24.25      TreeItem();
   24.26 @@ -155,6 +156,9 @@
   24.27  	virtual ImageItem* getImageNum(const int &n);
   24.28  	virtual FloatImageObj* getImageObjNum(const int &n);
   24.29  
   24.30 +	virtual XLinkItem* getXLinkNum(const int &n);
   24.31 +	virtual XLinkObj* getXLinkObjNum(const int &n);
   24.32 +
   24.33  protected:
   24.34  	bool hideExport;							//! Hide this item in export
   24.35  public:
   24.36 @@ -185,6 +189,9 @@
   24.37  	int attributeOffset;
   24.38  	int attributeCounter;
   24.39  
   24.40 +	int xlinkOffset;
   24.41 +	int xlinkCounter;
   24.42 +
   24.43  	bool hidden;	//! Hidden in export if true
   24.44  };
   24.45  
    25.1 --- a/treemodel.cpp	Mon Aug 24 14:39:07 2009 +0000
    25.2 +++ b/treemodel.cpp	Thu Sep 03 08:52:00 2009 +0000
    25.3 @@ -8,12 +8,13 @@
    25.4  #include "imageitem.h"
    25.5  #include "treeitem.h"
    25.6  #include "treemodel.h"
    25.7 +#include "xlinkitem.h"
    25.8  
    25.9  TreeModel::TreeModel(QObject *parent)
   25.10      : QAbstractItemModel(parent)
   25.11  {
   25.12      QList<QVariant> rootData;
   25.13 -    rootData << "Heading" << "Type" <<"Note";
   25.14 +    rootData << "Heading" << "Type";
   25.15      rootItem = new TreeItem(rootData);
   25.16  }
   25.17  
   25.18 @@ -217,13 +218,11 @@
   25.19      TreeItem *pi= getItem (parent);
   25.20  	TreeItem *ti;
   25.21  
   25.22 -/* FIXME-3
   25.23  	cout << "TM::removeRows  row="<<row<<"  count="<<count<<endl;
   25.24 -	cout << "                pi="<<pi<<"  ti="<<ti<<endl;
   25.25 -*/	
   25.26  	for (int i=row; i<=last; i++)
   25.27  	{
   25.28  		ti=pi->getChildNum (row);
   25.29 +		cout << "   pi="<<pi<<"  ti="<<ti<<endl;
   25.30  		pi->removeChild (row);	// does not delete object!
   25.31  		switch (ti->getType()) 
   25.32  		{
   25.33 @@ -239,6 +238,9 @@
   25.34  			case TreeItem::Attribute:
   25.35  				delete (AttributeItem*)ti; 
   25.36  				break;
   25.37 +			case TreeItem::XLink:
   25.38 +				delete (XLinkItem*)ti; 
   25.39 +				break;
   25.40  			default:
   25.41  				delete ti;
   25.42  				break;
    26.1 --- a/version.h	Mon Aug 24 14:39:07 2009 +0000
    26.2 +++ b/version.h	Thu Sep 03 08:52:00 2009 +0000
    26.3 @@ -7,7 +7,7 @@
    26.4  #define __VYM_VERSION "1.13.0"
    26.5  //#define __VYM_CODENAME "Codename: RC-1"
    26.6  #define __VYM_CODENAME "Codename: development version, not for production!"
    26.7 -#define __VYM_BUILD_DATE "2009-08-24"
    26.8 +#define __VYM_BUILD_DATE "2009-09-01"
    26.9  
   26.10  
   26.11  bool checkVersion(const QString &);
    27.1 --- a/vym.pro	Mon Aug 24 14:39:07 2009 +0000
    27.2 +++ b/vym.pro	Thu Sep 03 08:52:00 2009 +0000
    27.3 @@ -81,6 +81,7 @@
    27.4  	treeeditor.h \
    27.5  	version.h \
    27.6  	vymmodel.h \
    27.7 +	xlinkitem.h \
    27.8  	xlinkobj.h \
    27.9  	xml-base.h \
   27.10  	xml-vym.h \
   27.11 @@ -147,6 +148,7 @@
   27.12  	treemodel.cpp \
   27.13  	version.cpp \
   27.14  	vymmodel.cpp \
   27.15 +	xlinkitem.cpp \
   27.16  	xlinkobj.cpp \
   27.17  	xml-base.cpp \
   27.18  	xml-vym.cpp \
    28.1 --- a/vymmodel.cpp	Mon Aug 24 14:39:07 2009 +0000
    28.2 +++ b/vymmodel.cpp	Thu Sep 03 08:52:00 2009 +0000
    28.3 @@ -16,6 +16,7 @@
    28.4  #include "parser.h"
    28.5  
    28.6  #include "warningdialog.h"
    28.7 +#include "xlinkitem.h"
    28.8  #include "xml-freemind.h"
    28.9  #include "xmlobj.h"
   28.10  #include "xml-vym.h"
   28.11 @@ -238,7 +239,7 @@
   28.12  	s+=xml.beginElement("vymmap",mapAttr);
   28.13  	xml.incIndent();
   28.14  
   28.15 -	// Find the used flags while traversing the tree	// FIXME-2 this can be done local to vymmodel maybe...
   28.16 +	// Find the used flags while traversing the tree	// FIXME-3 this can be done local to vymmodel maybe...
   28.17  	standardFlagsMaster->resetUsedCounter();
   28.18  	
   28.19  	// Build xml recursivly
   28.20 @@ -261,7 +262,8 @@
   28.21  				// Save Image
   28.22  				s+=((ImageItem*)saveSel)->saveToDir(tmpdir,prefix);
   28.23  				break;
   28.24 -			default://FIXME-4 other types shouldn't be safed...
   28.25 +			default: 
   28.26 +				// other types shouldn't be safed directly...
   28.27  				break;
   28.28  		}
   28.29  	}
   28.30 @@ -1444,12 +1446,14 @@
   28.31  
   28.32  TreeItem* VymModel::findID (const QString &s)
   28.33  {
   28.34 -	TreeItem *ti;
   28.35 -	for (int i=0; i<rootItem->branchCount(); i++)
   28.36 +	BranchItem *cur=NULL;
   28.37 +	BranchItem *prev=NULL;
   28.38 +	next(cur,prev);
   28.39 +	while (cur) 
   28.40  	{
   28.41 -		ti=rootItem->getBranchNum(i)->findID (s);
   28.42 -		if (ti) return ti;
   28.43 -	}	
   28.44 +		if (s==cur->getID() ) return cur;
   28.45 +		next(cur,prev);
   28.46 +	}
   28.47  	return NULL;
   28.48  }
   28.49  
   28.50 @@ -1984,7 +1988,7 @@
   28.51  		int n;
   28.52  
   28.53  		QList<QVariant> cData;
   28.54 -		cData << "new" << "undef"<<"undef";
   28.55 +		cData << "new" << "undef";
   28.56  
   28.57  		ImageItem *newii=new ImageItem(cData) ;	
   28.58  		//newii->setHeading (QApplication::translate("Heading of new image in map", "new image"));
   28.59 @@ -2008,13 +2012,48 @@
   28.60  	return NULL;
   28.61  }
   28.62  
   28.63 +XLinkItem* VymModel::createXLink(BranchItem *bi,bool createMO)
   28.64 +{
   28.65 +	if (bi)
   28.66 +	{
   28.67 +		QModelIndex parix;
   28.68 +		int n;
   28.69 +
   28.70 +		QList<QVariant> cData;
   28.71 +		cData << "new xLink"<<"undef";
   28.72 +
   28.73 +		XLinkItem *newxli=new XLinkItem(cData) ;	
   28.74 +
   28.75 +		emit (layoutAboutToBeChanged() );
   28.76 +
   28.77 +			parix=index(bi);
   28.78 +			n=bi->getRowNumAppend(newxli);
   28.79 +			beginInsertRows (parix,n,n+1);
   28.80 +			bi->appendChild (newxli);	
   28.81 +			endInsertRows ();
   28.82 +
   28.83 +		emit (layoutChanged() );
   28.84 +
   28.85 +		// save scroll state. If scrolled, automatically select
   28.86 +		// new branch in order to tmp unscroll parent...
   28.87 +		newxli->setBegin (bi);
   28.88 +		if (createMO) 
   28.89 +		{
   28.90 +			newxli->createMapObj(mapScene);
   28.91 +			reposition();
   28.92 +		}
   28.93 +		return newxli;
   28.94 +	} 
   28.95 +	return NULL;
   28.96 +}
   28.97 +
   28.98  AttributeItem* VymModel::addAttribute()	// FIXME-2 savestate missing
   28.99  {
  28.100  	BranchItem *selbi=getSelectedBranch();
  28.101  	if (selbi)
  28.102  	{
  28.103  		QList<QVariant> cData;
  28.104 -		cData << "new attribute" << "undef"<<"undef";
  28.105 +		cData << "new attribute" << "undef";
  28.106  		AttributeItem *a=new AttributeItem (cData);
  28.107  
  28.108  		emit (layoutAboutToBeChanged() );
  28.109 @@ -2061,7 +2100,7 @@
  28.110  	beginInsertRows (parix,n,n+1);
  28.111  
  28.112  	QList<QVariant> cData;
  28.113 -	cData << "VM:addMapCenter" << "undef"<<"undef";
  28.114 +	cData << "VM:addMapCenter" << "undef";
  28.115  	BranchItem *newbi=new BranchItem (cData,rootItem);
  28.116  	newbi->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
  28.117  	rootItem->appendChild (newbi);
  28.118 @@ -2086,7 +2125,7 @@
  28.119  
  28.120  	// Create TreeItem
  28.121  	QList<QVariant> cData;
  28.122 -	cData << "new" << "undef"<<"undef";
  28.123 +	cData << "new" << "undef";
  28.124  
  28.125  	BranchItem *parbi;
  28.126  	QModelIndex parix;
  28.127 @@ -2298,15 +2337,20 @@
  28.128  		return;
  28.129  	}
  28.130  	TreeItem *ti=getSelectedItem();
  28.131 -	if (ti->getType()==TreeItem::Image || ti->getType()==TreeItem::Attribute)
  28.132 +	if (ti)
  28.133  	{
  28.134  		TreeItem *pi=ti->parent();
  28.135 -		saveStateChangingPart(
  28.136 -			pi, 
  28.137 -			ti,
  28.138 -			"delete ()",
  28.139 -			QString("Delete %1").arg(getObjectName(ti))
  28.140 -		);
  28.141 +		if (!pi) return;
  28.142 +		if (ti->getType()==TreeItem::Image || ti->getType()==TreeItem::Attribute)
  28.143 +		{
  28.144 +			saveStateChangingPart(
  28.145 +				pi, 
  28.146 +				ti,
  28.147 +				"delete ()",
  28.148 +				QString("Delete %1").arg(getObjectName(ti))
  28.149 +			);
  28.150 +		}
  28.151 +		// FIXME-0 savestate missing for deletion of other times
  28.152  		unselect();
  28.153  		deleteItem (ti);
  28.154  		emitDataHasChanged (pi);
  28.155 @@ -2393,6 +2437,7 @@
  28.156  
  28.157  TreeItem* VymModel::deleteItem (TreeItem *ti)
  28.158  {
  28.159 +	cout << "VM::deleteItem "<<ti<<endl;
  28.160  	if (ti)
  28.161  	{
  28.162  		TreeItem *pi=ti->parent();
  28.163 @@ -2764,49 +2809,40 @@
  28.164  }
  28.165  
  28.166  
  28.167 -void VymModel::followXLink(int i)	// FIXME-2
  28.168 +void VymModel::followXLink(int i)	
  28.169  {
  28.170  	i=0;
  28.171 -	/*
  28.172 -	BranchObj *bo=getSelectedBranch();
  28.173 -	if (bo)
  28.174 +	BranchItem *selbi=getSelectedBranch();
  28.175 +	if (selbi)
  28.176  	{
  28.177 -		bo=bo->XLinkTargetAt(i);
  28.178 -		if (bo) 
  28.179 -		{
  28.180 -			selection.select(bo);
  28.181 -			emitShowSelection();
  28.182 -		}
  28.183 +		selbi=selbi->getXLinkNum(i)->getPartnerBranch();
  28.184 +		if (selbi) select (selbi);
  28.185  	}
  28.186 -	*/
  28.187  }
  28.188  
  28.189 -void VymModel::editXLink(int i)	// FIXME-2 VM missing saveState
  28.190 +void VymModel::editXLink(int i)	
  28.191  {
  28.192  	i=0;
  28.193 -	/*
  28.194 -	BranchObj *bo=getSelectedBranch();
  28.195 -	if (bo)
  28.196 +	BranchItem *selbi=getSelectedBranch();
  28.197 +	if (selbi)
  28.198  	{
  28.199 -		XLinkObj *xlo=bo->XLinkAt(i);
  28.200 -		if (xlo) 
  28.201 +		XLinkItem *xli=selbi->getXLinkNum(i);
  28.202 +		if (xli) 
  28.203  		{
  28.204  			EditXLinkDialog dia;
  28.205 -			dia.setXLink (xlo);
  28.206 -			dia.setSelection(bo);
  28.207 +			dia.setXLink (xli);
  28.208 +			dia.setSelection(selbi);
  28.209  			if (dia.exec() == QDialog::Accepted)
  28.210  			{
  28.211  				if (dia.useSettingsGlobal() )
  28.212  				{
  28.213 -					setMapDefXLinkColor (xlo->getColor() );
  28.214 -					setMapDefXLinkWidth (xlo->getWidth() );
  28.215 +					setMapDefXLinkColor (xli->getColor() );
  28.216 +					setMapDefXLinkWidth (xli->getWidth() );
  28.217  				}
  28.218 -				if (dia.deleteXLink())
  28.219 -					bo->deleteXLinkAt(i);
  28.220 +				if (dia.deleteXLink()) deleteItem (xli);
  28.221  			}
  28.222  		}	
  28.223  	}
  28.224 -*/	
  28.225  }
  28.226  
  28.227  
    29.1 --- a/vymmodel.h	Mon Aug 24 14:39:07 2009 +0000
    29.2 +++ b/vymmodel.h	Thu Sep 03 08:52:00 2009 +0000
    29.3 @@ -18,6 +18,7 @@
    29.4  class AttributeItem;
    29.5  class BranchItem;
    29.6  class MapEditor;
    29.7 +class XLinkItem;
    29.8  
    29.9  class VymModel :  public TreeModel {		
   29.10  	Q_OBJECT
   29.11 @@ -291,6 +292,7 @@
   29.12  	BranchItem* createMapCenter();				//!< Create MapCenter 
   29.13  	BranchItem* createBranch(BranchItem *dst);	//!< Create Branch
   29.14  	ImageItem* createImage(BranchItem *dst);	//!< Create image
   29.15 +	XLinkItem* createXLink(BranchItem *dst,bool createMO=false);	//!< Create XLink starting at dst
   29.16  
   29.17  	AttributeItem* addAttribute();
   29.18  
   29.19 @@ -338,7 +340,6 @@
   29.20  	void deleteKeepChildren();			//!< remove branch, but keep children
   29.21  	void deleteChildren();				//!< keep branch, but remove children
   29.22  
   29.23 -private:	
   29.24  	TreeItem* deleteItem(TreeItem*);	//!< Delete item and return parent (if parent!= rootItem)
   29.25  	bool scrollBranch(BranchItem *);
   29.26  	bool unscrollBranch(BranchItem *);
    30.1 --- a/xlinkobj.cpp	Mon Aug 24 14:39:07 2009 +0000
    30.2 +++ b/xlinkobj.cpp	Thu Sep 03 08:52:00 2009 +0000
    30.3 @@ -1,31 +1,28 @@
    30.4  #include "xlinkobj.h"
    30.5 +
    30.6  #include "branchobj.h"
    30.7 +#include "branchitem.h"
    30.8 +#include "xlinkitem.h"
    30.9  
   30.10 +#include <iostream>
   30.11 +using namespace std;
   30.12  
   30.13  /////////////////////////////////////////////////////////////////
   30.14  // XLinkObj
   30.15  /////////////////////////////////////////////////////////////////
   30.16  
   30.17 -int XLinkObj::arrowSize=10;						// make instances 
   30.18 +int XLinkObj::arrowSize=10;					// make instances
   30.19  
   30.20 -XLinkObj::XLinkObj ():MapObj() 
   30.21 +XLinkObj::XLinkObj (QGraphicsScene* scene, TreeItem* ti):MapObj(scene,ti)
   30.22  {
   30.23 -	//	cout << "Const XLinkObj ()\n";
   30.24 +	//cout << "Const XLinkObj (s)\n";
   30.25  	init();
   30.26  }
   30.27  
   30.28 -XLinkObj::XLinkObj (QGraphicsScene* s):MapObj(s)
   30.29 -{
   30.30 -	//	cout << "Const XLinkObj (s)  called from MapCenterObj (s)\n";
   30.31 -	init();
   30.32 -}
   30.33 -
   30.34  
   30.35  XLinkObj::~XLinkObj ()
   30.36  {
   30.37 -//	cout << "Destr XLinkObj\n";
   30.38 -	if (xLinkState!=undefinedXLink)
   30.39 -		deactivate();
   30.40 +	//cout << "Destr XLinkObj\n";
   30.41  	delete (line);
   30.42  	delete (poly);
   30.43  }
   30.44 @@ -33,87 +30,17 @@
   30.45  
   30.46  void XLinkObj::init () 
   30.47  {
   30.48 -	beginBranch=NULL;
   30.49 -	endBranch=NULL;
   30.50 +	XLinkItem *xli=(XLinkItem*)treeItem;
   30.51  	visBranch=NULL;
   30.52 -	xLinkState=undefinedXLink;
   30.53  
   30.54 -	color=QColor (180,180,180);
   30.55 -	width=1;
   30.56 -	pen.setColor (color);
   30.57 -	pen.setWidth (width);
   30.58 +	pen.setColor ( xli->getColor() );
   30.59 +	pen.setWidth ( xli->getWidth() );
   30.60  	pen.setCapStyle (  Qt::RoundCap );
   30.61  	line=scene->addLine(QLineF(1,1,1,1),pen);
   30.62      line->setZValue (Z_XLINK);
   30.63 -	poly=scene->addPolygon(QPolygonF(),pen,color);
   30.64 +	poly=scene->addPolygon(QPolygonF(),pen, xli->getColor());
   30.65      poly->setZValue (Z_XLINK);
   30.66 -	setVisibility (false);
   30.67 -}
   30.68 -
   30.69 -void XLinkObj::copy (XLinkObj* other)
   30.70 -{
   30.71 -	// TODO copy not used yet
   30.72 -	MapObj::copy (other);
   30.73 -	setVisibility (other->visible);
   30.74 -	beginBranch=other->beginBranch;
   30.75 -	endBranch=other->endBranch;
   30.76 -	width=other->width;
   30.77 -
   30.78 -}
   30.79 -
   30.80 -void XLinkObj::setBegin (BranchObj *bo)
   30.81 -{
   30.82 -	if (bo) 
   30.83 -	{
   30.84 -		xLinkState=initXLink;
   30.85 -		beginBranch=bo;
   30.86 -		beginPos=beginBranch->getChildPos();
   30.87 -	}	
   30.88 -}
   30.89 -
   30.90 -BranchObj* XLinkObj::getBegin ()
   30.91 -{
   30.92 -	return beginBranch;
   30.93 -}
   30.94 -
   30.95 -void XLinkObj::setEnd (BranchObj *bo)
   30.96 -{
   30.97 -	if (bo) 
   30.98 -	{
   30.99 -		xLinkState=initXLink;
  30.100 -		endBranch=bo;
  30.101 -		endPos=endBranch->getChildPos();
  30.102 -	}		
  30.103 -}
  30.104 -
  30.105 -BranchObj* XLinkObj::getEnd()
  30.106 -{
  30.107 -	return endBranch;
  30.108 -}
  30.109 -
  30.110 -void XLinkObj::setWidth (int w)
  30.111 -{
  30.112 -	width=w;
  30.113 -	pen.setWidth (w);
  30.114 -	setColor (color);
  30.115 -}
  30.116 -
  30.117 -int XLinkObj::getWidth()
  30.118 -{
  30.119 -	return pen.width();
  30.120 -}
  30.121 -
  30.122 -void XLinkObj::setColor(QColor c)
  30.123 -{
  30.124 -	color=c;
  30.125 -	pen.setColor (c);
  30.126 -	line->setPen (pen);
  30.127 -	poly->setBrush( color );
  30.128 -}
  30.129 -
  30.130 -QColor XLinkObj::getColor()
  30.131 -{
  30.132 -	return pen.color();
  30.133 +	setVisibility (true);
  30.134  }
  30.135  
  30.136  void XLinkObj::setEnd (QPointF p)
  30.137 @@ -121,41 +48,6 @@
  30.138  	endPos=p;
  30.139  }
  30.140  
  30.141 -bool XLinkObj::activate ()
  30.142 -{
  30.143 -	if (beginBranch && endBranch)
  30.144 -	{
  30.145 -		if (beginBranch==endBranch) return false;
  30.146 -		xLinkState=activeXLink;
  30.147 -		beginBranch->addXLink (this);
  30.148 -		endBranch->addXLink (this);
  30.149 -		setVisibility ();
  30.150 -		return true;
  30.151 -	} else
  30.152 -		return false;
  30.153 -}
  30.154 -
  30.155 -void XLinkObj::deactivate ()
  30.156 -{
  30.157 -	if (beginBranch)
  30.158 -		beginBranch->removeXLinkRef (this);
  30.159 -	beginBranch=NULL;	
  30.160 -	if (endBranch)
  30.161 -		endBranch->removeXLinkRef (this);
  30.162 -	endBranch=NULL;	
  30.163 -	visBranch=NULL;
  30.164 -	xLinkState=undefinedXLink;
  30.165 -
  30.166 -	line->hide();
  30.167 -}
  30.168 -
  30.169 -bool XLinkObj::isUsed()
  30.170 -{
  30.171 -	if (beginBranch || endBranch || xLinkState!=undefinedXLink)
  30.172 -		return true;
  30.173 -	else
  30.174 -		return false;
  30.175 -}
  30.176  
  30.177  void XLinkObj::updateXLink()
  30.178  {
  30.179 @@ -164,8 +56,11 @@
  30.180  	if (visBranch)
  30.181  	{
  30.182  		// Only one of the linked branches is visible
  30.183 -		a=b=visBranch->getChildPos();
  30.184 -		if (visBranch->getOrientation()==LinkableMapObj::RightOfCenter)
  30.185 +		BranchObj *bo=(BranchObj*)(visBranch->getLMO());
  30.186 +		if (!bo) return;
  30.187 +
  30.188 +		a=b=bo->getChildPos();
  30.189 +		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
  30.190  		{
  30.191  			b.setX (b.x()+25);
  30.192  			
  30.193 @@ -186,43 +81,43 @@
  30.194  	} else
  30.195  	{
  30.196  		// Both linked branches are visible
  30.197 -		if (beginBranch)
  30.198 +		BranchItem *bi=((XLinkItem*)treeItem)->getBegin();
  30.199 +		if ( bi)
  30.200 +		{
  30.201  			// If a link is just drawn in the editor,
  30.202  			// we have already a beginBranch
  30.203 -			a=beginBranch->getChildPos();
  30.204 +			BranchObj *bo=(BranchObj*)(bi->getLMO());
  30.205 +			if (bo)	
  30.206 +				a=bo->getChildPos();
  30.207 +			else 
  30.208 +				return;	
  30.209 +		}	
  30.210  		else
  30.211  			// This shouldn't be reached normally...
  30.212  			a=beginPos;
  30.213 -		if (xLinkState==activeXLink && endBranch)
  30.214 -			b=endBranch->getChildPos();
  30.215 +
  30.216 +		// FIXME-3 try to get rid of xLinkstate if (xLinkState==activeXLink && endBranch)
  30.217 +		bi=((XLinkItem*)treeItem)->getEnd();
  30.218 +		if (bi)
  30.219 +		{
  30.220 +			BranchObj *bo=(BranchObj*)(bi->getLMO());
  30.221 +			if (bo)	
  30.222 +				b=bo->getChildPos();
  30.223 +			else 
  30.224 +				return;	
  30.225 +		}
  30.226  		else
  30.227  			b=endPos;
  30.228  	}
  30.229  
  30.230 -
  30.231 -	if (line->line().p1()==a && line->line().p2()==b && !visBranch)
  30.232 -	{
  30.233 -		// update is called from both branches, so only
  30.234 -		// update if something has changed
  30.235 -		return;
  30.236 -	}	
  30.237 -	else
  30.238 -	{
  30.239 -		beginPos=a;
  30.240 -		endPos=b;
  30.241 -		line->setPen (pen);
  30.242 -		line->setLine(a.x(), a.y(), b.x(), b.y());
  30.243 -	}
  30.244 -}
  30.245 -
  30.246 -BranchObj* XLinkObj::otherBranch(BranchObj* thisBranch)
  30.247 -{
  30.248 -	if (!beginBranch && !endBranch)
  30.249 -		return NULL;
  30.250 -	if (thisBranch==beginBranch)
  30.251 -		return endBranch;
  30.252 -	else	
  30.253 -		return beginBranch;
  30.254 +	beginPos=a;
  30.255 +	endPos=b;
  30.256 +	XLinkItem *xli=(XLinkItem*)treeItem;
  30.257 +	pen.setColor ( xli->getColor() );
  30.258 +	pen.setWidth ( xli->getWidth() );
  30.259 +	poly->setBrush (xli->getColor() );
  30.260 +	line->setPen (pen);
  30.261 +	line->setLine(a.x(), a.y(), b.x(), b.y());
  30.262  }
  30.263  
  30.264  void XLinkObj::positionBBox()
  30.265 @@ -253,49 +148,36 @@
  30.266  
  30.267  void XLinkObj::setVisibility ()
  30.268  {
  30.269 -	if (beginBranch && endBranch)
  30.270 +	BranchItem* beginBI=((XLinkItem*)treeItem)->getBegin();
  30.271 +	BranchObj* beginBO=NULL;
  30.272 +	if (beginBI) beginBO=(BranchObj*)(beginBI->getLMO());
  30.273 +
  30.274 +	BranchObj* endBO=NULL;
  30.275 +	BranchItem* endBI=((XLinkItem*)treeItem)->getEnd();
  30.276 +	if (endBI) endBO=(BranchObj*)(endBI->getLMO());
  30.277 +	if (beginBO && endBO)
  30.278  	{
  30.279 -		if(beginBranch->isVisibleObj() && endBranch->isVisibleObj())
  30.280 +		if(beginBO->isVisibleObj() && endBO->isVisibleObj())
  30.281  		{	// Both ends are visible
  30.282  			visBranch=NULL;
  30.283  			setVisibility (true);
  30.284  		} else
  30.285  		{
  30.286 -			if(!beginBranch->isVisibleObj() && !endBranch->isVisibleObj())
  30.287 +			if(!beginBO->isVisibleObj() && !endBO->isVisibleObj())
  30.288  			{	//None of the ends is visible
  30.289  				visBranch=NULL;
  30.290  				setVisibility (false);
  30.291  			} else
  30.292  			{	// Just one end is visible, draw a symbol that shows
  30.293  				// that there is a link to a scrolled branch
  30.294 -				if (beginBranch->isVisibleObj())
  30.295 -					visBranch=beginBranch;
  30.296 +				if (beginBO->isVisibleObj())
  30.297 +					visBranch=beginBI;
  30.298  				else
  30.299 -					visBranch=endBranch;
  30.300 +					visBranch=endBI;
  30.301  				setVisibility (true);
  30.302  			}
  30.303  		}
  30.304  	}
  30.305  }
  30.306  
  30.307 -QString XLinkObj::saveToDir ()
  30.308 -{
  30.309 -	QString s="";
  30.310 -	if (beginBranch && endBranch &&xLinkState==activeXLink)
  30.311 -	{
  30.312 -		if (beginBranch==endBranch && xLinkState)
  30.313 -			s="";
  30.314 -		else
  30.315 -		{
  30.316 -			QString colAttr=attribut ("color",color.name());
  30.317 -			QString widAttr=attribut ("width",QString().setNum(width,10));
  30.318 -			QString begSelAttr=attribut ("beginID",beginBranch->getSelectString());
  30.319 -			QString endSelAttr=attribut ("endID",  endBranch->getSelectString());
  30.320 -			s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr);
  30.321  
  30.322 -			s+=endElement ("xlink");
  30.323 -		}
  30.324 -	}
  30.325 -	return s;
  30.326 -}
  30.327 -
    31.1 --- a/xlinkobj.h	Mon Aug 24 14:39:07 2009 +0000
    31.2 +++ b/xlinkobj.h	Thu Sep 03 08:52:00 2009 +0000
    31.3 @@ -1,55 +1,35 @@
    31.4  #ifndef XLINKOBJ_H
    31.5  #define XLINKOBJ_H
    31.6  
    31.7 -#include "linkablemapobj.h"
    31.8 +#include "mapobj.h"
    31.9  
   31.10  class BranchObj;
   31.11 -
   31.12 -enum XLinkState {undefinedXLink,initXLink,activeXLink,deleteXLink};
   31.13 +class BranchItem;
   31.14  
   31.15  /*! \brief xlinks are used to draw arbitrary connections between branches (BranchObj) in the map. */
   31.16  
   31.17  /////////////////////////////////////////////////////////////////////////////
   31.18  class XLinkObj:public MapObj {
   31.19  public:
   31.20 -    XLinkObj ();
   31.21 -    XLinkObj (QGraphicsScene*);
   31.22 +    XLinkObj (QGraphicsScene* scene, TreeItem* ti);
   31.23      ~XLinkObj ();
   31.24      virtual void init ();
   31.25 -    virtual void copy (XLinkObj*);
   31.26 -	void setBegin (BranchObj*);
   31.27 -	BranchObj* getBegin();
   31.28 -	void setEnd   (BranchObj*);
   31.29 -	void setEnd   (QPointF);
   31.30 -	BranchObj* getEnd();
   31.31 -	void setColor(QColor);
   31.32 -	QColor getColor();
   31.33 -	void setWidth (int);
   31.34 -	int getWidth ();
   31.35 -	bool activate ();			// Sets pointers in branchObjects
   31.36 -	void deactivate();			// removes those pointers
   31.37 -	bool isUsed();				// true, if at least on branch uses it
   31.38 +	virtual void setEnd (QPointF);
   31.39  	void updateXLink();
   31.40 -	BranchObj* otherBranch (BranchObj*);
   31.41  	void positionBBox();
   31.42  	void calcBBoxSize();
   31.43  	void setVisibility (bool);
   31.44  	void setVisibility ();
   31.45 -	QString saveToDir ();
   31.46  
   31.47  private:
   31.48  	static int arrowSize;
   31.49  	QPen pen;
   31.50 -	QColor color;
   31.51 -	int width;
   31.52  	QGraphicsLineItem *line;
   31.53  	QGraphicsPolygonItem *poly;
   31.54 -	BranchObj *beginBranch;
   31.55 -	BranchObj *endBranch;
   31.56 -	BranchObj *visBranch;	// the "visible" part of a partially scrolled link
   31.57 -	XLinkState xLinkState;	// init during drawing or active
   31.58  	QPointF beginPos;
   31.59  	QPointF   endPos;
   31.60 +
   31.61 +	BranchItem *visBranch;	// the "visible" part of a partially scrolled li
   31.62  };
   31.63  
   31.64  #endif
    32.1 --- a/xml-vym.cpp	Mon Aug 24 14:39:07 2009 +0000
    32.2 +++ b/xml-vym.cpp	Thu Sep 03 08:52:00 2009 +0000
    32.3 @@ -12,6 +12,7 @@
    32.4  #include "linkablemapobj.h"
    32.5  #include "mainwindow.h"
    32.6  #include "version.h"
    32.7 +#include "xlinkitem.h"
    32.8  
    32.9  static ImageItem *lastImageItem;
   32.10  static MapItem *lastMI;
   32.11 @@ -450,8 +451,8 @@
   32.12  					return false;   // Couldn't read absPos
   32.13  			}           
   32.14  		}           
   32.15 -		//if (!a.value( "id").isEmpty() ) 
   32.16 -		//	lastMI->setID (a.value ("id"));		// FIXME-3
   32.17 +		if (!a.value( "id").isEmpty() ) 
   32.18 +			lastMI->setID (a.value ("id"));		
   32.19  			
   32.20  		if (!a.value( "url").isEmpty() ) 
   32.21  			lastMI->setURL (a.value ("url"));
   32.22 @@ -550,67 +551,39 @@
   32.23  	return true;
   32.24  }
   32.25  
   32.26 -bool parseVYMHandler::readXLinkAttr (const QXmlAttributes& a)
   32.27 +bool parseVYMHandler::readXLinkAttr (const QXmlAttributes& a)	
   32.28  {
   32.29 -	QColor col;
   32.30 -	bool okx;
   32.31 -	bool success=false;
   32.32 -	XLinkObj *xlo=new XLinkObj (model->getScene());
   32.33 -	if (!a.value( "color").isEmpty() ) 
   32.34 -	{
   32.35 -		col.setNamedColor(a.value("color"));
   32.36 -		xlo->setColor (col);
   32.37 -	}
   32.38 -
   32.39 -	if (!a.value( "width").isEmpty() ) 
   32.40 -	{
   32.41 -		xlo->setWidth(a.value ("width").toInt (&okx, 10));
   32.42 -	}
   32.43 -
   32.44 -	// Connecting by select string for compatibility with version < 1.8.76
   32.45 -	if (!a.value( "beginBranch").isEmpty() ) 
   32.46 -	{ 
   32.47 -		if (!a.value( "endBranch").isEmpty() ) 
   32.48 -		{
   32.49 -			TreeItem *ti=model->findBySelectString (a.value( "beginBranch"));
   32.50 -			if (ti && ti->isBranchLikeType())
   32.51 -			{
   32.52 -			/* FIXME-2 xLinks
   32.53 -				xlo->setBegin ((BranchObj*)lmo);
   32.54 -				lmo=model->findBySelectString (a.value( "endBranch"));
   32.55 -				if (lmo && typid (*lmo)==typid (BranchObj))
   32.56 -				{
   32.57 -					xlo->setEnd ((BranchObj*)(lmo));
   32.58 -					xlo->activate();
   32.59 -					success=true;
   32.60 -				}
   32.61 -			*/
   32.62 -			}
   32.63 -		}           
   32.64 -	}	
   32.65 -
   32.66  	// object ID is used starting in version 1.8.76
   32.67 -	/* FIXME-2 xLinks
   32.68 +	// (before there was beginBranch and endBranch)
   32.69  	if (!a.value( "beginID").isEmpty() ) 
   32.70  	{ 
   32.71  		if (!a.value( "endID").isEmpty() ) 
   32.72  		{
   32.73 -			LinkableMapObj *lmo=model->findID (a.value( "beginID"));
   32.74 -			if (lmo && typid (*lmo)==typid (BranchObj))
   32.75 +			TreeItem *beginBI=model->findID (a.value( "beginID"));
   32.76 +			TreeItem   *endBI=model->findID (a.value( "endID"));
   32.77 +			if (beginBI && endBI && beginBI->isBranchLikeType() && endBI->isBranchLikeType() )
   32.78  			{
   32.79 -				xlo->setBegin ((BranchObj*)lmo);
   32.80 -				lmo=model->findID (a.value( "endID"));
   32.81 -				if (lmo && typid (*lmo)==typid (BranchObj))
   32.82 +				XLinkItem *xli=model->createXLink (lastBranch,true);
   32.83 +				xli->setBegin ( (BranchItem*)beginBI );
   32.84 +				xli->setEnd ( (BranchItem*)endBI);
   32.85 +				xli->activate();
   32.86 +
   32.87 +				if (!a.value( "color").isEmpty() ) 
   32.88  				{
   32.89 -					xlo->setEnd ((BranchObj*)(lmo));
   32.90 -					xlo->activate();
   32.91 -					success=true;
   32.92 +					QColor col;
   32.93 +					col.setNamedColor(a.value("color"));
   32.94 +					xli->setColor (col);
   32.95  				}
   32.96 +
   32.97 +				if (!a.value( "width").isEmpty() ) 
   32.98 +				{
   32.99 +					bool okx;
  32.100 +					xli->setWidth(a.value ("width").toInt (&okx, 10));
  32.101 +				}
  32.102 +				xli->updateXLink();
  32.103  			}
  32.104  		}           
  32.105  	}	
  32.106 -	*/
  32.107 -	if (!success) delete (xlo);
  32.108  	return true;	// xLinks can only be established at the "end branch", return true
  32.109  }
  32.110