branchobj.cpp
changeset 753 25a77484ec72
parent 751 7fa9b3164cbe
child 754 db0ec4bcf416
     1.1 --- a/branchobj.cpp	Thu Apr 02 09:57:47 2009 +0000
     1.2 +++ b/branchobj.cpp	Tue Apr 07 16:15:53 2009 +0000
     1.3 @@ -1,17 +1,16 @@
     1.4  #include "branchobj.h"
     1.5  
     1.6 -// #include "texteditor.h"
     1.7  #include "branchitem.h"
     1.8  #include "geometry.h"
     1.9  #include "mapeditor.h"
    1.10  #include "mainwindow.h"
    1.11  #include "misc.h"
    1.12  
    1.13 -class TextEditor;
    1.14 +//class TextEditor; //FIXME-3
    1.15  
    1.16 -extern TextEditor *textEditor;
    1.17 -extern Main *mainWindow;
    1.18 -extern FlagRowObj *standardFlagsDefault;
    1.19 +//extern TextEditor *textEditor;
    1.20 +//extern Main *mainWindow;
    1.21 +//extern FlagRowObj *standardFlagsDefault;
    1.22  
    1.23  
    1.24  /////////////////////////////////////////////////////////////////
    1.25 @@ -57,7 +56,7 @@
    1.26  		model->stopAnimation (this);
    1.27  	}
    1.28  
    1.29 -	cout << "Destr BranchObj of "<<this<<" ("<<getHeading().toStdString()<<")"<<endl;
    1.30 +	cout << "Destr BranchObj of "<<this<<" ("<<treeItem->getHeading().toStdString()<<")"<<endl;
    1.31  	// Check, if this branch was the last child to be deleted
    1.32  	// If so, unset the scrolled flags in parent // FIXME-2 better do this in model?
    1.33  
    1.34 @@ -101,12 +100,13 @@
    1.35  {
    1.36      OrnamentedObj::copy(other);
    1.37  
    1.38 -	branch.clear();
    1.39 +/* FIXME-3 not needed
    1.40  	for (int i=0; i<other->treeItem->branchCount(); ++i)
    1.41  		// Make deep copy of b
    1.42  		// Because addBranch again calls copy for the children,
    1.43  		// Those will get a deep copy, too
    1.44  		addBranch(other->branch.at(i) );	
    1.45 +*/		
    1.46  
    1.47  	for (int i=0; i<other->floatimage.size(); ++i)
    1.48  		addFloatImage  (other->floatimage.at(i));
    1.49 @@ -127,9 +127,6 @@
    1.50  
    1.51  	while (!xlink.isEmpty())
    1.52  		delete xlink.takeFirst();
    1.53 -
    1.54 -	while (!branch.isEmpty())
    1.55 -		delete branch.takeFirst();
    1.56  }
    1.57  
    1.58  bool isAbove (BranchObj* a, BranchObj *b)
    1.59 @@ -243,7 +240,7 @@
    1.60  		{
    1.61  			// Now go recursivly through all children
    1.62  			for (i=0; i<treeItem->branchCount(); ++i)
    1.63 -				branch.at(i)->setVisibility (v,toDepth);	
    1.64 +				treeItem->getBranchObjNum(i)->setVisibility (v,toDepth);	
    1.65  		}
    1.66      } // depth <= toDepth	
    1.67  	requestReposition();
    1.68 @@ -273,7 +270,14 @@
    1.69  {
    1.70  	setColor (col);
    1.71  	for (int i=0; i<treeItem->branchCount(); ++i)
    1.72 -		branch.at(i)->setColorSubtree(col);
    1.73 +		treeItem->getBranchObjNum(i)->setColorSubtree(col);
    1.74 +}
    1.75 +
    1.76 +void BranchObj::updateContentSize()
    1.77 +{
    1.78 +	calcBBoxSize();
    1.79 +	positionBBox();
    1.80 +	requestReposition();
    1.81  }
    1.82  
    1.83  void BranchObj::positionContents()
    1.84 @@ -300,7 +304,7 @@
    1.85  {
    1.86  	OrnamentedObj::moveBy (x,y);
    1.87  	for (int i=0; i<treeItem->branchCount(); ++i)
    1.88 -		branch.at(i)->moveBy (x,y);
    1.89 +		treeItem->getBranchObjNum(i)->moveBy (x,y);
    1.90      positionBBox();
    1.91  }
    1.92  	
    1.93 @@ -329,12 +333,12 @@
    1.94      QSizeF heading_r=heading->getSize();
    1.95      qreal heading_w=(qreal) heading_r.width() ;
    1.96      qreal heading_h=(qreal) heading_r.height() ;
    1.97 -    QSizeF sysflags_r=systemFlags->getSize();
    1.98 -	qreal sysflags_h=sysflags_r.height();
    1.99 -	qreal sysflags_w=sysflags_r.width();
   1.100 -    QSizeF stanflags_r=standardFlags->getSize();
   1.101 -	qreal stanflags_h=stanflags_r.height();
   1.102 -	qreal stanflags_w=stanflags_r.width();
   1.103 +    QSizeF sysflags_r; //FIXME-1 =systemFlags->getSize();
   1.104 +	qreal sysflags_h=0;//sysflags_r.height();
   1.105 +	qreal sysflags_w=0;//sysflags_r.width();
   1.106 +    QSizeF stanflags_r; //FIXME-1 =standardFlags->getSize();
   1.107 +	qreal stanflags_h=0; //stanflags_r.height();
   1.108 +	qreal stanflags_w=0; //stanflags_r.width();
   1.109      qreal w;
   1.110      qreal h;
   1.111  
   1.112 @@ -426,7 +430,7 @@
   1.113      LinkableMapObj *lmo;
   1.114  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.115      {	
   1.116 -		lmo=branch.at(i)->findMapObj(p, excludeLMO);
   1.117 +		lmo=treeItem->getBranchObjNum(i)->findMapObj(p, excludeLMO);
   1.118  		if (lmo != NULL) return lmo;
   1.119      }
   1.120  	
   1.121 @@ -452,7 +456,7 @@
   1.122      LinkableMapObj *lmo;
   1.123  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.124      {	
   1.125 -		lmo=branch.at(i)->findID (sid);
   1.126 +		lmo=treeItem->getBranchObjNum(i)->findID (sid);
   1.127  		if (lmo != NULL) return lmo;
   1.128      }
   1.129  	
   1.130 @@ -472,54 +476,22 @@
   1.131      return NULL;
   1.132  }
   1.133  
   1.134 -void BranchObj::setHeading(QString s)
   1.135 +void BranchObj::updateHeading()
   1.136  {
   1.137 -    heading->setText(s);	// set new heading
   1.138 -	calcBBoxSize();			// recalculate bbox
   1.139 -    positionBBox();			// rearrange contents
   1.140 -	requestReposition();
   1.141 -}
   1.142 -
   1.143 -void BranchObj::setHideTmp (HideTmpMode mode)
   1.144 -{
   1.145 -	if (mode==HideExport && (hideExport|| hasHiddenExportParent() ) )
   1.146 +	if (!treeItem)
   1.147  	{
   1.148 -		// Hide stuff according to hideExport flag and parents
   1.149 -		setVisibility (false);
   1.150 -		hidden=true;
   1.151 -	}else
   1.152 -	{
   1.153 -		// Do not hide, but still take care of scrolled status
   1.154 -		if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem))
   1.155 -			setVisibility (false);
   1.156 -		else
   1.157 -			setVisibility (true);
   1.158 -		hidden=false;
   1.159 -	}	
   1.160 -
   1.161 -	// And take care of my children
   1.162 -	for (int i=0; i<treeItem->branchCount(); ++i)
   1.163 -		branch.at(i)->setHideTmp (mode);
   1.164 -}
   1.165 -
   1.166 -bool BranchObj::hasHiddenExportParent()
   1.167 -{
   1.168 -	// Calls parents recursivly to
   1.169 -	// find out, if we or parents are temp. hidden
   1.170 -
   1.171 -	if (hidden || hideExport) return true;
   1.172 -
   1.173 -	BranchObj* bo=(BranchObj*)parObj;
   1.174 -	if (bo) 
   1.175 -		return bo->hasHiddenExportParent();
   1.176 -	else
   1.177 -		return false;
   1.178 +		qWarning ("BranchObj::udpateHeading treeItem==NULL");
   1.179 +		return;
   1.180 +	}
   1.181 +	cout << "BO::updateHeading: "<<treeItem->getHeading().toStdString()<<endl;
   1.182 +	heading->setText (treeItem->getHeading() );
   1.183 +	updateContentSize();
   1.184  }
   1.185  
   1.186  QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
   1.187  {
   1.188  	// Cloudy stuff can be hidden during exports
   1.189 -	if (hidden) return "";
   1.190 +	// FIXME-1 if (hidden) return "";
   1.191  
   1.192  	// Update of note is usually done while unselecting a branch
   1.193  	// if (isNoteInEditor) getNoteFromTextEditor();		//FIXME-2 moved to TreeItem
   1.194 @@ -560,7 +532,7 @@
   1.195      incIndent();
   1.196  
   1.197  	// save heading
   1.198 -    s+=valueElement("heading", getHeading(),
   1.199 +    s+=valueElement("heading", treeItem->getHeading(),
   1.200  		attribut ("textColor",QColor(heading->getColor()).name()));
   1.201  
   1.202  	// Save frame
   1.203 @@ -580,7 +552,7 @@
   1.204  	
   1.205  	// Save branches
   1.206  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.207 -		s+=branch.at(i)->saveToDir(tmpdir,prefix,offset);
   1.208 +		s+=treeItem->getBranchObjNum(i)->saveToDir(tmpdir,prefix,offset);
   1.209  
   1.210  	// Save XLinks
   1.211  	QString ol;	// old link
   1.212 @@ -594,7 +566,7 @@
   1.213  			ol=cl;
   1.214  		} else
   1.215  		{
   1.216 -			qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
   1.217 +			qWarning (QString("Ignoring of duplicate xLink in %1").arg(treeItem->getHeading()));
   1.218  		}
   1.219  	}	
   1.220  
   1.221 @@ -743,7 +715,7 @@
   1.222  {
   1.223  	// Save position in angle
   1.224  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.225 -		branch.at(i)->angle=i;
   1.226 +		treeItem->getBranchObjNum(i)->angle=i;
   1.227  }
   1.228  
   1.229  void BranchObj::setDefAttr (BranchModification mod)
   1.230 @@ -771,10 +743,9 @@
   1.231  BranchObj* BranchObj::addBranch()
   1.232  {
   1.233      BranchObj* newbo=new BranchObj(scene,this);
   1.234 -    branch.append (newbo);
   1.235 +    //FIXME-1 branch.append (newbo);
   1.236      newbo->setParObj(this);
   1.237  	newbo->setDefAttr(NewBranch);
   1.238 -    newbo->setHeading ("new");
   1.239  	/* FIXME-2 treeItem not set yet!!!
   1.240  	if ( ((BranchItem*)treeItem)->isScrolled() )
   1.241  		newbo->setVisibility (false);
   1.242 @@ -789,7 +760,7 @@
   1.243  BranchObj* BranchObj::addBranch(BranchObj* bo)
   1.244  {
   1.245      BranchObj* newbo=new BranchObj(scene,this);
   1.246 -    branch.append (newbo);
   1.247 +    //FIXME-1 branch.append (newbo);
   1.248      newbo->copy(bo);
   1.249      newbo->setParObj(this);
   1.250  	newbo->setDefAttr(MovedBranch);
   1.251 @@ -804,7 +775,7 @@
   1.252  
   1.253  BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
   1.254  {
   1.255 -	branch.append (bo);
   1.256 +	//FIXME-1 branch.append (bo);
   1.257  	bo->setParObj (this);
   1.258  	bo->depth=depth+1;
   1.259  	bo->setDefAttr(MovedBranch);
   1.260 @@ -820,7 +791,7 @@
   1.261  	// Add new bo and resort branches
   1.262  	BranchObj *newbo=addBranch ();
   1.263  	newbo->angle=pos-0.5;
   1.264 -	qSort (branch.begin(),branch.end(), isAbove);
   1.265 +	//FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
   1.266  	return newbo;
   1.267  }
   1.268  
   1.269 @@ -830,7 +801,7 @@
   1.270  	// Add new bo and resort branches
   1.271  	bo->angle=pos-0.5;
   1.272  	BranchObj *newbo=addBranch (bo);
   1.273 -	qSort (branch.begin(),branch.end(), isAbove);
   1.274 +	//FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
   1.275  	return newbo;
   1.276  }
   1.277  
   1.278 @@ -839,14 +810,14 @@
   1.279  	savePosInAngle();
   1.280  	// Add new bo and resort branches
   1.281  	bo->angle=pos-0.5;
   1.282 -	branch.append (bo);
   1.283 +	//FIXME-1 branch.append (bo);
   1.284  	bo->setParObj (this);
   1.285  	bo->depth=depth+1;
   1.286  	bo->setDefAttr (MovedBranch);
   1.287  	BranchItem *bi=(BranchItem*)treeItem;
   1.288  	if ( bi->isScrolled() ) bi->tmpUnscroll();
   1.289  	//setLastSelectedBranch (bo); //FIXME-3 needed?
   1.290 -	qSort (branch.begin(),branch.end(), isAbove);
   1.291 +	//FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
   1.292  	return bo;
   1.293  }
   1.294  
   1.295 @@ -872,8 +843,9 @@
   1.296  	clear();
   1.297  }
   1.298  
   1.299 -void BranchObj::removeBranch(BranchObj* bo)
   1.300 +void BranchObj::removeBranch(BranchObj* bo)	// FIXME-1 not needed here
   1.301  {
   1.302 +/*
   1.303      // if bo is not in branch remove returns false, we
   1.304      // don't care...
   1.305  	
   1.306 @@ -885,10 +857,12 @@
   1.307  	} else
   1.308  		qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
   1.309  	requestReposition();
   1.310 +	*/
   1.311  }
   1.312  
   1.313 -void BranchObj::removeBranchPtr(BranchObj* bo)
   1.314 +void BranchObj::removeBranchPtr(BranchObj* bo)	// FIXME-1 not needed here
   1.315  {
   1.316 +/*
   1.317  	int i=branch.indexOf(bo);
   1.318  	
   1.319  	if (i>=0)
   1.320 @@ -896,6 +870,7 @@
   1.321  	else	
   1.322  		qWarning ("BranchObj::removeBranchPtr tried to remove non existing branch?!\n");
   1.323  	requestReposition();
   1.324 +*/	
   1.325  }
   1.326  
   1.327  bool BranchObj::canMoveBranchUp() 
   1.328 @@ -911,17 +886,19 @@
   1.329  return false;
   1.330  }
   1.331  
   1.332 -BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist
   1.333 +BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // FIXME-1
   1.334  {
   1.335 +/*
   1.336  	savePosInAngle();
   1.337      int i=branch.indexOf(bo1);
   1.338      if (i>0) 
   1.339  	{	// -1 if bo1 not found 
   1.340 -		branch.at(i)->angle--;
   1.341 -		branch.at(i-1)->angle++;
   1.342 +		treeItem->getBranchObjNum(i)->angle--;
   1.343 +		treeItem->getBranchObjNum(i-1)->angle++;
   1.344  		qSort (branch.begin(),branch.end(), isAbove);
   1.345 -		return branch.at(i);
   1.346 +		return treeItem->getBranchObjNum(i);
   1.347  	} else
   1.348 +*/	
   1.349  		return NULL;
   1.350  }
   1.351  
   1.352 @@ -938,19 +915,21 @@
   1.353  return false;	
   1.354  }
   1.355  
   1.356 -BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
   1.357 +BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// FIXME-1
   1.358  {
   1.359 +/*
   1.360  	savePosInAngle();
   1.361      int i=branch.indexOf(bo1);
   1.362  	int j;
   1.363  	if (i <treeItem->branchCount())
   1.364  	{
   1.365  		j = i+1;
   1.366 -		branch.at(i)->angle++;
   1.367 -		branch.at(j)->angle--;
   1.368 +		treeItem->getBranchObjNum(i)->angle++;
   1.369 +		treeItem->getBranchObjNum(j)->angle--;
   1.370  		qSort (branch.begin(),branch.end(), isAbove);
   1.371 -		return branch.at(i);
   1.372 +		return treeItem->getBranchObjNum(i);
   1.373  	} else
   1.374 +*/	
   1.375  		return NULL;
   1.376  }
   1.377  
   1.378 @@ -964,8 +943,8 @@
   1.379  	{
   1.380  		madeChanges=false;
   1.381  		for(curChildIndex=1;curChildIndex<childCount;curChildIndex++){
   1.382 -			BranchObj* curChild=(BranchObj*)branch.at(curChildIndex);
   1.383 -			BranchObj* prevChild=(BranchObj*)branch.at(curChildIndex-1);
   1.384 +			BranchObj* curChild=(BranchObj*)treeItem->getBranchObjNum(curChildIndex);
   1.385 +			BranchObj* prevChild=(BranchObj*)treeItem->getBranchObjNum(curChildIndex-1);
   1.386  			if(prevChild->heading->text().compare(curChild->heading->text())>0)
   1.387  			{
   1.388  				this->moveBranchUp(curChild);
   1.389 @@ -1015,41 +994,45 @@
   1.390  	qreal th = bboxTotal.height();	
   1.391  // TODO testing
   1.392  /*
   1.393 +	QString h=QString (treeItem->depth(),' ');
   1.394 +	h+=treeItem->getHeading();
   1.395 +	h+=QString (15,' ');
   1.396 +	h.truncate (15);
   1.397  	QPointF pp; if (parObj) pp=parObj->getChildPos();
   1.398 -	cout << "BO::alignRelTo "<<qPrintable (getHeading());
   1.399 -	cout << "    d="<<depth<<
   1.400 -		"  ref="<<ref<<
   1.401 -//		"  bbox.topLeft="<<bboxTotal.topLeft()<<
   1.402 +	cout << "BO::alignRelTo ";
   1.403 +	cout<<h.toStdString();
   1.404 +//	cout << "    d="<<treeItem->depth()<<
   1.405 +cout<<  "  ref="<<ref<<
   1.406 +      	"  bbox.tL="<<bboxTotal.topLeft()<<
   1.407  		"  absPos="<<absPos<<
   1.408  //		"  relPos="<<relPos<<
   1.409  //		"  parPos="<<pp<<
   1.410 -		"  width="<<bbox.width()<<
   1.411 -		"  orient="<<orientation<<
   1.412 -		"  alignSelf="<<alignSelf<<
   1.413 +		"  w="<<bbox.width()<<
   1.414 +		"  h="<<bbox.height()<<
   1.415 +//		"  orient="<<orientation<<
   1.416 +//		"  alignSelf="<<alignSelf<<
   1.417 +//		"  scrolled="<<((BranchItem*)treeItem)->isScrolled()<<
   1.418  //		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
   1.419  //		"  hidden="<<hidden<<
   1.420 -//		"  th="<<th<<
   1.421 +		"  th="<<th<<
   1.422  		endl;
   1.423  */
   1.424  
   1.425  	setOrientation();
   1.426  	//updateLink();
   1.427  
   1.428 -	if (depth<2)
   1.429 +	if (depth==1)
   1.430  	{
   1.431 -		if (depth==1)
   1.432 -		{
   1.433 -			// Position relatively, if needed
   1.434 -			//if (useRelPos) move2RelPos (relPos.x(), relPos.y());
   1.435 +		// Position relatively, if needed
   1.436 +		//if (useRelPos) move2RelPos (relPos.x(), relPos.y());
   1.437  
   1.438 -			// Calc angle to mapCenter if I am a mainbranch
   1.439 -			// needed for reordering the mainbranches clockwise 
   1.440 -			// around mapcenter 
   1.441 -			angle=getAngle (QPointF ((int)(x() - parObj->getChildPos().x() ), 
   1.442 -									(int)(y() - parObj->getChildPos().y() ) ) );
   1.443 -		}							
   1.444 -	} 
   1.445 -	else
   1.446 +		// Calc angle to mapCenter if I am a mainbranch
   1.447 +		// needed for reordering the mainbranches clockwise 
   1.448 +		// around mapcenter 
   1.449 +		angle=getAngle (QPointF ((int)(x() - parObj->getChildPos().x() ), 
   1.450 +								(int)(y() - parObj->getChildPos().y() ) ) );
   1.451 +	}							
   1.452 +	if (depth>1)
   1.453      {
   1.454  		// Align myself depending on orientation and parent, but
   1.455  		// only if I am not a mainbranch or mapcenter itself
   1.456 @@ -1074,7 +1057,7 @@
   1.457  					default:
   1.458  						qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
   1.459  					break;
   1.460 -				}
   1.461 +			}
   1.462  		}
   1.463      }		
   1.464  
   1.465 @@ -1095,12 +1078,12 @@
   1.466      // Align the children depending on reference point 
   1.467  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.468      {	
   1.469 -		if (!branch.at(i)->isHidden())
   1.470 +		if (!treeItem->getBranchNum(i)->isHidden())
   1.471  		{
   1.472 -			branch.at(i)->alignRelativeTo (ref2,true);
   1.473 +			treeItem->getBranchObjNum(i)->alignRelativeTo (ref2,true);
   1.474  
   1.475  			// append next branch below current one
   1.476 -			ref2.setY(ref2.y() + branch.at(i)->getBBoxSizeWithChildren().height() );
   1.477 +			ref2.setY(ref2.y() + treeItem->getBranchObjNum(i)->getBBoxSizeWithChildren().height() );
   1.478  		}
   1.479      }
   1.480  }
   1.481 @@ -1109,12 +1092,11 @@
   1.482  void BranchObj::reposition()
   1.483  {	
   1.484  /* TODO testing only
   1.485 -	if (!getHeading().isEmpty())
   1.486 -		cout << "BO::reposition  "<<qPrintable(getHeading())<<endl;
   1.487 +	if (!treeItem->getHeading().isEmpty())
   1.488 +		cout << "BO::reposition  "<<qPrintable(treeItem->getHeading())<<endl;
   1.489  	else	
   1.490  		cout << "BO::reposition  ???"<<endl;
   1.491 -
   1.492 -	cout << "  orient="<<orientation<<endl;
   1.493 +//	cout << "  orient="<<orientation<<endl;
   1.494  */		
   1.495  
   1.496  	if (depth==0)
   1.497 @@ -1128,7 +1110,7 @@
   1.498  
   1.499  	    alignRelativeTo ( QPointF (absPos.x(),
   1.500  			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
   1.501 -		qSort (branch.begin(),branch.end(), isAbove);
   1.502 +		//FIXME-2 qSort (branch.begin(),branch.end(), isAbove);
   1.503  		positionBBox();	// Reposition bbox and contents
   1.504  	} else
   1.505  	{
   1.506 @@ -1143,7 +1125,7 @@
   1.507  {
   1.508  	repositionRequest=false;
   1.509  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.510 -		branch.at(i)->unsetAllRepositionRequests();
   1.511 +		treeItem->getBranchObjNum(i)->unsetAllRepositionRequests();
   1.512  }
   1.513  
   1.514  
   1.515 @@ -1176,13 +1158,14 @@
   1.516  	if ( ((BranchItem*)treeItem)->isScrolled() ) return r;
   1.517  
   1.518  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.519 -		if (!branch.at(i)->isHidden())
   1.520 -			r=addBBox(branch.at(i)->getTotalBBox(),r);
   1.521 +		if (!treeItem->getBranchNum(i)->isHidden())
   1.522 +			r=addBBox(treeItem->getBranchObjNum(i)->getTotalBBox(),r);
   1.523  
   1.524 -	for (int i=0; i<floatimage.size(); ++i)
   1.525 +/*
   1.526 +	FIXME-1 for (int i=0; i<floatimage.size(); ++i)
   1.527  		if (!floatimage.at(i)->isHidden())
   1.528  			r=addBBox(floatimage.at(i)->getTotalBBox(),r);
   1.529 -		
   1.530 +	*/	
   1.531  	return r;
   1.532  }
   1.533  
   1.534 @@ -1204,14 +1187,15 @@
   1.535  	bboxTotal.setY(bbox.y() );
   1.536  
   1.537  	// if branch is scrolled, ignore children, but still consider floatimages
   1.538 -	if ( ((BranchItem*)treeItem)->isScrolled() ) 
   1.539 +	BranchItem *bi=(BranchItem*)treeItem;
   1.540 +	if ( bi->isScrolled() ) 
   1.541  	{
   1.542  		bboxTotal.setWidth (bbox.width());
   1.543  		bboxTotal.setHeight(bbox.height());
   1.544  		return;
   1.545  	}
   1.546  	
   1.547 -	if (hidden)
   1.548 +	if (bi->isHidden())
   1.549  	{
   1.550  		bboxTotal.setWidth (0);
   1.551  		bboxTotal.setHeight(0);
   1.552 @@ -1235,10 +1219,10 @@
   1.553  	// minimum of y
   1.554  	for (int i=0; i<treeItem->branchCount(); ++i)
   1.555  	{
   1.556 -		if (!branch.at(i)->isHidden())
   1.557 +		if (!bi->getBranchNum(i)->isHidden())
   1.558  		{
   1.559 -			branch.at(i)->calcBBoxSizeWithChildren();
   1.560 -			br=branch.at(i)->getBBoxSizeWithChildren();
   1.561 +			bi->getBranchObjNum(i)->calcBBoxSizeWithChildren();
   1.562 +			br=bi->getBranchObjNum(i)->getBBoxSizeWithChildren();
   1.563  			r.setWidth( max (br.width(), r.width() ));
   1.564  			r.setHeight(br.height() + r.height() );
   1.565  			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
   1.566 @@ -1246,7 +1230,7 @@
   1.567  	}
   1.568  	// Add myself and also
   1.569  	// add width of link to sum if necessary
   1.570 -	if (branch.isEmpty())
   1.571 +	if (bi->branchCount()<1)
   1.572  		bboxTotal.setWidth (bbox.width() + r.width() );
   1.573  	else	
   1.574  		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
   1.575 @@ -1255,7 +1239,7 @@
   1.576  }
   1.577  
   1.578  /*
   1.579 -void BranchObj::select()	// FIXME-2 try to get rid of this in BO completely
   1.580 +void BranchObj::select()	// FIXME-4 try to get rid of this in BO completely
   1.581  {
   1.582  	cout << "BO::select()\n";
   1.583  	textEditor->setText(treeItem->getNoteObj().getNote() );
   1.584 @@ -1291,7 +1275,7 @@
   1.585  	*/
   1.586  
   1.587  /*
   1.588 -void BranchObj::unselect()	//FIXME-3 should not be needed
   1.589 +void BranchObj::unselect()	//FIXME-4 should not be needed
   1.590  {
   1.591  	cout << "BO::unselect()\n";
   1.592  	LinkableMapObj::unselect();