mapeditor.cpp
changeset 136 b0d8b00fb937
parent 131 16b250a57c17
child 139 087e60400acc
     1.1 --- a/mapeditor.cpp	Sat Jul 23 15:13:34 2005 +0000
     1.2 +++ b/mapeditor.cpp	Mon Jul 25 20:07:18 2005 +0000
     1.3 @@ -587,12 +587,25 @@
     1.4  
     1.5  void MapEditor::saveState(const QString & c)
     1.6  {
     1.7 -	saveState (UndoCommand,NULL,c);
     1.8 +	LinkableMapObj *undoSel;
     1.9 +	if (selection)
    1.10 +		undoSel=selection;
    1.11 +	else
    1.12 +		undoSel=NULL;
    1.13 +	saveState (UndoCommand,undoSel,c);
    1.14  }
    1.15  
    1.16  void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom)
    1.17  {
    1.18  	setChanged();
    1.19 +
    1.20 +	// Save what is selected now
    1.21 +	if (undoSel)
    1.22 +		undoSelection=undoSel->getSelectString();
    1.23 +	else
    1.24 +		undoSelection="";
    1.25 +		
    1.26 +	// Save depending on how much needs to be saved	
    1.27  	if (savemode==UndoCommand)
    1.28  	{
    1.29  		undoCommand=undoCom;
    1.30 @@ -600,7 +613,7 @@
    1.31  	}	
    1.32  	else if (savemode==PartOfMap && undoSel)
    1.33  	{
    1.34 -		undoCommand="undoPart (\""+undoSel->getSelectString()+"\")";
    1.35 +		undoCommand="undoPart (\""+undoSelection+"\")";
    1.36  		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),undoSel);
    1.37  	} else
    1.38  	{
    1.39 @@ -1284,6 +1297,10 @@
    1.40  	// Finish open lineEdits
    1.41  	if (lineedit) finishedLineEditNoSave();
    1.42  
    1.43 +	// select  object before undo
    1.44 +	if (!undoSelection.isEmpty())
    1.45 +		select (undoSelection);
    1.46 +
    1.47  	parseAtom (undoCommand);
    1.48  	mapCenter->reposition();
    1.49