branchobj.cpp
changeset 760 59614eaf5fbb
parent 757 c6908bc17d78
child 766 7a71a914afdb
     1.1 --- a/branchobj.cpp	Tue Apr 28 20:53:44 2009 +0000
     1.2 +++ b/branchobj.cpp	Wed Apr 29 18:46:31 2009 +0000
     1.3 @@ -100,14 +100,6 @@
     1.4  {
     1.5      OrnamentedObj::copy(other);
     1.6  
     1.7 -/* FIXME-3 not needed
     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 -		addBranch(other->branch.at(i) );	
    1.13 -*/		
    1.14 -
    1.15  	for (int i=0; i<other->floatimage.size(); ++i)
    1.16  		addFloatImage  (other->floatimage.at(i));
    1.17  	
    1.18 @@ -682,92 +674,11 @@
    1.19  	heading->setFont(font );
    1.20  
    1.21  	if (mod==NewBranch)
    1.22 -		setColor (((BranchObj*)(parObj))->getColor());
    1.23 -	
    1.24 +		setColor (treeItem->getHeadingColor() );
    1.25  	calcBBoxSize();
    1.26  }
    1.27  
    1.28 -BranchObj* BranchObj::addBranch()	// FIXME-3 still needed?
    1.29 -{
    1.30 -    BranchObj* newbo=new BranchObj(scene,this);
    1.31 -    newbo->setParObj(this);
    1.32 -	newbo->setDefAttr(NewBranch);
    1.33 -	/* FIXME-2 treeItem not set yet!!!
    1.34 -	if ( ((BranchItem*)treeItem)->isScrolled() )
    1.35 -		newbo->setVisibility (false);
    1.36 -	else	
    1.37 -		newbo->setVisibility(visible);
    1.38 -	*/	
    1.39 -	newbo->updateLink();	
    1.40 -	requestReposition();
    1.41 -	return newbo;
    1.42 -}
    1.43 -
    1.44 -BranchObj* BranchObj::addBranch(BranchObj* bo)
    1.45 -{
    1.46 -    BranchObj* newbo=new BranchObj(scene,this);
    1.47 -    //FIXME-1 branch.append (newbo);
    1.48 -    newbo->copy(bo);
    1.49 -    newbo->setParObj(this);
    1.50 -	newbo->setDefAttr(MovedBranch);
    1.51 -	if ( ((BranchItem*)treeItem)->isScrolled() )
    1.52 -		newbo->setVisibility (false);
    1.53 -	else	
    1.54 -		newbo->setVisibility(bo->visible);
    1.55 -	newbo->updateLink();	
    1.56 -	requestReposition();
    1.57 -	return newbo;
    1.58 -}
    1.59 -
    1.60 -BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
    1.61 -{
    1.62 -	//FIXME-1 branch.append (bo);
    1.63 -	bo->setParObj (this);
    1.64 -	//FIXME-2 bo->depth=depth+1;
    1.65 -	bo->setDefAttr(MovedBranch);
    1.66 -	BranchItem *bi=(BranchItem*)treeItem;
    1.67 -	if ( bi->isScrolled() ) bi->tmpUnscroll();
    1.68 -	//setLastSelectedBranch (bo);	//FIXME-3 needed?
    1.69 -	return bo;
    1.70 -}
    1.71 -
    1.72 -BranchObj* BranchObj::insertBranch(int pos)
    1.73 -{
    1.74 -	savePosInAngle();
    1.75 -	// Add new bo and resort branches
    1.76 -	BranchObj *newbo=addBranch ();
    1.77 -	newbo->angle=pos-0.5;
    1.78 -	//FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
    1.79 -	return newbo;
    1.80 -}
    1.81 -
    1.82 -BranchObj* BranchObj::insertBranch(BranchObj* bo, int pos)
    1.83 -{
    1.84 -	savePosInAngle();
    1.85 -	// Add new bo and resort branches
    1.86 -	bo->angle=pos-0.5;
    1.87 -	BranchObj *newbo=addBranch (bo);
    1.88 -	//FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
    1.89 -	return newbo;
    1.90 -}
    1.91 -
    1.92 -BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
    1.93 -{
    1.94 -	savePosInAngle();
    1.95 -	// Add new bo and resort branches
    1.96 -	bo->angle=pos-0.5;
    1.97 -	//FIXME-4 branch.append (bo);
    1.98 -	bo->setParObj (this);
    1.99 -	//FIXME-2 bo->depth=depth+1;
   1.100 -	bo->setDefAttr (MovedBranch);
   1.101 -	BranchItem *bi=(BranchItem*)treeItem;
   1.102 -	if ( bi->isScrolled() ) bi->tmpUnscroll();
   1.103 -	//setLastSelectedBranch (bo); //FIXME-3 needed?
   1.104 -	//FIXME-2 qSort (branch.begin(),branch.end(), isAbove);
   1.105 -	return bo;
   1.106 -}
   1.107 -
   1.108 -void BranchObj::removeBranchHere(BranchObj* borem)	// FIXME-1 getNum no longer available
   1.109 +void BranchObj::removeBranchHere(BranchObj* borem)	// FIXME-2 getNum no longer available
   1.110  {
   1.111  /*
   1.112  	// This removes the branch bo from list, but 
   1.113 @@ -789,7 +700,7 @@
   1.114  	clear();
   1.115  }
   1.116  
   1.117 -void BranchObj::removeBranch(BranchObj* bo)	// FIXME-1 not needed here
   1.118 +void BranchObj::removeBranch(BranchObj* bo)	// FIXME-2 not needed here
   1.119  {
   1.120  /*
   1.121      // if bo is not in branch remove returns false, we
   1.122 @@ -806,7 +717,7 @@
   1.123  	*/
   1.124  }
   1.125  
   1.126 -void BranchObj::removeBranchPtr(BranchObj* bo)	// FIXME-1 not needed here
   1.127 +void BranchObj::removeBranchPtr(BranchObj* bo)	// FIXME-3 not needed here
   1.128  {
   1.129  /*
   1.130  	int i=branch.indexOf(bo);
   1.131 @@ -819,9 +730,9 @@
   1.132  */	
   1.133  }
   1.134  
   1.135 -bool BranchObj::canMoveBranchUp() 
   1.136 +bool BranchObj::canMoveBranchUp() // FIXME-1 move to BranchItem
   1.137  {
   1.138 -	/* FIXME-1 move to BranchItem
   1.139 +/*
   1.140  	if (!parObj || depth==1) return false;
   1.141  	BranchObj* par=(BranchObj*)parObj;
   1.142  	if (this==par->getTreeItem()->getFirstBranch())
   1.143 @@ -848,9 +759,9 @@
   1.144  		return NULL;
   1.145  }
   1.146  
   1.147 -bool BranchObj::canMoveBranchDown() 
   1.148 +bool BranchObj::canMoveBranchDown() //FIXME-1 move to BranchItem
   1.149  {
   1.150 -	/* FIXME-1 move to BranchItem
   1.151 +	/* 
   1.152  	if (!parObj|| depth==1) return false;
   1.153  	BranchObj* par=(BranchObj*)parObj;
   1.154  	if (this==par->getTreeItem()->getLastBranch())
   1.155 @@ -879,7 +790,7 @@
   1.156  		return NULL;
   1.157  }
   1.158  
   1.159 -void BranchObj::sortChildren() //FIXME-1  
   1.160 +void BranchObj::sortChildren() //FIXME-2  
   1.161  {
   1.162  /*
   1.163  	int childCount=branch.count(); 
   1.164 @@ -901,42 +812,6 @@
   1.165  */
   1.166  }
   1.167  
   1.168 -
   1.169 -BranchObj* BranchObj::linkTo (BranchObj* dst, int pos)
   1.170 -{
   1.171 -	// Find current parent and 
   1.172 -	// remove pointer to myself there
   1.173 -	if (!dst) return NULL;
   1.174 -	BranchObj *par=(BranchObj*)parObj;
   1.175 -	if (par)
   1.176 -		par->removeBranchPtr (this);
   1.177 -	else
   1.178 -		return NULL;
   1.179 -
   1.180 -/* FIXME-1
   1.181 -	// Create new pointer to myself at dst
   1.182 -	if (pos<0||dst->getDepth()==0)
   1.183 -	{	
   1.184 -		// links myself as last branch at dst
   1.185 -		dst->addBranchPtr (this);
   1.186 -		updateLink();
   1.187 -		return this;
   1.188 -	} else
   1.189 -	{
   1.190 -		// inserts me at pos in parent of dst
   1.191 -		if (par)
   1.192 -		{
   1.193 -			BranchObj *bo=dst->insertBranchPtr (this,pos);
   1.194 -			bo->setDefAttr(MovedBranch);
   1.195 -			updateLink();
   1.196 -			return bo;
   1.197 -
   1.198 -		} else
   1.199 -			return NULL;
   1.200 -	}	
   1.201 -*/	
   1.202 -}
   1.203 -
   1.204  void BranchObj::alignRelativeTo (QPointF ref,bool alignSelf)
   1.205  {
   1.206  	qreal th = bboxTotal.height();