diff -r 6b0a5f4923d3 -r cf634bbf9e04 branchobj.cpp --- a/branchobj.cpp Thu Sep 17 09:41:09 2009 +0000 +++ b/branchobj.cpp Wed Sep 23 11:59:54 2009 +0000 @@ -115,30 +115,32 @@ return false; } -void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPointF m, int off) +void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off) { - // Temporary link to lmo + // Temporary link to dst // m is position of mouse pointer - // offset 0: default 1: below lmo -1 above lmo (if possible) + // offset 0: default 1: below dst -1 above dst (if possible) - BranchItem *pi=(BranchItem*)(lmo->getTreeItem()->parent()); + BranchItem *dsti=(BranchItem*)(dst->getTreeItem()); + + BranchItem *pi=(BranchItem*)(dsti->parent()); int pi_depth=pi->depth(); - BranchObj* o=(BranchObj*)(lmo); - if (!parObjTmpBuf) - parObjTmpBuf=parObj; + BranchObj* bo=(BranchObj*)(dst); - // ignore mapcenter and mainbranch //FIXME-3 MCO meanwhile also could be relinked + if (!parObjTmpBuf) 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; else link2ParPos=true; - parObj=o; + parObj=bo; // setLinkStyle calls updateLinkGeometry, only set it once - //LinkableMapObj::Style ls=getDefLinkStyle (lmo->getTreeItem() ); + //LinkableMapObj::Style ls=getDefLinkStyle (dst->getTreeItem() ); //if (style!=ls ) setLinkStyle (ls); - setLinkStyle (lmo->getDefLinkStyle (lmo->getTreeItem())); + setLinkStyle (dst->getDefLinkStyle (dsti)); // Move temporary to new position at destination // Usually the positioning would be done by reposition(), @@ -149,8 +151,7 @@ //FIXME-2 rewrite to us new normalize QPointF p= normalize ( QPointF (m.x() - o->getChildPos().x(), // m.y() - o->getChildPos().y() )); - QPointF p= ( 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); } else @@ -159,8 +160,8 @@ if (off==0) { // new parent is just a branch, link to it - QRectF t=o->getBBoxSizeWithChildren(); - if (o->getTreeItem()->getLastBranch()) + QRectF t=bo->getBBoxSizeWithChildren(); + if (dsti->getLastBranch()) y=t.y() + t.height() ; else y=t.y(); @@ -168,19 +169,19 @@ } else { if (off<0) - // we want to link above lmo - y=o->y() - height() + 5; + // we want to link above dst + y=bo->y() - height() + 5; else - // we want to link below lmo + // we want to link below dst // Bottom of sel should be 5 pixels above // the bottom of the branch _below_ the target: // Don't try to find that branch, guess 12 pixels - y=o->getChildPos().y() -height() + 12; + y=bo->getChildPos().y() -height() + 12; } - if (o->getOrientation()==LinkableMapObj::LeftOfCenter) - move ( o->getChildPos().x() - linkwidth, y ); + if (bo->getOrientation()==LinkableMapObj::LeftOfCenter) + move ( bo->getChildPos().x() - linkwidth, y ); else - move (o->getChildPos().x() + linkwidth, y ); + move (bo->getChildPos().x() + linkwidth, y ); } // updateLinkGeometry is called implicitly in move @@ -264,12 +265,6 @@ void BranchObj::move (double x, double y) { OrnamentedObj::move (x,y); - FloatImageObj *fio; - for (int i=0; iimageCount(); ++i ) - { - fio=treeItem->getImageObjNum(i); - if (fio) fio->reposition(); - } positionBBox(); } @@ -550,6 +545,10 @@ angle=getAngle (QPointF ((int)(x() - parObj->getChildPos().x() ), (int)(y() - parObj->getChildPos().y() ) ) ); } + if (depth==1) + { + move2RelPos (getRelPos() ); + } if (depth>1) { // Align myself depending on orientation and parent, but @@ -647,28 +646,6 @@ } -QPolygonF BranchObj::shape() -{ - QPolygonF p; - - QRectF r=getTotalBBox(); - if (orientation==LinkableMapObj::LeftOfCenter) - p <