minor bugfixes
authorinsilmaril
Thu, 17 May 2007 20:19:03 +0000
changeset 491c58b3973337c
parent 490 a6499713d8ae
child 492 cf60b90369a4
minor bugfixes
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
     1.1 --- a/main.cpp	Thu May 17 20:19:03 2007 +0000
     1.2 +++ b/main.cpp	Thu May 17 20:19:03 2007 +0000
     1.3 @@ -17,6 +17,7 @@
     1.4  Main *mainWindow;				// used in BranchObj::select()								
     1.5  QString tmpVymDir;				// All temp files go there, created in mainwindow
     1.6  QString clipboardDir;			// Clipboard used in all mapEditors
     1.7 +QString clipboardFile;			// Clipboard used in all mapEditors
     1.8  QDir vymBaseDir;				// Containing all styles, scripts, images, ...
     1.9  QDir lastImageDir;
    1.10  QDir lastFileDir;
     2.1 --- a/mainwindow.cpp	Thu May 17 20:19:03 2007 +0000
     2.2 +++ b/mainwindow.cpp	Thu May 17 20:19:03 2007 +0000
     2.3 @@ -25,6 +25,7 @@
     2.4  extern Main *mainWindow;
     2.5  extern QString tmpVymDir;
     2.6  extern QString clipboardDir;
     2.7 +extern QString clipboardFile;
     2.8  extern bool clipboardEmpty;
     2.9  extern int statusbarTime;
    2.10  extern FlagRowObj* standardFlagsDefault;
    2.11 @@ -85,6 +86,7 @@
    2.12  
    2.13  	// Create direcctory for clipboard
    2.14  	clipboardDir=tmpVymDir+"/clipboard";
    2.15 +	clipboardFile="part";
    2.16  	QDir d(clipboardDir);
    2.17  	d.mkdir (clipboardDir,true);
    2.18  	makeSubDirs (clipboardDir);
    2.19 @@ -197,6 +199,7 @@
    2.20  	settings.setValue( "/version/version", vymVersion );
    2.21  	settings.setValue( "/version/builddate", vymBuildDate );
    2.22  
    2.23 +	settings.setValue( "/mapeditor/autosave/use",actionSettingsAutosaveToggle->isOn() );
    2.24  	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoSelectHeading->isOn() );
    2.25  	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
    2.26  	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoEdit->isOn() );
    2.27 @@ -252,13 +255,19 @@
    2.28  	tb->setObjectName ("mapTB");
    2.29  
    2.30      QAction *a;
    2.31 -    a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New...","File menu" ),this);
    2.32 +    a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New map","File menu" ),this);
    2.33  	a->setStatusTip ( tr( "New map","Status tip File menu" ) );
    2.34  	a->setShortcut ( Qt::CTRL + Qt::Key_N );		//New map
    2.35      a->addTo( tb );
    2.36  	fileMenu->addAction (a);
    2.37      connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
    2.38  	
    2.39 +    a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&Copy to new map","File menu" ),this);
    2.40 +	a->setStatusTip ( tr( "Copy selection to mapcenter of a new map","Status tip File menu" ) );
    2.41 +	a->setShortcut ( Qt::CTRL +Qt::SHIFT + Qt::Key_N );		//New map
    2.42 +	fileMenu->addAction (a);
    2.43 +    connect( a, SIGNAL( triggered() ), this, SLOT( fileNewCopy() ) );
    2.44 +	
    2.45      a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ,"File menu"),this);
    2.46  	a->setStatusTip (tr( "Open","Status tip File menu" ) );
    2.47  	a->setShortcut ( Qt::CTRL + Qt::Key_O );		//Open map
    2.48 @@ -1629,7 +1638,7 @@
    2.49  
    2.50  void Main::showEvent (QShowEvent * )
    2.51  {
    2.52 -	//FIXME if (textEditor->showWithMain()) textEditor->showNormal();
    2.53 +	if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal();
    2.54  }
    2.55  
    2.56  bool Main::reallyWriteDirectory(const QString &dir)
    2.57 @@ -1715,6 +1724,29 @@
    2.58  	me->select("mc:");
    2.59  }
    2.60  
    2.61 +void Main::fileNewCopy()
    2.62 +{
    2.63 +	QString fn="unnamed";
    2.64 +	MapEditor* oldME =currentMapEditor();
    2.65 +	if (oldME)
    2.66 +	{
    2.67 +		oldME->copy();
    2.68 +		MapEditor* newME = new MapEditor ( NULL);
    2.69 +		if (newME)
    2.70 +		{
    2.71 +			tabWidget->addTab (newME,fn);
    2.72 +			tabWidget->showPage(newME);
    2.73 +			newME->viewport()->setFocus();
    2.74 +			newME->setAntiAlias (actionViewToggleAntiAlias->isOn());
    2.75 +			newME->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
    2.76 +			// For the very first map we do not have flagrows yet...
    2.77 +			newME->select("mc:");
    2.78 +			newME->load (clipboardDir+"/"+clipboardFile,ImportReplace);
    2.79 +		}
    2.80 +
    2.81 +	}
    2.82 +}
    2.83 +
    2.84  ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode)
    2.85  {
    2.86  	ErrorCode err=success;
    2.87 @@ -2698,6 +2730,7 @@
    2.88  	MapEditor *me=currentMapEditor();
    2.89  	if (me)
    2.90  	{
    2.91 +		me->setStateEditHeading (false);
    2.92  		QPoint p;	//Not used here, only to find out pos of branch
    2.93  		bool ok;
    2.94  		QString s=me->getHeading(ok,p);
    2.95 @@ -2733,6 +2766,7 @@
    2.96  
    2.97  			if (ok)
    2.98  			{
    2.99 +				me->setStateEditHeading (true);
   2.100  #if defined(Q_OS_MACX)
   2.101  				p=currentMapEditor()->mapTo (this,p);
   2.102  				QDialog *d =new QDialog(NULL);
   2.103 @@ -3346,7 +3380,7 @@
   2.104  	MapEditor *me=currentMapEditor();
   2.105  	if (!me) return;
   2.106  
   2.107 -	historyWindow->setCaption (vymName + " - " +tr("History for %1").arg(currentMapEditor()->getFileName(),"Window Caption"));
   2.108 +	historyWindow->setCaption (vymName + " - " +tr("History for %1","Window Caption").arg(currentMapEditor()->getFileName()));
   2.109  
   2.110  	// updateActions is also called when NoteEditor is closed
   2.111  	actionViewToggleNoteEditor->setOn (textEditor->isVisible());
     3.1 --- a/mainwindow.h	Thu May 17 20:19:03 2007 +0000
     3.2 +++ b/mainwindow.h	Thu May 17 20:19:03 2007 +0000
     3.3 @@ -32,6 +32,7 @@
     3.4  
     3.5  public slots:
     3.6      void fileNew();
     3.7 +    void fileNewCopy();
     3.8  
     3.9  protected:
    3.10  	void closeEvent( QCloseEvent* );
     4.1 --- a/mapeditor.cpp	Thu May 17 20:19:03 2007 +0000
     4.2 +++ b/mapeditor.cpp	Thu May 17 20:19:03 2007 +0000
     4.3 @@ -26,6 +26,7 @@
     4.4  extern Main *mainWindow;
     4.5  extern QString tmpVymDir;
     4.6  extern QString clipboardDir;
     4.7 +extern QString clipboardFile;
     4.8  extern bool clipboardEmpty;
     4.9  extern bool debug;
    4.10  extern FlagRowObj *standardFlagsDefault;
    4.11 @@ -115,6 +116,7 @@
    4.12  
    4.13  	stepsTotal=settings.readNumEntry("/mapeditor/stepsTotal",100);
    4.14  	undoSet.setEntry ("/history/stepsTotal",QString::number(stepsTotal));
    4.15 +	mainWindow->updateHistory (undoSet);
    4.16  	
    4.17  	// Initialize find routine
    4.18  	itFind=NULL;				
    4.19 @@ -160,6 +162,21 @@
    4.20      return mapScene;
    4.21  }
    4.22  
    4.23 +MapEditor::State MapEditor::getState()
    4.24 +{
    4.25 +    return state;
    4.26 +}
    4.27 +
    4.28 +void MapEditor::setStateEditHeading(bool s)
    4.29 +{
    4.30 +	if (s)
    4.31 +	{
    4.32 +		if (state==Idle) state=EditHeading;
    4.33 +	}
    4.34 +	else	
    4.35 +		state=Idle;
    4.36 +}
    4.37 +
    4.38  bool MapEditor::isRepositionBlocked()
    4.39  {
    4.40  	return blockReposition;
    4.41 @@ -170,6 +187,14 @@
    4.42  	blockSaveState=b;
    4.43  }
    4.44  
    4.45 +bool MapEditor::isSelectBlocked()
    4.46 +{
    4.47 +	if (state==EditHeading)
    4.48 +		return true;
    4.49 +	else
    4.50 +		return false; 
    4.51 +}
    4.52 +
    4.53  QString MapEditor::getName (const LinkableMapObj *lmo)
    4.54  {
    4.55  	QString s;
    4.56 @@ -287,8 +312,6 @@
    4.57  
    4.58  	if (blockSaveState) return;
    4.59  
    4.60 -	/* TODO remove after testing
    4.61 -	*/
    4.62  	if (debug) cout << "ME::saveState() for  "<<mapName.ascii()<<endl;
    4.63  	
    4.64  	int undosAvail=undoSet.readNumEntry ("/history/undosAvail",0);
    4.65 @@ -569,9 +592,9 @@
    4.66  		if (xelection.isEmpty())
    4.67  		{
    4.68  			parser.setError (Aborted,"Nothing selected");
    4.69 -		} else if ( xelection.type()!=Branch  && 
    4.70 -					xelection.type()!=MapCenter  &&
    4.71 -					xelection.type()!=FloatImage )
    4.72 +		} else if ( xelection.type()!=Selection::Branch  && 
    4.73 +					xelection.type()!=Selection::MapCenter  &&
    4.74 +					xelection.type()!=Selection::FloatImage )
    4.75  		{				  
    4.76  			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
    4.77  		} else if (parser.checkParamCount(0))
    4.78 @@ -583,7 +606,7 @@
    4.79  		if (xelection.isEmpty())
    4.80  		{
    4.81  			parser.setError (Aborted,"Nothing selected");
    4.82 -		} else if (xelection.type() != Branch && xelection.type() != FloatImage )
    4.83 +		} else if (xelection.type() != Selection::Branch && xelection.type() != Selection::FloatImage )
    4.84  		{
    4.85  			parser.setError (Aborted,"Type of selection is wrong.");
    4.86  		} else if (parser.checkParamCount(0))
    4.87 @@ -614,6 +637,19 @@
    4.88  		{	
    4.89  			deleteChilds();
    4.90  		}	
    4.91 +	} else if (com=="importDir")
    4.92 +	{
    4.93 +		if (xelection.isEmpty())
    4.94 +		{
    4.95 +			parser.setError (Aborted,"Nothing selected");
    4.96 +		} else if (! selb )
    4.97 +		{				  
    4.98 +			parser.setError (Aborted,"Type of selection is not a branch");
    4.99 +		} else if (parser.checkParamCount(1))
   4.100 +		{
   4.101 +			s=parser.parString(ok,0);
   4.102 +			if (ok) importDirInt(s);
   4.103 +		}	
   4.104  	} else if (com=="linkTo")
   4.105  	{
   4.106  		if (xelection.isEmpty())
   4.107 @@ -649,7 +685,7 @@
   4.108  					}	
   4.109  				}	
   4.110  			}	
   4.111 -		} else if ( xelection.type() == FloatImage) 
   4.112 +		} else if ( xelection.type() == Selection::FloatImage) 
   4.113  		{
   4.114  			if (parser.checkParamCount(1))
   4.115  			{
   4.116 @@ -708,9 +744,9 @@
   4.117  		if (xelection.isEmpty() )
   4.118  		{
   4.119  			parser.setError (Aborted,"Nothing selected");
   4.120 -		} else if ( xelection.type()!=Branch  && 
   4.121 -					xelection.type()!=MapCenter  &&
   4.122 -					xelection.type()!=FloatImage )
   4.123 +		} else if ( xelection.type()!=Selection::Branch  && 
   4.124 +					xelection.type()!=Selection::MapCenter  &&
   4.125 +					xelection.type()!=Selection::FloatImage )
   4.126  		{				  
   4.127  			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
   4.128  		} else if (parser.checkParamCount(2))
   4.129 @@ -727,9 +763,9 @@
   4.130  		if (xelection.isEmpty() )
   4.131  		{
   4.132  			parser.setError (Aborted,"Nothing selected");
   4.133 -		} else if ( xelection.type()!=Branch  && 
   4.134 -					xelection.type()!=MapCenter  &&
   4.135 -					xelection.type()!=FloatImage )
   4.136 +		} else if ( xelection.type()!=Selection::Selection::Branch  && 
   4.137 +					xelection.type()!=Selection::Selection::MapCenter  &&
   4.138 +					xelection.type()!=Selection::Selection::FloatImage )
   4.139  		{				  
   4.140  			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
   4.141  		} else if (parser.checkParamCount(2))
   4.142 @@ -822,7 +858,7 @@
   4.143  		}	
   4.144  	} else if (com=="setFrameType")
   4.145  	{
   4.146 -		if ( xelection.type()!=Branch && xelection.type()!= MapCenter && xelection.type()!=FloatImage)
   4.147 +		if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
   4.148  		{
   4.149  			parser.setError (Aborted,"Type of selection does not allow setting frame type");
   4.150  		}
   4.151 @@ -833,7 +869,7 @@
   4.152  		}	
   4.153  	} else if (com=="setFramePenColor")
   4.154  	{
   4.155 -		if ( xelection.type()!=Branch && xelection.type()!= MapCenter && xelection.type()!=FloatImage)
   4.156 +		if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
   4.157  		{
   4.158  			parser.setError (Aborted,"Type of selection does not allow setting of pen color");
   4.159  		}
   4.160 @@ -844,7 +880,7 @@
   4.161  		}	
   4.162  	} else if (com=="setFrameBrushColor")
   4.163  	{
   4.164 -		if ( xelection.type()!=Branch && xelection.type()!= MapCenter && xelection.type()!=FloatImage)
   4.165 +		if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
   4.166  		{
   4.167  			parser.setError (Aborted,"Type of selection does not allow setting brush color");
   4.168  		}
   4.169 @@ -855,7 +891,7 @@
   4.170  		}	
   4.171  	} else if (com=="setFramePadding")
   4.172  	{
   4.173 -		if ( xelection.type()!=Branch && xelection.type()!= MapCenter && xelection.type()!=FloatImage)
   4.174 +		if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
   4.175  		{
   4.176  			parser.setError (Aborted,"Type of selection does not allow setting frame padding");
   4.177  		}
   4.178 @@ -866,7 +902,7 @@
   4.179  		}	
   4.180  	} else if (com=="setFrameBorderWidth")
   4.181  	{
   4.182 -		if ( xelection.type()!=Branch && xelection.type()!= MapCenter && xelection.type()!=FloatImage)
   4.183 +		if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
   4.184  		{
   4.185  			parser.setError (Aborted,"Type of selection does not allow setting frame border width");
   4.186  		}
   4.187 @@ -941,7 +977,7 @@
   4.188  		if (xelection.isEmpty() )
   4.189  		{
   4.190  			parser.setError (Aborted,"Nothing selected");
   4.191 -		} else if (xelection.type()!=Branch && xelection.type() != MapCenter &&xelection.type()!=FloatImage)
   4.192 +		} else if (xelection.type()!=Selection::Branch && xelection.type() != Selection::MapCenter &&xelection.type()!=Selection::FloatImage)
   4.193  		{				  
   4.194  			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
   4.195  		} else if (parser.checkParamCount(1))
   4.196 @@ -975,6 +1011,19 @@
   4.197  			b=parser.parBool(ok,0);
   4.198  			if (ok) setIncludeImagesVer(b);
   4.199  		}
   4.200 +	} else if (com=="setHideLinkUnselected")
   4.201 +	{
   4.202 +		if (xelection.isEmpty() )
   4.203 +		{
   4.204 +			parser.setError (Aborted,"Nothing selected");
   4.205 +		} else if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
   4.206 +		{				  
   4.207 +			parser.setError (Aborted,"Type of selection does not allow hiding the link");
   4.208 +		} else if (parser.checkParamCount(1))
   4.209 +		{
   4.210 +			b=parser.parBool(ok,0);
   4.211 +			if (ok) setHideLinkUnselected(b);
   4.212 +		}
   4.213  	} else if (com=="setSelectionColor")
   4.214  	{
   4.215  		if (parser.checkParamCount(1))
   4.216 @@ -993,7 +1042,7 @@
   4.217  		} else if (parser.checkParamCount(1))
   4.218  		{
   4.219  			s=parser.parString (ok,0);
   4.220 -			if (ok) setURLInt(s);
   4.221 +			if (ok) setURL(s);
   4.222  		}	
   4.223  	} else if (com=="setVymLink")
   4.224  	{
   4.225 @@ -1307,8 +1356,13 @@
   4.226  	if (savemode==CompleteMap || xelection.isEmpty())
   4.227  		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),NULL);
   4.228  	else	
   4.229 -		//save () FIXME check FIO
   4.230 -		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),xelection.getBranch());	
   4.231 +	{
   4.232 +		// TODO take care of multiselections
   4.233 +		if (xelection.type()==Selection::FloatImage)
   4.234 +			saveFloatImage();
   4.235 +		else	
   4.236 +			saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),xelection.getBranch());	
   4.237 +	}	
   4.238  
   4.239  	if (!saveStringToDisk(fileDir+fname,saveFile))
   4.240  		return 1;
   4.241 @@ -1556,11 +1610,10 @@
   4.242  	if (sel)
   4.243  	{
   4.244  		// write to directory
   4.245 -		QString clipfile="part";
   4.246 -		QString saveFile=saveToDir (fileDir,clipfile+"-",true,QPointF(),sel ); // FIXME check FIO
   4.247 +		QString saveFile=saveToDir (fileDir,clipboardFile+"-",true,QPointF(),sel ); // FIXME check FIO
   4.248  		QFile file;
   4.249  
   4.250 -		file.setName ( clipboardDir + "/"+clipfile+".xml");
   4.251 +		file.setName ( clipboardDir + "/"+clipboardFile);
   4.252  		if ( !file.open( QIODevice::WriteOnly ) )
   4.253  		{
   4.254  			// This should neverever happen
   4.255 @@ -1761,7 +1814,11 @@
   4.256  	}	
   4.257  	// Clicking below current step makes us redo things
   4.258  	if (i>undosAvail) 
   4.259 -		for (int j=undosAvail; j<i; j++) redo();
   4.260 +		for (int j=undosAvail; j<i; j++) 
   4.261 +		{
   4.262 +		cout << "redo "<<j<<"/"<<undosAvail<<" i="<<i<<endl;
   4.263 +		redo();
   4.264 +		}
   4.265  
   4.266  	// And ignore clicking the current row ;-)	
   4.267  }
   4.268 @@ -1843,13 +1900,10 @@
   4.269  
   4.270  void MapEditor::pasteNoSave()
   4.271  {
   4.272 -	load (clipboardDir+"/part.xml",ImportAdd);
   4.273 -}
   4.274 -
   4.275 -void MapEditor::cutNoSave()
   4.276 -{
   4.277 -	copy();
   4.278 -	deleteSelection();
   4.279 +	bool old=blockSaveState;
   4.280 +	blockSaveState=true;
   4.281 +	load (clipboardDir+"/"+clipboardFile,ImportAdd);
   4.282 +	blockSaveState=old;
   4.283  }
   4.284  
   4.285  void MapEditor::paste()		// FIXME no pasting of FIO ???
   4.286 @@ -1857,13 +1911,13 @@
   4.287  	BranchObj *sel=xelection.getBranch();
   4.288  	if (sel)
   4.289  	{
   4.290 -		pasteNoSave();
   4.291  		saveStateChangingPart(
   4.292  			sel,
   4.293  			sel,
   4.294  			"paste ()",
   4.295  			QString("Paste to %1").arg( getName(sel))
   4.296  		);
   4.297 +		pasteNoSave();
   4.298  		mapCenter->reposition();
   4.299  	}
   4.300  }
   4.301 @@ -1871,18 +1925,20 @@
   4.302  void MapEditor::cut()
   4.303  {
   4.304  	LinkableMapObj *sel=xelection.single();
   4.305 -	if ( sel && (xelection.type() == Branch ||
   4.306 -		xelection.type()==MapCenter ||
   4.307 -		xelection.type()==FloatImage))
   4.308 +	if ( sel && (xelection.type() == Selection::Branch ||
   4.309 +		xelection.type()==Selection::MapCenter ||
   4.310 +		xelection.type()==Selection::FloatImage))
   4.311  	{
   4.312 +	/* No savestate! savestate is called in cutNoSave
   4.313  		saveStateChangingPart(
   4.314  			sel->getParObj(),
   4.315  			sel,
   4.316  			"cut ()",
   4.317  			QString("Cut %1").arg(getName(sel ))
   4.318  		);
   4.319 +	*/	
   4.320  		copy();
   4.321 -		cutNoSave();
   4.322 +		deleteSelection();
   4.323  		mapCenter->reposition();
   4.324  	}
   4.325  }
   4.326 @@ -1957,7 +2013,7 @@
   4.327  	}	
   4.328  }
   4.329  
   4.330 -void MapEditor::linkTo(const QString &dstString)	// FIXME needed? only for FIO ??
   4.331 +void MapEditor::linkTo(const QString &dstString)	
   4.332  {
   4.333  	FloatImageObj *fio=xelection.getFloatImage();
   4.334  	if (fio)
   4.335 @@ -2018,19 +2074,6 @@
   4.336  	}
   4.337  }
   4.338  
   4.339 -void MapEditor::setURLInt (const QString &s)
   4.340 -{
   4.341 -	// Internal function, no saveState needed
   4.342 -	BranchObj *bo=xelection.getBranch();
   4.343 -	if (bo)
   4.344 -	{
   4.345 -		bo->setURL(s);
   4.346 -		mapCenter->reposition();
   4.347 -		xelection.update();
   4.348 -		ensureSelectionVisible();
   4.349 -	}
   4.350 -}
   4.351 -
   4.352  void MapEditor::setHeadingInt(const QString &s)
   4.353  {
   4.354  	BranchObj *bo=xelection.getBranch();
   4.355 @@ -2051,6 +2094,7 @@
   4.356  	{
   4.357  		bo->setVymLink(s);
   4.358  		mapCenter->reposition();
   4.359 +		updateActions();
   4.360  		xelection.update();
   4.361  		ensureSelectionVisible();
   4.362  	}
   4.363 @@ -2124,7 +2168,7 @@
   4.364  {
   4.365  	BranchObj *newbo=NULL;
   4.366  	BranchObj *bo = xelection.getBranch();
   4.367 -	if (bo && xelection.type()==Branch)
   4.368 +	if (bo && xelection.type()==Selection::Branch)
   4.369  		 // We accept no MapCenterObj here, so we _have_ a parent
   4.370  	{
   4.371  		QPointF p=bo->getRelPos();
   4.372 @@ -2154,7 +2198,7 @@
   4.373  void MapEditor::deleteSelection()
   4.374  {
   4.375  	BranchObj *bo = xelection.getBranch();
   4.376 -	if (bo && xelection.type()==Branch)
   4.377 +	if (bo && xelection.type()==Selection::Branch)
   4.378  	{
   4.379  		BranchObj* par=(BranchObj*)(bo->getParObj());
   4.380  		xelection.unselect();
   4.381 @@ -2235,7 +2279,7 @@
   4.382  
   4.383  void MapEditor::selectInt (LinkableMapObj *lmo)
   4.384  {
   4.385 -	if (lmo && xelection.single()!= lmo)
   4.386 +	if (lmo && xelection.single()!= lmo && isSelectBlocked()==false )
   4.387  	{
   4.388  		xelection.select(lmo);
   4.389  		xelection.update();
   4.390 @@ -2406,8 +2450,10 @@
   4.391  
   4.392  void MapEditor::selectUpperBranch()
   4.393  {
   4.394 +	if (isSelectBlocked() ) return;
   4.395 +
   4.396  	BranchObj *bo=xelection.getBranch();
   4.397 -	if (bo && xelection.type()==Branch)
   4.398 +	if (bo && xelection.type()==Selection::Branch)
   4.399  	{
   4.400  		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
   4.401  			selectPrevBranchInt();
   4.402 @@ -2421,8 +2467,10 @@
   4.403  
   4.404  void MapEditor::selectLowerBranch()
   4.405  {
   4.406 +	if (isSelectBlocked() ) return;
   4.407 +
   4.408  	BranchObj *bo=xelection.getBranch();
   4.409 -	if (bo && xelection.type()==Branch)
   4.410 +	if (bo && xelection.type()==Selection::Branch)
   4.411  		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
   4.412  			selectNextBranchInt();
   4.413  		else
   4.414 @@ -2435,12 +2483,14 @@
   4.415  
   4.416  void MapEditor::selectLeftBranch()
   4.417  {
   4.418 +	if (isSelectBlocked() ) return;
   4.419 +
   4.420  	BranchObj* bo;
   4.421  	BranchObj* par;
   4.422  	LinkableMapObj *sel=xelection.single();
   4.423  	if (sel)
   4.424  	{
   4.425 -		if (xelection.type()== MapCenter)
   4.426 +		if (xelection.type()== Selection::MapCenter)
   4.427  		{
   4.428  			par=xelection.getBranch();
   4.429  			bo=par->getLastSelectedBranch();
   4.430 @@ -2462,8 +2512,8 @@
   4.431  			par=(BranchObj*)(sel->getParObj());
   4.432  			if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
   4.433  			{
   4.434 -				if (xelection.type() == Branch ||
   4.435 -					xelection.type() == FloatImage)
   4.436 +				if (xelection.type() == Selection::Branch ||
   4.437 +					xelection.type() == Selection::FloatImage)
   4.438  				{
   4.439  					xelection.select(par);
   4.440  					xelection.update();
   4.441 @@ -2471,7 +2521,7 @@
   4.442  				}
   4.443  			} else
   4.444  			{
   4.445 -				if (xelection.type() == Branch )
   4.446 +				if (xelection.type() == Selection::Branch )
   4.447  				{
   4.448  					bo=xelection.getBranch()->getLastSelectedBranch();
   4.449  					if (bo) 
   4.450 @@ -2488,12 +2538,14 @@
   4.451  
   4.452  void MapEditor::selectRightBranch()
   4.453  {
   4.454 +	if (isSelectBlocked() ) return;
   4.455 +
   4.456  	BranchObj* bo;
   4.457  	BranchObj* par;
   4.458  	LinkableMapObj *sel=xelection.single();
   4.459  	if (sel)
   4.460  	{
   4.461 -		if (xelection.type()==MapCenter) 
   4.462 +		if (xelection.type()==Selection::MapCenter) 
   4.463  		{
   4.464  			par=xelection.getBranch();
   4.465  			bo=par->getLastSelectedBranch();
   4.466 @@ -2514,8 +2566,8 @@
   4.467  			par=(BranchObj*)(xelection.single()->getParObj());
   4.468  			if (xelection.single()->getOrientation()==LinkableMapObj::LeftOfCenter)
   4.469  			{
   4.470 -				if (xelection.type() == Branch ||
   4.471 -					xelection.type() == FloatImage)
   4.472 +				if (xelection.type() == Selection::Branch ||
   4.473 +					xelection.type() == Selection::FloatImage)
   4.474  				{
   4.475  					xelection.select(par);
   4.476  					xelection.update();
   4.477 @@ -2523,7 +2575,7 @@
   4.478  				}
   4.479  			} else
   4.480  			{
   4.481 -				if (xelection.type()  == Branch) 
   4.482 +				if (xelection.type()  == Selection::Branch) 
   4.483  				{
   4.484  					bo=xelection.getBranch()->getLastSelectedBranch();
   4.485  					if (bo) 
   4.486 @@ -2776,6 +2828,9 @@
   4.487  			QString ("set URL of %1 to %2").arg(getName(bo)).arg(url)
   4.488  		);
   4.489  		updateActions();
   4.490 +		mapCenter->reposition();
   4.491 +		xelection.update();
   4.492 +		ensureSelectionVisible();
   4.493  	}
   4.494  }	
   4.495  
   4.496 @@ -2881,10 +2936,7 @@
   4.497  				"setVymLink (\""+fd->selectedFile()+"\")",
   4.498  				QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile())
   4.499  			);	
   4.500 -			bo->setVymLink (fd->selectedFile() );
   4.501 -			updateActions();
   4.502 -			mapCenter->reposition();
   4.503 -			scene()->update();
   4.504 +			setVymLinkInt (fd->selectedFile() );
   4.505  		}
   4.506  	}
   4.507  }
   4.508 @@ -2926,6 +2978,7 @@
   4.509  		);	
   4.510  		updateActions();
   4.511  		mapCenter->reposition();
   4.512 +		xelection.update();
   4.513  		scene()->update();
   4.514  	}
   4.515  }
   4.516 @@ -2995,7 +3048,7 @@
   4.517  	if (bo)
   4.518  	{		
   4.519  		saveStateChangingPart(
   4.520 -			bo->getParObj(), 
   4.521 +			bo, 
   4.522  			bo,
   4.523  			"deleteChilds ()",
   4.524  			QString( "Remove childs of branch %1").arg(getName(bo))
   4.525 @@ -3264,6 +3317,7 @@
   4.526  			QString ("%1 %2").arg(r).arg(getName(bo))
   4.527  		);
   4.528  		bo->toggleScroll();
   4.529 +		xelection.update();
   4.530  		scene()->update();
   4.531  		return true;
   4.532  	}	
   4.533 @@ -3288,6 +3342,7 @@
   4.534  			QString ("%1 %2").arg(r).arg(getName(bo))
   4.535  		);
   4.536  		bo->toggleScroll();
   4.537 +		xelection.update();
   4.538  		scene()->update();
   4.539  		return true;
   4.540  	}	
   4.541 @@ -3297,7 +3352,7 @@
   4.542  void MapEditor::toggleScroll()
   4.543  {
   4.544  	BranchObj *bo=xelection.getBranch();
   4.545 -	if (xelection.type()==Branch )
   4.546 +	if (xelection.type()==Selection::Branch )
   4.547  	{
   4.548  		if (bo->isScrolled())
   4.549  			unscrollBranch (bo);
   4.550 @@ -3355,7 +3410,7 @@
   4.551  
   4.552  		if ( fd->exec() == QDialog::Accepted )
   4.553  		{
   4.554 -			// FIXME loadFIO in QT4 use:	lastImageDir=fd->directory();
   4.555 +			// TODO loadFIO in QT4 use:	lastImageDir=fd->directory();
   4.556  			lastImageDir=QDir (fd->dirPath());
   4.557  			QString s;
   4.558  			FloatImageObj *fio;
   4.559 @@ -3372,7 +3427,7 @@
   4.560  						QString("Add image %1 to %2").arg(s).arg(getName(bo))
   4.561  					);
   4.562  				else
   4.563 -					// FIXME loadFIO error handling
   4.564 +					// TODO loadFIO error handling
   4.565  					qWarning ("Failed to load "+s);
   4.566  			}
   4.567  		}
   4.568 @@ -3548,17 +3603,29 @@
   4.569  	}	
   4.570  }
   4.571  
   4.572 -void MapEditor::setHideLinkUnselected (bool b)	// FIXME missing saveState
   4.573 +void MapEditor::setHideLinkUnselected (bool b)
   4.574  {
   4.575  	LinkableMapObj *sel=xelection.single();
   4.576  	if (sel &&
   4.577 -		(xelection.type() == Branch || 
   4.578 -		xelection.type() == MapCenter  ||
   4.579 -		xelection.type() == FloatImage ))
   4.580 +		(xelection.type() == Selection::Branch || 
   4.581 +		xelection.type() == Selection::MapCenter  ||
   4.582 +		xelection.type() == Selection::FloatImage ))
   4.583 +	{
   4.584 +		QString u= b ? "false" : "true";
   4.585 +		QString r=!b ? "false" : "true";
   4.586 +		
   4.587 +		saveState(
   4.588 +			sel,
   4.589 +			QString("setHideLinkUnselected (%1)").arg(u),
   4.590 +			sel, 
   4.591 +			QString("setHideLinkUnselected (%1)").arg(r),
   4.592 +			QString("Hide link of %1 if unselected").arg(getName(sel))
   4.593 +		);	
   4.594  		sel->setHideLinkUnselected(b);
   4.595 +	}
   4.596  }
   4.597  
   4.598 -void MapEditor::importDirInt(BranchObj *dst, QDir d)	// FIXME missing saveState
   4.599 +void MapEditor::importDirInt(BranchObj *dst, QDir d)
   4.600  {
   4.601  	BranchObj *bo=xelection.getBranch();
   4.602  	if (bo)
   4.603 @@ -3605,6 +3672,18 @@
   4.604  	}		
   4.605  }
   4.606  
   4.607 +void MapEditor::importDirInt (const QString &s)
   4.608 +{
   4.609 +	BranchObj *bo=xelection.getBranch();
   4.610 +	if (bo)
   4.611 +	{
   4.612 +		saveStateChangingPart (bo,bo,QString ("importDir (\"%1\")").arg(s),QString("Import directory structure from %1").arg(s));
   4.613 +
   4.614 +		QDir d(s);
   4.615 +		importDirInt (bo,d);
   4.616 +	}
   4.617 +}	
   4.618 +
   4.619  void MapEditor::importDir()
   4.620  {
   4.621  	BranchObj *bo=xelection.getBranch();
   4.622 @@ -3621,7 +3700,7 @@
   4.623  		QString fn;
   4.624  		if ( fd->exec() == QDialog::Accepted )
   4.625  		{
   4.626 -			importDirInt (bo,QDir(fd->selectedFile()) );
   4.627 +			importDirInt (fd->selectedFile() );
   4.628  			mapCenter->reposition();
   4.629  			scene()->update();
   4.630  		}
   4.631 @@ -3790,6 +3869,13 @@
   4.632  		return;
   4.633  	}
   4.634  
   4.635 +	//Ignore clicks while editing heading
   4.636 +	if (isSelectBlocked() ) 
   4.637 +	{
   4.638 +		e->ignore();
   4.639 +		return;
   4.640 +	}
   4.641 +
   4.642      QPointF p = mapToScene(e->pos());
   4.643      LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
   4.644  	
   4.645 @@ -3880,7 +3966,7 @@
   4.646  			if (mainWindow->getModMode()==Main::ModModeCopy &&
   4.647  				e->state() & Qt::ControlModifier)
   4.648  			{
   4.649 -				if (xelection.type()==Branch)
   4.650 +				if (xelection.type()==Selection::Branch)
   4.651  				{
   4.652  					copyingObj=true;
   4.653  					mapCenter->addBranch ((BranchObj*)xelection.single());
   4.654 @@ -4081,7 +4167,7 @@
   4.655  	}
   4.656  
   4.657  	// Have we been drawing a link?
   4.658 -	if (drawingLink)	//FIXME savestate missing
   4.659 +	if (drawingLink)	
   4.660  	{
   4.661  		drawingLink=false;
   4.662  		// Check if we are over another branch
   4.663 @@ -4090,7 +4176,7 @@
   4.664  		{	
   4.665  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
   4.666  			tmpXLink->updateXLink();
   4.667 -			tmpXLink->activate();
   4.668 +			tmpXLink->activate(); //FIXME savestate missing
   4.669  			//saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	
   4.670  		} else
   4.671  		{
   4.672 @@ -4127,11 +4213,11 @@
   4.673  		if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj))) 
   4.674  			dst=NULL;
   4.675  		
   4.676 -		if (xelection.type() == MapCenter )
   4.677 +		if (xelection.type() == Selection::MapCenter )
   4.678  		{	// FIXME The MapCenter was moved, no savestate yet
   4.679  		}
   4.680  		
   4.681 -		if (xelection.type() == Branch )
   4.682 +		if (xelection.type() == Selection::Branch )
   4.683  		{	// A branch was moved
   4.684  			
   4.685  			// save the position in case we link to mapcenter
   4.686 @@ -4216,6 +4302,12 @@
   4.687  
   4.688  void MapEditor::mouseDoubleClickEvent(QMouseEvent* e)
   4.689  {
   4.690 +	if (isSelectBlocked() ) 
   4.691 +	{
   4.692 +		e->ignore();
   4.693 +		return;
   4.694 +	}
   4.695 +
   4.696  	if (e->button() == Qt::LeftButton )
   4.697  	{
   4.698  		QPointF p = mapToScene(e->pos());
   4.699 @@ -4310,7 +4402,7 @@
   4.700  	event->acceptProposedAction();
   4.701  }
   4.702  
   4.703 -void MapEditor::timerEvent(QTimerEvent *event)  //FIXME testing
   4.704 +void MapEditor::timerEvent(QTimerEvent *event)  //TODO animation
   4.705  {
   4.706      Q_UNUSED(event);
   4.707  
   4.708 @@ -4326,12 +4418,12 @@
   4.709  
   4.710  void MapEditor::autosave()
   4.711  {
   4.712 -	if (mapUnsaved &&mapChanged && settings.value ("/mapeditor/autosave/used",true).toBool() )
   4.713 +	if (mapUnsaved &&mapChanged && settings.value ("/mapeditor/autosave/use",true).toBool() )
   4.714  		mainWindow->fileSave (this);
   4.715  }
   4.716  
   4.717  
   4.718 -/*FIXME not needed? void MapEditor::contentsDropEvent(QDropEvent *event) 
   4.719 +/*TODO not needed? void MapEditor::contentsDropEvent(QDropEvent *event) 
   4.720  {
   4.721  
   4.722  		} else if (event->provides("application/x-moz-file-promise-url") && 
   4.723 @@ -4401,7 +4493,7 @@
   4.724    {
   4.725  	FloatImageObj *fio=bo->addFloatImage();
   4.726      fio->load(img);
   4.727 -    fio->setOriginalFilename("Image added by Drag and Drop");	// FIXME savestate
   4.728 +    fio->setOriginalFilename("Image added by Drag and Drop");	// FIXME savestate missing
   4.729      mapCenter->reposition();
   4.730      scene()->update();
   4.731    }
     5.1 --- a/mapeditor.h	Thu May 17 20:19:03 2007 +0000
     5.2 +++ b/mapeditor.h	Thu May 17 20:19:03 2007 +0000
     5.3 @@ -1,7 +1,6 @@
     5.4  #ifndef MAPEDITOR_H
     5.5  #define MAPEDITOR_H
     5.6  
     5.7 -//#include <QBuffer>
     5.8  #include <QGraphicsView>
     5.9  
    5.10  #include "mapcenterobj.h"
    5.11 @@ -19,15 +18,33 @@
    5.12      Q_OBJECT
    5.13  
    5.14  public:
    5.15 +    /*! \brief State of the mapeditor 
    5.16 +		
    5.17 +		While a heading is edited, the state has to change, so
    5.18 +		that e.g. no other object might get selected. This is done
    5.19 +		in Main by calling setStateEditHeading
    5.20 +	*/
    5.21 +	enum State {
    5.22 +		Idle,			//!< Idle, waiting for user event
    5.23 +		EditHeading		//!< Editing heading (dont't select another branch now)
    5.24 +	};
    5.25      MapEditor(QWidget* parent=0);
    5.26  	~MapEditor();
    5.27 -    MapCenterObj* getMapCenter();
    5.28 +    MapCenterObj* getMapCenter();		//!< Return center of map
    5.29  	QGraphicsScene * getScene();
    5.30 -	bool isRepositionBlocked(); // block while load or undo
    5.31 -	bool isSaveStateBlocked();	// block while undo/redo or while running scripts
    5.32 -	void setSaveStateBlocked(bool);
    5.33 +	State getState();					//!< Return State of MapEditor
    5.34 +	void setStateEditHeading (bool);	//!< If set to true, State will change to EditHeading
    5.35 +	bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview
    5.36 +	bool isSaveStateBlocked();			//!< block while undo/redo or while running scripts
    5.37 +	void setSaveStateBlocked(bool);		//!< block saving the undo/redo state
    5.38 +	bool isSelectBlocked();		//!< true, if no change of selection is possible, e.g. while editing the heading of abranch
    5.39  	
    5.40  protected:
    5.41 +	/*! \brief Get name of object
    5.42 +	  
    5.43 +	  Returns heading of a branch or name of an object for use in comment
    5.44 +	  of undo/redo history
    5.45 +	*/ 
    5.46  	QString getName(const LinkableMapObj*);	// Get e.g. heading or filename
    5.47  	void makeTmpDirs();		// create temporary directories
    5.48  
    5.49 @@ -81,64 +98,99 @@
    5.50  		 to map.xml. The destname is needed for vymLinks, pointing to another map. 
    5.51  		 The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
    5.52  	*/	 
    5.53 +
    5.54 +	/*! \brief Set File path
    5.55 +
    5.56 +	     The destname is needed to construct the references between maps
    5.57 +	*/	 
    5.58  	void setFilePath (QString filepath,QString destname);	
    5.59  	void setFilePath (QString);	//!< Overloaded for convenience
    5.60  	QString getFilePath ();	//!< Full path e.g. "/home/tux/map.xml"
    5.61  	QString getFileName ();	//!< e.g. "map.xml"
    5.62  	QString getMapName ();	//!< e.g. "map"
    5.63  	QString getDestPath (); //!< e.g. "/home/tux/map.vym"
    5.64 +
    5.65 +	/*! \brief Load map
    5.66 +
    5.67 +		The data is read from file. Depending on LoadMode the current
    5.68 +		selection gets replaced by data or the data is appended.
    5.69 +	*/	
    5.70      ErrorCode load (QString, LoadMode );	// newmap, import/replace selection
    5.71  public:
    5.72 -    int save(const SaveMode &);	// Save map 
    5.73 -	void setZipped(bool);		// save map zipped
    5.74 -	bool saveZipped();			// 1 if file will be saved zipped
    5.75 -    void print();				// print canvas
    5.76 -	void setAntiAlias (bool);
    5.77 -	void setSmoothPixmap(bool);
    5.78 +	/*! \brief Save the map to file */
    5.79 +    int save(const SaveMode &);	
    5.80 +	void setZipped(bool);		//!< Set or unset compression of map with zip save map zipped
    5.81 +	bool saveZipped();			//!< True, if file will be saved zipped
    5.82 +    void print();				//!< Print the map
    5.83 +	void setAntiAlias (bool);	//!< Set or unset antialiasing
    5.84 +	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
    5.85  private:
    5.86      QPixmap getPixmap();
    5.87  	void setHideTmpMode (BranchObj::HideTmpMode);	// temporary hide stuff
    5.88  	BranchObj::HideTmpMode getHideTmpMode();		// temporary hide stuff
    5.89  public:
    5.90 -	void setExportMode (bool);			// temporary hide stuff during export
    5.91 -    void exportImage (QString fn);			// export as PNG	
    5.92 -    void exportImage (QString fn, QString);	// export in given format
    5.93 -    void exportOOPresentation(const QString &,const QString &);
    5.94 -    void exportXML(const QString&);		// export to directory
    5.95 -    void clear();		// clear map
    5.96 -    void copy();		// copy branch to clipboard
    5.97 -    void redo();		// redo last action
    5.98 -	bool isRedoAvailable();
    5.99 -    void undo();		// undo last action
   5.100 -	bool isUndoAvailable();
   5.101 -	void gotoHistoryStep (int);// goto a step in history
   5.102 +	void setExportMode (bool);			//!< Set or unset temporary hiding of objects during export
   5.103 +    void exportImage (QString fn);			//!< Export as PNG	
   5.104 +    void exportImage (QString fn, QString);	//!< Export in given format
   5.105 +    void exportOOPresentation(const QString &,const QString &);	//!< Export as OpenOfficeOrg presentation
   5.106 +    void exportXML(const QString&);		//!< Export as XML to directory
   5.107 +    void clear();						//!< Clear map
   5.108 +    void copy();						//!< Copy to clipboard
   5.109 +    void redo();						//!< Redo last action
   5.110 +	bool isRedoAvailable();				//!< True, if redo is available
   5.111 +    void undo();						//!< Undo last action
   5.112 +	bool isUndoAvailable();				//!< True, if undo is available
   5.113 +	void gotoHistoryStep (int);			//!< Goto a specifig step in history
   5.114  private:	
   5.115      void addMapReplaceInt(const QString & undoSel, const QString & path);
   5.116      void addMapInsertInt (const QString & path, int pos);
   5.117      void pasteNoSave();		// paste clipboard to branch
   5.118 -    void cutNoSave();	// cut to clipboard
   5.119  public:	
   5.120 -    void paste();		// paste clipboard to branch and backup
   5.121 -    void cut();			// cut to clipboard and backup
   5.122 +    void paste();		//!< Paste clipboard to branch and backup
   5.123 +    void cut();			//!< Cut to clipboard (and copy)
   5.124 +	/*! \brief Move absolutly
   5.125 +
   5.126 +		Move absolutly to (x,y).
   5.127 +	*/	
   5.128      void move    (const int &x, const int &y);
   5.129 +	/*! \brief Move relativly
   5.130 +
   5.131 +		Move relativly to (x,y).
   5.132 +	*/	
   5.133      void moveRel (const int &x, const int &y);
   5.134 -    void moveBranchUp();
   5.135 -    void moveBranchDown();
   5.136 +    void moveBranchUp();	//!< Move branch up
   5.137 +    void moveBranchDown();	//!< Move branch down
   5.138  private:	
   5.139  	void linkTo(const QString &);
   5.140  public:	
   5.141 -	QString getHeading (bool &ok,QPoint &p); // Get heading, ok if selection is branch
   5.142 -	void setHeading(const QString &);
   5.143 +	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
   5.144 +	void setHeading(const QString &);		//!< Set heading of branch	
   5.145  private:
   5.146  	void setHeadingInt(const QString &);
   5.147 -	void setURLInt(const QString &);		// Just set the URL for selection
   5.148  	void setVymLinkInt(const QString &);	// Set vymLink for selection
   5.149 +	/*! \brief Add new branch
   5.150 +
   5.151 +		Depending on num the new branch is created
   5.152 +
   5.153 +		-3 above selection as child of selections parent
   5.154 +		-2 as child of selection
   5.155 +		-1 below selection as child of selections parent
   5.156 +		0..n	insert at a specific position in selections parent
   5.157 +		(needed for free relinking)
   5.158 +	*/	
   5.159      BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
   5.160  public:	
   5.161 -    BranchObj* addNewBranch(int);			// pos allows to add above/below selection
   5.162 -    BranchObj* addNewBranchBefore();		// insert and make selection its
   5.163 -    void deleteSelection();
   5.164 -	LinkableMapObj* getSelection();			// returns selection
   5.165 +	/*! \Add new branch
   5.166 +		
   5.167 +		Depending on num the new branch is created
   5.168 +		-1 above selection
   5.169 +		 0 as child of selection
   5.170 +		 1 below selection
   5.171 +	*/
   5.172 +    BranchObj* addNewBranch(int pos);		
   5.173 +    BranchObj* addNewBranchBefore();		//!< Insert branch between selection and its parent
   5.174 +    void deleteSelection();					//!< Delete selection
   5.175 +	LinkableMapObj* getSelection();			//!< Returns selection
   5.176  	BranchObj* getSelectedBranch();			// returns selected branch or NULL
   5.177  	FloatImageObj* getSelectedFloatImage();	// returns selected branch or NULL
   5.178  	void unselect();						// before changing current noteedit
   5.179 @@ -232,6 +284,7 @@
   5.180  	bool getHideLinkUnselected ();
   5.181  private:	
   5.182      void importDirInt(BranchObj *,QDir);
   5.183 +    void importDirInt(const QString&);
   5.184  public:	
   5.185      void importDir();
   5.186  	void followXLink (int);
   5.187 @@ -260,6 +313,7 @@
   5.188  	void autosave ();
   5.189  
   5.190  private:
   5.191 +	State state;				// State of MapEditor
   5.192  	QGraphicsScene *mapScene;
   5.193      MapCenterObj* mapCenter;
   5.194  	QTimer *autosaveTimer;