branchobj.cpp
changeset 773 340bc29da9a0
parent 772 e3f722759c7e
child 775 6e4b586aa88a
     1.1 --- a/branchobj.cpp	Wed May 20 15:40:14 2009 +0000
     1.2 +++ b/branchobj.cpp	Tue May 26 11:23:44 2009 +0000
     1.3 @@ -33,7 +33,7 @@
     1.4  //    cout << "Const BranchObj (s,p)\n";
     1.5      scene=s;
     1.6      setParObj (p);	
     1.7 -	if (treeItem->depth()==1)
     1.8 +	if (treeItem->depth()==1)	// FIXME-3 needed to recursively calc depth?
     1.9  		// Calc angle to mapCenter if I am a mainbranch
    1.10  		// needed for reordering the mainbranches clockwise 
    1.11  		// around mapcenter 
    1.12 @@ -50,6 +50,7 @@
    1.13  	if (anim.isAnimated() )
    1.14  	{
    1.15  		anim.setAnimated (false);
    1.16 +		VymModel *model=treeItem->getModel();
    1.17  		model->stopAnimation (this);
    1.18  	}
    1.19  
    1.20 @@ -86,8 +87,6 @@
    1.21  		absPos+=parObj->getChildPos();
    1.22  	}
    1.23  
    1.24 -    setChildObj(this);
    1.25 -
    1.26  	includeImagesVer=false;
    1.27  	includeImagesHor=false;
    1.28  }
    1.29 @@ -153,7 +152,7 @@
    1.30  	// Usually the positioning would be done by reposition(),
    1.31  	// but then also the destination branch would "Jump" around...
    1.32  	// Better just do it approximately
    1.33 -	if (treeItem->depth()==1)
    1.34 +	if (treeItem->depth()==1)	// FIXME-3 needed to recursively calc depth?
    1.35  	{	// new parent is the mapcenter itself
    1.36  
    1.37  		QPointF p= normalise ( QPointF (m.x() - o->getChildPos().x(),
    1.38 @@ -245,6 +244,7 @@
    1.39  	// Overloaded from LinkableMapObj
    1.40  	// BranchObj can use color of heading
    1.41  
    1.42 +	VymModel *model=treeItem->getModel();
    1.43  	if (model)
    1.44  	{
    1.45  		if (model->getMapLinkColorHint()==HeadingColor)
    1.46 @@ -254,13 +254,6 @@
    1.47  	}		
    1.48  }
    1.49  
    1.50 -void BranchObj::setColorSubtree(QColor col)
    1.51 -{
    1.52 -	setColor (col);
    1.53 -	for (int i=0; i<treeItem->branchCount(); ++i)
    1.54 -		treeItem->getBranchObjNum(i)->setColorSubtree(col);
    1.55 -}
    1.56 -
    1.57  void BranchObj::updateContentSize()
    1.58  {
    1.59  	calcBBoxSize();
    1.60 @@ -663,7 +656,7 @@
    1.61  void BranchObj::alignRelativeTo (QPointF ref,bool alignSelf)
    1.62  {
    1.63  	qreal th = bboxTotal.height();	
    1.64 -	int depth=treeItem->depth();
    1.65 +	int depth=treeItem->depth();	// FIXME-3 needed to recursively calc depth?
    1.66  // TODO testing
    1.67  /*
    1.68  
    1.69 @@ -918,7 +911,11 @@
    1.70  
    1.71  QString BranchObj::getSelectString()
    1.72  {
    1.73 -	return model->getSelectString (this);
    1.74 +	VymModel *model=treeItem->getModel();
    1.75 +	if (model)
    1.76 +		return model->getSelectString (this);
    1.77 +	else
    1.78 +		return QString();
    1.79  }
    1.80  
    1.81  void BranchObj::setAnimation(const AnimPoint &ap)