mapeditor.cpp
changeset 130 30cd58b70d02
parent 129 9b9c7e8b9147
child 131 16b250a57c17
     1.1 --- a/mapeditor.cpp	Tue Jul 19 14:44:30 2005 +0000
     1.2 +++ b/mapeditor.cpp	Tue Jul 19 15:57:49 2005 +0000
     1.3 @@ -631,14 +631,13 @@
     1.4  	else if (com=="move")
     1.5  	{
     1.6  		if (api.checkParamCount(2) &&
     1.7 -			selection && 
     1.8 -			typeid(*selection) == typeid(BranchObj) ) 
     1.9 +			selection )
    1.10  		{	
    1.11  			x=api.parInt (ok,0);
    1.12  			if (ok)
    1.13  			{
    1.14  				y=api.parInt (ok,1);
    1.15 -				if (ok) ((BranchObj*)(selection))->move (x,y);
    1.16 +				if (ok) move (x,y);
    1.17  			}
    1.18  		}	
    1.19  	}
    1.20 @@ -1432,6 +1431,14 @@
    1.21  	adjustCanvasSize();
    1.22  }
    1.23  
    1.24 +void MapEditor::move(const int &x, const int &y)
    1.25 +{
    1.26 +	// FIXME  no saveState, because this is only internal at undo so far
    1.27 +	if (selection) selection->move(x,y);
    1.28 +	if (typeid(*selection) == typeid(FloatImageObj))
    1.29 +		((FloatImageObj*)(selection))->setRelPos();
    1.30 +}
    1.31 +
    1.32  void MapEditor::moveBranchUp()
    1.33  {
    1.34  	// Finish open lineEdits
    1.35 @@ -1474,21 +1481,6 @@
    1.36  	}	
    1.37  }
    1.38  
    1.39 -void MapEditor::linkBranchToPos (LinkableMapObj *dst, const int &pos, const QPoint &p)
    1.40 -{
    1.41 -	// FIXME  no saveState, because this is only internal at undo so far
    1.42 -	if (selection && typeid(*selection) == typeid(BranchObj) ) 
    1.43 -	{
    1.44 -		if (dst  &&  typeid(*dst) == typeid(BranchObj) ) 
    1.45 -			((BranchObj*)(selection))->moveBranchTo ((BranchObj*)(dst),-1);
    1.46 -		if (dst  &&  typeid(*dst) == typeid(MapCenterObj) ) 
    1.47 -		{
    1.48 -			((BranchObj*)(selection))->moveBranchTo ((BranchObj*)(dst),-1);
    1.49 -			((BranchObj*)(selection))->move (p);
    1.50 -		}	
    1.51 -	}
    1.52 -}
    1.53 -
    1.54  void MapEditor::editHeading()
    1.55  {
    1.56  	// Finish open lineEdits
    1.57 @@ -2943,8 +2935,6 @@
    1.58  	}
    1.59  }
    1.60  
    1.61 -#include "api.h"
    1.62 -
    1.63  void MapEditor::testFunction()
    1.64  {
    1.65  	cout << "MapEditor::testFunction() called\n";
    1.66 @@ -3174,7 +3164,7 @@
    1.67  		if (typeid(*selection) == typeid(FloatImageObj))
    1.68  		{
    1.69  			setChanged();
    1.70 -			saveState();
    1.71 +			saveState("move "+qpointToString(movingObj_orgPos));
    1.72  			FloatObj *fo=(FloatObj*)(selection);
    1.73  			if (fo->getLinkStyle()==StyleUndef) 
    1.74  			{
    1.75 @@ -3396,7 +3386,6 @@
    1.76  					bs->moveBranchTo ((BranchObj*)(dst),-1);
    1.77  					if (dst->getDepth()==0) 
    1.78  						bs->move (savePos);
    1.79 -						cout << "ME::release  start was: "<<movingObj_orgPos<<endl;
    1.80  				} 
    1.81  			}	
    1.82  			// Draw the original link, before selection was moved around