diff -r bf3ea1f1520b -r 59614eaf5fbb mapeditor.cpp --- a/mapeditor.cpp Tue Apr 28 20:53:44 2009 +0000 +++ b/mapeditor.cpp Wed Apr 29 18:46:31 2009 +0000 @@ -798,7 +798,6 @@ { QPointF p = mapToScene(e->pos()); TreeItem *seli=model->getSelectedItem(); - LinkableMapObj *lmosel=seli->getLMO(); // FIXME-2 get rid of lmosel TreeItem *dsti=findMapItem(p, seli); LinkableMapObj* dst=NULL; @@ -811,7 +810,7 @@ pickingColor=false; setCursor (Qt::ArrowCursor); // Check if we are over another branch - if (dsti && lmosel) + if (dsti && seli) { if (e->state() & Qt::ShiftModifier) model->colorBranch (((BranchObj*)dst)->getColor()); @@ -826,7 +825,7 @@ { drawingLink=false; // Check if we are over another branch - if (dsti && lmosel && dsti->isBranchLikeType() ) + if (dsti && seli && dsti->isBranchLikeType() ) { tmpXLink->setEnd ( ((BranchObj*)(dst)) ); tmpXLink->updateXLink(); @@ -893,7 +892,9 @@ if (seli->getType() == TreeItem::Branch ) { // A branch was moved - + LinkableMapObj* lmosel=NULL; //FIXME-2 get rid of lmosel + lmosel=seli->getLMO(); + // save the position in case we link to mapcenter QPointF savePos=QPointF (lmosel->getAbsPos() ); @@ -918,19 +919,16 @@ if (e->state() & Qt::ShiftModifier && dst->getParObj()) { // Link above dst preDstParStr=model->getSelectString (dst->getParObj()); - bsel->linkTo ( (BranchObj*)(bdst->getParObj()), seli->num()); //FIXME-2 not needed model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)dsti)->num()); } else if (e->state() & Qt::ControlModifier && dst->getParObj()) { // Link below dst preDstParStr=model->getSelectString (dst->getParObj()); - bsel->linkTo ( (BranchObj*)(bdst->getParObj()), seli->num()+1);//FIXME-2 not needed model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)seli)->num()+1); } else { // Append to dst preDstParStr=model->getSelectString(dst); - bsel->linkTo (bdst,-1);//FIXME-2 not needed model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti); if (dsti->depth()==0) bsel->move (savePos); }