diff -r db0ec4bcf416 -r ed5b407975b3 branchobj.cpp --- a/branchobj.cpp Mon Apr 20 10:42:05 2009 +0000 +++ b/branchobj.cpp Thu Apr 23 12:15:31 2009 +0000 @@ -22,23 +22,22 @@ // cout << "Const BranchObj ()\n"; setParObj (this); init(); - depth=-1; } -BranchObj::BranchObj (QGraphicsScene* s):OrnamentedObj (s) +BranchObj::BranchObj (QGraphicsScene* s):OrnamentedObj (s)// FIXME-3 needed at all? { -// cout << "Const BranchObj (s) called from MapCenterObj (s)\n"; +// cout << "Const BranchObj (s) \n"; parObj=NULL; scene=s; + init(); } -BranchObj::BranchObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s) +BranchObj::BranchObj (QGraphicsScene* s, LinkableMapObj* p):OrnamentedObj (s)// FIXME-3 needed at all? { // cout << "Const BranchObj (s,p)\n"; scene=s; setParObj (p); - depth=p->getDepth()+1; - if (depth==1) + if (treeItem->depth()==1) // Calc angle to mapCenter if I am a mainbranch // needed for reordering the mainbranches clockwise // around mapcenter @@ -120,7 +119,7 @@ void BranchObj::clear() { - setVisibility (true); + //setVisibility (true); //FIXME-4 needed? while (!floatimage.isEmpty()) delete floatimage.takeFirst(); @@ -149,14 +148,14 @@ parObjTmpBuf=parObj; // ignore mapcenter and mainbranch - if (lmo->getDepth()<2) off=0; + if (treeItem->depth()<2) off=0; if (off==0) link2ParPos=false; else link2ParPos=true; parObj=o; - depth=parObj->getDepth()+1; + // FIXME-2 depth=parObj->getDepth()+1; // setLinkStyle calls updateLink, only set it once if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle()); @@ -165,7 +164,7 @@ // Usually the positioning would be done by reposition(), // but then also the destination branch would "Jump" around... // Better just do it approximately - if (depth==1) + if (treeItem->depth()==1) { // new parent is the mapcenter itself QPointF p= normalise ( QPointF (m.x() - o->getChildPos().x(), @@ -213,7 +212,7 @@ link2ParPos=false; parObj=parObjTmpBuf; parObjTmpBuf=NULL; - depth=parObj->getDepth()+1; + //FIXME-2 depth=parObj->getDepth()+1; setLinkStyle (getDefLinkStyle() ); updateLink(); } @@ -222,7 +221,7 @@ void BranchObj::setVisibility(bool v, int toDepth) { BranchItem *bi=(BranchItem*)treeItem; - if (depth <= toDepth) + if (bi->depth() <= toDepth) { frame->setVisibility(v); heading->setVisibility(v); @@ -669,7 +668,7 @@ void BranchObj::setDefAttr (BranchModification mod) { int fontsize; - switch (depth) + switch (treeItem->depth()) { case 0: fontsize=16; break; case 1: fontsize=12; break; @@ -688,7 +687,7 @@ calcBBoxSize(); } -BranchObj* BranchObj::addBranch() +BranchObj* BranchObj::addBranch() // FIXME-3 still needed? { BranchObj* newbo=new BranchObj(scene,this); newbo->setParObj(this); @@ -724,7 +723,7 @@ { //FIXME-1 branch.append (bo); bo->setParObj (this); - bo->depth=depth+1; + //FIXME-2 bo->depth=depth+1; bo->setDefAttr(MovedBranch); BranchItem *bi=(BranchItem*)treeItem; if ( bi->isScrolled() ) bi->tmpUnscroll(); @@ -757,14 +756,14 @@ savePosInAngle(); // Add new bo and resort branches bo->angle=pos-0.5; - //FIXME-1 branch.append (bo); + //FIXME-4 branch.append (bo); bo->setParObj (this); - bo->depth=depth+1; + //FIXME-2 bo->depth=depth+1; bo->setDefAttr (MovedBranch); BranchItem *bi=(BranchItem*)treeItem; if ( bi->isScrolled() ) bi->tmpUnscroll(); //setLastSelectedBranch (bo); //FIXME-3 needed? - //FIXME-1 qSort (branch.begin(),branch.end(), isAbove); + //FIXME-2 qSort (branch.begin(),branch.end(), isAbove); return bo; } @@ -785,7 +784,7 @@ */ } -void BranchObj::removeChildren() +void BranchObj::removeChildren() // FIXME-3 not needed here { clear(); } @@ -914,6 +913,7 @@ else return NULL; +/* FIXME-1 // Create new pointer to myself at dst if (pos<0||dst->getDepth()==0) { @@ -934,22 +934,25 @@ } else return NULL; } +*/ } void BranchObj::alignRelativeTo (QPointF ref,bool alignSelf) { qreal th = bboxTotal.height(); + int depth=treeItem->depth(); // TODO testing /* - QString h=QString (treeItem->depth(),' '); + + QString h=QString (depth,' '); h+=treeItem->getHeading(); h+=QString (15,' '); h.truncate (15); QPointF pp; if (parObj) pp=parObj->getChildPos(); cout << "BO::alignRelTo "; cout<