xlinkobj.cpp
changeset 103 c810a11d11d9
parent 102 dba9303a1a5c
child 104 270593ab83b2
     1.1 --- a/xlinkobj.cpp	Wed May 18 07:39:58 2005 +0000
     1.2 +++ b/xlinkobj.cpp	Mon May 23 15:28:20 2005 +0000
     1.3 @@ -88,6 +88,7 @@
     1.4  
     1.5  int XLinkObj::getWidth()
     1.6  {
     1.7 +	cout << "XLO  w="<<width<<endl;
     1.8  	return width;
     1.9  }
    1.10  
    1.11 @@ -112,10 +113,15 @@
    1.12  {
    1.13  	if (beginBranch && endBranch)
    1.14  	{
    1.15 +		if (beginBranch==endBranch)
    1.16 +		{	//FIXME debugging
    1.17 +			cout << "XLO::activate  b=e="<<beginBranch->getHeading()<<endl;
    1.18 +			return false;
    1.19 +		}
    1.20  		xLinkState=activeXLink;
    1.21  		beginBranch->addXLink (this);
    1.22  		endBranch->addXLink (this);
    1.23 -		setVisibility (true);
    1.24 +		setVisibility ();
    1.25  		return true;
    1.26  	} else
    1.27  		return false;
    1.28 @@ -266,17 +272,27 @@
    1.29  
    1.30  QString XLinkObj::saveToDir ()
    1.31  {
    1.32 -	QString s;
    1.33 -	if (beginBranch && endBranch)
    1.34 +	QString s="";
    1.35 +	if (beginBranch && endBranch &&xLinkState==activeXLink)
    1.36  	{
    1.37 -		QString colAttr=attribut ("color",color.name());
    1.38 -		QString widAttr=attribut ("width",QString().setNum(width,10));
    1.39 -		QString begSelAttr=attribut ("beginBranch",beginBranch->getSelectString());
    1.40 -		QString endSelAttr=attribut ("endBranch",  endBranch->getSelectString());
    1.41 -		s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr);
    1.42 +		if (beginBranch==endBranch && xLinkState)
    1.43 +		{
    1.44 +			//FIXME testing
    1.45 +			//cout << "   identical ends: "<<beginBranch->getSelectString()<<endl;
    1.46 +			s="";
    1.47 +		} else
    1.48 +		{
    1.49 +			QString colAttr=attribut ("color",color.name());
    1.50 +			QString widAttr=attribut ("width",QString().setNum(width,10));
    1.51 +			QString begSelAttr=attribut ("beginBranch",beginBranch->getSelectString());
    1.52 +			QString endSelAttr=attribut ("endBranch",  endBranch->getSelectString());
    1.53 +			s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr);
    1.54  
    1.55 -		s+=endElement ("xlink");
    1.56 +			s+=endElement ("xlink");
    1.57 +		}
    1.58  	}
    1.59 +	//FIXME testing
    1.60 +	//cout << s<<endl;
    1.61  	return s;
    1.62  }
    1.63