branchobj.cpp
changeset 750 ff3b01ce0960
parent 749 9ff332964015
child 751 7fa9b3164cbe
     1.1 --- a/branchobj.cpp	Wed Apr 01 15:06:57 2009 +0000
     1.2 +++ b/branchobj.cpp	Thu Apr 02 09:46:29 2009 +0000
     1.3 @@ -102,7 +102,7 @@
     1.4      OrnamentedObj::copy(other);
     1.5  
     1.6  	branch.clear();
     1.7 -	for (int i=0; i<other->branch.size(); ++i)
     1.8 +	for (int i=0; i<other->treeItem->branchCount(); ++i)
     1.9  		// Make deep copy of b
    1.10  		// Because addBranch again calls copy for the children,
    1.11  		// Those will get a deep copy, too
    1.12 @@ -182,7 +182,7 @@
    1.13  		{
    1.14  			// new parent is just a branch, link to it
    1.15  			QRectF t=o->getBBoxSizeWithChildren();
    1.16 -			if (o->getLastBranch())
    1.17 +			if (o->getTreeItem()->getLastBranch())
    1.18  				y=t.y() + t.height() ;
    1.19  			else
    1.20  				y=t.y();
    1.21 @@ -242,7 +242,7 @@
    1.22  		if (! bi->isScrolled() && (bi->depth() < toDepth))
    1.23  		{
    1.24  			// Now go recursivly through all children
    1.25 -			for (i=0; i<branch.size(); ++i)
    1.26 +			for (i=0; i<treeItem->branchCount(); ++i)
    1.27  				branch.at(i)->setVisibility (v,toDepth);	
    1.28  		}
    1.29      } // depth <= toDepth	
    1.30 @@ -272,7 +272,7 @@
    1.31  void BranchObj::setColorSubtree(QColor col)
    1.32  {
    1.33  	setColor (col);
    1.34 -	for (int i=0; i<branch.size(); ++i)
    1.35 +	for (int i=0; i<treeItem->branchCount(); ++i)
    1.36  		branch.at(i)->setColorSubtree(col);
    1.37  }
    1.38  
    1.39 @@ -299,7 +299,7 @@
    1.40  void BranchObj::moveBy (double x, double y)
    1.41  {
    1.42  	OrnamentedObj::moveBy (x,y);
    1.43 -	for (int i=0; i<branch.size(); ++i)
    1.44 +	for (int i=0; i<treeItem->branchCount(); ++i)
    1.45  		branch.at(i)->moveBy (x,y);
    1.46      positionBBox();
    1.47  }
    1.48 @@ -424,7 +424,7 @@
    1.49  {
    1.50  	// Search branches
    1.51      LinkableMapObj *lmo;
    1.52 -	for (int i=0; i<branch.size(); ++i)
    1.53 +	for (int i=0; i<treeItem->branchCount(); ++i)
    1.54      {	
    1.55  		lmo=branch.at(i)->findMapObj(p, excludeLMO);
    1.56  		if (lmo != NULL) return lmo;
    1.57 @@ -450,7 +450,7 @@
    1.58  {
    1.59  	// Search branches
    1.60      LinkableMapObj *lmo;
    1.61 -	for (int i=0; i<branch.size(); ++i)
    1.62 +	for (int i=0; i<treeItem->branchCount(); ++i)
    1.63      {	
    1.64  		lmo=branch.at(i)->findID (sid);
    1.65  		if (lmo != NULL) return lmo;
    1.66 @@ -498,7 +498,7 @@
    1.67  	}	
    1.68  
    1.69  	// And take care of my children
    1.70 -	for (int i=0; i<branch.size(); ++i)
    1.71 +	for (int i=0; i<treeItem->branchCount(); ++i)
    1.72  		branch.at(i)->setHideTmp (mode);
    1.73  }
    1.74  
    1.75 @@ -579,7 +579,7 @@
    1.76  		s+=treeItem->getNoteObj().saveToDir();
    1.77  	
    1.78  	// Save branches
    1.79 -	for (int i=0; i<branch.size(); ++i)
    1.80 +	for (int i=0; i<treeItem->branchCount(); ++i)
    1.81  		s+=branch.at(i)->saveToDir(tmpdir,prefix,offset);
    1.82  
    1.83  	// Save XLinks
    1.84 @@ -742,7 +742,7 @@
    1.85  void BranchObj::savePosInAngle ()
    1.86  {
    1.87  	// Save position in angle
    1.88 -	for (int i=0; i<branch.size(); ++i)
    1.89 +	for (int i=0; i<treeItem->branchCount(); ++i)
    1.90  		branch.at(i)->angle=i;
    1.91  }
    1.92  
    1.93 @@ -898,9 +898,10 @@
    1.94  	requestReposition();
    1.95  }
    1.96  
    1.97 +/* FIXME-1 not needed
    1.98  BranchObj* BranchObj::getFirstBranch ()
    1.99  {
   1.100 -	if (branch.size()>0)
   1.101 +	if (treeItem->branchCount()>0)
   1.102  		return branch.first();
   1.103  	else
   1.104  		return NULL;
   1.105 @@ -908,7 +909,7 @@
   1.106  
   1.107  BranchObj* BranchObj::getLastBranch ()
   1.108  {
   1.109 -	if (branch.size()>0)
   1.110 +	if (treeItem->branchCount()>0)
   1.111  		return branch.last();
   1.112  	else
   1.113  		return NULL;
   1.114 @@ -916,20 +917,24 @@
   1.115  
   1.116  BranchObj* BranchObj::getBranchNum (int i)
   1.117  {
   1.118 -	if (i>=0 && i<branch.size())
   1.119 +	if (i>=0 && i<treeItem->branchCount())
   1.120  		return branch.at(i);
   1.121  	else	
   1.122  		return	NULL;
   1.123  }
   1.124 +*/
   1.125  
   1.126  bool BranchObj::canMoveBranchUp() 
   1.127  {
   1.128 +	/* FIXME-1 move to BranchItem
   1.129  	if (!parObj || depth==1) return false;
   1.130  	BranchObj* par=(BranchObj*)parObj;
   1.131 -	if (this==par->getFirstBranch())
   1.132 +	if (this==par->getTreeItem()->getFirstBranch())
   1.133  		return false;
   1.134  	else
   1.135  		return true;
   1.136 +		*/
   1.137 +return false;
   1.138  }
   1.139  
   1.140  BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist
   1.141 @@ -948,12 +953,15 @@
   1.142  
   1.143  bool BranchObj::canMoveBranchDown() 
   1.144  {
   1.145 +	/* FIXME-1 move to BranchItem
   1.146  	if (!parObj|| depth==1) return false;
   1.147  	BranchObj* par=(BranchObj*)parObj;
   1.148 -	if (this==par->getLastBranch())
   1.149 +	if (this==par->getTreeItem()->getLastBranch())
   1.150  		return false;
   1.151  	else
   1.152  		return true;
   1.153 +	*/
   1.154 +return false;	
   1.155  }
   1.156  
   1.157  BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
   1.158 @@ -961,7 +969,7 @@
   1.159  	savePosInAngle();
   1.160      int i=branch.indexOf(bo1);
   1.161  	int j;
   1.162 -	if (i <branch.size())
   1.163 +	if (i <treeItem->branchCount())
   1.164  	{
   1.165  		j = i+1;
   1.166  		branch.at(i)->angle++;
   1.167 @@ -1111,7 +1119,7 @@
   1.168  		ref2.setY(ref.y() );	
   1.169  
   1.170      // Align the children depending on reference point 
   1.171 -	for (int i=0; i<branch.size(); ++i)
   1.172 +	for (int i=0; i<treeItem->branchCount(); ++i)
   1.173      {	
   1.174  		if (!branch.at(i)->isHidden())
   1.175  		{
   1.176 @@ -1160,7 +1168,7 @@
   1.177  void BranchObj::unsetAllRepositionRequests()
   1.178  {
   1.179  	repositionRequest=false;
   1.180 -	for (int i=0; i<branch.size(); ++i)
   1.181 +	for (int i=0; i<treeItem->branchCount(); ++i)
   1.182  		branch.at(i)->unsetAllRepositionRequests();
   1.183  }
   1.184  
   1.185 @@ -1193,7 +1201,7 @@
   1.186  
   1.187  	if ( ((BranchItem*)treeItem)->isScrolled() ) return r;
   1.188  
   1.189 -	for (int i=0; i<branch.size(); ++i)
   1.190 +	for (int i=0; i<treeItem->branchCount(); ++i)
   1.191  		if (!branch.at(i)->isHidden())
   1.192  			r=addBBox(branch.at(i)->getTotalBBox(),r);
   1.193  
   1.194 @@ -1251,7 +1259,7 @@
   1.195  	// sum of heights 
   1.196  	// maximum of widths 
   1.197  	// minimum of y
   1.198 -	for (int i=0; i<branch.size(); ++i)
   1.199 +	for (int i=0; i<treeItem->branchCount(); ++i)
   1.200  	{
   1.201  		if (!branch.at(i)->isHidden())
   1.202  		{