mapeditor.cpp
changeset 760 59614eaf5fbb
parent 756 a8a5c7288f57
child 761 0301e6109702
     1.1 --- a/mapeditor.cpp	Tue Apr 28 20:53:44 2009 +0000
     1.2 +++ b/mapeditor.cpp	Wed Apr 29 18:46:31 2009 +0000
     1.3 @@ -798,7 +798,6 @@
     1.4  {
     1.5      QPointF p = mapToScene(e->pos());
     1.6  	TreeItem *seli=model->getSelectedItem();
     1.7 -	LinkableMapObj *lmosel=seli->getLMO();	// FIXME-2 get rid of lmosel
     1.8  
     1.9  	TreeItem *dsti=findMapItem(p, seli);
    1.10  	LinkableMapObj* dst=NULL;
    1.11 @@ -811,7 +810,7 @@
    1.12  		pickingColor=false;
    1.13  		setCursor (Qt::ArrowCursor);
    1.14  		// Check if we are over another branch
    1.15 -		if (dsti && lmosel) 
    1.16 +		if (dsti && seli) 
    1.17  		{	
    1.18  			if (e->state() & Qt::ShiftModifier)
    1.19  				model->colorBranch (((BranchObj*)dst)->getColor());
    1.20 @@ -826,7 +825,7 @@
    1.21  	{
    1.22  		drawingLink=false;
    1.23  		// Check if we are over another branch
    1.24 -		if (dsti && lmosel && dsti->isBranchLikeType() ) 
    1.25 +		if (dsti && seli && dsti->isBranchLikeType() ) 
    1.26  		{	
    1.27  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
    1.28  			tmpXLink->updateXLink();
    1.29 @@ -893,7 +892,9 @@
    1.30  	
    1.31  		if (seli->getType() == TreeItem::Branch )
    1.32  		{	// A branch was moved
    1.33 -			
    1.34 +			LinkableMapObj* lmosel=NULL;		//FIXME-2 get rid of lmosel
    1.35 +			lmosel=seli->getLMO();
    1.36 +				
    1.37  			// save the position in case we link to mapcenter
    1.38  			QPointF savePos=QPointF (lmosel->getAbsPos()  );
    1.39  
    1.40 @@ -918,19 +919,16 @@
    1.41  				if (e->state() & Qt::ShiftModifier && dst->getParObj())
    1.42  				{	// Link above dst
    1.43  					preDstParStr=model->getSelectString (dst->getParObj());
    1.44 -					bsel->linkTo ( (BranchObj*)(bdst->getParObj()), seli->num());	//FIXME-2 not needed
    1.45  					model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)dsti)->num());
    1.46  				} else 
    1.47  				if (e->state() & Qt::ControlModifier && dst->getParObj())
    1.48  				{
    1.49  					// Link below dst
    1.50  					preDstParStr=model->getSelectString (dst->getParObj());
    1.51 -					bsel->linkTo ( (BranchObj*)(bdst->getParObj()), seli->num()+1);//FIXME-2 not needed
    1.52  					model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti->parent(),((BranchItem*)seli)->num()+1);
    1.53  				} else	
    1.54  				{	// Append to dst
    1.55  					preDstParStr=model->getSelectString(dst);
    1.56 -					bsel->linkTo (bdst,-1);//FIXME-2 not needed
    1.57  					model->relinkBranch ((BranchItem*)seli,(BranchItem*)dsti);
    1.58  					if (dsti->depth()==0) bsel->move (savePos);
    1.59  				}