mapeditor.cpp
changeset 773 340bc29da9a0
parent 772 e3f722759c7e
child 775 6e4b586aa88a
     1.1 --- a/mapeditor.cpp	Wed May 20 15:40:14 2009 +0000
     1.2 +++ b/mapeditor.cpp	Tue May 26 11:23:44 2009 +0000
     1.3 @@ -560,7 +560,7 @@
     1.4  	}
     1.5  	BranchObj *bo=model->getSelectedBranchObj();
     1.6  	BranchItem *bi=model->getSelectedBranchItem();
     1.7 -	if (bo)	//FIXME-3
     1.8 +	if (bo)	
     1.9  	{
    1.10  		model->setSelectionBlocked(true);
    1.11  
    1.12 @@ -680,14 +680,13 @@
    1.13      QPointF p = mapToScene(e->pos());
    1.14      TreeItem *ti=findMapItem (p, NULL);
    1.15      LinkableMapObj* lmo=NULL;
    1.16 -	if (ti) lmo=ti->getLMO();	//FIXME-2 get rid of lmo...
    1.17 +	if (ti) lmo=ti->getLMO();	//FIXME-3 get rid of lmo...
    1.18  	
    1.19  	e->accept();
    1.20  
    1.21  	//Take care of  system flags _or_ modifier modes
    1.22  	//
    1.23 -	if (lmo && (typeid(*lmo)==typeid(BranchObj) ||
    1.24 -		typeid(*lmo)==typeid(MapCenterObj) ))
    1.25 +	if (lmo && ti->isBranchLikeType() )
    1.26  	{
    1.27  		QString foname=((BranchObj*)lmo)->getSystemFlagName(p);
    1.28  		if (!foname.isEmpty())
    1.29 @@ -866,27 +865,23 @@
    1.30  			if ( (e->modifiers()==Qt::ShiftModifier) && dst && ( dst != fio->getParObj())  
    1.31  				)
    1.32  			{
    1.33 -				if (typeid(*fio) == typeid(FloatImageObj) )  
    1.34 -				{
    1.35 +				// Also save the move which was done so far
    1.36 +				QString pold=qpointfToString(movingObj_orgRelPos);
    1.37 +				QString pnow=qpointfToString(fio->getRelPos());
    1.38 +				model->saveState(
    1.39 +					fio->getTreeItem(),  // FIXME-3 
    1.40 +					"moveRel "+pold,
    1.41 +					fio->getTreeItem(),
    1.42 +					"moveRel "+pnow,
    1.43 +					QString("Move %1 to relative position %2").arg(model->getObjectName(fio)).arg(pnow));
    1.44 +				fio->getParObj()->requestReposition();
    1.45 +				model->reposition();
    1.46  
    1.47 -					// Also save the move which was done so far
    1.48 -					QString pold=qpointfToString(movingObj_orgRelPos);
    1.49 -					QString pnow=qpointfToString(fio->getRelPos());
    1.50 -					model->saveState(
    1.51 -						fio->getTreeItem(),  // FIXME-3 
    1.52 -						"moveRel "+pold,
    1.53 -						fio->getTreeItem(),
    1.54 -						"moveRel "+pnow,
    1.55 -						QString("Move %1 to relative position %2").arg(model->getObjectName(fio)).arg(pnow));
    1.56 -					fio->getParObj()->requestReposition();
    1.57 -					model->reposition();
    1.58 +				model->linkFloatImageTo (model->getSelectString(dst));
    1.59 +				//movingObj=lmosel;
    1.60 +				//movingObj_orgRelPos=lmosel->getRelPos();	
    1.61  
    1.62 -					model->linkFloatImageTo (model->getSelectString(dst));
    1.63 -					//movingObj=lmosel;
    1.64 -					//movingObj_orgRelPos=lmosel->getRelPos();	
    1.65 -
    1.66 -					model->reposition();
    1.67 -				}	
    1.68 +				model->reposition();
    1.69  			}
    1.70  		} else	
    1.71  		{	// selection != a FloatObj
    1.72 @@ -894,7 +889,9 @@
    1.73  			{
    1.74  				// Move MapCenter
    1.75  				if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
    1.76 -					((MapCenterObj*)lmosel)->moveAll(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
    1.77 +					((BranchObj*)lmosel)->moveBy(
    1.78 +						QPointF(p.x() -movingObj_start.x(), 
    1.79 +						p.y()-movingObj_start.y()) );		
    1.80  				else	
    1.81  					lmosel->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
    1.82  				model->updateRelPositions();
    1.83 @@ -1051,7 +1048,7 @@
    1.84              }
    1.85  		}
    1.86  	
    1.87 -		if (seli->getType() == TreeItem::Branch )
    1.88 +		if (seli->isBranchLikeType() ) //(seli->getType() == TreeItem::Branch )
    1.89  		{	// A branch was moved
    1.90  			LinkableMapObj* lmosel=NULL;		//FIXME-2 get rid of lmosel
    1.91  			lmosel=seli->getLMO();
    1.92 @@ -1063,7 +1060,7 @@
    1.93  			lmosel->unsetParObjTmp();
    1.94  
    1.95  			// For Redo we may need to save original selection
    1.96 -			QString preSelStr=model->getSelectString(lmosel);
    1.97 +			QString preSelStr=model->getSelectString(seli);
    1.98  
    1.99  			copyingObj=false;	
   1.100  			if (dsti)