minor fixes
authorinsilmaril
Mon, 29 Jan 2007 12:29:13 +0000
changeset 424d886c77ac0fe
parent 423 7019762f8701
child 425 7014be3ac7d0
minor fixes
demos/todo.vym
exports.cpp
exports.h
mainwindow.cpp
mapeditor.cpp
mapeditor.h
selection.cpp
selection.h
tex/vym.changelog
version.h
     1.1 Binary file demos/todo.vym has changed
     2.1 --- a/exports.cpp	Tue Jan 23 11:50:56 2007 +0000
     2.2 +++ b/exports.cpp	Mon Jan 29 12:29:13 2007 +0000
     2.3 @@ -26,9 +26,9 @@
     2.4  	removeDir (tmpDir);
     2.5  }
     2.6  
     2.7 -void ExportBase::setDir(const QString &p)
     2.8 +void ExportBase::setDir(const QDir &d)
     2.9  {
    2.10 -	outputDir=p;
    2.11 +	outDir=d;
    2.12  }
    2.13  
    2.14  void ExportBase::setFile (const QString &p)
    2.15 @@ -59,6 +59,7 @@
    2.16  		fd->setFilter (filter);
    2.17  		fd->setCaption(caption);
    2.18  		fd->setMode( QFileDialog::AnyFile );
    2.19 +		fd->setDir (outDir);
    2.20  		fd->show();
    2.21  
    2.22  		if ( fd->exec() == QDialog::Accepted )
     3.1 --- a/exports.h	Tue Jan 23 11:50:56 2007 +0000
     3.2 +++ b/exports.h	Mon Jan 29 12:29:13 2007 +0000
     3.3 @@ -15,7 +15,7 @@
     3.4  public:
     3.5  	ExportBase();
     3.6  	virtual ~ExportBase();
     3.7 -	virtual void setDir(const QString &);
     3.8 +	virtual void setDir(const QDir&);
     3.9  	virtual void setFile(const QString &);
    3.10  	virtual void setMapCenter (MapCenterObj*);
    3.11  	virtual void setCaption(const QString &);
    3.12 @@ -25,7 +25,7 @@
    3.13  	virtual QString getSectionString (BranchObj*);
    3.14  
    3.15  	QDir tmpDir;
    3.16 -	QString outputDir;
    3.17 +	QDir outDir;
    3.18  	QString outputFile;
    3.19  	MapCenterObj *mapCenter;
    3.20  	QString	indentPerDepth;
     4.1 --- a/mainwindow.cpp	Tue Jan 23 11:50:56 2007 +0000
     4.2 +++ b/mainwindow.cpp	Mon Jan 29 12:29:13 2007 +0000
     4.3 @@ -2249,6 +2249,7 @@
     4.4  		ExportASCII ex;
     4.5  		ex.setMapCenter(me->getMapCenter());
     4.6  		ex.addFilter ("TXT (*.txt)");
     4.7 +		ex.setDir(lastImageDir);
     4.8  		ex.setCaption(vymName+ " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
     4.9  		if (ex.execDialog() ) 
    4.10  		{
    4.11 @@ -2267,6 +2268,7 @@
    4.12  		ExportLaTeX ex;
    4.13  		ex.setMapCenter(me->getMapCenter());
    4.14  		ex.addFilter ("Tex (*.tex)");
    4.15 +		ex.setDir(lastImageDir);
    4.16  		ex.setCaption(vymName+ " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
    4.17  		if (ex.execDialog() ) 
    4.18  		{
    4.19 @@ -2296,6 +2298,7 @@
    4.20  	{
    4.21  		ex.setMapCenter (me->getMapCenter() );
    4.22  		ex.setCaption ( vymName+" - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
    4.23 +		ex.setDir(lastImageDir);
    4.24  		ex.addFilter ("Taskjuggler (*.tjp)");
    4.25  		if (ex.execDialog() ) 
    4.26  		{
     5.1 --- a/mapeditor.cpp	Tue Jan 23 11:50:56 2007 +0000
     5.2 +++ b/mapeditor.cpp	Mon Jan 29 12:29:13 2007 +0000
     5.3 @@ -95,12 +95,10 @@
     5.4  	copyingObj=false;
     5.5  
     5.6      editingBO=NULL;
     5.7 -    selection=NULL;
     5.8 -    selectionLast=NULL;
     5.9      movingObj=NULL;
    5.10  
    5.11  	xelection.setMapCenter (mapCenter);
    5.12 -	xelection.clear();
    5.13 +	xelection.unselect();
    5.14  
    5.15  	defXLinkWidth=1;
    5.16  	defXLinkColor=QColor (230,230,230);
    5.17 @@ -257,8 +255,8 @@
    5.18  	s+=settings.getXMLData (destPath);
    5.19  
    5.20  	// Save selection
    5.21 -	if (selection && !saveSel ) 
    5.22 -		s+=valueElement("select",selection->getSelectString());
    5.23 +	if (!xelection.isEmpty() && !saveSel ) 
    5.24 +		s+=valueElement("select",xelection.getSelectString());
    5.25  
    5.26  	decIndent();
    5.27  	s+=endElement("vymmap");
    5.28 @@ -428,6 +426,7 @@
    5.29  
    5.30  void MapEditor::parseAtom(const QString &atom)
    5.31  {
    5.32 +	BranchObj *selb=xelection.getBranch();
    5.33  	API api;
    5.34  	QString s,t;
    5.35  	int x,y;
    5.36 @@ -440,11 +439,10 @@
    5.37  	// External commands
    5.38  	if (com=="addBranch")
    5.39  	{
    5.40 -		if (!selection)
    5.41 +		if (xelection.isEmpty())
    5.42  		{
    5.43  			api.setError (Aborted,"Nothing selected");
    5.44 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
    5.45 -					 typeid(*selection) != typeid(MapCenterObj)) )
    5.46 +		} else if (! selb )
    5.47  		{				  
    5.48  			api.setError (Aborted,"Type of selection is not a branch");
    5.49  		} else 
    5.50 @@ -464,11 +462,10 @@
    5.51  		}
    5.52  	} else if (com=="addBranchBefore")
    5.53  	{
    5.54 -		if (!selection)
    5.55 +		if (xelection.isEmpty())
    5.56  		{
    5.57  			api.setError (Aborted,"Nothing selected");
    5.58 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
    5.59 -					 typeid(*selection) != typeid(MapCenterObj)) )
    5.60 +		} else if (! selb )
    5.61  		{				  
    5.62  			api.setError (Aborted,"Type of selection is not a branch");
    5.63  		} else 
    5.64 @@ -480,11 +477,10 @@
    5.65  		}
    5.66  	} else if (com==QString("addMapReplace"))
    5.67  	{
    5.68 -		if (!selection)
    5.69 +		if (xelection.isEmpty())
    5.70  		{
    5.71  			api.setError (Aborted,"Nothing selected");
    5.72 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
    5.73 -					 typeid(*selection) != typeid(MapCenterObj)) )
    5.74 +		} else if (! selb )
    5.75  		{				  
    5.76  			api.setError (Aborted,"Type of selection is not a branch");
    5.77  		} else if (api.checkParamCount(1))
    5.78 @@ -492,15 +488,14 @@
    5.79  			//s=api.parString (ok,0);	// selection
    5.80  			t=api.parString (ok,0);	// path to map
    5.81  			if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
    5.82 -			addMapReplaceInt(selection->getSelectString(),t);	
    5.83 +			addMapReplaceInt(selb->getSelectString(),t);	
    5.84  		}
    5.85  	} else if (com==QString("addMapInsert"))
    5.86  	{
    5.87 -		if (!selection)
    5.88 +		if (xelection.isEmpty())
    5.89  		{
    5.90  			api.setError (Aborted,"Nothing selected");
    5.91 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
    5.92 -					 typeid(*selection) != typeid(MapCenterObj)) )
    5.93 +		} else if (! selb )
    5.94  		{				  
    5.95  			api.setError (Aborted,"Type of selection is not a branch");
    5.96  		} else 
    5.97 @@ -515,11 +510,10 @@
    5.98  		}
    5.99  	} else if (com=="colorBranch")
   5.100  	{
   5.101 -		if (!selection)
   5.102 +		if (xelection.isEmpty())
   5.103  		{
   5.104  			api.setError (Aborted,"Nothing selected");
   5.105 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
   5.106 -					typeid(*selection) != typeid(MapCenterObj))
   5.107 +		} else if (! selb )
   5.108  		{				  
   5.109  			api.setError (Aborted,"Type of selection is not a branch");
   5.110  		} else if (api.checkParamCount(1))
   5.111 @@ -529,11 +523,10 @@
   5.112  		}	
   5.113  	} else if (com=="colorSubtree")
   5.114  	{
   5.115 -		if (!selection)
   5.116 +		if (xelection.isEmpty())
   5.117  		{
   5.118  			api.setError (Aborted,"Nothing selected");
   5.119 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
   5.120 -					typeid(*selection) != typeid(MapCenterObj))
   5.121 +		} else if (! selb )
   5.122  		{				  
   5.123  			api.setError (Aborted,"Type of selection is not a branch");
   5.124  		} else if (api.checkParamCount(1))
   5.125 @@ -543,12 +536,12 @@
   5.126  		}	
   5.127  	} else if (com=="cut")
   5.128  	{
   5.129 -		if (!selection)
   5.130 +		if (xelection.isEmpty())
   5.131  		{
   5.132  			api.setError (Aborted,"Nothing selected");
   5.133 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
   5.134 -					typeid(*selection) != typeid(MapCenterObj) &&
   5.135 -					typeid(*selection) != typeid(FloatImageObj) )
   5.136 +		} else if ( xelection.type()!=Branch  && 
   5.137 +					xelection.type()!=MapCenter  &&
   5.138 +					xelection.type()!=FloatImage )
   5.139  		{				  
   5.140  			api.setError (Aborted,"Type of selection is not a branch or floatimage");
   5.141  		} else if (api.checkParamCount(0))
   5.142 @@ -557,12 +550,11 @@
   5.143  		}	
   5.144  	} else if (com=="delete")
   5.145  	{
   5.146 -		if (!selection)
   5.147 +		if (xelection.isEmpty())
   5.148  		{
   5.149  			api.setError (Aborted,"Nothing selected");
   5.150 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.151 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.152 -		{				  
   5.153 +		} else if (! selb )
   5.154 +		{
   5.155  			api.setError (Aborted,"Type of selection is not a branch");
   5.156  		} else if (api.checkParamCount(0))
   5.157  		{	
   5.158 @@ -570,12 +562,11 @@
   5.159  		}	
   5.160  	} else if (com=="deleteKeepChilds")
   5.161  	{
   5.162 -		if (!selection)
   5.163 +		if (xelection.isEmpty())
   5.164  		{
   5.165  			api.setError (Aborted,"Nothing selected");
   5.166 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.167 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.168 -		{				  
   5.169 +		} else if (! selb )
   5.170 +		{
   5.171  			api.setError (Aborted,"Type of selection is not a branch");
   5.172  		} else if (api.checkParamCount(0))
   5.173  		{	
   5.174 @@ -583,12 +574,11 @@
   5.175  		}	
   5.176  	} else if (com=="deleteChilds")
   5.177  	{
   5.178 -		if (!selection)
   5.179 +		if (xelection.isEmpty())
   5.180  		{
   5.181  			api.setError (Aborted,"Nothing selected");
   5.182 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.183 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.184 -		{				  
   5.185 +		} else if (! selb)
   5.186 +		{
   5.187  			api.setError (Aborted,"Type of selection is not a branch");
   5.188  		} else if (api.checkParamCount(0))
   5.189  		{	
   5.190 @@ -596,11 +586,10 @@
   5.191  		}	
   5.192  	} else if (com=="linkTo")
   5.193  	{
   5.194 -		if (!selection)
   5.195 +		if (xelection.isEmpty())
   5.196  		{
   5.197  			api.setError (Aborted,"Nothing selected");
   5.198 -		} else if ( (typeid(*selection) == typeid(BranchObj) || 
   5.199 -					 typeid(*selection) == typeid(MapCenterObj)) )
   5.200 +		} else if ( selb)
   5.201  		{
   5.202  			if (api.checkParamCount(4))
   5.203  			{
   5.204 @@ -616,21 +605,21 @@
   5.205  						// Get number in parent
   5.206  						x=api.parInt (ok,1);
   5.207  						if (ok)
   5.208 -							((BranchObj*)selection)->linkTo ((BranchObj*)(dst),x);
   5.209 +							selb->linkTo ((BranchObj*)(dst),x);
   5.210  					} else if (typeid(*dst) == typeid(MapCenterObj) ) 
   5.211  					{
   5.212 -						((BranchObj*)selection)->linkTo ((BranchObj*)(dst),-1);
   5.213 +						selb->linkTo ((BranchObj*)(dst),-1);
   5.214  						// Get coordinates of mainbranch
   5.215  						x=api.parInt (ok,2);
   5.216  						if (ok)
   5.217  						{
   5.218  							y=api.parInt (ok,3);
   5.219 -							if (ok) ((BranchObj*)selection)->move (x,y);
   5.220 +							if (ok) selb->move (x,y);
   5.221  						}
   5.222  					}	
   5.223  				}	
   5.224  			}	
   5.225 -		} else if ( typeid(*selection) != typeid(FloatImageObj)) 
   5.226 +		} else if ( xelection.type() == FloatImage) 
   5.227  		{
   5.228  			if (api.checkParamCount(1))
   5.229  			{
   5.230 @@ -649,11 +638,10 @@
   5.231  			api.setError (Aborted,"Type of selection is not a floatimage or branch");
   5.232  	} else if (com=="moveBranchUp")
   5.233  	{
   5.234 -		if (!selection)
   5.235 +		if (xelection.isEmpty() )
   5.236  		{
   5.237  			api.setError (Aborted,"Nothing selected");
   5.238 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.239 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.240 +		} else if (! selb )
   5.241  		{				  
   5.242  			api.setError (Aborted,"Type of selection is not a branch");
   5.243  		} else if (api.checkParamCount(0))
   5.244 @@ -662,11 +650,10 @@
   5.245  		}	
   5.246  	} else if (com=="moveBranchDown")
   5.247  	{
   5.248 -		if (!selection)
   5.249 +		if (xelection.isEmpty() )
   5.250  		{
   5.251  			api.setError (Aborted,"Nothing selected");
   5.252 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.253 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.254 +		} else if (! selb )
   5.255  		{				  
   5.256  			api.setError (Aborted,"Type of selection is not a branch");
   5.257  		} else if (api.checkParamCount(0))
   5.258 @@ -675,12 +662,12 @@
   5.259  		}	
   5.260  	} else if (com=="move")
   5.261  	{
   5.262 -		if (!selection)
   5.263 +		if (xelection.isEmpty() )
   5.264  		{
   5.265  			api.setError (Aborted,"Nothing selected");
   5.266 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
   5.267 -					typeid(*selection) != typeid(MapCenterObj) &&
   5.268 -					typeid(*selection) != typeid(FloatImageObj) )
   5.269 +		} else if ( xelection.type()!=Branch  && 
   5.270 +					xelection.type()!=MapCenter  &&
   5.271 +					xelection.type()!=FloatImage )
   5.272  		{				  
   5.273  			api.setError (Aborted,"Type of selection is not a branch or floatimage");
   5.274  		} else if (api.checkParamCount(2))
   5.275 @@ -694,12 +681,12 @@
   5.276  		}	
   5.277  	} else if (com=="moveRel")
   5.278  	{
   5.279 -		if (!selection)
   5.280 +		if (xelection.isEmpty() )
   5.281  		{
   5.282  			api.setError (Aborted,"Nothing selected");
   5.283 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
   5.284 -					typeid(*selection) != typeid(MapCenterObj) &&
   5.285 -					typeid(*selection) != typeid(FloatImageObj) )
   5.286 +		} else if ( xelection.type()!=Branch  && 
   5.287 +					xelection.type()!=MapCenter  &&
   5.288 +					xelection.type()!=FloatImage )
   5.289  		{				  
   5.290  			api.setError (Aborted,"Type of selection is not a branch or floatimage");
   5.291  		} else if (api.checkParamCount(2))
   5.292 @@ -713,11 +700,10 @@
   5.293  		}	
   5.294  	} else if (com=="paste")
   5.295  	{
   5.296 -		if (!selection)
   5.297 +		if (xelection.isEmpty() )
   5.298  		{
   5.299  			api.setError (Aborted,"Nothing selected");
   5.300 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
   5.301 -					typeid(*selection) != typeid(MapCenterObj) )
   5.302 +		} else if (! selb )
   5.303  		{				  
   5.304  			api.setError (Aborted,"Type of selection is not a branch");
   5.305  		} else if (api.checkParamCount(0))
   5.306 @@ -747,11 +733,10 @@
   5.307  		}	
   5.308  	} else if (com=="setMapBackgroundColor")
   5.309  	{
   5.310 -		if (!selection)
   5.311 +		if (xelection.isEmpty() )
   5.312  		{
   5.313  			api.setError (Aborted,"Nothing selected");
   5.314 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.315 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.316 +		} else if (! xelection.getBranch() )
   5.317  		{				  
   5.318  			api.setError (Aborted,"Type of selection is not a branch");
   5.319  		} else if (api.checkParamCount(1))
   5.320 @@ -761,11 +746,10 @@
   5.321  		}	
   5.322  	} else if (com=="setMapDefLinkColor")
   5.323  	{
   5.324 -		if (!selection)
   5.325 +		if (xelection.isEmpty() )
   5.326  		{
   5.327  			api.setError (Aborted,"Nothing selected");
   5.328 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.329 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.330 +		} else if (! selb )
   5.331  		{				  
   5.332  			api.setError (Aborted,"Type of selection is not a branch");
   5.333  		} else if (api.checkParamCount(1))
   5.334 @@ -782,11 +766,10 @@
   5.335  		}	
   5.336  	} else if (com=="setHeading")
   5.337  	{
   5.338 -		if (!selection)
   5.339 +		if (xelection.isEmpty() )
   5.340  		{
   5.341  			api.setError (Aborted,"Nothing selected");
   5.342 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.343 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.344 +		} else if (! selb )
   5.345  		{				  
   5.346  			api.setError (Aborted,"Type of selection is not a branch");
   5.347  		} else if (api.checkParamCount(1))
   5.348 @@ -797,11 +780,10 @@
   5.349  		}	
   5.350  	} else if (com=="setHideExport")
   5.351  	{
   5.352 -		if (!selection)
   5.353 +		if (xelection.isEmpty() )
   5.354  		{
   5.355  			api.setError (Aborted,"Nothing selected");
   5.356 -		} else if ( typeid(*selection) != typeid(BranchObj) && 
   5.357 -					typeid(*selection) != typeid(FloatImageObj) )
   5.358 +		} else if (! selb)
   5.359  		{				  
   5.360  			api.setError (Aborted,"Type of selection is not a branch or floatimage");
   5.361  		} else if (api.checkParamCount(1))
   5.362 @@ -811,11 +793,10 @@
   5.363  		}
   5.364  	} else if (com=="setURL")
   5.365  	{
   5.366 -		if (!selection)
   5.367 +		if (xelection.isEmpty() )
   5.368  		{
   5.369  			api.setError (Aborted,"Nothing selected");
   5.370 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.371 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.372 +		} else if (! selb )
   5.373  		{				  
   5.374  			api.setError (Aborted,"Type of selection is not a branch");
   5.375  		} else if (api.checkParamCount(1))
   5.376 @@ -825,11 +806,10 @@
   5.377  		}	
   5.378  	} else if (com=="setVymLink")
   5.379  	{
   5.380 -		if (!selection)
   5.381 +		if (xelection.isEmpty() )
   5.382  		{
   5.383  			api.setError (Aborted,"Nothing selected");
   5.384 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.385 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.386 +		} else if (! selb )
   5.387  		{				  
   5.388  			api.setError (Aborted,"Type of selection is not a branch");
   5.389  		} else if (api.checkParamCount(1))
   5.390 @@ -840,11 +820,10 @@
   5.391  	}
   5.392  	else if (com=="setFlag")
   5.393  	{
   5.394 -		if (!selection)
   5.395 +		if (xelection.isEmpty() )
   5.396  		{
   5.397  			api.setError (Aborted,"Nothing selected");
   5.398 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.399 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.400 +		} else if (! selb )
   5.401  		{				  
   5.402  			api.setError (Aborted,"Type of selection is not a branch");
   5.403  		} else if (api.checkParamCount(1))
   5.404 @@ -852,19 +831,17 @@
   5.405  			s=api.parString(ok,0);
   5.406  			if (ok) 
   5.407  			{
   5.408 -				BranchObj* bo=(BranchObj*)selection;
   5.409 -				bo->activateStandardFlag(s);
   5.410 -				bo->updateFlagsToolbar();
   5.411 +				selb->activateStandardFlag(s);
   5.412 +				selb->updateFlagsToolbar();
   5.413  			}	
   5.414  		}
   5.415  	}	
   5.416  	else if (com=="unsetFlag")
   5.417  	{
   5.418 -		if (!selection)
   5.419 +		if (xelection.isEmpty() )
   5.420  		{
   5.421  			api.setError (Aborted,"Nothing selected");
   5.422 -		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   5.423 -					 typeid(*selection) != typeid(MapCenterObj)) )
   5.424 +		} else if (! selb )
   5.425  		{				  
   5.426  			api.setError (Aborted,"Type of selection is not a branch");
   5.427  		} else if (api.checkParamCount(1))
   5.428 @@ -872,9 +849,8 @@
   5.429  			s=api.parString(ok,0);
   5.430  			if (ok) 
   5.431  			{
   5.432 -				BranchObj* bo=(BranchObj*)selection;
   5.433 -				bo->deactivateStandardFlag(s);
   5.434 -				bo->updateFlagsToolbar();
   5.435 +				selb->deactivateStandardFlag(s);
   5.436 +				selb->updateFlagsToolbar();
   5.437  			}	
   5.438  		}
   5.439  	} else
   5.440 @@ -918,8 +894,8 @@
   5.441  void MapEditor::closeMap()
   5.442  {
   5.443  	// Unselect before disabling the toolbar actions
   5.444 -	if (selection) selection->unselect();
   5.445 -	selection=NULL;
   5.446 +	if (!xelection.isEmpty() ) xelection.unselect();
   5.447 +	xelection.clear();
   5.448  	updateActions();
   5.449  
   5.450      clear();
   5.451 @@ -983,27 +959,25 @@
   5.452  
   5.453  	if (lmode==NewMap)
   5.454  	{
   5.455 -		if (selection) selection->unselect();
   5.456 -		selection=NULL;
   5.457 +		if (xelection.isEmpty() ) xelection.unselect();
   5.458 +		xelection.clear();
   5.459  		mapCenter->clear();
   5.460  		mapCenter->setMapEditor(this);
   5.461  		// (map state is set later at end of load...)
   5.462  	} else
   5.463  	{
   5.464 -		if (!selection || (typeid(*selection) != typeid(BranchObj) &&
   5.465 -			typeid(*selection) != typeid (MapCenterObj)))
   5.466 -			return aborted;
   5.467 -		BranchObj *bo=(BranchObj*)selection;	
   5.468 +		BranchObj *bo=xelection.getBranch();
   5.469 +		if (!bo) return aborted;
   5.470  		if (lmode==ImportAdd)
   5.471  			saveStateChangingPart(
   5.472 -				selection,
   5.473 -				selection,
   5.474 +				bo,
   5.475 +				bo,
   5.476  				QString("addMapInsert (%1)").arg(fname),
   5.477  				QString("Add map %1 to %2").arg(fname).arg(getName(bo)));
   5.478  		else	
   5.479  			saveStateChangingPart(
   5.480 -				selection,
   5.481 -				selection,
   5.482 +				bo,
   5.483 +				bo,
   5.484  				QString("addMapReplace(%1)").arg(fname),
   5.485  				QString("Add map %1 to %2").arg(fname).arg(getName(bo)));
   5.486  	}	
   5.487 @@ -1073,10 +1047,10 @@
   5.488  
   5.489  
   5.490  	QString saveFile;
   5.491 -	if (savemode==CompleteMap || selection==NULL)
   5.492 +	if (savemode==CompleteMap || xelection.isEmpty())
   5.493  		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),NULL);
   5.494  	else	
   5.495 -		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),selection);
   5.496 +		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),xelection.getBranch());	//FIXME check selected FIO
   5.497  
   5.498  	if (!saveStringToDisk(fileDir+fname,saveFile))
   5.499  		return 1;
   5.500 @@ -1136,12 +1110,7 @@
   5.501  		pp.setRenderHint(QPainter::Antialiasing,true);
   5.502  
   5.503  		// Don't print the visualisation of selection
   5.504 -		LinkableMapObj *oldselection=NULL;
   5.505 -		if (selection) 
   5.506 -		{
   5.507 -			oldselection=selection;
   5.508 -			selection->unselect();
   5.509 -		}
   5.510 +		xelection.unselect();
   5.511  
   5.512  		QRectF mapRect=totalBBox;
   5.513  		QGraphicsRectItem *frame=NULL;
   5.514 @@ -1192,11 +1161,7 @@
   5.515  		if (frame)  delete (frame);
   5.516  
   5.517  		// Restore selection
   5.518 -		if (oldselection) 
   5.519 -		{
   5.520 -			selection=oldselection;
   5.521 -			selection->select();
   5.522 -		}	
   5.523 +		xelection.reselect();
   5.524  
   5.525  		// Save settings in vymrc
   5.526  		settings.writeEntry("/mainwindow/printerName",printer->printerName());
   5.527 @@ -1225,12 +1190,7 @@
   5.528  	pp.setRenderHints(renderHints());
   5.529  
   5.530  	// Don't print the visualisation of selection
   5.531 -	LinkableMapObj *oldselection=NULL;
   5.532 -	if (selection) 
   5.533 -	{
   5.534 -		oldselection=selection;
   5.535 -		selection->unselect();
   5.536 -	}
   5.537 +	xelection.unselect();
   5.538  
   5.539  	mapScene->render (	&pp, 
   5.540  		QRectF(0,0,mapRect.width(),mapRect.height()),
   5.541 @@ -1241,11 +1201,7 @@
   5.542  
   5.543  
   5.544  	// Restore selection
   5.545 -	if (oldselection) 
   5.546 -	{
   5.547 -		selection=oldselection;
   5.548 -		selection->select();
   5.549 -	}	
   5.550 +	xelection.reselect();
   5.551  	
   5.552  	return pix;
   5.553  }
   5.554 @@ -1338,22 +1294,18 @@
   5.555  
   5.556  void MapEditor::clear()
   5.557  {
   5.558 -	if (selection)
   5.559 -	{
   5.560 -		selection->unselect();
   5.561 -		selection=NULL;
   5.562 -	}	
   5.563 -
   5.564 +	xelection.unselect();
   5.565  	mapCenter->clear();
   5.566  }
   5.567  
   5.568  void MapEditor::copy()
   5.569  {
   5.570 -	if (selection) 
   5.571 +	LinkableMapObj *sel=xelection.single();
   5.572 +	if (sel)
   5.573  	{
   5.574  		// write to directory
   5.575  		QString clipfile="part";
   5.576 -		QString saveFile=saveToDir (fileDir,clipfile+"-",true,QPointF(),selection);
   5.577 +		QString saveFile=saveToDir (fileDir,clipfile+"-",true,QPointF(),sel ); // FIXME check FIO
   5.578  		QFile file;
   5.579  
   5.580  		file.setName ( clipboardDir + "/"+clipfile+".xml");
   5.581 @@ -1597,8 +1549,8 @@
   5.582  
   5.583  void MapEditor::addMapInsertInt (const QString &path, int pos)
   5.584  {
   5.585 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   5.586 -				      typeid(*selection) == typeid(MapCenterObj))) 
   5.587 +	BranchObj *sel=xelection.getBranch();
   5.588 +	if (sel);
   5.589  	{
   5.590  		QString pathDir=path.left(path.findRev("/"));
   5.591  		QDir d(pathDir);
   5.592 @@ -1624,8 +1576,8 @@
   5.593  				QMessageBox::critical( 0, tr( "Critical Parse Error while reading %1").arg(path),
   5.594  										handler.errorProtocol());
   5.595  			}
   5.596 -			if (selection!=mapCenter)
   5.597 -				((BranchObj*)selection)->getLastBranch()->linkTo ((BranchObj*)(selection),pos);
   5.598 +			if (sel!=mapCenter)
   5.599 +				sel->getLastBranch()->linkTo (sel,pos);
   5.600  		} else	
   5.601  			QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
   5.602  	}		
   5.603 @@ -1642,17 +1594,17 @@
   5.604  	deleteSelection();
   5.605  }
   5.606  
   5.607 -void MapEditor::paste()
   5.608 +void MapEditor::paste()		// FIXME no pasting of FIO ???
   5.609  {   
   5.610 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   5.611 -				      typeid(*selection) == typeid(MapCenterObj))) 
   5.612 +	BranchObj *sel=xelection.getBranch();
   5.613 +	if (sel)
   5.614  	{
   5.615  		pasteNoSave();
   5.616  		saveStateChangingPart(
   5.617 -			selection,
   5.618 -			selection,
   5.619 +			sel,
   5.620 +			sel,
   5.621  			"paste ()",
   5.622 -			QString("Paste to %1").arg( getName(selection))
   5.623 +			QString("Paste to %1").arg( getName(sel))
   5.624  		);
   5.625  		mapCenter->reposition();
   5.626  	}
   5.627 @@ -1660,28 +1612,35 @@
   5.628  
   5.629  void MapEditor::cut()
   5.630  {
   5.631 -	saveStateChangingPart(
   5.632 -		selection->getParObj(),
   5.633 -		selection,
   5.634 -		"cut ()",
   5.635 -		QString("Cut %1").arg(getName(selection))
   5.636 -	);
   5.637 -	copy();
   5.638 -	cutNoSave();
   5.639 -	mapCenter->reposition();
   5.640 +	LinkableMapObj *sel=xelection.single();
   5.641 +	if ( sel && (xelection.type() == Branch ||
   5.642 +		xelection.type()==MapCenter ||
   5.643 +		xelection.type()==FloatImage))
   5.644 +	{
   5.645 +		saveStateChangingPart(
   5.646 +			sel->getParObj(),
   5.647 +			sel,
   5.648 +			"cut ()",
   5.649 +			QString("Cut %1").arg(getName(sel ))
   5.650 +		);
   5.651 +		copy();
   5.652 +		cutNoSave();
   5.653 +		mapCenter->reposition();
   5.654 +	}
   5.655  }
   5.656  
   5.657  void MapEditor::move(const int &x, const int &y)
   5.658  {
   5.659 -	if (selection)
   5.660 +	LinkableMapObj *sel=xelection.single();
   5.661 +	if (sel)
   5.662  	{
   5.663 -		QString ps=qpointfToString (selection->getAbsPos());
   5.664 -		QString s=selection->getSelectString();
   5.665 +		QString ps=qpointfToString (sel->getAbsPos());
   5.666 +		QString s=xelection.single()->getSelectString();
   5.667  		saveState(
   5.668  			s, "move "+ps, 
   5.669  			s, "move "+qpointfToString (QPointF (x,y)), 
   5.670 -			QString("Move %1 to  %2").arg(getName(selection)).arg(ps));
   5.671 -		selection->move(x,y);
   5.672 +			QString("Move %1 to  %2").arg(getName(sel)).arg(ps));
   5.673 +		sel->move(x,y);	// FIXME	xelection not moved automagically...
   5.674  		mapCenter->reposition();
   5.675  	}
   5.676  
   5.677 @@ -1689,35 +1648,34 @@
   5.678  
   5.679  void MapEditor::moveRel (const int &x, const int &y)
   5.680  {
   5.681 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   5.682 -				      typeid(*selection) == typeid(MapCenterObj) ||
   5.683 -					  typeid(*selection) == typeid (FloatImageObj))) 
   5.684 +	LinkableMapObj *sel=xelection.single();
   5.685 +	if (sel)
   5.686  	{
   5.687 -		QString ps=qpointfToString (selection->getRelPos());
   5.688 -		QString s=selection->getSelectString();
   5.689 +		QString ps=qpointfToString (sel->getRelPos());
   5.690 +		QString s=sel->getSelectString();
   5.691  		saveState(
   5.692  			s, "moveRel "+ps, 
   5.693  			s, "moveRel "+qpointfToString (QPointF (x,y)), 
   5.694 -			QString("Move %1 to relativ position %2").arg(getName(selection)).arg(ps));
   5.695 -		((OrnamentedObj*)selection)->move2RelPos (x,y);
   5.696 +			QString("Move %1 to relativ position %2").arg(getName(sel)).arg(ps));
   5.697 +		((OrnamentedObj*)sel)->move2RelPos (x,y);
   5.698  		mapCenter->reposition();
   5.699 -		selection->updateLink();
   5.700 +		sel->updateLink();
   5.701  	}
   5.702  }
   5.703  
   5.704  void MapEditor::moveBranchUp()
   5.705  {
   5.706 -	BranchObj* bo;
   5.707 +	BranchObj* bo=xelection.getBranch();
   5.708  	BranchObj* par;
   5.709 -	if (typeid(*selection) == typeid(BranchObj)  ) 
   5.710 +	if (bo)
   5.711  	{
   5.712 -		bo=(BranchObj*)selection;
   5.713  		if (!bo->canMoveBranchUp()) return;
   5.714  		par=(BranchObj*)(bo->getParObj());
   5.715 -		selection->unselect();
   5.716 +		xelection.unselect();		// FIXME needed?
   5.717  		bo=par->moveBranchUp (bo);	// bo will be the one below selection
   5.718 -		selection->select();
   5.719 -		saveState (selection,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
   5.720 +		xelection.reselect();
   5.721 +		//saveState (selection,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
   5.722 +		saveState (bo,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
   5.723  		mapCenter->reposition();
   5.724  		scene()->update();
   5.725  		ensureSelectionVisible();
   5.726 @@ -1726,63 +1684,61 @@
   5.727  
   5.728  void MapEditor::moveBranchDown()
   5.729  {
   5.730 -	BranchObj* bo;
   5.731 +	BranchObj* bo=xelection.getBranch();
   5.732  	BranchObj* par;
   5.733 -	if (typeid(*selection) == typeid(BranchObj)  ) 
   5.734 +	if (bo)
   5.735  	{
   5.736 -		bo=(BranchObj*)selection;
   5.737  		if (!bo->canMoveBranchDown()) return;
   5.738  		par=(BranchObj*)(bo->getParObj());
   5.739 -		selection->unselect(); 
   5.740 +		xelection.unselect();		// FIXME needed?
   5.741  		bo=par->moveBranchDown(bo);	// bo will be the one above selection
   5.742 -		selection->select();
   5.743 -		saveState(selection,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
   5.744 +		xelection.reselect();
   5.745 +		//saveState(selection,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
   5.746 +		saveState(bo,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
   5.747  		mapCenter->reposition();
   5.748  		scene()->update();
   5.749  		ensureSelectionVisible();
   5.750  	}	
   5.751  }
   5.752  
   5.753 -void MapEditor::linkTo(const QString &dstString)
   5.754 +void MapEditor::linkTo(const QString &dstString)	// FIXME needed? only for FIO ??
   5.755  {
   5.756 -	BranchObj *dst=(BranchObj*)(mapCenter->findObjBySelect(dstString));
   5.757 -	if (dst && (typeid(*dst)==typeid (BranchObj) || 
   5.758 -	            typeid(*dst)==typeid (MapCenterObj)))
   5.759 -	{			
   5.760 -		LinkableMapObj *dstPar=dst->getParObj();
   5.761 -		QString parString=dstPar->getSelectString();
   5.762 -		if (typeid(*selection)==typeid(FloatImageObj)) 
   5.763 -		{
   5.764 -			FloatImageObj *fio=(FloatImageObj*)selection;
   5.765 +	FloatImageObj *fio=xelection.getFloatImage();
   5.766 +	if (fio)
   5.767 +	{
   5.768 +		BranchObj *dst=(BranchObj*)(mapCenter->findObjBySelect(dstString));
   5.769 +		if (dst && (typeid(*dst)==typeid (BranchObj) || 
   5.770 +					typeid(*dst)==typeid (MapCenterObj)))
   5.771 +		{			
   5.772 +			LinkableMapObj *dstPar=dst->getParObj();
   5.773 +			QString parString=dstPar->getSelectString();
   5.774  			QString fioPreSelectString=fio->getSelectString();
   5.775  			QString fioPreParentSelectString=fio->getParObj()->getSelectString();
   5.776  			((BranchObj*)(dst))->addFloatImage (fio);
   5.777 -			fio->unselect();
   5.778 +			xelection.unselect();
   5.779  			((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
   5.780  			fio=((BranchObj*)(dst))->getLastFloatImage();
   5.781  			fio->setRelPos();
   5.782  			fio->reposition();
   5.783 -			selection=(LinkableMapObj*)fio;
   5.784 -			selection->select();
   5.785 +			xelection.select(fio);
   5.786  			saveState(
   5.787  				fio->getSelectString(),
   5.788  				QString("linkTo (\"%1\")").arg(fioPreParentSelectString), 
   5.789  				fioPreSelectString, 
   5.790  				QString ("linkTo (\"%1\")").arg(dstString),
   5.791  				QString ("Link floatimage to %1").arg(getName(dst)));
   5.792 -		}	
   5.793 +		}
   5.794  	}
   5.795  }
   5.796  
   5.797  QString MapEditor::getHeading(bool &ok, QPoint &p)
   5.798  {
   5.799 -	if (selection  &&  
   5.800 -		 (typeid(*selection) == typeid(BranchObj) || 
   5.801 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   5.802 +	BranchObj *bo=xelection.getBranch();
   5.803 +	if (bo)
   5.804  	{
   5.805  		ok=true;
   5.806 -		p=mapFromScene(selection->getAbsPos());
   5.807 -		return ((BranchObj*)selection)->getHeading();
   5.808 +		p=mapFromScene(bo->getAbsPos());
   5.809 +		return bo->getHeading();
   5.810  	}
   5.811  	ok=false;
   5.812  	return QString();
   5.813 @@ -1790,19 +1746,16 @@
   5.814  
   5.815  void MapEditor::setHeading(const QString &s)
   5.816  {
   5.817 -	if (selection  &&  
   5.818 -		 (typeid(*selection) == typeid(BranchObj) || 
   5.819 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   5.820 +	BranchObj *sel=xelection.getBranch();
   5.821 +	if (sel)
   5.822  	{
   5.823 -		editingBO=(BranchObj*)selection;
   5.824  		saveState(
   5.825 -			selection,
   5.826 -			"setHeading (\""+editingBO->getHeading()+"\")", 
   5.827 -			selection,
   5.828 +			sel,
   5.829 +			"setHeading (\""+sel->getHeading()+"\")", 
   5.830 +			sel,
   5.831  			"setHeading (\""+s+"\")", 
   5.832 -			QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(s) );
   5.833 -		editingBO->setHeading(s );
   5.834 -		editingBO=NULL;
   5.835 +			QString("Set heading of %1 to \"%2\"").arg(getName(sel)).arg(s) );
   5.836 +		sel->setHeading(s );
   5.837  		mapCenter->reposition();
   5.838  		ensureSelectionVisible();
   5.839  	}
   5.840 @@ -1811,11 +1764,10 @@
   5.841  void MapEditor::setURLInt (const QString &s)
   5.842  {
   5.843  	// Internal function, no saveState needed
   5.844 -	if (selection  &&  
   5.845 -		 (typeid(*selection) == typeid(BranchObj) || 
   5.846 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   5.847 +	BranchObj *bo=xelection.getBranch();
   5.848 +	if (bo)
   5.849  	{
   5.850 -		((BranchObj*)selection)->setURL(s);
   5.851 +		bo->setURL(s);
   5.852  		mapCenter->reposition();
   5.853  		ensureSelectionVisible();
   5.854  	}
   5.855 @@ -1823,11 +1775,10 @@
   5.856  
   5.857  void MapEditor::setHeadingInt(const QString &s)
   5.858  {
   5.859 -	if (selection  &&  
   5.860 -		 (typeid(*selection) == typeid(BranchObj) || 
   5.861 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   5.862 +	BranchObj *bo=xelection.getBranch();
   5.863 +	if (bo)
   5.864  	{
   5.865 -		((BranchObj*)selection)->setHeading(s);
   5.866 +		bo->setHeading(s);
   5.867  		mapCenter->reposition();
   5.868  		ensureSelectionVisible();
   5.869  	}
   5.870 @@ -1836,11 +1787,10 @@
   5.871  void MapEditor::setVymLinkInt (const QString &s)
   5.872  {
   5.873  	// Internal function, no saveState needed
   5.874 -	if (selection  &&  
   5.875 -		 (typeid(*selection) == typeid(BranchObj) || 
   5.876 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   5.877 +	BranchObj *bo=xelection.getBranch();
   5.878 +	if (bo)
   5.879  	{
   5.880 -		((BranchObj*)selection)->setVymLink(s);
   5.881 +		bo->setVymLink(s);
   5.882  		mapCenter->reposition();
   5.883  		ensureSelectionVisible();
   5.884  	}
   5.885 @@ -1854,11 +1804,9 @@
   5.886  	// -1		insert in childs of parent below selection 
   5.887  	// 0..n		insert in childs of parent at pos
   5.888  	BranchObj *newbo=NULL;
   5.889 -	if (selection  &&  
   5.890 -		 (typeid(*selection) == typeid(BranchObj) || 
   5.891 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   5.892 +	BranchObj *bo=xelection.getBranch();
   5.893 +	if (bo)
   5.894  	{
   5.895 -		BranchObj* bo = (BranchObj*) selection;
   5.896  		if (num==-2)
   5.897  		{
   5.898  			// save scroll state. If scrolled, automatically select
   5.899 @@ -1886,12 +1834,10 @@
   5.900  	// -1	add above
   5.901  	//  0	add as child
   5.902  	// +1	add below
   5.903 -	BranchObj *bo = (BranchObj*) selection;
   5.904 +	BranchObj *bo = xelection.getBranch();
   5.905  	BranchObj *newbo=NULL;
   5.906  
   5.907 -	if (selection  &&  
   5.908 -		 (typeid(*selection) == typeid(BranchObj) || 
   5.909 -		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   5.910 +	if (bo)
   5.911  	{
   5.912  		setCursor (Qt::ArrowCursor);
   5.913  
   5.914 @@ -1902,7 +1848,7 @@
   5.915  			saveState(
   5.916  				newbo,		
   5.917  				"delete ()",
   5.918 -				selection,
   5.919 +				bo,
   5.920  				QString ("addBranch (%1)").arg(pos-2),
   5.921  				QString ("Add new branch to %1").arg(getName(bo)));	
   5.922  
   5.923 @@ -1916,15 +1862,14 @@
   5.924  BranchObj* MapEditor::addNewBranchBefore()
   5.925  {
   5.926  	BranchObj *newbo=NULL;
   5.927 -	if (selection  &&  
   5.928 -		 (typeid(*selection) == typeid(BranchObj) ) )
   5.929 +	BranchObj *bo = xelection.getBranch();
   5.930 +	if (bo && xelection.type()==Branch)
   5.931  		 // We accept no MapCenterObj here, so we _have_ a parent
   5.932  	{
   5.933 -		BranchObj* bo = (BranchObj*) selection;
   5.934  		QPointF p=bo->getRelPos();
   5.935  
   5.936  
   5.937 -		BranchObj *parbo=(BranchObj*)(selection->getParObj());
   5.938 +		BranchObj *parbo=(BranchObj*)(bo->getParObj());
   5.939  
   5.940  		// add below selection
   5.941  		newbo=parbo->insertBranch(bo->getNum()+1);
   5.942 @@ -1933,7 +1878,7 @@
   5.943  			newbo->move2RelPos (p);
   5.944  
   5.945  			// Move selection to new branch
   5.946 -			((BranchObj*)selection)->linkTo (newbo,-1);
   5.947 +			bo->linkTo (newbo,-1);
   5.948  
   5.949  			saveState (newbo, "deleteKeepChilds ()", newbo, "addBranchBefore ()", 
   5.950  				QString ("Add branch before %1").arg(getName(bo)));
   5.951 @@ -1946,22 +1891,22 @@
   5.952  
   5.953  void MapEditor::deleteSelection()
   5.954  {
   5.955 -	if (selection  && typeid(*selection) ==typeid(BranchObj) ) 
   5.956 +	BranchObj *bo = xelection.getBranch();
   5.957 +	if (bo && xelection.type()==Branch)
   5.958  	{
   5.959 -		BranchObj* bo=(BranchObj*)selection;
   5.960  		BranchObj* par=(BranchObj*)(bo->getParObj());
   5.961 -		bo->unselect();
   5.962 +		xelection.unselect();
   5.963  		saveStateRemovingPart (bo, QString ("Delete %1").arg(getName(bo)));
   5.964 -		selection=NULL;
   5.965  		par->removeBranch(bo);
   5.966 -		selection=par;
   5.967 -		selection->select();
   5.968 +		xelection.select (par);
   5.969  		ensureSelectionVisible();
   5.970  		mapCenter->reposition();
   5.971 +		mapScene->update();
   5.972 +		return;
   5.973  	}
   5.974 -	if (selection  && typeid(*selection) ==typeid(FloatImageObj) ) 
   5.975 +	FloatImageObj *fio=xelection.getFloatImage();
   5.976 +	if (fio)
   5.977  	{
   5.978 -		FloatImageObj* fio=(FloatImageObj*)selection;
   5.979  		BranchObj* par=(BranchObj*)(fio->getParObj());
   5.980  		saveStateChangingPart(
   5.981  			par, 
   5.982 @@ -1969,40 +1914,29 @@
   5.983  			"delete ()",
   5.984  			QString("Delete %1").arg(getName(fio))
   5.985  		);
   5.986 -		fio->unselect();
   5.987 -		selection=NULL;
   5.988 +		xelection.unselect();
   5.989  		par->removeFloatImage(fio);
   5.990 -		selection=par;
   5.991 -		selection->select();
   5.992 +		xelection.select (par);
   5.993  		ensureSelectionVisible();
   5.994  		mapCenter->reposition();
   5.995 +		mapScene->update();
   5.996 +		return;
   5.997  	}
   5.998 -	mapScene->update();
   5.999  }
  5.1000  
  5.1001  LinkableMapObj* MapEditor::getSelection()
  5.1002  {
  5.1003 -	return selection;
  5.1004 +	return xelection.single();
  5.1005  }
  5.1006  
  5.1007  void MapEditor::unselect()
  5.1008  {
  5.1009 -	if (selection) 
  5.1010 -	{
  5.1011 -		selectionLast=selection;
  5.1012 -		selection->unselect();
  5.1013 -		selection=NULL;
  5.1014 -	}
  5.1015 +	xelection.unselect();
  5.1016  }	
  5.1017  
  5.1018  void MapEditor::reselect()
  5.1019  {
  5.1020 -	if (selectionLast)
  5.1021 -	{
  5.1022 -		selection=selectionLast;
  5.1023 -		selection->select();
  5.1024 -		selectionLast=NULL;
  5.1025 -	}
  5.1026 +	xelection.reselect();
  5.1027  }	
  5.1028  
  5.1029  bool MapEditor::select (const QString &s)
  5.1030 @@ -2012,9 +1946,8 @@
  5.1031  	// Finally select the found object
  5.1032  	if (lmo)
  5.1033  	{
  5.1034 -		if (selection) unselect();
  5.1035 -		selection=lmo;
  5.1036 -		selection->select();
  5.1037 +		xelection.unselect();
  5.1038 +		xelection.select(lmo);
  5.1039  		ensureSelectionVisible();
  5.1040  		return true;
  5.1041  	} 
  5.1042 @@ -2023,27 +1956,22 @@
  5.1043  
  5.1044  QString MapEditor::getSelectString()
  5.1045  {
  5.1046 -	if (selection) return selection->getSelectString();
  5.1047 -	return QString();
  5.1048 +	return xelection.getSelectString();
  5.1049  }
  5.1050  
  5.1051  void MapEditor::selectInt (LinkableMapObj *lmo)
  5.1052  {
  5.1053 -	if (lmo && selection != lmo)
  5.1054 -	{
  5.1055 -		// select the MapObj
  5.1056 -		if (selection) selection->unselect();
  5.1057 -		selection=lmo;
  5.1058 -		selection->select();
  5.1059 -	}
  5.1060 +	if (lmo && xelection.single()!= lmo)
  5.1061 +		xelection.select(lmo);
  5.1062  }
  5.1063  
  5.1064  void MapEditor::selectNextBranchInt()
  5.1065  {
  5.1066  	// Increase number of branch
  5.1067 -	if (selection)
  5.1068 +	LinkableMapObj *sel=xelection.single();
  5.1069 +	if (sel)
  5.1070  	{
  5.1071 -		QString s=selection->getSelectString();
  5.1072 +		QString s=sel->getSelectString();
  5.1073  		QString part;
  5.1074  		QString typ;
  5.1075  		QString num;
  5.1076 @@ -2067,7 +1995,7 @@
  5.1077  		// try to increase the parental number in order to
  5.1078  		// find a successor with same depth
  5.1079  
  5.1080 -		int d=selection->getDepth();
  5.1081 +		int d=xelection.single()->getDepth();
  5.1082  		int oldDepth=d;
  5.1083  		int i;
  5.1084  		bool found=false;
  5.1085 @@ -2088,7 +2016,7 @@
  5.1086  			} else
  5.1087  			{
  5.1088  				// Special case, look at orientation
  5.1089 -				if (selection->getOrientation()==OrientRightOfCenter)
  5.1090 +				if (xelection.single()->getOrientation()==OrientRightOfCenter)
  5.1091  					num=QString ("%1").arg(num.toUInt()+1);
  5.1092  				else	
  5.1093  					num=QString ("%1").arg(num.toUInt()-1);
  5.1094 @@ -2102,7 +2030,7 @@
  5.1095  					b=select (s);
  5.1096  					if (b)
  5.1097  					{	
  5.1098 -						if ( ((BranchObj*)selection)->countBranches()>0)
  5.1099 +						if ( xelection.getBranch()->countBranches()>0)
  5.1100  							s+=",bo:0";
  5.1101  						else	
  5.1102  							break;
  5.1103 @@ -2121,9 +2049,10 @@
  5.1104  void MapEditor::selectPrevBranchInt()
  5.1105  {
  5.1106  	// Decrease number of branch
  5.1107 -	if (selection)
  5.1108 +	BranchObj *bo=xelection.getBranch();
  5.1109 +	if (bo)
  5.1110  	{
  5.1111 -		QString s=selection->getSelectString();
  5.1112 +		QString s=bo->getSelectString();
  5.1113  		QString part;
  5.1114  		QString typ;
  5.1115  		QString num;
  5.1116 @@ -2148,7 +2077,7 @@
  5.1117  		// try to decrease the parental number in order to
  5.1118  		// find a precessor with same depth
  5.1119  
  5.1120 -		int d=selection->getDepth();
  5.1121 +		int d=xelection.single()->getDepth();
  5.1122  		int oldDepth=d;
  5.1123  		int i;
  5.1124  		bool found=false;
  5.1125 @@ -2169,7 +2098,7 @@
  5.1126  			} else
  5.1127  			{
  5.1128  				// Special case, look at orientation
  5.1129 -				if (selection->getOrientation()==OrientRightOfCenter)
  5.1130 +				if (xelection.single()->getOrientation()==OrientRightOfCenter)
  5.1131  					num=QString ("%1").arg(num.toInt()-1);
  5.1132  				else	
  5.1133  					num=QString ("%1").arg(num.toInt()+1);
  5.1134 @@ -2182,8 +2111,8 @@
  5.1135  				{
  5.1136  					b=select (s);
  5.1137  					if (b)
  5.1138 -						if ( ((BranchObj*)selection)->countBranches()>0)
  5.1139 -							s+=",bo:"+ QString ("%1").arg( ((BranchObj*)selection)->countBranches()-1 );
  5.1140 +						if ( xelection.getBranch()->countBranches()>0)
  5.1141 +							s+=",bo:"+ QString ("%1").arg( xelection.getBranch()->countBranches()-1 );
  5.1142  						else	
  5.1143  							break;
  5.1144  					else
  5.1145 @@ -2200,36 +2129,30 @@
  5.1146  
  5.1147  void MapEditor::selectUpperBranch()
  5.1148  {
  5.1149 -	if (selection) 
  5.1150 +	BranchObj *bo=xelection.getBranch();
  5.1151 +	if (bo && xelection.type()==Branch)
  5.1152  	{
  5.1153 -		if (typeid(*selection) == typeid(BranchObj))
  5.1154 -		{
  5.1155 -			if (selection->getOrientation()==OrientRightOfCenter)
  5.1156 +		if (bo->getOrientation()==OrientRightOfCenter)
  5.1157 +			selectPrevBranchInt();
  5.1158 +		else
  5.1159 +			if (bo->getDepth()==1)
  5.1160 +				selectNextBranchInt();
  5.1161 +			else
  5.1162 +				selectPrevBranchInt();
  5.1163 +	}
  5.1164 +}
  5.1165 +
  5.1166 +void MapEditor::selectLowerBranch()
  5.1167 +{
  5.1168 +	BranchObj *bo=xelection.getBranch();
  5.1169 +	if (bo && xelection.type()==Branch)
  5.1170 +		if (bo->getOrientation()==OrientRightOfCenter)
  5.1171 +			selectNextBranchInt();
  5.1172 +		else
  5.1173 +			if (bo->getDepth()==1)
  5.1174  				selectPrevBranchInt();
  5.1175  			else
  5.1176 -				if (selection->getDepth()==1)
  5.1177 -					selectNextBranchInt();
  5.1178 -				else
  5.1179 -					selectPrevBranchInt();
  5.1180 -		}		
  5.1181 -	}
  5.1182 -}
  5.1183 -
  5.1184 -void MapEditor::selectLowerBranch()
  5.1185 -{
  5.1186 -	if (selection) 
  5.1187 -	{
  5.1188 -		if (typeid(*selection) == typeid(BranchObj))
  5.1189 -		{
  5.1190 -			if (selection->getOrientation()==OrientRightOfCenter)
  5.1191  				selectNextBranchInt();
  5.1192 -			else
  5.1193 -				if (selection->getDepth()==1)
  5.1194 -					selectPrevBranchInt();
  5.1195 -				else
  5.1196 -					selectNextBranchInt();
  5.1197 -		}		
  5.1198 -	}
  5.1199  }
  5.1200  
  5.1201  
  5.1202 @@ -2237,50 +2160,44 @@
  5.1203  {
  5.1204  	BranchObj* bo;
  5.1205  	BranchObj* par;
  5.1206 -	if (selection) 
  5.1207 +	LinkableMapObj *sel=xelection.single();
  5.1208 +	if (sel)
  5.1209  	{
  5.1210 -		if (typeid(*selection) == typeid(MapCenterObj))
  5.1211 +		if (xelection.type()== MapCenter)
  5.1212  		{
  5.1213 -			par=  (BranchObj*) selection;
  5.1214 +			par=xelection.getBranch();
  5.1215  			bo=par->getLastSelectedBranch();
  5.1216  			if (bo)
  5.1217  			{
  5.1218  				// Workaround for reselecting on left and right side
  5.1219  				if (bo->getOrientation()==OrientRightOfCenter)
  5.1220 +					bo=par->getLastBranch();
  5.1221 +				if (bo)
  5.1222  				{
  5.1223  					bo=par->getLastBranch();
  5.1224 -				}	
  5.1225 -				if (bo)
  5.1226 -				{
  5.1227 -					par->unselect();
  5.1228 -					selection=bo;
  5.1229 -					selection->select();
  5.1230 +					xelection.select(bo);
  5.1231  					ensureSelectionVisible();
  5.1232  				}
  5.1233  			}	
  5.1234  		} else
  5.1235  		{
  5.1236 -			par=(BranchObj*)(selection->getParObj());
  5.1237 -			if (selection->getOrientation()==OrientRightOfCenter)
  5.1238 +			par=(BranchObj*)(sel->getParObj());
  5.1239 +			if (sel->getOrientation()==OrientRightOfCenter)
  5.1240  			{
  5.1241 -				if (typeid(*selection) == typeid(BranchObj) ||
  5.1242 -					typeid(*selection) == typeid(FloatImageObj))
  5.1243 +				if (xelection.type() == Branch ||
  5.1244 +					xelection.type() == FloatImage)
  5.1245  				{
  5.1246 -					selection->unselect();
  5.1247 -					selection=par;
  5.1248 -					selection->select();
  5.1249 +					xelection.select(par);
  5.1250  					ensureSelectionVisible();
  5.1251  				}
  5.1252  			} else
  5.1253  			{
  5.1254 -				if (typeid(*selection) == typeid(BranchObj) )
  5.1255 +				if (xelection.type() == Branch )
  5.1256  				{
  5.1257 -					bo=((BranchObj*)selection)->getLastSelectedBranch();
  5.1258 +					bo=xelection.getBranch()->getLastSelectedBranch();
  5.1259  					if (bo) 
  5.1260  					{
  5.1261 -						selection->unselect();
  5.1262 -						selection=bo;
  5.1263 -						selection->select();
  5.1264 +						xelection.select(bo);
  5.1265  						ensureSelectionVisible();
  5.1266  					}
  5.1267  				}
  5.1268 @@ -2293,12 +2210,12 @@
  5.1269  {
  5.1270  	BranchObj* bo;
  5.1271  	BranchObj* par;
  5.1272 -
  5.1273 -	if (selection) 
  5.1274 +	LinkableMapObj *sel=xelection.single();
  5.1275 +	if (sel)
  5.1276  	{
  5.1277 -		if (typeid(*selection) == typeid(MapCenterObj))
  5.1278 +		if (xelection.type()==MapCenter) 
  5.1279  		{
  5.1280 -			par=  (BranchObj*) selection;
  5.1281 +			par=xelection.getBranch();
  5.1282  			bo=par->getLastSelectedBranch();
  5.1283  			if (bo)
  5.1284  			{
  5.1285 @@ -2307,35 +2224,29 @@
  5.1286  					bo=par->getFirstBranch();
  5.1287  				if (bo)
  5.1288  				{
  5.1289 -					par->unselect();
  5.1290 -					selection=bo;
  5.1291 -					selection->select();
  5.1292 +					xelection.select(bo);
  5.1293  					ensureSelectionVisible();
  5.1294  				}
  5.1295  			}
  5.1296  		} else
  5.1297  		{
  5.1298 -			par=(BranchObj*)(selection->getParObj());
  5.1299 -			if (selection->getOrientation()==OrientLeftOfCenter)
  5.1300 +			par=(BranchObj*)(xelection.single()->getParObj());
  5.1301 +			if (xelection.single()->getOrientation()==OrientLeftOfCenter)
  5.1302  			{
  5.1303 -				if (typeid(*selection) == typeid(BranchObj) ||
  5.1304 -					typeid(*selection) == typeid(FloatImageObj))
  5.1305 +				if (xelection.type() == Branch ||
  5.1306 +					xelection.type() == FloatImage)
  5.1307  				{
  5.1308 -					selection->unselect();
  5.1309 -					selection=par;
  5.1310 -					selection->select();
  5.1311 +					xelection.select(par);
  5.1312  					ensureSelectionVisible();
  5.1313  				}
  5.1314  			} else
  5.1315  			{
  5.1316 -				if (typeid(*selection) == typeid(BranchObj) )
  5.1317 +				if (xelection.type()  == Branch) 
  5.1318  				{
  5.1319 -					bo=((BranchObj*)selection)->getLastSelectedBranch();
  5.1320 +					bo=xelection.getBranch()->getLastSelectedBranch();
  5.1321  					if (bo) 
  5.1322  					{
  5.1323 -						selection->unselect();
  5.1324 -						selection=bo;
  5.1325 -						selection->select();
  5.1326 +						xelection.select(bo);
  5.1327  						ensureSelectionVisible();
  5.1328  					}
  5.1329  				}
  5.1330 @@ -2346,44 +2257,35 @@
  5.1331  
  5.1332  void MapEditor::selectFirstBranch()
  5.1333  {
  5.1334 -	BranchObj *bo1;
  5.1335 +	BranchObj *bo1=xelection.getBranch();
  5.1336  	BranchObj *bo2;
  5.1337  	BranchObj* par;
  5.1338 -	if (selection) {
  5.1339 -		if (typeid(*selection) == typeid(BranchObj))
  5.1340 -		{
  5.1341 -			bo1=  (BranchObj*) selection;
  5.1342 -			par=(BranchObj*)(bo1->getParObj());
  5.1343 -			bo2=par->getFirstBranch();
  5.1344 -			if (bo2) {
  5.1345 -				bo1->unselect();
  5.1346 -				selection=bo2;
  5.1347 -				selection->select();
  5.1348 -				ensureSelectionVisible();
  5.1349 -			}
  5.1350 -		}		
  5.1351 -	}
  5.1352 +	if (bo1)
  5.1353 +	{
  5.1354 +		par=(BranchObj*)(bo1->getParObj());
  5.1355 +		bo2=par->getFirstBranch();
  5.1356 +		if (bo2) {
  5.1357 +			xelection.select(bo2);
  5.1358 +			ensureSelectionVisible();
  5.1359 +		}
  5.1360 +	}		
  5.1361  }
  5.1362  
  5.1363  void MapEditor::selectLastBranch()
  5.1364  {
  5.1365 -	BranchObj *bo1;
  5.1366 +	BranchObj *bo1=xelection.getBranch();
  5.1367  	BranchObj *bo2;
  5.1368  	BranchObj* par;
  5.1369 -	if (selection) {
  5.1370 -		if (typeid(*selection) == typeid(BranchObj))
  5.1371 +	if (bo1)
  5.1372 +	{
  5.1373 +		par=(BranchObj*)(bo1->getParObj());
  5.1374 +		bo2=par->getLastBranch();
  5.1375 +		if (bo2) 
  5.1376  		{
  5.1377 -			bo1=  (BranchObj*) selection;
  5.1378 -			par=(BranchObj*)(bo1->getParObj());
  5.1379 -			bo2=par->getLastBranch();
  5.1380 -			if (bo2) {
  5.1381 -				bo1->unselect();
  5.1382 -				selection=bo2;
  5.1383 -				selection->select();
  5.1384 -				ensureSelectionVisible();
  5.1385 -			}
  5.1386 -		}		
  5.1387 -	}
  5.1388 +			xelection.select(bo2);
  5.1389 +			ensureSelectionVisible();
  5.1390 +		}
  5.1391 +	}		
  5.1392  }
  5.1393  
  5.1394  void MapEditor::selectMapBackgroundImage ()
  5.1395 @@ -2418,7 +2320,7 @@
  5.1396  		QString ("setMapBackgroundImage (%1)").arg(col.name()),
  5.1397  		QString("Set background color of map to %1").arg(col.name()));
  5.1398  	*/	
  5.1399 -	cout << "Trying to load "<<fn.ascii()<<endl;
  5.1400 +	cout << "Trying to load "<<fn.ascii()<<endl;//FIXME
  5.1401  	QBrush brush;
  5.1402  	brush.setTextureImage (QPixmap (fn));
  5.1403  	mapScene->setBackgroundBrush(brush);
  5.1404 @@ -2436,9 +2338,9 @@
  5.1405  {
  5.1406  	QColor oldcol=mapScene->backgroundBrush().color();
  5.1407  	saveState(
  5.1408 -		selection,
  5.1409 +		mapCenter,
  5.1410  		QString ("setMapBackgroundColor (%1)").arg(oldcol.name()),
  5.1411 -		selection,
  5.1412 +		mapCenter,
  5.1413  		QString ("setMapBackgroundColor (%1)").arg(col.name()),
  5.1414  		QString("Set background color of map to %1").arg(col.name()));
  5.1415  	mapScene->setBackgroundBrush(col);
  5.1416 @@ -2451,15 +2353,8 @@
  5.1417  
  5.1418  QColor MapEditor::getCurrentHeadingColor()
  5.1419  {
  5.1420 -	if (selection) 
  5.1421 -	{
  5.1422 -		if (typeid(*selection) == typeid(BranchObj) ||
  5.1423 -			typeid(*selection) == typeid(MapCenterObj))
  5.1424 -		{
  5.1425 -			BranchObj *bo=(BranchObj*)selection;
  5.1426 -			return bo->getColor(); 
  5.1427 -		}    
  5.1428 -	}
  5.1429 +	BranchObj *bo=xelection.getBranch();
  5.1430 +	if (bo) return bo->getColor(); 
  5.1431  	
  5.1432  	QMessageBox::warning(0,tr("Warning"),tr("Can't get color of heading,\nthere's no branch selected"));
  5.1433  	return Qt::black;
  5.1434 @@ -2467,72 +2362,60 @@
  5.1435  
  5.1436  void MapEditor::colorBranch (QColor c)
  5.1437  {
  5.1438 -	if (selection) 
  5.1439 +	BranchObj *bo=xelection.getBranch();
  5.1440 +	if (bo)
  5.1441  	{
  5.1442 -		if (typeid(*selection) == typeid(BranchObj) ||
  5.1443 -			typeid(*selection) == typeid(MapCenterObj))
  5.1444 -		{
  5.1445 -			BranchObj *bo=(BranchObj*)selection;
  5.1446 -			saveState(
  5.1447 -				selection, 
  5.1448 -				QString ("colorBranch (%1)").arg(bo->getColor().name()),
  5.1449 -				selection,
  5.1450 -				QString ("colorBranch (%1)").arg(c.name()),
  5.1451 -				QString("Set color of %1 to %2").arg(getName(bo)).arg(c.name())
  5.1452 -			);	
  5.1453 -			bo->setColor(c); // color branch
  5.1454 -		}    
  5.1455 +		saveState(
  5.1456 +			bo, 
  5.1457 +			QString ("colorBranch (%1)").arg(bo->getColor().name()),
  5.1458 +			bo,
  5.1459 +			QString ("colorBranch (%1)").arg(c.name()),
  5.1460 +			QString("Set color of %1 to %2").arg(getName(bo)).arg(c.name())
  5.1461 +		);	
  5.1462 +		bo->setColor(c); // color branch
  5.1463  	}
  5.1464  }
  5.1465  
  5.1466  void MapEditor::colorSubtree (QColor c)
  5.1467  {
  5.1468 -	if (selection) 
  5.1469 +	BranchObj *bo=xelection.getBranch();
  5.1470 +	if (bo) 
  5.1471  	{
  5.1472 -		if (typeid(*selection) == typeid(BranchObj) ||
  5.1473 -			typeid(*selection) == typeid(MapCenterObj))
  5.1474 -		{
  5.1475 -			BranchObj *bo=(BranchObj*)selection;
  5.1476 -			saveStateChangingPart(
  5.1477 -				selection, 
  5.1478 -				selection,
  5.1479 -				QString ("colorSubtree (%1)").arg(c.name()),
  5.1480 -				QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(c.name())
  5.1481 -			);	
  5.1482 -			bo->setColorSubtree (c); // color links, color childs
  5.1483 -		}    
  5.1484 +		saveStateChangingPart(
  5.1485 +			bo, 
  5.1486 +			bo,
  5.1487 +			QString ("colorSubtree (%1)").arg(c.name()),
  5.1488 +			QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(c.name())
  5.1489 +		);	
  5.1490 +		bo->setColorSubtree (c); // color links, color childs
  5.1491  	}
  5.1492  }
  5.1493  
  5.1494  
  5.1495  void MapEditor::toggleStandardFlag(QString f)
  5.1496  {
  5.1497 -	if (selection)
  5.1498 +	BranchObj *bo=xelection.getBranch();
  5.1499 +	if (bo) 
  5.1500  	{
  5.1501 -		if (typeid(*selection) == typeid(BranchObj) ||
  5.1502 -			typeid(*selection) == typeid(MapCenterObj))
  5.1503 +		QString u,r;
  5.1504 +		if (bo->isSetStandardFlag(f))
  5.1505  		{
  5.1506 -			BranchObj *bo=(BranchObj*)selection;
  5.1507 -			QString u,r;
  5.1508 -			if (bo->isSetStandardFlag(f))
  5.1509 -			{
  5.1510 -				r="unsetFlag";
  5.1511 -				u="setFlag";
  5.1512 -			}	
  5.1513 -			else
  5.1514 -			{
  5.1515 -				u="unsetFlag";
  5.1516 -				r="setFlag";
  5.1517 -			}	
  5.1518 -			saveState(
  5.1519 -				selection,
  5.1520 -				QString("%1 (\"%2\")").arg(u).arg(f), 
  5.1521 -				selection,
  5.1522 -				QString("%1 (\"%2\")").arg(r).arg(f),
  5.1523 -				QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo)));
  5.1524 -			bo->toggleStandardFlag (f,mainWindow->useFlagGroups());
  5.1525 -		}
  5.1526 -	}	
  5.1527 +			r="unsetFlag";
  5.1528 +			u="setFlag";
  5.1529 +		}	
  5.1530 +		else
  5.1531 +		{
  5.1532 +			u="unsetFlag";
  5.1533 +			r="setFlag";
  5.1534 +		}	
  5.1535 +		saveState(
  5.1536 +			bo,
  5.1537 +			QString("%1 (\"%2\")").arg(u).arg(f), 
  5.1538 +			bo,
  5.1539 +			QString("%1 (\"%2\")").arg(r).arg(f),
  5.1540 +			QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo)));
  5.1541 +		bo->toggleStandardFlag (f,mainWindow->useFlagGroups());
  5.1542 +	}
  5.1543  }
  5.1544  
  5.1545  
  5.1546 @@ -2557,11 +2440,9 @@
  5.1547  			// Searching in Note
  5.1548  			if (itFind->getNote().contains(s,cs))
  5.1549  			{
  5.1550 -				if (selection!=itFind) 
  5.1551 +				if (xelection.single()!=itFind) 
  5.1552  				{
  5.1553 -					if (selection) ((BranchObj*)selection)->unselect();
  5.1554 -					selection=itFind;
  5.1555 -					selection->select();
  5.1556 +					xelection.select(itFind);
  5.1557  					ensureSelectionVisible();
  5.1558  				}
  5.1559  				if (textEditor->findText(s,flags)) 
  5.1560 @@ -2573,9 +2454,7 @@
  5.1561  			// Searching in Heading
  5.1562  			if (searching && itFind->getHeading().contains (s,cs) ) 
  5.1563  			{
  5.1564 -				if (selection) ((BranchObj*)selection)->unselect();
  5.1565 -				selection=itFind;
  5.1566 -				selection->select();
  5.1567 +				xelection.select(itFind);
  5.1568  				ensureSelectionVisible();
  5.1569  				searching=false;
  5.1570  			}
  5.1571 @@ -2587,9 +2466,8 @@
  5.1572  		}
  5.1573  	}	
  5.1574  	if (!searching)
  5.1575 -	{
  5.1576 -		return (BranchObj*)selection;
  5.1577 -	}	else
  5.1578 +		return xelection.getBranch();
  5.1579 +	else
  5.1580  		return NULL;
  5.1581  }
  5.1582  
  5.1583 @@ -2600,16 +2478,15 @@
  5.1584  }
  5.1585  void MapEditor::setURL(const QString &url)
  5.1586  {
  5.1587 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1588 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1589 -	{		
  5.1590 -		BranchObj *bo=(BranchObj*)selection;
  5.1591 +	BranchObj *bo=xelection.getBranch();
  5.1592 +	if (bo)
  5.1593 +	{
  5.1594  		QString oldurl=bo->getURL();
  5.1595  		bo->setURL (url);
  5.1596  		saveState (
  5.1597 -			selection,
  5.1598 +			bo,
  5.1599  			QString ("setURL (\"%1\")").arg(oldurl),
  5.1600 -			selection,
  5.1601 +			bo,
  5.1602  			QString ("setURL (\"%1\")").arg(url),
  5.1603  			QString ("set URL of %1 to %2").arg(getName(bo)).arg(url)
  5.1604  		);
  5.1605 @@ -2619,11 +2496,10 @@
  5.1606  
  5.1607  void MapEditor::editURL()
  5.1608  {
  5.1609 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1610 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1611 +	BranchObj *bo=xelection.getBranch();
  5.1612 +	if (bo)
  5.1613  	{		
  5.1614  		bool ok;
  5.1615 -		BranchObj *bo=(BranchObj*)selection;
  5.1616  		QString text = QInputDialog::getText(
  5.1617  				"VYM", tr("Enter URL:"), QLineEdit::Normal,
  5.1618  				bo->getURL(), &ok, this );
  5.1619 @@ -2635,9 +2511,9 @@
  5.1620  
  5.1621  QString MapEditor::getURL()
  5.1622  {
  5.1623 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1624 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1625 -		return ((BranchObj*)selection)->getURL();
  5.1626 +	BranchObj *bo=xelection.getBranch();
  5.1627 +	if (bo)
  5.1628 +		return bo->getURL();
  5.1629  	else
  5.1630  		return "";
  5.1631  }
  5.1632 @@ -2645,10 +2521,9 @@
  5.1633  QStringList MapEditor::getURLs()
  5.1634  {
  5.1635  	QStringList urls;
  5.1636 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1637 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1638 +	BranchObj *bo=xelection.getBranch();
  5.1639 +	if (bo)
  5.1640  	{		
  5.1641 -		BranchObj *bo=(BranchObj*)selection;
  5.1642  		bo=bo->first();	
  5.1643  		while (bo) 
  5.1644  		{
  5.1645 @@ -2662,17 +2537,16 @@
  5.1646  
  5.1647  void MapEditor::editHeading2URL()
  5.1648  {
  5.1649 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1650 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1651 -		setURL (((BranchObj*)selection)->getHeading());
  5.1652 +	BranchObj *bo=xelection.getBranch();
  5.1653 +	if (bo)
  5.1654 +		setURL (bo->getHeading());
  5.1655  }	
  5.1656  
  5.1657  void MapEditor::editBugzilla2URL()
  5.1658  {
  5.1659 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1660 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1661 +	BranchObj *bo=xelection.getBranch();
  5.1662 +	if (bo)
  5.1663  	{		
  5.1664 -		BranchObj *bo=(BranchObj*)selection;
  5.1665  		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
  5.1666  		setURL (url);
  5.1667  	}
  5.1668 @@ -2680,15 +2554,14 @@
  5.1669  
  5.1670  void MapEditor::editFATE2URL()
  5.1671  {
  5.1672 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1673 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1674 +	BranchObj *bo=xelection.getBranch();
  5.1675 +	if (bo)
  5.1676  	{		
  5.1677 -		BranchObj *bo=(BranchObj*)selection;
  5.1678  		QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
  5.1679  		saveState(
  5.1680 -			selection,
  5.1681 +			bo,
  5.1682  			"setURL (\""+bo->getURL()+"\")",
  5.1683 -			selection,
  5.1684 +			bo,
  5.1685  			"setURL (\""+url+"\")",
  5.1686  			QString("Use heading of %1 as link to FATE").arg(getName(bo))
  5.1687  		);	
  5.1688 @@ -2699,10 +2572,9 @@
  5.1689  
  5.1690  void MapEditor::editVymLink()
  5.1691  {
  5.1692 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1693 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1694 +	BranchObj *bo=xelection.getBranch();
  5.1695 +	if (bo)
  5.1696  	{		
  5.1697 -		BranchObj *bo=(BranchObj*)selection;
  5.1698  		QStringList filters;
  5.1699  		filters <<"VYM map (*.vym)";
  5.1700  		QFileDialog *fd=new QFileDialog( this,vymName+" - " +tr("Link to another map"));
  5.1701 @@ -2716,9 +2588,9 @@
  5.1702  		if ( fd->exec() == QDialog::Accepted )
  5.1703  		{
  5.1704  			saveState(
  5.1705 -				selection,
  5.1706 +				bo,
  5.1707  				"setVymLink (\""+bo->getVymLink()+"\")",
  5.1708 -				selection,
  5.1709 +				bo,
  5.1710  				"setVymLink (\""+fd->selectedFile()+"\")",
  5.1711  				QString("Set vymlink of %1 to %2").arg(getName(bo)).arg(fd->selectedFile())
  5.1712  			);	
  5.1713 @@ -2732,14 +2604,13 @@
  5.1714  
  5.1715  void MapEditor::deleteVymLink()
  5.1716  {
  5.1717 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1718 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1719 +	BranchObj *bo=xelection.getBranch();
  5.1720 +	if (bo)
  5.1721  	{		
  5.1722 -		BranchObj *bo=(BranchObj*)selection;
  5.1723  		saveState(
  5.1724 -			selection,
  5.1725 +			bo,
  5.1726  			"setVymLink (\""+bo->getVymLink()+"\")",
  5.1727 -			selection,
  5.1728 +			bo,
  5.1729  			"setVymLink (\"\")",
  5.1730  			QString("Unset vymlink of %1").arg(getName(bo))
  5.1731  		);	
  5.1732 @@ -2752,20 +2623,19 @@
  5.1733  
  5.1734  void MapEditor::setHideExport(bool b)
  5.1735  {
  5.1736 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1737 -			typeid(*selection)==typeid(FloatImageObj)))
  5.1738 +	BranchObj *bo=xelection.getBranch();
  5.1739 +	if (bo)
  5.1740  	{
  5.1741 -		OrnamentedObj *oo=(OrnamentedObj*)selection;
  5.1742 -		oo->setHideInExport (b);
  5.1743 +		bo->setHideInExport (b);
  5.1744  		QString u= b ? "false" : "true";
  5.1745  		QString r=!b ? "false" : "true";
  5.1746  		
  5.1747  		saveState(
  5.1748 -			selection,
  5.1749 +			bo,
  5.1750  			QString ("setHideExport (%1)").arg(u),
  5.1751 -			selection,
  5.1752 +			bo,
  5.1753  			QString ("setHideExport (%1)").arg(r),
  5.1754 -			QString ("Set HideExport flag of %1 to %2").arg(getName(oo)).arg (r)
  5.1755 +			QString ("Set HideExport flag of %1 to %2").arg(getName(bo)).arg (r)
  5.1756  		);	
  5.1757  		updateActions();
  5.1758  		mapCenter->reposition();
  5.1759 @@ -2775,29 +2645,27 @@
  5.1760  
  5.1761  void MapEditor::toggleHideExport()
  5.1762  {
  5.1763 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1764 -			typeid(*selection)==typeid(FloatImageObj)))
  5.1765 -		setHideExport ( !((OrnamentedObj*)selection)->hideInExport() );
  5.1766 +	BranchObj *bo=xelection.getBranch();
  5.1767 +	if (bo)
  5.1768 +		setHideExport ( !bo->hideInExport() );
  5.1769  }
  5.1770  
  5.1771  QString MapEditor::getVymLink()
  5.1772  {
  5.1773 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1774 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1775 -	{		
  5.1776 -		return ((BranchObj*)selection)->getVymLink();
  5.1777 -	}
  5.1778 -	return "";
  5.1779 +	BranchObj *bo=xelection.getBranch();
  5.1780 +	if (bo)
  5.1781 +		return bo->getVymLink();
  5.1782 +	else	
  5.1783 +		return "";
  5.1784  	
  5.1785  }
  5.1786  
  5.1787  QStringList MapEditor::getVymLinks()
  5.1788  {
  5.1789  	QStringList links;
  5.1790 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1791 -			typeid(*selection) == typeid(MapCenterObj)) )
  5.1792 +	BranchObj *bo=xelection.getBranch();
  5.1793 +	if (bo)
  5.1794  	{		
  5.1795 -		BranchObj *bo=(BranchObj*)selection;
  5.1796  		bo=bo->first();	
  5.1797  		while (bo) 
  5.1798  		{
  5.1799 @@ -2811,40 +2679,41 @@
  5.1800  
  5.1801  void MapEditor::deleteKeepChilds()
  5.1802  {
  5.1803 -	if (selection && (typeid(*selection) == typeid(BranchObj) ))
  5.1804 -	{		
  5.1805 -		BranchObj* bo=(BranchObj*)selection;
  5.1806 -		BranchObj* par=(BranchObj*)(bo->getParObj());
  5.1807 +	BranchObj *bo=xelection.getBranch();
  5.1808 +	BranchObj *par;
  5.1809 +	if (bo)
  5.1810 +	{
  5.1811 +		par=(BranchObj*)(bo->getParObj());
  5.1812  		QPointF p=bo->getRelPos();
  5.1813  		saveStateChangingPart(
  5.1814 -			selection->getParObj(),
  5.1815 -			selection,
  5.1816 +			bo->getParObj(),
  5.1817 +			bo,
  5.1818  			"deleteKeepChilds ()",
  5.1819  			QString("Remove %1 and keep its childs").arg(getName(bo))
  5.1820  		);
  5.1821  
  5.1822 -		QString sel=selection->getSelectString();
  5.1823 +		QString sel=bo->getSelectString();
  5.1824  		unselect();
  5.1825  		par->removeBranchHere(bo);
  5.1826  		mapCenter->reposition();
  5.1827  		select (sel);
  5.1828 -		((BranchObj*)selection)->move2RelPos (p);
  5.1829 +		xelection.getBranch()->move2RelPos (p);
  5.1830  		mapCenter->reposition();
  5.1831  	}	
  5.1832  }
  5.1833  
  5.1834  void MapEditor::deleteChilds()
  5.1835  {
  5.1836 -	if (selection && (typeid(*selection) == typeid(BranchObj) ||
  5.1837 -		typeid(*selection)==typeid(MapCenterObj)))
  5.1838 +	BranchObj *bo=xelection.getBranch();
  5.1839 +	if (bo)
  5.1840  	{		
  5.1841  		saveStateChangingPart(
  5.1842 -			selection->getParObj(), 
  5.1843 -			selection,
  5.1844 +			bo->getParObj(), 
  5.1845 +			bo,
  5.1846  			"deleteChilds ()",
  5.1847 -			QString( "Remove childs of branch %1").arg(getName(selection))
  5.1848 +			QString( "Remove childs of branch %1").arg(getName(bo))
  5.1849  		);
  5.1850 -		((BranchObj*)selection)->removeChilds();
  5.1851 +		bo->removeChilds();
  5.1852  		mapCenter->reposition();
  5.1853  	}	
  5.1854  }
  5.1855 @@ -2896,18 +2765,16 @@
  5.1856  
  5.1857  void MapEditor::updateNoteFlag()
  5.1858  {
  5.1859 -	if (selection)
  5.1860 -		if ( (typeid(*selection) == typeid(BranchObj)) || 
  5.1861 -			(typeid(*selection) == typeid(MapCenterObj))  )
  5.1862 -			((BranchObj*)selection)->updateNoteFlag();
  5.1863 +	BranchObj *bo=xelection.getBranch();
  5.1864 +	if (bo) bo->updateNoteFlag();
  5.1865  }
  5.1866  
  5.1867  void MapEditor::setMapAuthor (const QString &s)
  5.1868  {
  5.1869  	saveState (
  5.1870 -		selection,
  5.1871 +		mapCenter,
  5.1872  		QString ("setMapAuthor (\"%1\")").arg(mapCenter->getAuthor()),
  5.1873 -		selection,
  5.1874 +		mapCenter,
  5.1875  		QString ("setMapAuthor (\"%1\")").arg(s),
  5.1876  		QString ("Set author of map to \"%1\"").arg(s)
  5.1877  	);
  5.1878 @@ -2917,9 +2784,9 @@
  5.1879  void MapEditor::setMapComment (const QString &s)
  5.1880  {
  5.1881  	saveState (
  5.1882 -		selection,
  5.1883 +		mapCenter,
  5.1884  		QString ("setMapComment (\"%1\")").arg(mapCenter->getComment()),
  5.1885 -		selection,
  5.1886 +		mapCenter,
  5.1887  		QString ("setMapComment (\"%1\")").arg(s),
  5.1888  		QString ("Set comment of map")
  5.1889  	);
  5.1890 @@ -3034,9 +2901,9 @@
  5.1891  	QColor col = QColorDialog::getColor( defLinkColor, this );
  5.1892  	if ( !col.isValid() ) return;
  5.1893  	saveState (
  5.1894 -		selection,
  5.1895 +		mapCenter,
  5.1896  		QString("setMapDefLinkColor (\"%1\")").arg(getMapDefLinkColor().name()),
  5.1897 -		selection,
  5.1898 +		mapCenter,
  5.1899  		QString("setMapDefLinkColor (\"%1\")").arg(col.name()),
  5.1900  		QString("Set link color to %1").arg(col.name())
  5.1901  	);
  5.1902 @@ -3046,9 +2913,9 @@
  5.1903  
  5.1904  void MapEditor::toggleScroll()
  5.1905  {
  5.1906 -	if (selection && (typeid(*selection) == typeid(BranchObj)) )
  5.1907 +	BranchObj *bo=xelection.getBranch();
  5.1908 +	if (xelection.type()==Branch )
  5.1909  	{
  5.1910 -		BranchObj *bo=((BranchObj*)selection);
  5.1911  		if (bo->countBranches()==0) return;
  5.1912  		if (bo->getDepth()==0) return;
  5.1913  		QString u,r;
  5.1914 @@ -3063,9 +2930,9 @@
  5.1915  			r="unscroll";
  5.1916  		}	
  5.1917  		saveState(
  5.1918 -			selection,
  5.1919 +			bo,
  5.1920  			QString ("%1 ()").arg(u),
  5.1921 -			selection,
  5.1922 +			bo,
  5.1923  			QString ("%1 ()").arg(r),
  5.1924  			QString ("%1 %2").arg(r).arg(getName(bo))
  5.1925  		);
  5.1926 @@ -3087,11 +2954,9 @@
  5.1927  
  5.1928  void MapEditor::loadFloatImage ()
  5.1929  {
  5.1930 -	if (selection && 
  5.1931 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.1932 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.1933 +	BranchObj *bo=xelection.getBranch();
  5.1934 +	if (bo)
  5.1935  	{
  5.1936 -		BranchObj *bo=((BranchObj*)selection);
  5.1937  
  5.1938  		Q3FileDialog *fd=new Q3FileDialog( this);
  5.1939  		fd->setMode (Q3FileDialog::ExistingFiles);
  5.1940 @@ -3122,9 +2987,9 @@
  5.1941  				saveState(
  5.1942  					(LinkableMapObj*)fio,
  5.1943  					"delete ()",
  5.1944 -					selection, 
  5.1945 +					bo, 
  5.1946  					QString ("loadFloatImage (%1)").arg(*it),
  5.1947 -					QString("Add floatimage %1 to %2").arg(*it).arg(getName(selection))
  5.1948 +					QString("Add floatimage %1 to %2").arg(*it).arg(getName(bo))
  5.1949  				);
  5.1950  				bo->getLastFloatImage()->setOriginalFilename(fn);
  5.1951  				++it;
  5.1952 @@ -3140,10 +3005,9 @@
  5.1953  
  5.1954  void MapEditor::saveFloatImage ()
  5.1955  {
  5.1956 -	if (selection && 
  5.1957 -		(typeid(*selection) == typeid(FloatImageObj)) )
  5.1958 +	FloatImageObj *fio=xelection.getFloatImage();
  5.1959 +	if (fio)
  5.1960  	{
  5.1961 -		FloatImageObj *fio=((FloatImageObj*)selection);
  5.1962  		QFileDialog *fd=new QFileDialog( this);
  5.1963  		fd->setFilters (imageIO.getFilters());
  5.1964  		fd->setCaption(vymName+" - " +tr("Save image"));
  5.1965 @@ -3187,51 +3051,50 @@
  5.1966  
  5.1967  void MapEditor::setFrame(const FrameType &t)	// FIXME missing saveState
  5.1968  {
  5.1969 -	if (selection && 
  5.1970 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.1971 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.1972 +	BranchObj *bo=xelection.getBranch();
  5.1973 +	if (bo)
  5.1974  	{
  5.1975 -		selection->setFrameType (t);
  5.1976 +		bo->setFrameType (t);
  5.1977  		mapCenter->reposition();
  5.1978 -		selection->updateLink();
  5.1979 +		bo->updateLink();
  5.1980  	}
  5.1981  }
  5.1982  
  5.1983  void MapEditor::setIncludeImagesVer(bool b)	// FIXME missing saveState
  5.1984  {
  5.1985 -	if (selection && 
  5.1986 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.1987 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.1988 -		((BranchObj*)selection)->setIncludeImagesVer(b);
  5.1989 +	BranchObj *bo=xelection.getBranch();
  5.1990 +	if (bo)
  5.1991 +	{
  5.1992 +		bo->setIncludeImagesVer(b);
  5.1993  		mapCenter->reposition();
  5.1994 +	}	
  5.1995  }
  5.1996  
  5.1997  void MapEditor::setIncludeImagesHor(bool b)	// FIXME missing saveState
  5.1998  {
  5.1999 -	if (selection && 
  5.2000 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.2001 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.2002 -		((BranchObj*)selection)->setIncludeImagesHor(b);
  5.2003 +	BranchObj *bo=xelection.getBranch();
  5.2004 +	if (bo)
  5.2005 +	{
  5.2006 +		bo->setIncludeImagesHor(b);
  5.2007  		mapCenter->reposition();
  5.2008 +	}	
  5.2009  }
  5.2010  
  5.2011  void MapEditor::setHideLinkUnselected (bool b)	// FIXME missing saveState
  5.2012  {
  5.2013 -	if (selection && 
  5.2014 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.2015 -		(typeid(*selection) == typeid(MapCenterObj))  ||
  5.2016 -		(typeid(*selection) == typeid(FloatImageObj)) )
  5.2017 -		selection->setHideLinkUnselected(b);
  5.2018 +	LinkableMapObj *sel=xelection.single();
  5.2019 +	if (sel &&
  5.2020 +		(xelection.type() == Branch || 
  5.2021 +		xelection.type() == MapCenter  ||
  5.2022 +		xelection.type() == FloatImage ))
  5.2023 +		sel->setHideLinkUnselected(b);
  5.2024  }
  5.2025  
  5.2026  void MapEditor::importDirInt(BranchObj *dst, QDir d)	// FIXME missing saveState
  5.2027  {
  5.2028 -	if (selection && 
  5.2029 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.2030 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.2031 +	BranchObj *bo=xelection.getBranch();
  5.2032 +	if (bo)
  5.2033  	{
  5.2034 -		BranchObj *bo;
  5.2035 -		
  5.2036  		// Traverse directories
  5.2037  		d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
  5.2038  		QFileInfoList list = d.entryInfoList();
  5.2039 @@ -3276,9 +3139,8 @@
  5.2040  
  5.2041  void MapEditor::importDir()
  5.2042  {
  5.2043 -	if (selection && 
  5.2044 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.2045 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.2046 +	BranchObj *bo=xelection.getBranch();
  5.2047 +	if (bo)
  5.2048  	{
  5.2049  		QStringList filters;
  5.2050  		filters <<"VYM map (*.vym)";
  5.2051 @@ -3291,7 +3153,6 @@
  5.2052  		QString fn;
  5.2053  		if ( fd->exec() == QDialog::Accepted )
  5.2054  		{
  5.2055 -			BranchObj *bo=((BranchObj*)selection);
  5.2056  			importDirInt (bo,QDir(fd->selectedFile()) );
  5.2057  			mapCenter->reposition();
  5.2058  			scene()->update();
  5.2059 @@ -3301,16 +3162,13 @@
  5.2060  
  5.2061  void MapEditor::followXLink(int i)
  5.2062  {
  5.2063 -	if (selection && 
  5.2064 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.2065 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.2066 +	BranchObj *bo=xelection.getBranch();
  5.2067 +	if (bo)
  5.2068  	{
  5.2069 -		BranchObj *bo=((BranchObj*)selection)->XLinkTargetAt(i);
  5.2070 +		bo=bo->XLinkTargetAt(i);
  5.2071  		if (bo) 
  5.2072  		{
  5.2073 -			selection->unselect();
  5.2074 -			selection=bo;
  5.2075 -			selection->select();
  5.2076 +			xelection.select(bo);
  5.2077  			ensureSelectionVisible();
  5.2078  		}
  5.2079  	}
  5.2080 @@ -3318,16 +3176,15 @@
  5.2081  
  5.2082  void MapEditor::editXLink(int i)	// FIXME missing saveState
  5.2083  {
  5.2084 -	if (selection && 
  5.2085 -		(typeid(*selection) == typeid(BranchObj)) || 
  5.2086 -		(typeid(*selection) == typeid(MapCenterObj))  )
  5.2087 +	BranchObj *bo=xelection.getBranch();
  5.2088 +	if (bo)
  5.2089  	{
  5.2090 -		XLinkObj *xlo=((BranchObj*)selection)->XLinkAt(i);
  5.2091 +		XLinkObj *xlo=bo->XLinkAt(i);
  5.2092  		if (xlo) 
  5.2093  		{
  5.2094  			EditXLinkDialog dia;
  5.2095  			dia.setXLink (xlo);
  5.2096 -			dia.setSelection(selection);
  5.2097 +			dia.setSelection(bo);
  5.2098  			if (dia.exec() == QDialog::Accepted)
  5.2099  			{
  5.2100  				if (dia.useSettingsGlobal() )
  5.2101 @@ -3336,7 +3193,7 @@
  5.2102  					setMapDefXLinkWidth (xlo->getWidth() );
  5.2103  				}
  5.2104  				if (dia.deleteXLink())
  5.2105 -					((BranchObj*)selection)->deleteXLinkAt(i);
  5.2106 +					bo->deleteXLinkAt(i);
  5.2107  			}
  5.2108  		}	
  5.2109  	}
  5.2110 @@ -3388,12 +3245,8 @@
  5.2111  
  5.2112  void MapEditor::ensureSelectionVisible()
  5.2113  {
  5.2114 -	if (selection)
  5.2115 -	{
  5.2116 -		LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
  5.2117 -		ensureVisible (lmo->getBBox());
  5.2118 -	}
  5.2119 -
  5.2120 +	LinkableMapObj *lmo=xelection.single();
  5.2121 +	if (lmo) ensureVisible (lmo->getBBox() );
  5.2122  }
  5.2123  
  5.2124  void MapEditor::contextMenuEvent ( QContextMenuEvent * e )
  5.2125 @@ -3406,24 +3259,20 @@
  5.2126  	
  5.2127      if (lmo) 
  5.2128  	{	// MapObj was found
  5.2129 -		if (selection != lmo)
  5.2130 +		if (xelection.single() != lmo)
  5.2131  		{
  5.2132  			// select the MapObj
  5.2133 -			if (selection) selection->unselect();
  5.2134 -			selection=lmo;
  5.2135 -			selection->select();
  5.2136 +			xelection.select(lmo);
  5.2137  		}
  5.2138  		// Context Menu 
  5.2139 -		if (selection) 
  5.2140 +		if (xelection.getBranch() ) 
  5.2141  		{
  5.2142 -			if (typeid(*selection)==typeid(BranchObj) ||
  5.2143 -				typeid(*selection)==typeid(MapCenterObj) )
  5.2144 -			{
  5.2145 -				// Context Menu on branch or mapcenter
  5.2146 -				updateActions();
  5.2147 -				branchContextMenu->popup(e->globalPos() );
  5.2148 -			}	
  5.2149 -			if (typeid(*selection)==typeid(FloatImageObj))
  5.2150 +			// Context Menu on branch or mapcenter
  5.2151 +			updateActions();
  5.2152 +			branchContextMenu->popup(e->globalPos() );
  5.2153 +		} else
  5.2154 +		{
  5.2155 +			if (xelection.getFloatImage() )
  5.2156  			{
  5.2157  				// Context Menu on floatimage
  5.2158  				updateActions();
  5.2159 @@ -3527,10 +3376,8 @@
  5.2160  			if (lmo)
  5.2161  				bo_begin=(BranchObj*)(lmo);
  5.2162  			else	
  5.2163 -				if (selection && 
  5.2164 -					((typeid(*selection) == typeid(BranchObj)) || 
  5.2165 -					(typeid(*selection) == typeid(MapCenterObj)))  )
  5.2166 -				bo_begin=(BranchObj*)selection;
  5.2167 +				if (xelection.getBranch() ) 
  5.2168 +					bo_begin=xelection.getBranch();
  5.2169  			if (bo_begin)	
  5.2170  			{
  5.2171  				drawingLink=true;
  5.2172 @@ -3552,8 +3399,10 @@
  5.2173  		// Left Button	    Move Branches
  5.2174  		if (e->button() == Qt::LeftButton )
  5.2175  		{
  5.2176 -			movingObj_start.setX( p.x() - selection->x() );	
  5.2177 -			movingObj_start.setY( p.y() - selection->y() );	
  5.2178 +			//movingObj_start.setX( p.x() - selection->x() );// TODO replaced selection->lmo here	
  5.2179 +			//movingObj_start.setY( p.y() - selection->y() );	
  5.2180 +			movingObj_start.setX( p.x() - lmo->x() );	
  5.2181 +			movingObj_start.setY( p.y() - lmo->y() );	
  5.2182  			movingObj_orgPos.setX (lmo->x() );
  5.2183  			movingObj_orgPos.setY (lmo->y() );
  5.2184  			movingObj_orgRelPos=lmo->getRelPos();
  5.2185 @@ -3563,18 +3412,17 @@
  5.2186  			if (mainWindow->getModMode()==ModModeCopy &&
  5.2187  				e->state() & Qt::ControlModifier)
  5.2188  			{
  5.2189 -				if (typeid(*selection)==typeid(BranchObj) )
  5.2190 +				if (xelection.type()==Branch)
  5.2191  				{
  5.2192  					copyingObj=true;
  5.2193 -					mapCenter->addBranch ((BranchObj*)selection);
  5.2194 +					mapCenter->addBranch ((BranchObj*)xelection.single());
  5.2195  					unselect();
  5.2196 -					selection=mapCenter->getLastBranch();
  5.2197 -					selection->select();
  5.2198 +					xelection.select(mapCenter->getLastBranch());
  5.2199  					mapCenter->reposition();
  5.2200  				}
  5.2201  			} 
  5.2202  
  5.2203 -			movingObj=selection;	
  5.2204 +			movingObj=xelection.single();	
  5.2205  		} else
  5.2206  			// Middle Button    Toggle Scroll
  5.2207  			// (On Mac OS X this won't work, but we still have 
  5.2208 @@ -3601,9 +3449,10 @@
  5.2209  void MapEditor::mouseMoveEvent(QMouseEvent* e)
  5.2210  {
  5.2211      QPointF p = mapToScene(e->pos());
  5.2212 +	LinkableMapObj *lmosel=xelection.single();
  5.2213  
  5.2214      // Move the selected MapObj
  5.2215 -    if ( selection && movingObj) 
  5.2216 +    if ( lmosel && movingObj) 
  5.2217      {	
  5.2218  		// reset cursor if we are moving and don't copy
  5.2219  		if (mainWindow->getModMode()!=ModModeCopy)
  5.2220 @@ -3611,7 +3460,7 @@
  5.2221  
  5.2222  		// To avoid jumping of the sceneView, only 
  5.2223  		// ensureSelectionVisible, if not tmp linked
  5.2224 -		if (!selection->hasParObjTmp())
  5.2225 +		if (!lmosel->hasParObjTmp())
  5.2226  			ensureSelectionVisible ();
  5.2227  		
  5.2228  		// Now move the selection, but add relative position 
  5.2229 @@ -3619,51 +3468,47 @@
  5.2230  		// mousepointer. (This avoids flickering resp. jumping 
  5.2231  		// of selection back to absPos)
  5.2232  		
  5.2233 -		LinkableMapObj *lmosel;
  5.2234 -		lmosel =  dynamic_cast <LinkableMapObj*> (selection);
  5.2235 -
  5.2236  		// Check if we could link 
  5.2237  		LinkableMapObj* lmo=mapCenter->findMapObj(p, lmosel);
  5.2238  		
  5.2239  
  5.2240 -		if (typeid(*selection) == typeid(FloatImageObj))
  5.2241 +		FloatObj *fio=xelection.getFloatImage();
  5.2242 +		if (fio)
  5.2243  		{
  5.2244 -			FloatObj *fo=(FloatObj*)selection;
  5.2245 -			fo->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
  5.2246 -			fo->setRelPos();
  5.2247 -			fo->updateLink(); //no need for reposition, if we update link here
  5.2248 +			fio->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
  5.2249 +			fio->setRelPos();
  5.2250 +			fio->updateLink(); //no need for reposition, if we update link here
  5.2251  
  5.2252  			// Relink float to new mapcenter or branch, if shift is pressed	
  5.2253  			// Only relink, if selection really has a new parent
  5.2254  			if ( (e->modifiers()==Qt::ShiftModifier) && lmo &&
  5.2255  				( (typeid(*lmo)==typeid(BranchObj)) ||
  5.2256  				  (typeid(*lmo)==typeid(MapCenterObj)) ) &&
  5.2257 -				( lmo != fo->getParObj())  
  5.2258 +				( lmo != fio->getParObj())  
  5.2259  				)
  5.2260  			{
  5.2261 -				if (typeid(*fo) == typeid(FloatImageObj) && 
  5.2262 +				if (typeid(*fio) == typeid(FloatImageObj) && 
  5.2263  				( (typeid(*lmo)==typeid(BranchObj) ||
  5.2264  				  typeid(*lmo)==typeid(MapCenterObj)) ))  
  5.2265  				{
  5.2266  
  5.2267  					// Also save the move which was done so far
  5.2268 -					FloatImageObj *fio=(FloatImageObj*)selection;
  5.2269  					QString pold=qpointfToString(movingObj_orgRelPos);
  5.2270  					QString pnow=qpointfToString(fio->getRelPos());
  5.2271  					saveState(
  5.2272 -						selection,
  5.2273 +						fio,
  5.2274  						"moveRel "+pold,
  5.2275 -						selection,
  5.2276 +						fio,
  5.2277  						"moveRel "+pnow,
  5.2278 -						QString("Move %1 to relativ position %2").arg(getName(selection)).arg(pnow));
  5.2279 +						QString("Move %1 to relativ position %2").arg(getName(fio)).arg(pnow));
  5.2280  					fio->getParObj()->requestReposition();
  5.2281  					mapCenter->reposition();
  5.2282  
  5.2283 -					cout << "current relPos="<<movingObj_orgRelPos<<endl;
  5.2284 +					cout << "current relPos="<<movingObj_orgRelPos<<endl;	// FIXME testing
  5.2285  					linkTo (lmo->getSelectString());
  5.2286  					cout << "setting movingObj\n";
  5.2287 -					movingObj=(MapObj*)selection;
  5.2288 -					movingObj_orgRelPos=selection->getRelPos();	
  5.2289 +					movingObj=lmosel;
  5.2290 +					movingObj_orgRelPos=lmosel->getRelPos();	
  5.2291  					cout <<"ok 0\n";
  5.2292  
  5.2293  					mapCenter->reposition();
  5.2294 @@ -3699,10 +3544,7 @@
  5.2295  				// reposition subbranch
  5.2296  				lmosel->reposition();	
  5.2297  
  5.2298 -				if (lmo && (lmo!=selection) &&  
  5.2299 -					(typeid(*lmo) == typeid(BranchObj) ||
  5.2300 -					(typeid(*lmo) == typeid(MapCenterObj) )
  5.2301 -					) )
  5.2302 +				if (lmo && (lmo!=lmosel) && xelection.getBranch() ) 
  5.2303  				{
  5.2304  					if (e->modifiers()==Qt::ControlModifier)
  5.2305  					{
  5.2306 @@ -3748,6 +3590,7 @@
  5.2307  {
  5.2308      QPointF p = mapToScene(e->pos());
  5.2309  	LinkableMapObj *dst;
  5.2310 +	LinkableMapObj *lmosel=xelection.single();
  5.2311  	// Have we been picking color?
  5.2312  	if (pickingColor)
  5.2313  	{
  5.2314 @@ -3755,7 +3598,7 @@
  5.2315  		setCursor (Qt::ArrowCursor);
  5.2316  		// Check if we are over another branch
  5.2317  		dst=mapCenter->findMapObj(p, NULL);
  5.2318 -		if (dst && selection) 
  5.2319 +		if (dst && lmosel) 
  5.2320  		{	
  5.2321  			if (e->state() & Qt::ShiftModifier)
  5.2322  				colorBranch (((BranchObj*)(dst))->getColor());
  5.2323 @@ -3771,7 +3614,7 @@
  5.2324  		drawingLink=false;
  5.2325  		// Check if we are over another branch
  5.2326  		dst=mapCenter->findMapObj(p, NULL);
  5.2327 -		if (dst && selection) 
  5.2328 +		if (dst && lmosel) 
  5.2329  		{	
  5.2330  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
  5.2331  			tmpXLink->updateXLink();
  5.2332 @@ -3786,53 +3629,52 @@
  5.2333  	}
  5.2334  	
  5.2335      // Have we been moving something?
  5.2336 -    if ( selection && movingObj ) 
  5.2337 +    if ( lmosel && movingObj ) 
  5.2338      {	
  5.2339 -		if(typeid(*selection)==typeid (FloatImageObj))
  5.2340 +		FloatImageObj *fo=xelection.getFloatImage();
  5.2341 +		if(fo)
  5.2342  		{
  5.2343  			// Moved FloatObj. Maybe we need to reposition
  5.2344 -			FloatImageObj *fo=(FloatImageObj*)selection;
  5.2345  		    QString pold=qpointfToString(movingObj_orgRelPos);
  5.2346  		    QString pnow=qpointfToString(fo->getRelPos());
  5.2347  			saveState(
  5.2348 -				selection,
  5.2349 +				fo,
  5.2350  				"moveRel "+pold,
  5.2351 -				selection,
  5.2352 +				fo,
  5.2353  				"moveRel "+pnow,
  5.2354 -				QString("Move %1 to relativ position %2").arg(getName(selection)).arg(pnow));
  5.2355 -
  5.2356 -			selection->getParObj()->requestReposition();
  5.2357 +				QString("Move %1 to relativ position %2").arg(getName(fo)).arg(pnow));
  5.2358 +
  5.2359 +			fo->getParObj()->requestReposition();
  5.2360  			mapCenter->reposition();
  5.2361  		}	
  5.2362  
  5.2363  		// Check if we are over another branch, but ignore 
  5.2364  		// any found LMOs, which are FloatObjs
  5.2365 -		dst=mapCenter->findMapObj(mapToScene(e->pos() ), 
  5.2366 -			((LinkableMapObj*)selection) );
  5.2367 +		dst=mapCenter->findMapObj(mapToScene(e->pos() ), lmosel);
  5.2368  
  5.2369  		if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj))) 
  5.2370  			dst=NULL;
  5.2371  		
  5.2372 -		if (typeid(*selection) == typeid(MapCenterObj)  )
  5.2373 +		if (xelection.type() == MapCenter )
  5.2374  		{	// FIXME The MapCenter was moved, no savestate yet
  5.2375  		}
  5.2376  		
  5.2377 -		if (typeid(*selection) == typeid(BranchObj)  )
  5.2378 +		if (xelection.type() == Branch )
  5.2379  		{	// A branch was moved
  5.2380  			
  5.2381  			// save the position in case we link to mapcenter
  5.2382 -			QPointF savePos=QPointF (selection->x(),selection->y() );
  5.2383 +			QPointF savePos=QPointF (lmosel->getAbsPos()  );
  5.2384  
  5.2385  			// Reset the temporary drawn link to the original one
  5.2386 -			((LinkableMapObj*)selection)->unsetParObjTmp();
  5.2387 +			lmosel->unsetParObjTmp();
  5.2388  
  5.2389  			// For Redo we may need to save original selection
  5.2390 -			QString preSelStr=selection->getSelectString();
  5.2391 +			QString preSelStr=lmosel->getSelectString();
  5.2392  
  5.2393  			copyingObj=false;	
  5.2394  			if (dst ) 
  5.2395  			{
  5.2396 -				BranchObj* bsel=(BranchObj*)selection;
  5.2397 +				BranchObj* bsel=xelection.getBranch();
  5.2398  				BranchObj* bdst=(BranchObj*)dst;
  5.2399  
  5.2400  				QString preParStr=(bsel->getParObj())->getSelectString();
  5.2401 @@ -3855,7 +3697,7 @@
  5.2402  					bsel->linkTo (bdst,-1);
  5.2403  					if (dst->getDepth()==0) bsel->move (savePos);
  5.2404  				} 
  5.2405 -				QString postSelStr=selection->getSelectString();
  5.2406 +				QString postSelStr=lmosel->getSelectString();
  5.2407  				QString postNum=QString::number (bsel->getNum(),10);
  5.2408  
  5.2409  				QString undoCom="linkTo (\""+ 
  5.2410 @@ -3871,17 +3713,17 @@
  5.2411  					preSelStr, redoCom,
  5.2412  					QString("Relink %1 to %2").arg(getName(bsel)).arg(getName(dst)) );
  5.2413  			} else
  5.2414 -				if (selection->getDepth()==1)
  5.2415 +				if (lmosel->getDepth()==1)
  5.2416  				{
  5.2417  					// The select string might be different _after_ moving around.
  5.2418  					// Therefor reposition and then use string of old selection, too
  5.2419  					mapCenter->reposition();
  5.2420  
  5.2421 -					QString ps=qpointfToString ( ((BranchObj*)selection)->getRelPos() );
  5.2422 +					QString ps=qpointfToString ( lmosel->getRelPos() );
  5.2423  					saveState(
  5.2424 -						selection->getSelectString(), "moveRel "+qpointfToString(movingObj_orgRelPos), 
  5.2425 +						lmosel->getSelectString(), "moveRel "+qpointfToString(movingObj_orgRelPos), 
  5.2426  						preSelStr, "moveRel "+ps, 
  5.2427 -						QString("Move %1 to relative position %2").arg(getName(selection)).arg(ps));
  5.2428 +						QString("Move %1 to relative position %2").arg(getName(lmosel)).arg(ps));
  5.2429  			
  5.2430  				}
  5.2431  			// Draw the original link, before selection was moved around
  5.2432 @@ -3907,9 +3749,7 @@
  5.2433  		LinkableMapObj *lmo=mapCenter->findMapObj(p, NULL);
  5.2434  		if (lmo) {	// MapObj was found
  5.2435  			// First select the MapObj than edit heading
  5.2436 -			if (selection) selection->unselect();
  5.2437 -			selection=lmo;
  5.2438 -			selection->select();
  5.2439 +			xelection.select(lmo);
  5.2440  			mainWindow->editHeading();
  5.2441  		}
  5.2442  	}
  5.2443 @@ -3943,9 +3783,8 @@
  5.2444  
  5.2445  void MapEditor::dropEvent(QDropEvent *event)
  5.2446  {
  5.2447 -	if (selection && 
  5.2448 -      (typeid(*selection) == typeid(BranchObj)) || 
  5.2449 -      (typeid(*selection) == typeid(MapCenterObj))) 
  5.2450 +	BranchObj *sel=xelection.getBranch();
  5.2451 +	if (sel)
  5.2452  	{
  5.2453  		QList <QUrl> uris;
  5.2454  		if (event->mimeData()->hasImage()) 
  5.2455 @@ -3964,7 +3803,7 @@
  5.2456  			BranchObj *bo;
  5.2457  			for (int i=0; i<uris.count();++i)
  5.2458  			{
  5.2459 -				bo=((BranchObj*)selection)->addBranch();
  5.2460 +				bo=sel->addBranch();
  5.2461  				if (bo)
  5.2462  				{
  5.2463  					s=uris.at(i).toLocalFile();
  5.2464 @@ -4060,11 +3899,9 @@
  5.2465        
  5.2466  void MapEditor::addFloatImageInt (const QPixmap &img) 
  5.2467  {
  5.2468 -  if (selection && 
  5.2469 -      (typeid(*selection) == typeid(BranchObj)) || 
  5.2470 -      (typeid(*selection) == typeid(MapCenterObj))  )
  5.2471 +	BranchObj *bo=xelection.getBranch();
  5.2472 +	if (bo)
  5.2473    {
  5.2474 -    BranchObj *bo=((BranchObj*)selection);
  5.2475      //FIXME XXX saveStateChangingPart(selection,QString("Add floatimage to %1").arg(getName(bo)));
  5.2476      //QString fn=fd->selectedFile();
  5.2477      //lastImageDir=fn.left(fn.findRev ("/"));
     6.1 --- a/mapeditor.h	Tue Jan 23 11:50:56 2007 +0000
     6.2 +++ b/mapeditor.h	Mon Jan 29 12:29:13 2007 +0000
     6.3 @@ -213,9 +213,7 @@
     6.4  	bool copyingObj;			// true while creating a link
     6.5  	XLinkObj* tmpXLink;
     6.6  
     6.7 -	Selection xelection;			// FIXME  not used (yet)
     6.8 -    LinkableMapObj* selection;		// select a LinkableMapObj
     6.9 -    LinkableMapObj* selectionLast;	// last selection 
    6.10 +	Selection xelection;	
    6.11      MapObj* movingObj;				// moving a MapObj
    6.12  	MapObj* linkingObj_src;			// part of a link
    6.13      QPointF movingObj_orgPos;		// org. pos of mouse before move
     7.1 --- a/selection.cpp	Tue Jan 23 11:50:56 2007 +0000
     7.2 +++ b/selection.cpp	Mon Jan 29 12:29:13 2007 +0000
     7.3 @@ -23,15 +23,16 @@
     7.4  
     7.5  void Selection::clear()
     7.6  {
     7.7 -	selectList.clear();
     7.8 +	unselect();
     7.9  	lastSelectList.clear();
    7.10  }
    7.11  
    7.12  bool Selection::select(LinkableMapObj *lmo)	// TODO no multiselections yet
    7.13  {
    7.14 -	clear();
    7.15 +	if (!selectList.isEmpty()) unselect();
    7.16  	selectList.append (lmo);
    7.17 -	return false;
    7.18 +	lmo->select();
    7.19 +	return true;
    7.20  }
    7.21  
    7.22  bool Selection::select (const QString &s)	// TODO no multiselections yet
    7.23 @@ -41,7 +42,7 @@
    7.24  	// Finally select the found object
    7.25  	if (lmo)
    7.26  	{
    7.27 -		clear();
    7.28 +		unselect();
    7.29  		select (lmo);
    7.30  		return true;
    7.31  	} 
    7.32 @@ -62,8 +63,13 @@
    7.33  
    7.34  void Selection::unselect()
    7.35  {
    7.36 -	lastSelectList=selectList;
    7.37 -	selectList.clear();
    7.38 +	if (!selectList.isEmpty() )
    7.39 +	{
    7.40 +		for (int i=0; i< selectList.count(); ++i) 
    7.41 +			selectList.at(i)->unselect();
    7.42 +		lastSelectList=selectList;
    7.43 +		selectList.clear();
    7.44 +	}	
    7.45  }
    7.46  
    7.47  bool Selection::isEmpty()
    7.48 @@ -88,6 +94,45 @@
    7.49  	return Undefined;
    7.50  }
    7.51  
    7.52 +LinkableMapObj* Selection::first()
    7.53 +{
    7.54 +	if (!selectList.isEmpty())
    7.55 +		return selectList.first();
    7.56 +	else	
    7.57 +		return NULL;
    7.58 +}
    7.59 +
    7.60 +LinkableMapObj* Selection::single()
    7.61 +{
    7.62 +	if (selectList.count() == 1)
    7.63 +		return selectList.first();
    7.64 +	else	
    7.65 +		return NULL;
    7.66 +}
    7.67 +
    7.68 +BranchObj* Selection::getBranch()
    7.69 +{
    7.70 +	if (!selectList.isEmpty())
    7.71 +	{
    7.72 +		LinkableMapObj *sel=selectList.first();
    7.73 +		if (typeid (*sel)==typeid (BranchObj) ||
    7.74 +		    typeid (*sel)==typeid (MapCenterObj)) 
    7.75 +			return (BranchObj*)sel;
    7.76 +	}
    7.77 +		return NULL;
    7.78 +}
    7.79 +
    7.80 +FloatImageObj* Selection::getFloatImage()
    7.81 +{
    7.82 +	if (!selectList.isEmpty())
    7.83 +	{
    7.84 +		LinkableMapObj *sel=selectList.first();
    7.85 +		if (typeid (*sel)==typeid (FloatImageObj)) 
    7.86 +			return (FloatImageObj*)sel;
    7.87 +	}
    7.88 +		return NULL;
    7.89 +}
    7.90 +
    7.91  QString Selection::getSelectString()// TODO no multiselections yet
    7.92  {
    7.93  	if (selectList.count()==1)
     8.1 --- a/selection.h	Tue Jan 23 11:50:56 2007 +0000
     8.2 +++ b/selection.h	Mon Jan 29 12:29:13 2007 +0000
     8.3 @@ -22,6 +22,10 @@
     8.4  	bool isEmpty();
     8.5  	uint count();
     8.6  	SelectionType type();
     8.7 +	LinkableMapObj * first();		// first in selection list
     8.8 +	LinkableMapObj * single();		// NULL, if multiple selected
     8.9 +	BranchObj* getBranch();
    8.10 +	FloatImageObj* getFloatImage();
    8.11  
    8.12  	QString getSelectString();
    8.13  
     9.1 --- a/tex/vym.changelog	Tue Jan 23 11:50:56 2007 +0000
     9.2 +++ b/tex/vym.changelog	Mon Jan 29 12:29:13 2007 +0000
     9.3 @@ -1,3 +1,10 @@
     9.4 +-------------------------------------------------------------------
     9.5 +Wed Jan 29 17:27:31 CET 2007 - uwedr
     9.6 +
     9.7 +- Version: 1.8.66
     9.8 +- Feature: Using a new class to select objects
     9.9 +- Bugfix: Remember last directory before  ASCII/LaTeX export
    9.10 +
    9.11  -------------------------------------------------------------------
    9.12  Fri Jan 19 22:53:27 CET 2007 - uwe
    9.13  
    10.1 --- a/version.h	Tue Jan 23 11:50:56 2007 +0000
    10.2 +++ b/version.h	Mon Jan 29 12:29:13 2007 +0000
    10.3 @@ -4,8 +4,8 @@
    10.4  #include <QString>
    10.5  
    10.6  #define __VYM_NAME "VYM"
    10.7 -#define __VYM_VERSION "1.8.65"
    10.8 -#define __VYM_BUILD_DATE "January 22, 2007"
    10.9 +#define __VYM_VERSION "1.8.66"
   10.10 +#define __VYM_BUILD_DATE "January 29, 2007"
   10.11  
   10.12  
   10.13  bool checkVersion(const QString &);