branchobj.cpp
changeset 790 133e2ed6b9c5
parent 789 d85834ad8c54
child 792 7d67be709091
     1.1 --- a/branchobj.cpp	Mon Aug 24 14:39:07 2009 +0000
     1.2 +++ b/branchobj.cpp	Thu Sep 03 08:52:00 2009 +0000
     1.3 @@ -13,21 +13,16 @@
     1.4  // BranchObj
     1.5  /////////////////////////////////////////////////////////////////
     1.6  
     1.7 -BranchObj::BranchObj () :OrnamentedObj()	// FIXME-3 needed at all?
     1.8 -{
     1.9 -//    cout << "Const BranchObj ()\n";
    1.10 -    setParObj (this);	
    1.11 -    init();
    1.12 -}
    1.13 -
    1.14 -BranchObj::BranchObj (QGraphicsScene* s):OrnamentedObj (s)// FIXME-3 needed at all?
    1.15 +BranchObj::BranchObj (QGraphicsScene* s,TreeItem *ti):OrnamentedObj (s)
    1.16  {
    1.17  //    cout << "Const BranchObj (s)  \n";
    1.18  	parObj=NULL;
    1.19      scene=s;
    1.20 +	treeItem=ti;
    1.21  	init();
    1.22  }
    1.23  
    1.24 +/*
    1.25  BranchObj::BranchObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s)// FIXME-3 needed at all?
    1.26  {
    1.27  //    cout << "Const BranchObj (s,p)\n";
    1.28 @@ -41,6 +36,7 @@
    1.29  								(y() - parObj->getChildPos().y() ) ) );
    1.30      init();
    1.31  }
    1.32 +*/
    1.33  
    1.34  BranchObj::~BranchObj ()
    1.35  {
    1.36 @@ -210,8 +206,8 @@
    1.37  		int i;
    1.38  		for (i=0; i<treeItem->imageCount(); ++i)
    1.39  			treeItem->getImageObjNum(i)->setVisibility (v);
    1.40 -		for (i=0; i<xlink.size(); ++i)	
    1.41 -			xlink.at(i)->setVisibility ();	
    1.42 +		for (i=0; i<treeItem->xlinkCount(); ++i)	
    1.43 +			treeItem->getXLinkObjNum(i)->setVisibility ();	
    1.44  
    1.45  		// Only change children, if I am not scrolled
    1.46  		if (! bi->isScrolled() && (bi->depth() < toDepth))
    1.47 @@ -299,9 +295,13 @@
    1.48  	// set the frame
    1.49  	frame->setRect(QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
    1.50  
    1.51 -	// Update links to other branches
    1.52 -	for (int i=0; i<xlink.size(); ++i)
    1.53 -		xlink.at(i)->updateXLink();
    1.54 +	//Update links to other branches
    1.55 +	XLinkObj *xlo;
    1.56 +	for (int i=0; i<treeItem->xlinkCount(); ++i)	
    1.57 +	{
    1.58 +		xlo=treeItem->getXLinkObjNum(i);
    1.59 +		if (xlo) xlo->updateXLink();
    1.60 +	}	
    1.61  }
    1.62  
    1.63  void BranchObj::calcBBoxSize()
    1.64 @@ -472,105 +472,6 @@
    1.65  	updateContentSize();
    1.66  }
    1.67  
    1.68 -
    1.69 -void BranchObj::addXLink (XLinkObj *xlo)
    1.70 -{
    1.71 -	xlink.append (xlo);
    1.72 -	
    1.73 -}
    1.74 -
    1.75 -void BranchObj::removeXLinkRef (XLinkObj *xlo)
    1.76 -{
    1.77 -	xlink.removeAt (xlink.indexOf(xlo));
    1.78 -}
    1.79 -
    1.80 -void BranchObj::deleteXLink(XLinkObj *xlo)
    1.81 -{
    1.82 -	xlo->deactivate();
    1.83 -	if (!xlo->isUsed()) delete (xlo);
    1.84 -}
    1.85 -
    1.86 -void BranchObj::deleteXLinkAt (int i)
    1.87 -{
    1.88 -	XLinkObj *xlo=xlink.at(i);
    1.89 -	xlo->deactivate();
    1.90 -	if (!xlo->isUsed()) delete(xlo);
    1.91 -}
    1.92 -
    1.93 -XLinkObj* BranchObj::XLinkAt (int i)
    1.94 -{
    1.95 -	return xlink.at(i);
    1.96 -}
    1.97 -
    1.98 -BranchObj* BranchObj::XLinkTargetAt (int i)
    1.99 -{
   1.100 -	if (i>=0 && i<xlink.size())
   1.101 -	{
   1.102 -		if (xlink.at(i))
   1.103 -			return xlink.at(i)->otherBranch (this);
   1.104 -	}
   1.105 -	return NULL;
   1.106 -}
   1.107 -
   1.108 - 
   1.109 -// FIXME-3 FloatImageObj* BranchObj::addFloatImage ()
   1.110 -/*
   1.111 -{
   1.112 -	FloatImageObj *newfi=new FloatImageObj (scene,this);
   1.113 -	floatimage.append (newfi);
   1.114 -	if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem) )
   1.115 -		newfi->setVisibility (false);
   1.116 -	else	
   1.117 -		newfi->setVisibility(visible);
   1.118 -	//calcBBoxSize();
   1.119 -	//positionBBox();
   1.120 -	requestReposition();
   1.121 -	return newfi;
   1.122 -}
   1.123 -*/
   1.124 -
   1.125 -//FIXME-3 FloatImageObj* BranchObj::addFloatImage (FloatImageObj *fio)
   1.126 -/*
   1.127 -{
   1.128 -	FloatImageObj *newfi=new FloatImageObj (scene,this);
   1.129 -	floatimage.append (newfi);
   1.130 -	newfi->copy (fio);
   1.131 -	if (((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem) )
   1.132 -		newfi->setVisibility (false);
   1.133 -	else	
   1.134 -		newfi->setVisibility(visible);
   1.135 -	//calcBBoxSize();
   1.136 -	//positionBBox();
   1.137 -	requestReposition();
   1.138 -	return newfi;
   1.139 -}
   1.140 -*/
   1.141 -
   1.142 -/* FIXME-3 FloatImageObj* BranchObj::getFirstFloatImage ()
   1.143 -{
   1.144 -    return floatimage.first();
   1.145 -}
   1.146 -
   1.147 -FloatImageObj* BranchObj::getLastFloatImage ()
   1.148 -{
   1.149 -    return floatimage.last();
   1.150 -}
   1.151 -
   1.152 -FIXME -3 FloatImageObj* BranchObj::getFloatImageNum (const uint &i)
   1.153 -{
   1.154 -    return floatimage.at(i);
   1.155 -}
   1.156 -
   1.157 -void BranchObj::removeFloatImage (FloatImageObj *fio)
   1.158 -{
   1.159 -	int i=floatimage.indexOf (fio);
   1.160 -	if (i>-1) delete (floatimage.takeAt (i));
   1.161 -	calcBBoxSize();
   1.162 -	positionBBox();
   1.163 -	requestReposition();
   1.164 -}
   1.165 -*/
   1.166 -
   1.167  void BranchObj::savePosInAngle ()
   1.168  {
   1.169  	// Save position in angle