added basic xLink functions
authorinsilmaril
Mon Apr 18 06:17:00 2005 +0000 (2005-04-18)
changeset 95f688a9913724
parent 94 6783e13bb05d
child 96 598768200cfa
added basic xLink functions
branchobj.cpp
branchobj.h
demos/todo.vym
editxlinkdialog.ui
editxlinkdialog.ui.h
linkablemapobj.cpp
linkablemapobj.h
mainwindow.cpp
mainwindow.h
mapcenterobj.cpp
mapcenterobj.h
mapeditor.cpp
mapeditor.h
misc.cpp
tex/vym.tex
texteditor.cpp
version.h
vym.pro
xlinkobj.cpp
xlinkobj.h
xml.cpp
xml.h
     1.1 --- a/branchobj.cpp	Sat Apr 09 22:50:08 2005 +0000
     1.2 +++ b/branchobj.cpp	Mon Apr 18 06:17:00 2005 +0000
     1.3 @@ -87,7 +87,7 @@
     1.4  {
     1.5      branch.setAutoDelete (false);
     1.6      floatimage.setAutoDelete (true);
     1.7 -    link.setAutoDelete (false);
     1.8 +    xlink.setAutoDelete (false);
     1.9  
    1.10  	if (parObj)
    1.11  	{
    1.12 @@ -141,8 +141,8 @@
    1.13  void BranchObj::clear() 
    1.14  {
    1.15  	floatimage.clear();
    1.16 -	while (!link.isEmpty())
    1.17 -		deleteLink (link.first() );
    1.18 +	while (!xlink.isEmpty())
    1.19 +		deleteXLink (xlink.first() );
    1.20  
    1.21  	BranchObj *bo;
    1.22  	while (!branch.isEmpty())
    1.23 @@ -163,7 +163,12 @@
    1.24  
    1.25  int BranchObj::getNum(BranchObj *bo)
    1.26  {
    1.27 -	return branch.findRef (bo);
    1.28 +	// keep current pointer in branch, 
    1.29 +	// otherwise save might fail
    1.30 +	int cur=branch.at();
    1.31 +	int ind=branch.findRef (bo);
    1.32 +	branch.at(cur);
    1.33 +	return ind;
    1.34  }
    1.35  
    1.36  int BranchObj::getFloatImageNum(FloatImageObj *fio)
    1.37 @@ -181,9 +186,9 @@
    1.38  	return floatimage.count();
    1.39  }
    1.40  
    1.41 -int BranchObj::countLinks()
    1.42 +int BranchObj::countXLinks()
    1.43  {
    1.44 -	return link.count();
    1.45 +	return xlink.count();
    1.46  }
    1.47  
    1.48  void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
    1.49 @@ -380,9 +385,9 @@
    1.50  			FloatImageObj *fio;
    1.51  			for (fio=floatimage.first(); fio; fio=floatimage.next())
    1.52  				fio->setVisibility (v);
    1.53 -			LinkObj* lo;
    1.54 -			for (lo=link.first(); lo;lo=link.next() ) 
    1.55 -				lo->setVisibility ();	
    1.56 +			XLinkObj* xlo;
    1.57 +			for (xlo=xlink.first(); xlo;xlo=xlink.next() ) 
    1.58 +				xlo->setVisibility ();	
    1.59  		}
    1.60      } // depth <= toDepth	
    1.61  	requestReposition();
    1.62 @@ -599,9 +604,9 @@
    1.63  	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
    1.64  
    1.65  	// Update links to other branches
    1.66 -	LinkObj *l;
    1.67 -    for (l=link.first(); l; l=link.next() )
    1.68 -		l->updateLink();
    1.69 +	XLinkObj *xlo;
    1.70 +    for (xlo=xlink.first(); xlo; xlo=xlink.next() )
    1.71 +		xlo->updateXLink();
    1.72  }
    1.73  
    1.74  void BranchObj::calcBBoxSize()
    1.75 @@ -783,53 +788,55 @@
    1.76      BranchObj *bo;
    1.77      for (bo=branch.first(); bo; bo=branch.next() )
    1.78  		s+=bo->saveToDir(tmpdir,prefix,offset);
    1.79 -    decIndent();
    1.80  
    1.81  	// Save FloatImages
    1.82  	FloatImageObj *fio;
    1.83  	for (fio=floatimage.first(); fio; fio=floatimage.next() )
    1.84  		s+=fio->saveToDir (tmpdir,prefix);
    1.85  
    1.86 +	// Save XLinks
    1.87 +	XLinkObj *xlo;
    1.88 +    for (xlo=xlink.first(); xlo; xlo=xlink.next() )
    1.89 +		s+=xlo->saveToDir();
    1.90 +
    1.91 +    decIndent();
    1.92      s+=endElement   ("branch");
    1.93      return s;
    1.94  }
    1.95  
    1.96 -void BranchObj::addLink (LinkObj *lo)
    1.97 +void BranchObj::addXLink (XLinkObj *xlo)
    1.98  {
    1.99 -	link.append (lo);
   1.100 +	xlink.append (xlo);
   1.101  	
   1.102  }
   1.103  
   1.104 -void BranchObj::removeLinkRef (LinkObj *lo)
   1.105 +void BranchObj::removeXLinkRef (XLinkObj *xlo)
   1.106  {
   1.107 -	link.remove (lo);
   1.108 +	xlink.remove (xlo);
   1.109  }
   1.110  
   1.111 -void BranchObj::deleteLink(LinkObj *lo)
   1.112 +void BranchObj::deleteXLink(XLinkObj *xlo)
   1.113  {
   1.114 -	lo->deactivate();
   1.115 -	if (!lo->isUsed()) delete (lo);
   1.116 +	xlo->deactivate();
   1.117 +	if (!xlo->isUsed()) delete (xlo);
   1.118  }
   1.119  
   1.120 -void BranchObj::deleteLinkAt (int i)
   1.121 +void BranchObj::deleteXLinkAt (int i)
   1.122  {
   1.123 -	LinkObj *lo=link.at(i);
   1.124 -	lo->deactivate();
   1.125 -	if (!lo->isUsed()) 
   1.126 -	{
   1.127 -		delete(lo);
   1.128 -	}	
   1.129 +	XLinkObj *xlo=xlink.at(i);
   1.130 +	xlo->deactivate();
   1.131 +	if (!xlo->isUsed()) delete(xlo);
   1.132  }
   1.133  
   1.134 -int BranchObj::countLink()
   1.135 +int BranchObj::countXLink()
   1.136  {
   1.137 -	return link.count();
   1.138 +	return xlink.count();
   1.139  }
   1.140  
   1.141 -BranchObj* BranchObj::linkTargetAt (int i)
   1.142 +BranchObj* BranchObj::XLinkTargetAt (int i)
   1.143  {
   1.144 -	if (link.at(i))
   1.145 -		return link.at(i)->otherBranch (this);
   1.146 +	if (xlink.at(i))
   1.147 +		return xlink.at(i)->otherBranch (this);
   1.148  	else
   1.149  		return NULL;
   1.150  }
   1.151 @@ -1312,15 +1319,12 @@
   1.152  	QString s;
   1.153  	if (parObj)
   1.154  	{
   1.155 -		if (parObj->getDepth()==0)
   1.156 +		if (depth==1)
   1.157  			s= "bo:" + QString("%1").arg(getNum());
   1.158  		else	
   1.159  			s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
   1.160  	} else
   1.161 -	{
   1.162  		s="mc:";
   1.163 -	}
   1.164 -	
   1.165  	return s;
   1.166  }
   1.167  
     2.1 --- a/branchobj.h	Sat Apr 09 22:50:08 2005 +0000
     2.2 +++ b/branchobj.h	Mon Apr 18 06:17:00 2005 +0000
     2.3 @@ -4,7 +4,7 @@
     2.4  #include "floatimageobj.h"
     2.5  #include "linkablemapobj.h"
     2.6  #include "ornamentedobj.h"
     2.7 -#include "linkobj.h"
     2.8 +#include "xlinkobj.h"
     2.9  
    2.10  class BranchObjPtrList : public QPtrList<BranchObj>
    2.11  {
    2.12 @@ -28,7 +28,7 @@
    2.13  	virtual int getFloatImageNum(FloatImageObj*);		
    2.14  	virtual int countBranches();		
    2.15  	virtual int countFloatImages();		
    2.16 -	virtual int countLinks();		
    2.17 +	virtual int countXLinks();		
    2.18      virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
    2.19  	virtual void unsetParObjTmp();			// reuse original ParObj
    2.20  
    2.21 @@ -63,12 +63,12 @@
    2.22      virtual void setVymLink (QString);
    2.23      virtual QString getVymLink ();
    2.24  	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    2.25 -	virtual void addLink (LinkObj*);
    2.26 -	virtual void removeLinkRef (LinkObj*);	// Remove ref in list
    2.27 -	virtual void deleteLink (LinkObj*);		// remove references and delete LinkObj 
    2.28 -	virtual void deleteLinkAt (int);		// remove references and delete LinkObj 
    2.29 -	virtual int countLink ();
    2.30 -	virtual BranchObj* linkTargetAt (int);
    2.31 +	virtual void addXLink (XLinkObj*);
    2.32 +	virtual void removeXLinkRef (XLinkObj*);	// Remove ref in list
    2.33 +	virtual void deleteXLink (XLinkObj*);		// remove references and delete XLinkObj 
    2.34 +	virtual void deleteXLinkAt (int);		// remove references and delete XLinkObj 
    2.35 +	virtual int countXLink ();
    2.36 +	virtual BranchObj* XLinkTargetAt (int);
    2.37  	virtual LinkableMapObj* addFloatImage();
    2.38  	virtual LinkableMapObj* addFloatImage(FloatImageObj*);
    2.39  	virtual void removeFloatImage(FloatImageObj*);
    2.40 @@ -109,7 +109,7 @@
    2.41  	static BranchObj* itLast;		// iterator for first(), next()
    2.42      BranchObjPtrList branch;		// all child branches
    2.43  	QPtrList<FloatImageObj> floatimage;	// child images
    2.44 -	QPtrList<LinkObj> link;			// links to other branches
    2.45 +	QPtrList<XLinkObj> xlink;		// xlinks to other branches
    2.46  public:	
    2.47  	float angle;					// used in mainbranch to reorder mainbranches
    2.48  protected:	
     3.1 Binary file demos/todo.vym has changed
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/editxlinkdialog.ui	Mon Apr 18 06:17:00 2005 +0000
     4.3 @@ -0,0 +1,100 @@
     4.4 +<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
     4.5 +<class>EditXLinkDialog</class>
     4.6 +<widget class="QDialog">
     4.7 +    <property name="name">
     4.8 +        <cstring>EditXLinkDialog</cstring>
     4.9 +    </property>
    4.10 +    <property name="geometry">
    4.11 +        <rect>
    4.12 +            <x>0</x>
    4.13 +            <y>0</y>
    4.14 +            <width>570</width>
    4.15 +            <height>91</height>
    4.16 +        </rect>
    4.17 +    </property>
    4.18 +    <property name="caption">
    4.19 +        <string>Edit Link</string>
    4.20 +    </property>
    4.21 +    <grid>
    4.22 +        <property name="name">
    4.23 +            <cstring>unnamed</cstring>
    4.24 +        </property>
    4.25 +        <widget class="QPushButton" row="0" column="0">
    4.26 +            <property name="name">
    4.27 +                <cstring>deleteButton</cstring>
    4.28 +            </property>
    4.29 +            <property name="text">
    4.30 +                <string>Delete XLink</string>
    4.31 +            </property>
    4.32 +        </widget>
    4.33 +        <spacer row="0" column="1">
    4.34 +            <property name="name">
    4.35 +                <cstring>spacer11</cstring>
    4.36 +            </property>
    4.37 +            <property name="orientation">
    4.38 +                <enum>Horizontal</enum>
    4.39 +            </property>
    4.40 +            <property name="sizeType">
    4.41 +                <enum>Expanding</enum>
    4.42 +            </property>
    4.43 +            <property name="sizeHint">
    4.44 +                <size>
    4.45 +                    <width>180</width>
    4.46 +                    <height>20</height>
    4.47 +                </size>
    4.48 +            </property>
    4.49 +        </spacer>
    4.50 +        <widget class="QPushButton" row="0" column="3">
    4.51 +            <property name="name">
    4.52 +                <cstring>okButton</cstring>
    4.53 +            </property>
    4.54 +            <property name="text">
    4.55 +                <string>Ok</string>
    4.56 +            </property>
    4.57 +        </widget>
    4.58 +        <widget class="QPushButton" row="0" column="2">
    4.59 +            <property name="name">
    4.60 +                <cstring>cancelButton</cstring>
    4.61 +            </property>
    4.62 +            <property name="text">
    4.63 +                <string>Cancel</string>
    4.64 +            </property>
    4.65 +        </widget>
    4.66 +    </grid>
    4.67 +</widget>
    4.68 +<connections>
    4.69 +    <connection>
    4.70 +        <sender>okButton</sender>
    4.71 +        <signal>clicked()</signal>
    4.72 +        <receiver>EditXLinkDialog</receiver>
    4.73 +        <slot>accept()</slot>
    4.74 +    </connection>
    4.75 +    <connection>
    4.76 +        <sender>cancelButton</sender>
    4.77 +        <signal>clicked()</signal>
    4.78 +        <receiver>EditXLinkDialog</receiver>
    4.79 +        <slot>reject()</slot>
    4.80 +    </connection>
    4.81 +    <connection>
    4.82 +        <sender>deleteButton</sender>
    4.83 +        <signal>clicked()</signal>
    4.84 +        <receiver>EditXLinkDialog</receiver>
    4.85 +        <slot>deleteButtonPressed()</slot>
    4.86 +    </connection>
    4.87 +</connections>
    4.88 +<includes>
    4.89 +    <include location="local" impldecl="in implementation">editxlinkdialog.ui.h</include>
    4.90 +</includes>
    4.91 +<variables>
    4.92 +    <variable access="private">bool delink;</variable>
    4.93 +</variables>
    4.94 +<slots>
    4.95 +    <slot access="protected">deleteButtonPressed()</slot>
    4.96 +</slots>
    4.97 +<functions>
    4.98 +    <function access="private" specifier="non virtual">init()</function>
    4.99 +    <function returnType="bool">deleteXLink()</function>
   4.100 +</functions>
   4.101 +<pixmapinproject/>
   4.102 +<layoutdefaults spacing="6" margin="11"/>
   4.103 +</UI>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/editxlinkdialog.ui.h	Mon Apr 18 06:17:00 2005 +0000
     5.3 @@ -0,0 +1,23 @@
     5.4 +/****************************************************************************
     5.5 +** ui.h extension file, included from the uic-generated form implementation.
     5.6 +**
     5.7 +** If you wish to add, delete or rename functions or slots use
     5.8 +** Qt Designer which will update this file, preserving your code. Create an
     5.9 +** init() function in place of a constructor, and a destroy() function in
    5.10 +** place of a destructor.
    5.11 +*****************************************************************************/
    5.12 +void EditXLinkDialog::init()
    5.13 +{
    5.14 +	delink=false;
    5.15 +}
    5.16 +
    5.17 +void EditXLinkDialog::deleteButtonPressed()
    5.18 +{
    5.19 +	delink=true;
    5.20 +	accept();
    5.21 +}
    5.22 +
    5.23 +bool EditXLinkDialog::deleteXLink()
    5.24 +{
    5.25 +	return delink;
    5.26 +}	
     6.1 --- a/linkablemapobj.cpp	Sat Apr 09 22:50:08 2005 +0000
     6.2 +++ b/linkablemapobj.cpp	Mon Apr 18 06:17:00 2005 +0000
     6.3 @@ -1,4 +1,4 @@
     6.4 -//#include <math.h>
     6.5 +#include <cmath>
     6.6  
     6.7  #include "linkablemapobj.h"
     6.8  #include "branchobj.h"
     6.9 @@ -535,6 +535,40 @@
    6.10      return parObj;
    6.11  }
    6.12  
    6.13 +LinkableMapObj* LinkableMapObj::findObj (QString s)
    6.14 +{
    6.15 +	LinkableMapObj *lmo=this;
    6.16 +	QString part;
    6.17 +	QString typ;
    6.18 +	QString num;
    6.19 +	while (!s.isEmpty() )
    6.20 +	{
    6.21 +		part=s.section(",",0,0);
    6.22 +		typ=part.left (3);
    6.23 +		num=part.right(part.length() - 3);
    6.24 +		
    6.25 +		if (typ=="mc:")
    6.26 +		{
    6.27 +			if (depth>0)
    6.28 +				return false;	// in a subtree there is no center
    6.29 +			else
    6.30 +				break;
    6.31 +		} else
    6.32 +			if (typ=="bo:")
    6.33 +				lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
    6.34 +			else
    6.35 +				if (typ=="fi:")
    6.36 +					lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
    6.37 +		if (!lmo) break;
    6.38 +		
    6.39 +		if (s.contains(","))
    6.40 +			s=s.right(s.length() - part.length() -1 );
    6.41 +		else	
    6.42 +			break;
    6.43 +	}
    6.44 +	return lmo;
    6.45 +}
    6.46 +
    6.47  QPoint LinkableMapObj::getChildPos()
    6.48  {
    6.49      return childPos;
    6.50 @@ -584,6 +618,8 @@
    6.51  
    6.52  void LinkableMapObj::alignRelativeTo (QPoint ref)
    6.53  {
    6.54 +	cout << "LMO::alignRelTo   ref="<<ref<<endl;
    6.55 +	//FIXME 
    6.56  }
    6.57  
    6.58  void LinkableMapObj::reposition()
     7.1 --- a/linkablemapobj.h	Sat Apr 09 22:50:08 2005 +0000
     7.2 +++ b/linkablemapobj.h	Mon Apr 18 06:17:00 2005 +0000
     7.3 @@ -51,6 +51,7 @@
     7.4  											// redraw link with given style
     7.5      LinkableMapObj* getChildObj();			// returns pointer to fromObj
     7.6      LinkableMapObj* getParObj();			// returns pointer to toObj
     7.7 +    virtual LinkableMapObj* findObj(QString s);	// find obj by selectstring
     7.8      QPoint getChildPos();					// returns pos where childs dock
     7.9      QPoint getParPos();						// returns pos where parents dock
    7.10      QPoint getRelPos();						// get position relative to parent (or (0,0))
     8.1 --- a/mainwindow.cpp	Sat Apr 09 22:50:08 2005 +0000
     8.2 +++ b/mainwindow.cpp	Mon Apr 18 06:17:00 2005 +0000
     8.3 @@ -16,7 +16,7 @@
     8.4  
     8.5  
     8.6  #include <iostream>
     8.7 -#include <stdlib.h>
     8.8 +#include <cstdlib>
     8.9  #include <typeinfo>
    8.10  
    8.11  #include "version.h"
    8.12 @@ -842,9 +842,9 @@
    8.13  	branchContextMenu->insertSeparator();	
    8.14  	actionEditLoadImage->addTo( branchContextMenu );
    8.15  	branchContextMenu->insertSeparator();	
    8.16 -	actionEditCopy->addTo( branchContextMenu );
    8.17 -	actionEditCut->addTo( branchContextMenu );
    8.18 -	actionEditPaste->addTo( branchContextMenu );
    8.19 +	//actionEditCopy->addTo( branchContextMenu );
    8.20 +	//actionEditCut->addTo( branchContextMenu );
    8.21 +	//actionEditPaste->addTo( branchContextMenu );
    8.22  	branchContextMenu->insertSeparator();	
    8.23  	actionGroupFormatFrameTypes->addTo( branchContextMenu );
    8.24  
    8.25 @@ -852,12 +852,12 @@
    8.26  	// This will be populated "on demand" in MapEditor::updateActions
    8.27  	branchContextMenu->insertSeparator();	
    8.28  	branchLinksContextMenu =new QPopupMenu (this);
    8.29 -	branchContextMenu->insertItem (tr("Goto Link"),branchLinksContextMenu);
    8.30 -	connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowLink(int ) ) );
    8.31 +	branchContextMenu->insertItem (tr("Goto XLink"),branchLinksContextMenu);
    8.32 +	connect( branchLinksContextMenu, SIGNAL( activated(int) ), this, SLOT( editFollowXLink(int ) ) );
    8.33  	
    8.34  	branchLinksContextMenuDup =new QPopupMenu (this);
    8.35 -	branchContextMenu->insertItem (tr("Edit Link"),branchLinksContextMenuDup);
    8.36 -	connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditLink(int ) ) );
    8.37 +	branchContextMenu->insertItem (tr("Edit XLink"),branchLinksContextMenuDup);
    8.38 +	connect( branchLinksContextMenuDup, SIGNAL( activated(int) ), this, SLOT( editEditXLink(int ) ) );
    8.39  
    8.40  	// Context menu for floatimage
    8.41  	floatimageContextMenu =new QPopupMenu (this);
    8.42 @@ -1135,8 +1135,7 @@
    8.43  		if (!QFile(fn).exists() )
    8.44  		{
    8.45  			QMessageBox mb( "VYM",
    8.46 -				tr("The map") + fn + 
    8.47 -				tr(" does not exist.\n Do you want to create a new one?"),
    8.48 +				tr("This map does not exist:\n  ")+fn+tr("\nDo you want to create a new one?"),
    8.49  				QMessageBox::Question,
    8.50  				QMessageBox::Yes ,
    8.51  				QMessageBox::Cancel | QMessageBox::Default,
    8.52 @@ -1994,16 +1993,16 @@
    8.53  		currentMapEditor()->toggleFloatExport();
    8.54  }
    8.55  
    8.56 -void Main::editFollowLink(int item)
    8.57 +void Main::editFollowXLink(int item)
    8.58  {
    8.59  	if (currentMapEditor())
    8.60 -		currentMapEditor()->followLink(branchLinksContextMenu->indexOf(item));
    8.61 +		currentMapEditor()->followXLink(branchLinksContextMenu->indexOf(item));
    8.62  }
    8.63  
    8.64 -void Main::editEditLink(int item)
    8.65 +void Main::editEditXLink(int item)
    8.66  {
    8.67  	if (currentMapEditor())
    8.68 -		currentMapEditor()->editLink(branchLinksContextMenuDup->indexOf(item));
    8.69 +		currentMapEditor()->editXLink(branchLinksContextMenuDup->indexOf(item));
    8.70  }
    8.71  
    8.72  void Main::formatSelectColor()
     9.1 --- a/mainwindow.h	Sat Apr 09 22:50:08 2005 +0000
     9.2 +++ b/mainwindow.h	Mon Apr 18 06:17:00 2005 +0000
     9.3 @@ -115,8 +115,8 @@
     9.4      void editLoadImage();
     9.5      void editSaveImage(int);
     9.6      void editToggleFloatExport();
     9.7 -    void editFollowLink (int);
     9.8 -    void editEditLink (int);
     9.9 +    void editFollowXLink (int);
    9.10 +    void editEditXLink (int);
    9.11  
    9.12      void formatSelectColor();
    9.13      void formatPickColor();
    10.1 --- a/mapcenterobj.cpp	Sat Apr 09 22:50:08 2005 +0000
    10.2 +++ b/mapcenterobj.cpp	Mon Apr 18 06:17:00 2005 +0000
    10.3 @@ -151,15 +151,20 @@
    10.4  	if (!note.isEmpty() )
    10.5  		s+=note.saveToDir();
    10.6  	
    10.7 +	// Save branches
    10.8 +    BranchObj *bo;
    10.9 +    for (bo=branch.first(); bo; bo=branch.next() )
   10.10 +		s+=bo->saveToDir(tmpdir,prefix, offset);
   10.11 +
   10.12  	// Save FloatImages
   10.13  	FloatImageObj *fio;
   10.14  	for (fio=floatimage.first(); fio; fio=floatimage.next() )
   10.15  		s+=fio->saveToDir (tmpdir,prefix);
   10.16  
   10.17 -	// Save branches
   10.18 -    BranchObj *bo;
   10.19 -    for (bo=branch.first(); bo; bo=branch.next() )
   10.20 -		s+=bo->saveToDir(tmpdir,prefix, offset);
   10.21 +	// Save XLinks
   10.22 +	XLinkObj *xlo;
   10.23 +    for (xlo=xlink.first(); xlo; xlo=xlink.next() )
   10.24 +		s+=xlo->saveToDir();
   10.25  
   10.26      decIndent();
   10.27      s+=endElement   ("mapcenter");
    11.1 --- a/mapcenterobj.h	Sat Apr 09 22:50:08 2005 +0000
    11.2 +++ b/mapcenterobj.h	Mon Apr 18 06:17:00 2005 +0000
    11.3 @@ -2,7 +2,7 @@
    11.4  #define MAPCENTEROBJ_H
    11.5  
    11.6  #include "branchobj.h"
    11.7 -#include "linkobj.h"
    11.8 +#include "xlinkobj.h"
    11.9  #include "version.h"
   11.10  
   11.11  /////////////////////////////////////////////////////////////////////////////
    12.1 --- a/mapeditor.cpp	Sat Apr 09 22:50:08 2005 +0000
    12.2 +++ b/mapeditor.cpp	Mon Apr 18 06:17:00 2005 +0000
    12.3 @@ -17,7 +17,7 @@
    12.4  #include <qinputdialog.h>
    12.5  
    12.6  #include <iostream>
    12.7 -#include <stdlib.h>
    12.8 +#include <cstdlib>
    12.9  #include <typeinfo>
   12.10  
   12.11  #include "version.h"
   12.12 @@ -29,7 +29,7 @@
   12.13  #include "misc.h"
   12.14  #include "mainwindow.h"
   12.15  #include "extrainfodialog.h"
   12.16 -#include "editlinkdialog.h"
   12.17 +#include "editxlinkdialog.h"
   12.18  #include "settings.h"
   12.19  
   12.20  #include "icons/flag-note.xpm"
   12.21 @@ -1449,43 +1449,9 @@
   12.22  	return selection;
   12.23  }
   12.24  
   12.25 -LinkableMapObj* MapEditor::findObj (QString s)
   12.26 -{
   12.27 -	LinkableMapObj *lmo=mapCenter;
   12.28 -	QString part;
   12.29 -	QString typ;
   12.30 -	QString num;
   12.31 -	while (!s.isEmpty() )
   12.32 -	{
   12.33 -		part=s.section(",",0,0);
   12.34 -		typ=part.left (3);
   12.35 -		num=part.right(part.length() - 3);
   12.36 -		
   12.37 -		if (typ=="mc:")
   12.38 -		{
   12.39 -			if (num=="")
   12.40 -				break;
   12.41 -			else
   12.42 -				lmo=mapCenter->getBranchNum (num.toUInt());
   12.43 -		} else
   12.44 -			if (typ=="bo:")
   12.45 -				lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt());
   12.46 -			else
   12.47 -				if (typ=="fi:")
   12.48 -					lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt());
   12.49 -		if (!lmo) break;
   12.50 -		
   12.51 -		if (s.contains(","))
   12.52 -			s=s.right(s.length() - part.length() -1 );
   12.53 -		else	
   12.54 -			break;
   12.55 -	}
   12.56 -	return lmo;
   12.57 -}
   12.58 -
   12.59  bool MapEditor::select (const QString &s)
   12.60  {
   12.61 -	LinkableMapObj *lmo=findObj(s);
   12.62 +	LinkableMapObj *lmo=mapCenter->findObj(s);
   12.63  
   12.64  	// Finally select the found object
   12.65  	if (lmo)
   12.66 @@ -2104,8 +2070,7 @@
   12.67  			typeid(*selection) == typeid(MapCenterObj)) )
   12.68  	{		
   12.69  		BranchObj *b=(BranchObj*)(selection);
   12.70 -		b->setURL ("http://bugzilla.suse.de/show_bug.cgi?id="+b->getHeading());
   12.71 -		b->setURL ("https://bugzilla.innerweb.novell.com/show_bug.cgi?id="+b->getHeading());
   12.72 +		b->setURL ("https://bugzilla.novell.com/show_bug.cgi?id="+b->getHeading());
   12.73  		updateActions();
   12.74  		setChanged();
   12.75  	}
   12.76 @@ -2241,7 +2206,7 @@
   12.77  		{
   12.78  			BranchObj *bo=(BranchObj*)(selection);
   12.79  			// Take care of links
   12.80 -			if (bo->countLinks()==0)
   12.81 +			if (bo->countXLinks()==0)
   12.82  			{
   12.83  				branchLinksContextMenu->clear();
   12.84  				branchLinksContextMenu->insertItem ("No link available");
   12.85 @@ -2254,9 +2219,9 @@
   12.86  				QString s;
   12.87  				branchLinksContextMenu->clear();
   12.88  				branchLinksContextMenuDup->clear();
   12.89 -				for (int i=0; i<=bo->countLinks();i++)
   12.90 +				for (int i=0; i<=bo->countXLinks();i++)
   12.91  				{
   12.92 -					bot=bo->linkTargetAt(i);
   12.93 +					bot=bo->XLinkTargetAt(i);
   12.94  					if (bot)
   12.95  					{
   12.96  						s=bot->getHeading();
   12.97 @@ -2682,9 +2647,9 @@
   12.98  	}	
   12.99  }
  12.100  
  12.101 -void MapEditor::followLink(int i)
  12.102 +void MapEditor::followXLink(int i)
  12.103  {
  12.104 -	BranchObj *bo=((BranchObj*)(selection))->linkTargetAt(i);
  12.105 +	BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i);
  12.106  	if (bo) 
  12.107  	{
  12.108  		selection->unselect();
  12.109 @@ -2694,16 +2659,16 @@
  12.110  	}
  12.111  }
  12.112  
  12.113 -void MapEditor::editLink(int i)
  12.114 +void MapEditor::editXLink(int i)
  12.115  {
  12.116 -	BranchObj *bo=((BranchObj*)(selection))->linkTargetAt(i);
  12.117 +	BranchObj *bo=((BranchObj*)(selection))->XLinkTargetAt(i);
  12.118  	if (bo) 
  12.119  	{
  12.120 -		EditLinkDialog dia;
  12.121 +		EditXLinkDialog dia;
  12.122  		if (dia.exec() == QDialog::Accepted)
  12.123  		{
  12.124 -			if (dia.deleteLink())
  12.125 -				((BranchObj*)(selection))->deleteLinkAt(i);
  12.126 +			if (dia.deleteXLink())
  12.127 +				((BranchObj*)(selection))->deleteXLinkAt(i);
  12.128  			setChanged();
  12.129  		}
  12.130  	}	
  12.131 @@ -2712,40 +2677,9 @@
  12.132  void MapEditor::testFunction()
  12.133  {
  12.134  	cout << "MapEditor::testFunction() called\n";
  12.135 -	if (selection  &&  
  12.136 -		 (typeid(*selection) == typeid(BranchObj) || 
  12.137 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
  12.138 -	{
  12.139 -		BranchObj *bo=(BranchObj*)(selection);
  12.140 -		QPoint p = worldMatrix().map(QPoint (bo->x(),bo->y()));
  12.141 -		//	lineedit->setGeometry(p.x()-contentsX(),p.y()-contentsY(),200,25);
  12.142 -		QPopupMenu *popupLinks=new QPopupMenu (this);
  12.143 -		if (bo->countLinks()==0)
  12.144 -		{
  12.145 -			popupLinks->clear();
  12.146 -			popupLinks->insertItem ("No link available");
  12.147 -			
  12.148 -		} else
  12.149 -		{
  12.150 -			BranchObj *bot;
  12.151 -			QString s;
  12.152 -			popupLinks->clear();
  12.153 -			for (int i=0; i<=bo->countLinks();i++)
  12.154 -			{
  12.155 -				bot=bo->linkTargetAt(i);
  12.156 -				if (bot)
  12.157 -				{
  12.158 -					s=bot->getHeading();
  12.159 -					if (s.length()>25)
  12.160 -						s=s.left(25)+"...";
  12.161 -					popupLinks->insertItem (s);
  12.162 -				}	
  12.163 -			}
  12.164 -		}
  12.165 -		popupLinks->move(p);
  12.166 -		popupLinks->exec();
  12.167 -		
  12.168 -	}
  12.169 +	//cout <<((BranchObj*)(selection))->getSelectString()<<endl;
  12.170 +	QString tmpdir,prefix;
  12.171 +	cout << saveToDir(tmpdir,prefix,true,QPoint(0,0),CompleteMap)<<endl;
  12.172  }
  12.173  
  12.174  void MapEditor::ensureSelectionVisible()
  12.175 @@ -2847,11 +2781,11 @@
  12.176  			{
  12.177  				drawingLink=true;
  12.178  				linkingObj_src=bo_begin;
  12.179 -				tmpLink=new LinkObj (mapCanvas);
  12.180 -				tmpLink->setBegin (bo_begin);
  12.181 -				tmpLink->setEnd   (p);
  12.182 -				tmpLink->updateLink();
  12.183 -				tmpLink->setVisibility (true);
  12.184 +				tmpXLink=new XLinkObj (mapCanvas);
  12.185 +				tmpXLink->setBegin (bo_begin);
  12.186 +				tmpXLink->setEnd   (p);
  12.187 +				tmpXLink->updateXLink();
  12.188 +				tmpXLink->setVisibility (true);
  12.189  				return;
  12.190  			} 
  12.191  		}	
  12.192 @@ -3071,8 +3005,8 @@
  12.193  	// Draw a link from one branch to another
  12.194  	if (drawingLink)
  12.195  	{
  12.196 -		 tmpLink->setEnd (p);
  12.197 -		 tmpLink->updateLink();
  12.198 +		 tmpXLink->setEnd (p);
  12.199 +		 tmpXLink->updateXLink();
  12.200  	}	 
  12.201  	
  12.202      // Move CanvasView 
  12.203 @@ -3123,15 +3057,15 @@
  12.204  		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ), NULL);
  12.205  		if (dst && selection) 
  12.206  		{	
  12.207 -			tmpLink->setEnd ( ((BranchObj*)(dst)) );
  12.208 -			tmpLink->updateLink();
  12.209 -			tmpLink->activate();
  12.210 +			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
  12.211 +			tmpXLink->updateXLink();
  12.212 +			tmpXLink->activate();
  12.213  			setChanged();
  12.214  			
  12.215  		} else
  12.216  		{
  12.217 -			delete(tmpLink);
  12.218 -			tmpLink=NULL;
  12.219 +			delete(tmpXLink);
  12.220 +			tmpXLink=NULL;
  12.221  		}
  12.222  		return;
  12.223  	}
    13.1 --- a/mapeditor.h	Sat Apr 09 22:50:08 2005 +0000
    13.2 +++ b/mapeditor.h	Mon Apr 18 06:17:00 2005 +0000
    13.3 @@ -76,7 +76,6 @@
    13.4      void addNewBranch(int);			// pos allows to add above/below selection
    13.5      void deleteSelection();
    13.6  	LinkableMapObj* getSelection();	// returns selection
    13.7 -	LinkableMapObj* findObj (QString);
    13.8  	bool select(const QString &);	// Select 
    13.9  	void unselect();				// before changing current noteedit
   13.10  	void reselect();				// after  changing current noteedit
   13.11 @@ -128,8 +127,8 @@
   13.12      void importDir(BranchObj *,QDir);
   13.13  public:	
   13.14      void importDir();
   13.15 -	void followLink (int);
   13.16 -	void editLink (int);
   13.17 +	void followXLink (int);
   13.18 +	void editXLink (int);
   13.19      void testFunction();				// FIXME just testing
   13.20  
   13.21  protected:
   13.22 @@ -159,7 +158,7 @@
   13.23  	bool pickingColor;
   13.24  	bool drawingLink;			// true while creating a link
   13.25  	bool copyingObj;			// true while creating a link
   13.26 -	LinkObj* tmpLink;
   13.27 +	XLinkObj* tmpXLink;
   13.28  	
   13.29      LinkableMapObj* selection;		// select a LinkableMapObj
   13.30      LinkableMapObj* selectionLast;	// last selection 
    14.1 --- a/misc.cpp	Sat Apr 09 22:50:08 2005 +0000
    14.2 +++ b/misc.cpp	Mon Apr 18 06:17:00 2005 +0000
    14.3 @@ -1,7 +1,7 @@
    14.4  #include <qregexp.h>
    14.5  #include <qpoint.h>
    14.6  
    14.7 -#include <math.h>
    14.8 +#include <cmath>
    14.9  
   14.10  #include "misc.h"
   14.11  
    15.1 --- a/tex/vym.tex	Sat Apr 09 22:50:08 2005 +0000
    15.2 +++ b/tex/vym.tex	Mon Apr 18 06:17:00 2005 +0000
    15.3 @@ -713,6 +713,8 @@
    15.4  \begin{longtable}{|lcp{8cm}l|} \hline
    15.5  Version	&	&	Comment								& Date	\\ \hline \hline \endhead
    15.6  	\hline \endfoot
    15.7 +1.6.4	& -	&	xLinks (arbitrary connection between 2 branches) works
    15.8 +				in a basic version (straight line)	& 2005-04-15\\
    15.9  1.6.3	& -	&	Bugfix: Saving of selection to a vym part (.vyp)	&2005-03-30\\
   15.10  		& - &	Bugfix: Closing the noteeditor by closing its window now
   15.11  				also toggles the responding toolbar button. &\\
    16.1 --- a/texteditor.cpp	Sat Apr 09 22:50:08 2005 +0000
    16.2 +++ b/texteditor.cpp	Mon Apr 18 06:17:00 2005 +0000
    16.3 @@ -25,7 +25,7 @@
    16.4  #include <qsimplerichtext.h>
    16.5  
    16.6  #include <iostream>
    16.7 -#include <stdlib.h>
    16.8 +#include <cstdlib>
    16.9  #include <typeinfo>
   16.10  
   16.11  #include "icons/fileopen.xpm"
    17.1 --- a/version.h	Sat Apr 09 22:50:08 2005 +0000
    17.2 +++ b/version.h	Mon Apr 18 06:17:00 2005 +0000
    17.3 @@ -1,7 +1,7 @@
    17.4  #ifndef VERSION_H 
    17.5  #define VERSION_H
    17.6  
    17.7 -#define __VYM_VERSION__ "1.6.3"
    17.8 -#define __BUILD_DATE__ "April 11, 2005"
    17.9 +#define __VYM_VERSION__ "1.6.4"
   17.10 +#define __BUILD_DATE__ "April 15, 2005"
   17.11  
   17.12  #endif
    18.1 --- a/vym.pro	Sat Apr 09 22:50:08 2005 +0000
    18.2 +++ b/vym.pro	Mon Apr 18 06:17:00 2005 +0000
    18.3 @@ -22,23 +22,6 @@
    18.4  INSTALLS += demo
    18.5  
    18.6  
    18.7 -
    18.8 -
    18.9 -
   18.10 -
   18.11 -
   18.12 -
   18.13 -
   18.14 -
   18.15 -
   18.16 -
   18.17 -
   18.18 -
   18.19 -
   18.20 -
   18.21 -
   18.22 -
   18.23 -
   18.24  TEMPLATE	= app
   18.25  LANGUAGE	= C++
   18.26  
   18.27 @@ -56,7 +39,7 @@
   18.28  	headingobj.h \
   18.29  	imageobj.h \
   18.30  	linkablemapobj.h \
   18.31 -	linkobj.h \
   18.32 +	xlinkobj.h \
   18.33  	mainwindow.h \
   18.34  	mapcenterobj.h \
   18.35  	mapeditor.h \
   18.36 @@ -82,7 +65,7 @@
   18.37  	headingobj.cpp \
   18.38  	imageobj.cpp \
   18.39  	linkablemapobj.cpp \
   18.40 -	linkobj.cpp \
   18.41 +	xlinkobj.cpp \
   18.42  	main.cpp \
   18.43  	mainwindow.cpp \
   18.44  	mapcenterobj.cpp \
   18.45 @@ -101,5 +84,5 @@
   18.46  	exportxhtmldialog.ui \
   18.47  	showtextdialog.ui \
   18.48  	extrainfodialog.ui \
   18.49 -	editlinkdialog.ui
   18.50 +	editxlinkdialog.ui
   18.51  
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/xlinkobj.cpp	Mon Apr 18 06:17:00 2005 +0000
    19.3 @@ -0,0 +1,261 @@
    19.4 +#include "xlinkobj.h"
    19.5 +#include "branchobj.h"
    19.6 +
    19.7 +
    19.8 +/////////////////////////////////////////////////////////////////
    19.9 +// XLinkObj
   19.10 +/////////////////////////////////////////////////////////////////
   19.11 +
   19.12 +int XLinkObj::arrowSize=10;						// make instances 
   19.13 +QColor XLinkObj::defXLinkColor=QColor(180,180,180); 
   19.14 +
   19.15 +XLinkObj::XLinkObj ():MapObj() 
   19.16 +{
   19.17 +	//	cout << "Const XLinkObj ()\n";
   19.18 +	init();
   19.19 +}
   19.20 +
   19.21 +XLinkObj::XLinkObj (QCanvas* c):MapObj(c)
   19.22 +{
   19.23 +	//	cout << "Const XLinkObj (c)  called from MapCenterObj (c)\n";
   19.24 +	init();
   19.25 +}
   19.26 +
   19.27 +
   19.28 +XLinkObj::~XLinkObj ()
   19.29 +{
   19.30 +	//	cout << "Destr XLinkObj\n";
   19.31 +	if (xLinkState!=undefinedXLink)
   19.32 +		deactivate();
   19.33 +	delete (line);
   19.34 +	delete (poly);
   19.35 +}
   19.36 +
   19.37 +void XLinkObj::init () 
   19.38 +{
   19.39 +	beginBranch=NULL;
   19.40 +	endBranch=NULL;
   19.41 +	visBranch=NULL;
   19.42 +	xLinkState=undefinedXLink;
   19.43 +
   19.44 +	xLinkColor=defXLinkColor;
   19.45 +	line=new QCanvasLine (canvas);
   19.46 +	line->setPoints (0,0,200,200);
   19.47 +	line->setPen (QPen(xLinkColor, 1));
   19.48 +
   19.49 +	poly=new QCanvasPolygon (canvas);
   19.50 +	poly->setBrush( xLinkColor );
   19.51 +
   19.52 +	setVisibility (false);
   19.53 +}
   19.54 +
   19.55 +void XLinkObj::copy (XLinkObj* other)
   19.56 +{
   19.57 +	// FIXME copy not used yet
   19.58 +	cout << "LO::copy called\n";
   19.59 +	MapObj::copy (other);
   19.60 +	setVisibility (other->visible);
   19.61 +	beginBranch=other->beginBranch;
   19.62 +	endBranch=other->endBranch;
   19.63 +}
   19.64 +
   19.65 +void XLinkObj::setBegin (BranchObj *bo)
   19.66 +{
   19.67 +	if (bo) 
   19.68 +	{
   19.69 +		xLinkState=initXLink;
   19.70 +		beginBranch=bo;
   19.71 +		beginPos=beginBranch->getChildPos();
   19.72 +	}	
   19.73 +}
   19.74 +
   19.75 +void XLinkObj::setEnd (BranchObj *bo)
   19.76 +{
   19.77 +	if (bo) 
   19.78 +	{
   19.79 +		xLinkState=initXLink;
   19.80 +		endBranch=bo;
   19.81 +		endPos=endBranch->getChildPos();
   19.82 +	}		
   19.83 +}
   19.84 +
   19.85 +void XLinkObj::setColor(QColor c)
   19.86 +{
   19.87 +	xLinkColor=c;
   19.88 +}
   19.89 +
   19.90 +void XLinkObj::setEnd (QPoint p)
   19.91 +{
   19.92 +	endPos=p;
   19.93 +}
   19.94 +
   19.95 +bool XLinkObj::activate ()
   19.96 +{
   19.97 +	if (beginBranch && endBranch)
   19.98 +	{
   19.99 +		xLinkState=activeXLink;
  19.100 +		beginBranch->addXLink (this);
  19.101 +		endBranch->addXLink (this);
  19.102 +		setVisibility (true);
  19.103 +		return true;
  19.104 +	} else
  19.105 +		return false;
  19.106 +}
  19.107 +
  19.108 +void XLinkObj::deactivate ()
  19.109 +{
  19.110 +	if (beginBranch)
  19.111 +		beginBranch->removeXLinkRef (this);
  19.112 +	beginBranch=NULL;	
  19.113 +	if (endBranch)
  19.114 +		endBranch->removeXLinkRef (this);
  19.115 +	endBranch=NULL;	
  19.116 +	visBranch=NULL;
  19.117 +	xLinkState=undefinedXLink;
  19.118 +
  19.119 +	line->hide();
  19.120 +}
  19.121 +
  19.122 +bool XLinkObj::isUsed()
  19.123 +{
  19.124 +	if (beginBranch || endBranch || xLinkState!=undefinedXLink)
  19.125 +		return true;
  19.126 +	else
  19.127 +		return false;
  19.128 +}
  19.129 +
  19.130 +void XLinkObj::updateXLink()
  19.131 +{
  19.132 +	QPoint a,b;
  19.133 +	QPointArray pa (3);
  19.134 +	if (visBranch)
  19.135 +	{
  19.136 +		// Only one of the linked branches is visible
  19.137 +		a=b=visBranch->getChildPos();
  19.138 +		if (visBranch->getOrientation()==OrientRightOfCenter)
  19.139 +		{
  19.140 +			b.setX (b.x()+25);
  19.141 +			pa.putPoints (0,3,
  19.142 +				b.x(),b.y(),
  19.143 +				b.x()-arrowSize,b.y()-arrowSize,
  19.144 +				b.x()-arrowSize,b.y()+arrowSize
  19.145 +			);
  19.146 +			poly->setPoints (pa);
  19.147 +		} else
  19.148 +		{
  19.149 +			b.setX (b.x()-25);
  19.150 +			pa.putPoints (0,3,
  19.151 +				b.x(),b.y(),
  19.152 +				b.x()+arrowSize,b.y()-arrowSize,
  19.153 +				b.x()+arrowSize,b.y()+arrowSize);
  19.154 +			poly->setPoints (pa);
  19.155 +		}	
  19.156 +	} else
  19.157 +	{
  19.158 +		// Both linked branches are visible
  19.159 +		if (beginBranch)
  19.160 +			// If a link is just drawn in the editor,
  19.161 +			// we have already a beginBranch
  19.162 +			a=beginBranch->getChildPos();
  19.163 +		else
  19.164 +			// This shouldn't be reached normally...
  19.165 +			a=beginPos;
  19.166 +		if (xLinkState==activeXLink && endBranch)
  19.167 +			b=endBranch->getChildPos();
  19.168 +		else
  19.169 +			b=endPos;
  19.170 +	}
  19.171 +
  19.172 +
  19.173 +	if (line->startPoint()==a && line->endPoint()==b && !visBranch)
  19.174 +	{
  19.175 +		// update is called from both branches, so only
  19.176 +		// update if something has changed
  19.177 +		return;
  19.178 +	}	
  19.179 +	else
  19.180 +	{
  19.181 +		beginPos=a;
  19.182 +		endPos=b;
  19.183 +		line->setPoints (a.x(), a.y(), b.x(), b.y());
  19.184 +	}
  19.185 +}
  19.186 +
  19.187 +BranchObj* XLinkObj::otherBranch(BranchObj* thisBranch)
  19.188 +{
  19.189 +	if (!beginBranch && !endBranch)
  19.190 +		return NULL;
  19.191 +	if (thisBranch==beginBranch)
  19.192 +		return endBranch;
  19.193 +	else	
  19.194 +		return beginBranch;
  19.195 +}
  19.196 +
  19.197 +void XLinkObj::positionBBox()
  19.198 +{
  19.199 +}
  19.200 +
  19.201 +void XLinkObj::calcBBoxSize()
  19.202 +{
  19.203 +}
  19.204 +
  19.205 +void XLinkObj::setVisibility (bool b)
  19.206 +{
  19.207 +	MapObj::setVisibility (b);
  19.208 +	if (b)
  19.209 +	{
  19.210 +		line->show();
  19.211 +		if (visBranch) 
  19.212 +			poly->show();
  19.213 +		else	
  19.214 +			poly->hide();
  19.215 +	}	
  19.216 +	else
  19.217 +	{
  19.218 +		line->hide();
  19.219 +		poly->hide();
  19.220 +	}	
  19.221 +}
  19.222 +
  19.223 +void XLinkObj::setVisibility ()
  19.224 +{
  19.225 +	if (beginBranch && endBranch)
  19.226 +	{
  19.227 +		if(beginBranch->isVisibleObj() && endBranch->isVisibleObj())
  19.228 +		{	// Both ends are visible
  19.229 +			visBranch=NULL;
  19.230 +			setVisibility (true);
  19.231 +		} else
  19.232 +		{
  19.233 +			if(!beginBranch->isVisibleObj() && !endBranch->isVisibleObj())
  19.234 +			{	//None of the ends is visible
  19.235 +				visBranch=NULL;
  19.236 +				setVisibility (false);
  19.237 +			} else
  19.238 +			{	// Just one end is visible, draw a symbol that shows
  19.239 +				// that there is a link to a scrolled branch
  19.240 +				if (beginBranch->isVisibleObj())
  19.241 +					visBranch=beginBranch;
  19.242 +				else
  19.243 +					visBranch=endBranch;
  19.244 +				setVisibility (true);
  19.245 +			}
  19.246 +		}
  19.247 +	}
  19.248 +}
  19.249 +
  19.250 +QString XLinkObj::saveToDir ()
  19.251 +{
  19.252 +	QString s;
  19.253 +	if (beginBranch && endBranch)
  19.254 +	{
  19.255 +		QString colAttr=attribut ("color",xLinkColor.name());
  19.256 +		QString begSelAttr=attribut ("beginBranch",beginBranch->getSelectString());
  19.257 +		QString endSelAttr=attribut ("endBranch",  endBranch->getSelectString());
  19.258 +		s=beginElement ("xlink", colAttr +begSelAttr +endSelAttr);
  19.259 +
  19.260 +		s+=endElement ("xlink");
  19.261 +	}
  19.262 +	return s;
  19.263 +}
  19.264 +
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/xlinkobj.h	Mon Apr 18 06:17:00 2005 +0000
    20.3 @@ -0,0 +1,45 @@
    20.4 +#ifndef XLINKOBJ_H
    20.5 +#define XLINKOBJ_H
    20.6 +
    20.7 +#include "linkablemapobj.h"
    20.8 +
    20.9 +enum XLinkState {undefinedXLink,initXLink,activeXLink,deleteXLink};
   20.10 +
   20.11 +/////////////////////////////////////////////////////////////////////////////
   20.12 +class XLinkObj:public MapObj {
   20.13 +public:
   20.14 +    XLinkObj ();
   20.15 +    XLinkObj (QCanvas*);
   20.16 +    ~XLinkObj ();
   20.17 +    virtual void init ();
   20.18 +    virtual void copy (XLinkObj*);
   20.19 +	void setBegin (BranchObj*);
   20.20 +	void setEnd   (BranchObj*);
   20.21 +	void setEnd   (QPoint);
   20.22 +	void setColor(QColor);
   20.23 +	bool activate ();			// Sets pointers in branchObjects
   20.24 +	void deactivate();			// removes those pointers
   20.25 +	bool isUsed();				// true, if at least on branch uses it
   20.26 +	void updateXLink();
   20.27 +	BranchObj* otherBranch (BranchObj*);
   20.28 +	void positionBBox();
   20.29 +	void calcBBoxSize();
   20.30 +	void setVisibility (bool);
   20.31 +	void setVisibility ();
   20.32 +	QString saveToDir ();
   20.33 +
   20.34 +private:
   20.35 +	static int arrowSize;
   20.36 +	static QColor defXLinkColor;
   20.37 +	QColor xLinkColor;
   20.38 +	QCanvasLine *line;
   20.39 +	QCanvasPolygon *poly;
   20.40 +	BranchObj *beginBranch;
   20.41 +	BranchObj *endBranch;
   20.42 +	BranchObj *visBranch;	// the "visible" part of a partially scrolled link
   20.43 +	XLinkState xLinkState;	// init during drawing or active
   20.44 +	QPoint beginPos;
   20.45 +	QPoint   endPos;
   20.46 +};
   20.47 +
   20.48 +#endif
    21.1 --- a/xml.cpp	Sat Apr 09 22:50:08 2005 +0000
    21.2 +++ b/xml.cpp	Mon Apr 18 06:17:00 2005 +0000
    21.3 @@ -7,6 +7,7 @@
    21.4  
    21.5  #include "misc.h"
    21.6  #include "settings.h"
    21.7 +#include "linkablemapobj.h"
    21.8  
    21.9  #include "version.h"
   21.10  
   21.11 @@ -228,6 +229,10 @@
   21.12          lastBranch->addFloatImage();
   21.13  		lastFloat=lastBranch->getLastFloatImage();
   21.14  		if (!readFloatImageAttr(atts)) return false;
   21.15 +    } else if ( eName == "xlink" && state == StateBranch ) 
   21.16 +	{
   21.17 +		state=StateBranchXLink;
   21.18 +		if (!readXLinkAttr (atts)) return false;
   21.19      } else if ( eName == "branch" && state == StateBranch ) 
   21.20  	{
   21.21          lastBranch->addBranch();
   21.22 @@ -282,6 +287,7 @@
   21.23          case StateBranchHeading: state=StateBranch;  return true;
   21.24          case StateBranchNote: state=StateBranch; return true;
   21.25          case StateBranchFloatImage: state=StateBranch;  return true;
   21.26 +        case StateBranchXLink: state=StateBranch;  return true;
   21.27          case StateHtmlNote: state=laststate; return true;
   21.28          case StateHtml: 
   21.29  			htmldata+="</"+eName+">";
   21.30 @@ -504,6 +510,38 @@
   21.31  	return true;
   21.32  }
   21.33  
   21.34 +bool mapBuilderHandler::readXLinkAttr (const QXmlAttributes& a)
   21.35 +{
   21.36 +	QColor col;
   21.37 +	XLinkObj *xlo=new XLinkObj (mc->getCanvas());
   21.38 +	if (!a.value( "xLinkColor").isEmpty() ) 
   21.39 +	{
   21.40 +		col.setNamedColor(a.value("xLinkColor"));
   21.41 +		xlo->setColor (col);
   21.42 +	}
   21.43 +
   21.44 +	if (!a.value( "beginBranch").isEmpty() ) 
   21.45 +	{
   21.46 +		if (!a.value( "endBranch").isEmpty() ) 
   21.47 +		{
   21.48 +			LinkableMapObj *lmo=mc->findObj (a.value( "beginBranch"));
   21.49 +			if (lmo && typeid (*lmo)==typeid (BranchObj))
   21.50 +			{
   21.51 +				xlo->setBegin ((BranchObj*)(lmo));
   21.52 +				lmo=mc->findObj (a.value( "endBranch"));
   21.53 +				if (lmo && typeid (*lmo)==typeid (BranchObj))
   21.54 +				{
   21.55 +					xlo->setEnd ((BranchObj*)(lmo));
   21.56 +					xlo->activate();
   21.57 +					return true;
   21.58 +				}
   21.59 +			}
   21.60 +			return true;	// Not all branches there yet, no error
   21.61 +		}           
   21.62 +	}	
   21.63 +	return false; 
   21.64 +}
   21.65 +
   21.66  bool mapBuilderHandler::readHtmlAttr (const QXmlAttributes& a)
   21.67  {
   21.68  	for (int i=1; i<=a.count(); i++)
    22.1 --- a/xml.h	Sat Apr 09 22:50:08 2005 +0000
    22.2 +++ b/xml.h	Mon Apr 18 06:17:00 2005 +0000
    22.3 @@ -29,6 +29,7 @@
    22.4  	bool readBranchAttr (const QXmlAttributes&);
    22.5  	bool readNoteAttr (const QXmlAttributes&);
    22.6  	bool readFloatImageAttr (const QXmlAttributes&);
    22.7 +	bool readXLinkAttr (const QXmlAttributes&);
    22.8  	bool readHtmlAttr (const QXmlAttributes&);
    22.9  	bool readSettingAttr (const QXmlAttributes&);
   22.10  
   22.11 @@ -44,7 +45,7 @@
   22.12  		
   22.13  		StateBranch, StateBranchStandardFlag,
   22.14  		StateBranchHeading, StateBranchNote, 
   22.15 -		StateBranchFloatImage, 
   22.16 +		StateBranchFloatImage, StateBranchXLink,
   22.17  		StateHtmlNote, StateHtml 
   22.18  	 };
   22.19