diff -r 2876353ea150 -r d251c7b2de54 branchobj.cpp --- a/branchobj.cpp Wed Sep 23 12:14:08 2009 +0000 +++ b/branchobj.cpp Thu Oct 01 11:28:50 2009 +0000 @@ -115,7 +115,7 @@ return false; } -void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off) +void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off) //FIXME-1 after moving a mainbranch to a branch and away again mainbranch is no longer connected to mapcenter... { // Temporary link to dst // m is position of mouse pointer @@ -127,9 +127,12 @@ int pi_depth=pi->depth(); BranchObj* bo=(BranchObj*)(dst); - if (!parObjTmpBuf) parObjTmpBuf=parObj; + if (!tmpParent) + { + tmpParent=true; + parObjTmpBuf=parObj; + } - // ignore mapcenter and mainbranch //FIXME-1 MCO meanwhile also could be relinked if (pi_depth<2) off=0; if (off==0) link2ParPos=false; @@ -137,9 +140,6 @@ link2ParPos=true; parObj=bo; - // setLinkStyle calls updateLinkGeometry, only set it once - //LinkableMapObj::Style ls=getDefLinkStyle (dst->getTreeItem() ); - //if (style!=ls ) setLinkStyle (ls); setLinkStyle (dst->getDefLinkStyle (dsti)); // Move temporary to new position at destination @@ -148,12 +148,11 @@ // Better just do it approximately if (parObj->getTreeItem()->depth()==0) { // new parent is a mapcenter - - //FIXME-2 rewrite to us new normalize QPointF p= normalize ( QPointF (m.x() - o->getChildPos().x(), - // m.y() - o->getChildPos().y() )); - QPointF p= ( m - bo->getChildPos()); - if (p.x()<0) p.setX( p.x()-bbox.width() ); - move2RelPos (p); + Vector v= ( m - bo->getChildPos()); + if (v.x()<0) v.setX( v.x()-bbox.width() ); + v.normalize(); + v.scale (100); + move2RelPos (v.toQPointF()); } else { qreal y; @@ -190,8 +189,9 @@ void BranchObj::unsetParObjTmp() { - if (parObjTmpBuf) + if (tmpParent) { + tmpParent=false; link2ParPos=false; parObj=parObjTmpBuf; parObjTmpBuf=NULL; @@ -485,9 +485,18 @@ int fontsize; switch (treeItem->depth()) { - case 0: fontsize=16; break; - case 1: fontsize=12; break; - default: fontsize=10; break; + case 0: + fontsize=16; + setFrameType (FrameObj::Rectangle); + break; + case 1: + fontsize=12; + setFrameType (FrameObj::NoFrame); + break; + default: + fontsize=10; + setFrameType (FrameObj::NoFrame); + break; } setLinkStyle(getDefLinkStyle(treeItem->parent() )); setLinkColor (); @@ -497,6 +506,10 @@ if (mod==NewBranch) setColor (treeItem->getHeadingColor() ); + else + // Also set styles for children + for (int i=0; ibranchCount(); ++i) + treeItem->getBranchObjNum(i)->setDefAttr(MovedBranch); calcBBoxSize(); } @@ -672,7 +685,7 @@ return bboxTotal; } -ConvexPolygon BranchObj::getBoundingPolygon() +ConvexPolygon BranchObj::getBoundingPolygon() { /* if (!pi) //FIXME-3 Testing only @@ -683,6 +696,7 @@ pi->setZValue(Z_BBOX); } */ + if (treeItem->branchCount()==0 || treeItem->depth()==0) { if (pi) pi->setPolygon (MapObj::getBoundingPolygon() ); @@ -695,7 +709,9 @@ p<setPolygon (p ); + //cout << "BO::getBP (total) "<getHeadingStd()<<" tL="<