mapeditor.cpp
branchqt4-port
changeset 18 70c41284cb48
parent 17 557239819c45
child 19 caba269c3757
     1.1 --- a/mapeditor.cpp	Wed Aug 30 12:16:25 2006 +0000
     1.2 +++ b/mapeditor.cpp	Thu Aug 31 11:55:33 2006 +0000
     1.3 @@ -123,7 +123,6 @@
     1.4  extern QAction *actionSettingsAutoedit;
     1.5  extern QAction *actionSettingsAutoselectHeading;
     1.6  extern QAction *actionSettingsAutoselectText;
     1.7 -extern QAction *actionSettingsPasteNewHeading;
     1.8  extern QAction *actionSettingsUseFlagGroups;
     1.9  
    1.10  extern QMenu* branchContextMenu;
    1.11 @@ -184,14 +183,12 @@
    1.12  	linkcolorhint=DefaultColor;
    1.13  	linkstyle=StylePolyParabel;
    1.14  
    1.15 -	// Create bitmap cursors, patform dependant
    1.16 +	// Create bitmap cursors, platform dependant
    1.17  	#if defined(Q_OS_MACX)
    1.18 -		handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png") );		
    1.19 -		// set hot spot to tip of picker			
    1.20 +		handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png"),1,1 );		
    1.21  		pickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 ); 
    1.22  	#else
    1.23 -		handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen16.png"));		
    1.24 -		// set hot spot to tip of picker			
    1.25 +		handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1);		
    1.26  		pickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 ); 
    1.27  	#endif
    1.28  
    1.29 @@ -465,8 +462,8 @@
    1.30  {
    1.31  	// Save complete map, Undo will replace whole map
    1.32  	saveState (CompleteMap,
    1.33 -		NULL, "",
    1.34 -		NULL, "", 
    1.35 +		"", "",
    1.36 +		"", "", 
    1.37  		comment, 
    1.38  		mapCenter);
    1.39  }
    1.40 @@ -474,9 +471,12 @@
    1.41  void MapEditor::saveStatePart(LinkableMapObj *undoSel, const QString &comment)
    1.42  {
    1.43  	// save the selected part of the map, Undo will replace part of map 
    1.44 +	QString undoSelection="";
    1.45 +	if (undoSel) undoSelection=undoSel->getSelectString();
    1.46 +
    1.47  	saveState (PartOfMap,
    1.48 -		undoSel, "",
    1.49 -		NULL, "", 
    1.50 +		undoSelection, "",
    1.51 +		"", "", 
    1.52  		comment, 
    1.53  		undoSel);
    1.54  }
    1.55 @@ -486,33 +486,63 @@
    1.56  	// selection does not change during action,
    1.57  	// so just save commands for undo and redo
    1.58  	// and use current selection
    1.59 +
    1.60 +	QString sel;
    1.61 +	if (selection) sel=selection->getSelectString();
    1.62 +
    1.63  	saveState (UndoCommand,
    1.64 -		selection, uc,
    1.65 -		selection, rc, 
    1.66 +		sel, uc,
    1.67 +		sel, rc, 
    1.68  		comment, 
    1.69  		NULL);
    1.70  }
    1.71  
    1.72 -void MapEditor::saveStateX(LinkableMapObj *unsel, const QString &uc, const QString &comment) 
    1.73 +void MapEditor::saveStateComData(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel) 
    1.74  {
    1.75 -	// TODO Is this still needed?
    1.76 +	QString redoSelection="";
    1.77 +	if (redoSel) redoSelection=redoSel->getSelectString();
    1.78 +	QString undoSelection="";
    1.79 +	if (undoSel) undoSelection=undoSel->getSelectString();
    1.80 +
    1.81  	saveState (UndoCommand,
    1.82 -		unsel, uc,
    1.83 -		NULL, "FIXME-redoCom",	//FIXME
    1.84 +		undoSelection, uc,
    1.85 +		redoSelection, "FIXME-redoCom",	//FIXME
    1.86 +		comment, 
    1.87 +		saveSel);
    1.88 +}
    1.89 +
    1.90 +void MapEditor::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment) 
    1.91 +{
    1.92 +	// "Normal" savestate: save commands, selections and comment
    1.93 +	// so just save commands for undo and redo
    1.94 +	// and use current selection
    1.95 +
    1.96 +	QString redoSelection="";
    1.97 +	if (redoSel) redoSelection=redoSel->getSelectString();
    1.98 +	QString undoSelection="";
    1.99 +	if (undoSel) undoSelection=undoSel->getSelectString();
   1.100 +
   1.101 +	saveState (UndoCommand,
   1.102 +		undoSelection, uc,
   1.103 +		redoSelection, rc, 
   1.104  		comment, 
   1.105  		NULL);
   1.106  }
   1.107  
   1.108 -void MapEditor::saveStateComData(LinkableMapObj *unSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel) 
   1.109 +void MapEditor::saveState(const QString &undoSel, const QString &uc, const QString &redoSel, const QString &rc, const QString &comment) 
   1.110  {
   1.111 +	// "Normal" savestate: save commands, selections and comment
   1.112 +	// so just save commands for undo and redo
   1.113 +	// and use current selection
   1.114  	saveState (UndoCommand,
   1.115 -		unSel, uc,
   1.116 -		NULL, "FIXME-redoCom",	//FIXME
   1.117 +		undoSel, uc,
   1.118 +		redoSel, rc, 
   1.119  		comment, 
   1.120 -		saveSel);
   1.121 +		NULL);
   1.122  }
   1.123  
   1.124 -void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom, LinkableMapObj *redoSel, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
   1.125 +		
   1.126 +void MapEditor::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
   1.127  {
   1.128  	// Main saveState
   1.129  
   1.130 @@ -541,16 +571,6 @@
   1.131  	if (!d.exists()) 
   1.132  		makeSubDirs (bakMapDir);
   1.133  
   1.134 -	// Save current selection 
   1.135 -	QString redoSelection="";
   1.136 -	if (redoSel)
   1.137 -		redoSelection=redoSel->getSelectString();
   1.138 -
   1.139 -	// Save the object, which should be undone
   1.140 -	QString undoSelection="";
   1.141 -	if (undoSel)
   1.142 -		undoSelection=undoSel->getSelectString();
   1.143 -		
   1.144  	// Save depending on how much needs to be saved	
   1.145  	if (!saveSel)
   1.146  		backupXML="";
   1.147 @@ -562,7 +582,7 @@
   1.148  	{
   1.149  		undoCommand=undoCom;
   1.150  	}	
   1.151 -	else if (savemode==PartOfMap && undoSel)
   1.152 +	else if (savemode==PartOfMap )
   1.153  	{
   1.154  		undoCommand="undoPart (\""+ undoSelection+"\",\""+bakMapPath+"\")";
   1.155  	} else
   1.156 @@ -630,10 +650,15 @@
   1.157  		if (api.checkParamCount(1) && selection )
   1.158  		{	
   1.159  			s=api.parString(ok,0);
   1.160 -			if (ok)
   1.161 -			{
   1.162 -				if (select (s)) deleteSelection();
   1.163 -			}
   1.164 +			if (ok &&select (s)) deleteSelection();
   1.165 +		}	
   1.166 +	}	
   1.167 +	else if (com=="addBranch")
   1.168 +	{
   1.169 +		if (api.checkParamCount(1) && selection )
   1.170 +		{	
   1.171 +			y=api.parInt (ok,0);
   1.172 +			if (ok ) addNewBranchInt (y);
   1.173  		}	
   1.174  	}	
   1.175  	else if (com=="linkBranchToPos")
   1.176 @@ -642,6 +667,9 @@
   1.177  		{
   1.178  			if (api.checkParamCount(4))
   1.179  			{
   1.180 +				// 0	selectstring of parent
   1.181 +				// 1	num in parent (for branches)
   1.182 +				// 2,3	x,y of mainbranch or mapcenter
   1.183  				s=api.parString(ok,0);
   1.184  				LinkableMapObj *dst=mapCenter->findObjBySelect (s);
   1.185  				if (dst)
   1.186 @@ -696,7 +724,12 @@
   1.187  			if (api.checkParamCount(1) )
   1.188  			{	
   1.189  				s=api.parString(ok,0);
   1.190 -				if (ok) ((BranchObj*)selection)->activateStandardFlag(s);
   1.191 +				if (ok) 
   1.192 +				{
   1.193 +					BranchObj* bo=(BranchObj*)selection;
   1.194 +					bo->activateStandardFlag(s);
   1.195 +					bo->updateFlagsToolbar();
   1.196 +				}	
   1.197  			}	
   1.198  		}
   1.199  	}	
   1.200 @@ -707,7 +740,12 @@
   1.201  			if (api.checkParamCount(1) )
   1.202  			{	
   1.203  				s=api.parString(ok,0);
   1.204 -				if (ok) ((BranchObj*)selection)->deactivateStandardFlag(s);
   1.205 +				if (ok) 
   1.206 +				{
   1.207 +					BranchObj* bo=(BranchObj*)selection;
   1.208 +					bo->deactivateStandardFlag(s);
   1.209 +					bo->updateFlagsToolbar();
   1.210 +				}	
   1.211  			}	
   1.212  		}
   1.213  	}	
   1.214 @@ -1286,12 +1324,17 @@
   1.215  	parseAtom (redoCommand);
   1.216  	mapCenter->reposition();
   1.217  
   1.218 -	//if (!redoSelection.isEmpty())
   1.219 -	//	select (redoSelection);
   1.220 -
   1.221  	blockSaveState=false;
   1.222 -/* TODO remove testing
   1.223 -*/	
   1.224 +
   1.225 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
   1.226 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
   1.227 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
   1.228 +	undoSet.writeSettings(histPath);
   1.229 +
   1.230 +	updateActions();
   1.231 +
   1.232 +	/* TODO remove testing
   1.233 +*/
   1.234  	cout << "ME::redo() end\n";
   1.235  	cout << "    undosAvail="<<undosAvail<<endl;
   1.236  	cout << "    redosAvail="<<redosAvail<<endl;
   1.237 @@ -1299,12 +1342,6 @@
   1.238  	cout << "    ---------------------------"<<endl<<endl;
   1.239  
   1.240  
   1.241 -	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
   1.242 -	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
   1.243 -	undoSet.setEntry ("/history/curStep",QString::number(curStep));
   1.244 -	undoSet.writeSettings(histPath);
   1.245 -
   1.246 -	updateActions();
   1.247  }
   1.248  
   1.249  void MapEditor::undo()
   1.250 @@ -1344,16 +1381,9 @@
   1.251  	parseAtom (undoCommand);
   1.252  	mapCenter->reposition();
   1.253  
   1.254 -	//if (!redoSelection.isEmpty())
   1.255 -	//	select (redoSelection);
   1.256 -
   1.257 -	
   1.258  	undosAvail--;
   1.259 -	if (undosAvail<1)
   1.260 -		// Undo not longer available now
   1.261 -		actionEditUndo->setEnabled (false);
   1.262 -	else	
   1.263 -		curStep--; if (curStep<1) curStep=undosTotal;
   1.264 +	curStep--; 
   1.265 +	if (curStep<1) curStep=undosTotal;
   1.266  
   1.267  	redosAvail++;
   1.268  
   1.269 @@ -1367,7 +1397,7 @@
   1.270  	cout << "    ---------------------------"<<endl<<endl;
   1.271  
   1.272  	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
   1.273 -	undoSet.setEntry ("/history/redosAvail",QString::number(undosAvail));
   1.274 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
   1.275  	undoSet.setEntry ("/history/curStep",QString::number(curStep));
   1.276  	undoSet.writeSettings(histPath);
   1.277  
   1.278 @@ -1470,9 +1500,9 @@
   1.279  		if (!bo->canMoveBranchUp()) return;
   1.280  		par=(BranchObj*)(bo->getParObj());
   1.281  		selection->unselect();
   1.282 -		selection=par->moveBranchUp (bo);
   1.283 +		bo=par->moveBranchUp (bo);	// bo will be the one below selection
   1.284  		selection->select();
   1.285 -		saveStateX(bo,"moveBranchDown ()",QString("Move up %1").arg(getName(bo)));
   1.286 +		saveState (selection,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
   1.287  		mapCenter->reposition();
   1.288  		ensureSelectionVisible();
   1.289  	}
   1.290 @@ -1488,9 +1518,9 @@
   1.291  		if (!bo->canMoveBranchDown()) return;
   1.292  		par=(BranchObj*)(bo->getParObj());
   1.293  		selection->unselect(); 
   1.294 -		selection=par->moveBranchDown(bo);
   1.295 +		bo=par->moveBranchDown(bo);	// bo will be the one above selection
   1.296  		selection->select();
   1.297 -		saveStateX(bo,"moveBranchUp ()",QString("Move down %1").arg(getName(bo)));
   1.298 +		saveState(selection,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
   1.299  		mapCenter->reposition();
   1.300  		ensureSelectionVisible();
   1.301  	}	
   1.302 @@ -1573,68 +1603,84 @@
   1.303  	}
   1.304  }
   1.305  
   1.306 -void MapEditor::addNewBranch(int pos)
   1.307 +BranchObj* MapEditor::addNewBranchInt(int num)
   1.308  {
   1.309 +	// Depending on pos:
   1.310 +	// -3		insert in childs of parent  above selection 
   1.311 +	// -2		add branch to selection 
   1.312 +	// -1		insert in childs of parent below selection 
   1.313 +	// 0..n		insert in childs of parent at pos
   1.314 +	BranchObj *newbo=NULL;
   1.315  	if (selection  &&  
   1.316  		 (typeid(*selection) == typeid(BranchObj) || 
   1.317  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   1.318  	{
   1.319 -		BranchObj* bo1 = (BranchObj*) selection;
   1.320 -
   1.321 -		bool wasScrolled=false;
   1.322 -		BranchObj *newbo=NULL;
   1.323 -		if (pos==0)
   1.324 +		BranchObj* bo = (BranchObj*) selection;
   1.325 +		if (num==-2)
   1.326  		{
   1.327  			// save scroll state. If scrolled, automatically select
   1.328  			// new branch in order to tmp unscroll parent...
   1.329 -			wasScrolled=bo1->isScrolled();
   1.330 -			newbo=bo1->addBranch();
   1.331 -		}	else 
   1.332 +			return bo->addBranch();
   1.333 +			
   1.334 +		}else if (num==-1)
   1.335  		{
   1.336 -			BranchObj *parbo=(BranchObj*)(selection->getParObj());
   1.337 -			if (parbo)
   1.338 -			{
   1.339 -				if (pos<0)
   1.340 -					// add above selection
   1.341 -					newbo=parbo->insertBranch(bo1->getNum());
   1.342 -				else
   1.343 -					// add below selection
   1.344 -					newbo=parbo->insertBranch(bo1->getNum()+1);
   1.345 -			} else
   1.346 -				// This should not happen...
   1.347 -				// ...but it happens if CTRL-A is pressed on MCO,
   1.348 -				// ignore it then
   1.349 -				return;
   1.350 -		}	
   1.351 -		saveStateX(selection,QString ("delete (\"%1\")").arg(newbo->getSelectString()),QString("Add new branch to %1").arg(getName(bo1)));	//TODO undoCommand
   1.352 -
   1.353 -		LinkableMapObj *oldselection=selection;
   1.354 -
   1.355 -		mapCenter->reposition();
   1.356 -		adjustCanvasSize();
   1.357 -
   1.358 -
   1.359 -		if (actionSettingsAutoedit->isOn() ||
   1.360 -			actionSettingsAutoselectHeading->isOn() )
   1.361 +			num=bo->getNum()+1;
   1.362 +			bo=(BranchObj*)bo->getParObj();
   1.363 +		}else if (num==-3)
   1.364  		{
   1.365 -			selection->unselect();
   1.366 -			selection=newbo;
   1.367 -			selection->select();
   1.368 -			if (actionSettingsPasteNewHeading->isOn() )
   1.369 -			{
   1.370 -				BranchObj *bo2= (BranchObj*)selection;
   1.371 -				bo2->setHeading("");
   1.372 -			}	
   1.373 -			if (actionSettingsAutoedit->isOn() )
   1.374 -				mainWindow->editHeading();
   1.375 -			if (!actionSettingsAutoselectHeading->isOn()
   1.376 -				&& !wasScrolled)
   1.377 +			num=bo->getNum();
   1.378 +			bo=(BranchObj*)bo->getParObj();
   1.379 +		}
   1.380 +		if (!bo) return bo;
   1.381 +		newbo=bo->insertBranch(num);
   1.382 +	}	
   1.383 +	return newbo;
   1.384 +}	
   1.385 +
   1.386 +void MapEditor::addNewBranch(int pos)
   1.387 +{
   1.388 +	// Different meaning than num in addNewBranchInt!
   1.389 +	// -1	add above
   1.390 +	//  0	add as child
   1.391 +	// +1	add below
   1.392 +	if (selection  &&  
   1.393 +		 (typeid(*selection) == typeid(BranchObj) || 
   1.394 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   1.395 +	{
   1.396 +		BranchObj *bo = (BranchObj*) selection;
   1.397 +		BranchObj *newbo;
   1.398 +		newbo=addNewBranchInt (pos-2);
   1.399 +
   1.400 +		if (newbo)
   1.401 +		{
   1.402 +			saveStateConstSelection (
   1.403 +				QString ("delete (\"%1\")").arg(newbo->getSelectString()),
   1.404 +				QString ("addBranch (%1)").arg(pos-2),
   1.405 +				QString ("Add new branch to %1").arg(getName(bo)));	//TODO undoCommand
   1.406 +
   1.407 +			LinkableMapObj *oldselection=selection;
   1.408 +
   1.409 +			mapCenter->reposition();
   1.410 +			adjustCanvasSize();
   1.411 +
   1.412 +
   1.413 +			if (actionSettingsAutoedit->isOn() ||
   1.414 +				actionSettingsAutoselectHeading->isOn() )
   1.415  			{
   1.416  				selection->unselect();
   1.417 -				selection=oldselection;
   1.418 +				selection=newbo;
   1.419  				selection->select();
   1.420 -			}
   1.421 -		}	
   1.422 +				if (actionSettingsAutoedit->isOn() )
   1.423 +					mainWindow->editHeading();
   1.424 +				if (!actionSettingsAutoselectHeading->isOn()
   1.425 +					)//&& !wasScrolled)  //FIXME wasScrolled was moved to addNewBranchInt
   1.426 +				{
   1.427 +					selection->unselect();
   1.428 +					selection=oldselection;
   1.429 +					selection->select();
   1.430 +				}
   1.431 +			}	
   1.432 +		}
   1.433  	}	
   1.434  }
   1.435  
   1.436 @@ -1667,11 +1713,6 @@
   1.437  			selection->unselect();
   1.438  			selection=newbo;
   1.439  			selection->select();
   1.440 -			if (actionSettingsPasteNewHeading->isOn() )
   1.441 -			{
   1.442 -				BranchObj *bo2= (BranchObj*)selection;
   1.443 -				bo2->setHeading("");
   1.444 -			}	
   1.445  			if (actionSettingsAutoedit->isOn() )
   1.446  				mainWindow->editHeading();
   1.447  			if (!actionSettingsAutoselectHeading->isOn()
   1.448 @@ -1784,7 +1825,6 @@
   1.449  			
   1.450  		adjustCanvasSize();
   1.451  	}
   1.452 -
   1.453  }
   1.454  
   1.455  void MapEditor::selectNextBranchInt()
   1.456 @@ -3606,41 +3646,64 @@
   1.457  			// Reset the temporary drawn link to the original one
   1.458  			((LinkableMapObj*)selection)->unsetParObjTmp();
   1.459  
   1.460 +			// For Redo we may need to save original selection
   1.461 +			QString orgSel=selection->getSelectString();
   1.462  
   1.463  			copyingObj=false;	
   1.464  			if (dst ) 
   1.465  			{
   1.466 -				BranchObj* bs=((BranchObj*)selection);
   1.467 +				BranchObj* bsel=(BranchObj*)selection;
   1.468 +				BranchObj* bdst=(BranchObj*)dst;
   1.469 +
   1.470 +
   1.471  				QString undoCom="linkBranchToPos (\""+ 
   1.472 -					(bs->getParObj())->getSelectString()+
   1.473 +					(bsel->getParObj())->getSelectString()+
   1.474  					"\","+
   1.475 -					QString("%1").arg(bs->getNum())+
   1.476 +					QString("%1").arg(bsel->getNum())+
   1.477  					","+
   1.478  					QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+
   1.479  					")";
   1.480 -				// TODO we also could check, if dest and src are on same branch,
   1.481 -				// then it would be sufficient to saveState of this branch
   1.482  
   1.483  				// Modifiers allow to insert above/below dst
   1.484  				if (e->state() & Qt::ShiftModifier)
   1.485  				{
   1.486 -					bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum());
   1.487 +					bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum());
   1.488  				} else 
   1.489  				if (e->state() & Qt::ControlModifier)
   1.490  			{
   1.491 -					bs->moveBranchTo ( (BranchObj*)(dst->getParObj()), ((BranchObj*)(dst))->getNum()+1);
   1.492 +					bsel->moveBranchTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum()+1);
   1.493  				} else	
   1.494  				{
   1.495 -					bs->moveBranchTo ((BranchObj*)(dst),-1);
   1.496 +					bsel->moveBranchTo (bdst,-1);
   1.497  					if (dst->getDepth()==0) 
   1.498 -						bs->move (savePos);
   1.499 +						bsel->move (savePos);
   1.500  				} 
   1.501 -				saveStateConstSelection (undoCom,bs->getSelectString(),QString("Relink %1 to %2").arg(getName(bs)).arg(getName(dst)) );
   1.502 +				QString redoCom="linkBranchToPos (\""+ 
   1.503 +					((BranchObj*)(bsel->getParObj()))->getSelectString()+
   1.504 +					"\","+
   1.505 +					QString("%1").arg(bsel->getNum())+
   1.506 +					","+
   1.507 +					QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+
   1.508 +					")";
   1.509 +
   1.510 +				saveState (
   1.511 +					selection->getSelectString(),undoCom,
   1.512 +					orgSel,redoCom,
   1.513 +					QString("Relink %1 to %2").arg(getName(bsel)).arg(getName(dst)) );
   1.514  			} else
   1.515  				if (selection->getDepth()==1)
   1.516 -					// If we have moved mainbranch only save endposition
   1.517 -					saveStateConstSelection("move "+qpointToString(movingObj_orgPos), selection->getSelectString(), QString("Move %1 to %2").arg(getName(selection)).arg(qpointToString(movingObj_orgPos)));
   1.518 +				{
   1.519 +					// The select string might be different _after_ moving around.
   1.520 +					// Therefor reposition and then use string of old selection, too
   1.521 +					mapCenter->reposition();
   1.522 +
   1.523 +					QString ps=qpointToString ( ((BranchObj*)selection)->getAbsPos() );
   1.524 +					saveState(
   1.525 +						selection->getSelectString(), "move "+qpointToString(movingObj_orgPos), 
   1.526 +						orgSel, "move "+ps, 
   1.527 +						QString("Move %1 to %2").arg(getName(selection)).arg(ps));
   1.528  			
   1.529 +				}
   1.530  			// Draw the original link, before selection was moved around
   1.531  			mapCenter->reposition();
   1.532  		}