vymmodel.cpp
changeset 753 25a77484ec72
parent 750 ff3b01ce0960
child 754 db0ec4bcf416
     1.1 --- a/vymmodel.cpp	Thu Apr 02 09:57:47 2009 +0000
     1.2 +++ b/vymmodel.cpp	Tue Apr 07 16:15:53 2009 +0000
     1.3 @@ -3,6 +3,7 @@
     1.4  
     1.5  #include "vymmodel.h"
     1.6  
     1.7 +#include "treeitem.h"
     1.8  #include "branchitem.h"
     1.9  #include "mapcenteritem.h"
    1.10  #include "editxlinkdialog.h"
    1.11 @@ -147,7 +148,7 @@
    1.12  	defXLinkWidth=1;
    1.13  	defXLinkColor=QColor (230,230,230);
    1.14  
    1.15 -	hidemode=HideNone;
    1.16 +	hidemode=TreeItem::HideNone;
    1.17  
    1.18  	// Network
    1.19  	netstate=Offline;
    1.20 @@ -186,7 +187,7 @@
    1.21  
    1.22  
    1.23  
    1.24 -QString VymModel::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel)
    1.25 +QString VymModel::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, TreeItem *saveSel)
    1.26  {
    1.27  	// tmpdir		temporary directory to which data will be written
    1.28  	// prefix		mapname, which will be appended to images etc.
    1.29 @@ -357,20 +358,20 @@
    1.30  		// (map state is set later at end of load...)
    1.31  	} else
    1.32  	{
    1.33 -		BranchObj *bo=getSelectedBranch();
    1.34 -		if (!bo) return aborted;
    1.35 +		BranchItem *bi=getSelectedBranchItem();
    1.36 +		if (!bi) return aborted;
    1.37  		if (lmode==ImportAdd)
    1.38  			saveStateChangingPart(
    1.39 -				bo,
    1.40 -				bo,
    1.41 +				bi,
    1.42 +				bi,
    1.43  				QString("addMapInsert (%1)").arg(fname),
    1.44 -				QString("Add map %1 to %2").arg(fname).arg(getObjectName(bo)));
    1.45 +				QString("Add map %1 to %2").arg(fname).arg(getObjectName(bi)));
    1.46  		else	
    1.47  			saveStateChangingPart(
    1.48 -				bo,
    1.49 -				bo,
    1.50 +				bi,
    1.51 +				bi,
    1.52  				QString("addMapReplace(%1)").arg(fname),
    1.53 -				QString("Add map %1 to %2").arg(fname).arg(getObjectName(bo)));
    1.54 +				QString("Add map %1 to %2").arg(fname).arg(getObjectName(bi)));
    1.55  	}	
    1.56      
    1.57  
    1.58 @@ -602,7 +603,7 @@
    1.59  		if (selectionType()==TreeItem::Image)
    1.60  			saveFloatImage();
    1.61  		else	
    1.62 -			saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),getSelectedBranch());	
    1.63 +			saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),getSelectedBranchItem());	
    1.64  		// TODO take care of multiselections
    1.65  	}	
    1.66  
    1.67 @@ -719,8 +720,9 @@
    1.68  	return NULL;
    1.69  }	
    1.70  
    1.71 -void VymModel::loadFloatImage ()
    1.72 -{
    1.73 +void VymModel::loadFloatImage ()	// FIXME-2
    1.74 +{
    1.75 +/*
    1.76  	BranchObj *bo=getSelectedBranch();
    1.77  	if (bo)
    1.78  	{
    1.79 @@ -762,6 +764,7 @@
    1.80  		delete (p);
    1.81  		delete (fd);
    1.82  	}
    1.83 +*/	
    1.84  }
    1.85  
    1.86  void VymModel::saveFloatImageInt  (FloatImageObj *fio, const QString &type, const QString &fn)
    1.87 @@ -867,8 +870,9 @@
    1.88  */
    1.89  }
    1.90  
    1.91 -void VymModel::importDirInt (const QString &s)
    1.92 -{
    1.93 +void VymModel::importDirInt (const QString &s)	// FIXME-2
    1.94 +{
    1.95 +/*
    1.96  	BranchObj *bo=getSelectedBranch();
    1.97  	if (bo)
    1.98  	{
    1.99 @@ -877,10 +881,12 @@
   1.100  		QDir d(s);
   1.101  		importDirInt (bo,d);
   1.102  	}
   1.103 +*/	
   1.104  }	
   1.105  
   1.106 -void VymModel::importDir()
   1.107 -{
   1.108 +void VymModel::importDir()	//FIXME-2
   1.109 +{
   1.110 +/*
   1.111  	BranchObj *bo=getSelectedBranch();
   1.112  	if (bo)
   1.113  	{
   1.114 @@ -900,6 +906,7 @@
   1.115  			//FIXME-3 VM needed? scene()->update();
   1.116  		}
   1.117  	}	
   1.118 +*/
   1.119  }
   1.120  
   1.121  
   1.122 @@ -993,8 +1000,7 @@
   1.123  	findReset();
   1.124  }
   1.125  
   1.126 -
   1.127 -QString VymModel::getObjectName (const LinkableMapObj *lmo)
   1.128 +QString VymModel::getObjectName (const LinkableMapObj *lmo)	// FIXME-3 should be obsolete
   1.129  {
   1.130  	QString s;
   1.131  	if (!lmo) return QString("Error: NULL has no name!");
   1.132 @@ -1003,7 +1009,7 @@
   1.133  				      typeid(*lmo) == typeid(MapCenterObj))) 
   1.134  	{
   1.135  		
   1.136 -		s=(((BranchObj*)lmo)->getHeading());
   1.137 +		s=lmo->getTreeItem()->getHeading();
   1.138  		if (s=="") s="unnamed";
   1.139  		return QString("branch (%1)").arg(s);
   1.140  	}	
   1.141 @@ -1012,6 +1018,25 @@
   1.142  	return QString("Unknown type has no name!");
   1.143  }
   1.144  
   1.145 +
   1.146 +QString VymModel::getObjectName (const TreeItem *ti)
   1.147 +{
   1.148 +	QString s;
   1.149 +	if (!ti) return QString("Error: NULL has no name!");
   1.150 +
   1.151 +	if (ti->isBranchLikeType() )
   1.152 +	{
   1.153 +		s=ti->getHeading();
   1.154 +		if (s=="") s="unnamed";
   1.155 +		return QString("branch (%1)").arg(s);
   1.156 +	}	
   1.157 +	/* FIXME-2 move floatimage to TreeModel first
   1.158 +	if (type==TreeItem::Image)
   1.159 +		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
   1.160 +	*/	
   1.161 +	return QString("Unknown type has no name!");
   1.162 +}
   1.163 +
   1.164  void VymModel::redo()
   1.165  {
   1.166  	// Can we undo at all?
   1.167 @@ -1206,7 +1231,7 @@
   1.168  	return (tmpMapDir+"/"+histName);
   1.169  }
   1.170  
   1.171 -void VymModel::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
   1.172 +void VymModel::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, TreeItem *saveSel)
   1.173  {
   1.174  	sendData(redoCom);	//FIXME-3 testing
   1.175  
   1.176 @@ -1290,7 +1315,7 @@
   1.177  }
   1.178  
   1.179  
   1.180 -void VymModel::saveStateChangingPart(LinkableMapObj *undoSel, LinkableMapObj* redoSel, const QString &rc, const QString &comment)
   1.181 +void VymModel::saveStateChangingPart(TreeItem *undoSel, TreeItem* redoSel, const QString &rc, const QString &comment)
   1.182  {
   1.183  	// save the selected part of the map, Undo will replace part of map 
   1.184  	QString undoSelection="";
   1.185 @@ -1312,20 +1337,20 @@
   1.186  		undoSel);
   1.187  }
   1.188  
   1.189 -void VymModel::saveStateRemovingPart(LinkableMapObj *redoSel, const QString &comment)
   1.190 +void VymModel::saveStateRemovingPart(TreeItem*redoSel, const QString &comment)
   1.191  {
   1.192  	if (!redoSel)
   1.193  	{
   1.194  		qWarning ("VymModel::saveStateRemovingPart  no redoSel given!");
   1.195  		return;
   1.196  	}
   1.197 -	QString undoSelection=getSelectString (redoSel->getParObj());
   1.198 +	QString undoSelection=getSelectString (redoSel->parent() );
   1.199  	QString redoSelection=getSelectString(redoSel);
   1.200 -	if (typeid(*redoSel) == typeid(BranchObj)  ) 
   1.201 +	if (redoSel->getType()==TreeItem::Branch) 
   1.202  	{
   1.203  		// save the selected branch of the map, Undo will insert part of map 
   1.204  		saveState (PartOfMap,
   1.205 -			undoSelection, QString("addMapInsert (\"PATH\",%1)").arg(redoSel->getTreeItem()->num()),
   1.206 +			undoSelection, QString("addMapInsert (\"PATH\",%1)").arg(redoSel->num()),
   1.207  			redoSelection, "delete ()", 
   1.208  			comment, 
   1.209  			redoSel);
   1.210 @@ -1333,7 +1358,7 @@
   1.211  }
   1.212  
   1.213  
   1.214 -void VymModel::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment) 
   1.215 +void VymModel::saveState(TreeItem *undoSel, const QString &uc, TreeItem *redoSel, const QString &rc, const QString &comment) 
   1.216  {
   1.217  	// "Normal" savestate: save commands, selections and comment
   1.218  	// so just save commands for undo and redo
   1.219 @@ -1489,42 +1514,28 @@
   1.220  
   1.221  void VymModel::setHeading(const QString &s)
   1.222  {
   1.223 -	BranchObj *sel=getSelectedBranch();
   1.224 -	if (sel)
   1.225 +	BranchItem *selbi=getSelectedBranchItem();
   1.226 +	if (selbi)
   1.227  	{
   1.228  		saveState(
   1.229 -			sel,
   1.230 -			"setHeading (\""+sel->getHeading()+"\")", 
   1.231 -			sel,
   1.232 +			selbi,
   1.233 +			"setHeading (\""+selbi->getHeading()+"\")", 
   1.234 +			selbi,
   1.235  			"setHeading (\""+s+"\")", 
   1.236 -			QString("Set heading of %1 to \"%2\"").arg(getObjectName(sel)).arg(s) );
   1.237 -		sel->setHeading(s );
   1.238 +			QString("Set heading of %1 to \"%2\"").arg(getObjectName(selbi)).arg(s) );
   1.239 +		selbi->setHeading(s );
   1.240 +		QModelIndex ix2=index (selbi);
   1.241 +		emit (dataChanged ( ix2,ix2));
   1.242  		/* FIXME-3 testing only
   1.243  		*/
   1.244 -		TreeItem *ti=getSelectedItem();
   1.245 -		if (ti)
   1.246 -		{
   1.247 -			ti->setHeading (s);
   1.248 -			//FIXME-3 VM ix is wrong ModelIndex below, ix2 is (hopefully) correct:
   1.249 -			//QModelIndex ix=index( ti->row(), ti->column(), index (0,0,QModelIndex()) );
   1.250 -			//FIXME-3 VM testing only cout <<"VM::setHeading  s="<<s.toStdString()<<"  ti="<<ti<<"  r,c=("<<ti->row()<<","<<ti->column()<<")"<<endl;
   1.251 -			QModelIndex ix2=index (ti);
   1.252 -			emit (dataChanged ( ix2,ix2));
   1.253 -		}
   1.254 -		else
   1.255 -		{
   1.256 -			cout << "Warning: VM::setHeading ti==NULL\n";
   1.257 -		}
   1.258 -
   1.259 -		//cout <<"                (r,c)=("<<ix2.row()<<","<<ix2.column()<<")"<<endl;
   1.260  
   1.261  		reposition();
   1.262 -		selection.update();
   1.263 +//		selection.update();	//FIXME-4
   1.264  		ensureSelectionVisible();
   1.265  	}
   1.266  }
   1.267  
   1.268 -BranchObj* VymModel::findText (QString s, bool cs)   
   1.269 +BranchItem* VymModel::findText (QString s, bool cs)   
   1.270  {
   1.271  	int d=0;
   1.272  	QTextDocument::FindFlags flags=0;
   1.273 @@ -1577,7 +1588,7 @@
   1.274  	//cout <<"still searching...  "<<qPrintable( itFind->getHeading())<<endl;
   1.275  	}	
   1.276  	if (!searching)
   1.277 -		return getSelectedBranch();
   1.278 +		return getSelectedBranchItem();
   1.279  	else
   1.280  		return NULL;
   1.281  }
   1.282 @@ -1598,8 +1609,9 @@
   1.283  			// which is (still) needed to create MapCenters
   1.284  }
   1.285  
   1.286 -void VymModel::setURL(const QString &url)
   1.287 -{
   1.288 +void VymModel::setURL(const QString &url) //FIXME-2
   1.289 +{
   1.290 +/*
   1.291  	BranchObj *bo=getSelectedBranch();
   1.292  	if (bo)
   1.293  	{
   1.294 @@ -1617,15 +1629,18 @@
   1.295  		selection.update();
   1.296  		ensureSelectionVisible();
   1.297  	}
   1.298 +*/
   1.299  }	
   1.300  
   1.301 -QString VymModel::getURL()
   1.302 -{
   1.303 +QString VymModel::getURL()	//FIXME-2
   1.304 +{
   1.305 +/*
   1.306  	BranchObj *bo=getSelectedBranch();
   1.307  	if (bo)
   1.308  		return bo->getURL();
   1.309  	else
   1.310  		return "";
   1.311 +*/
   1.312  }
   1.313  
   1.314  QStringList VymModel::getURLs()	// FIXME-1	first, next moved to vymmodel
   1.315 @@ -1678,8 +1693,9 @@
   1.316  }
   1.317  
   1.318  
   1.319 -void VymModel::setFrameType(const FrameObj::FrameType &t)
   1.320 -{
   1.321 +void VymModel::setFrameType(const FrameObj::FrameType &t)	//FIXME-2
   1.322 +{
   1.323 +/*
   1.324  	BranchObj *bo=getSelectedBranch();
   1.325  	if (bo)
   1.326  	{
   1.327 @@ -1690,10 +1706,12 @@
   1.328  		reposition();
   1.329  		bo->updateLink();
   1.330  	}
   1.331 +*/	
   1.332  }
   1.333  
   1.334 -void VymModel::setFrameType(const QString &s)	
   1.335 -{
   1.336 +void VymModel::setFrameType(const QString &s)	//FIXME-2
   1.337 +{
   1.338 +/*
   1.339  	BranchObj *bo=getSelectedBranch();
   1.340  	if (bo)
   1.341  	{
   1.342 @@ -1703,10 +1721,12 @@
   1.343  		reposition();
   1.344  		bo->updateLink();
   1.345  	}
   1.346 +*/
   1.347  }
   1.348  
   1.349 -void VymModel::setFramePenColor(const QColor &c)	
   1.350 -{
   1.351 +void VymModel::setFramePenColor(const QColor &c)	//FIXME-2
   1.352 +{
   1.353 +/*
   1.354  	BranchObj *bo=getSelectedBranch();
   1.355  	if (bo)
   1.356  	{
   1.357 @@ -1714,10 +1734,12 @@
   1.358  			bo, QString ("setFramePenColor (\"%1\")").arg(c.name() ),QString ("set pen color of frame to %1").arg(c.name() ));
   1.359  		bo->setFramePenColor (c);
   1.360  	}	
   1.361 +*/	
   1.362  }
   1.363  
   1.364 -void VymModel::setFrameBrushColor(const QColor &c)	
   1.365 -{
   1.366 +void VymModel::setFrameBrushColor(const QColor &c)	//FIXME-2
   1.367 +{
   1.368 +/*
   1.369  	BranchObj *bo=getSelectedBranch();
   1.370  	if (bo)
   1.371  	{
   1.372 @@ -1725,10 +1747,11 @@
   1.373  			bo, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
   1.374  		bo->setFrameBrushColor (c);
   1.375  	}	
   1.376 -}
   1.377 -
   1.378 -void VymModel::setFramePadding (const int &i)
   1.379 -{
   1.380 +*/}
   1.381 +
   1.382 +void VymModel::setFramePadding (const int &i) //FIXME-2
   1.383 +{
   1.384 +/*
   1.385  	BranchObj *bo=getSelectedBranch();
   1.386  	if (bo)
   1.387  	{
   1.388 @@ -1738,10 +1761,12 @@
   1.389  		reposition();
   1.390  		bo->updateLink();
   1.391  	}	
   1.392 +	*/
   1.393  }
   1.394  
   1.395 -void VymModel::setFrameBorderWidth(const int &i)
   1.396 -{
   1.397 +void VymModel::setFrameBorderWidth(const int &i) //FIXME-2
   1.398 +{
   1.399 +/*
   1.400  	BranchObj *bo=getSelectedBranch();
   1.401  	if (bo)
   1.402  	{
   1.403 @@ -1751,10 +1776,12 @@
   1.404  		reposition();
   1.405  		bo->updateLink();
   1.406  	}	
   1.407 +*/	
   1.408  }
   1.409  
   1.410 -void VymModel::setIncludeImagesVer(bool b)	
   1.411 -{
   1.412 +void VymModel::setIncludeImagesVer(bool b)	//FIXME-2
   1.413 +{
   1.414 +/*
   1.415  	BranchObj *bo=getSelectedBranch();
   1.416  	if (bo)
   1.417  	{
   1.418 @@ -1771,10 +1798,11 @@
   1.419  		bo->setIncludeImagesVer(b);
   1.420  		reposition();
   1.421  	}	
   1.422 -}
   1.423 -
   1.424 -void VymModel::setIncludeImagesHor(bool b)	
   1.425 -{
   1.426 +*/}
   1.427 +
   1.428 +void VymModel::setIncludeImagesHor(bool b)	//FIXME-2
   1.429 +{
   1.430 +/*
   1.431  	BranchObj *bo=getSelectedBranch();
   1.432  	if (bo)
   1.433  	{
   1.434 @@ -1791,10 +1819,12 @@
   1.435  		bo->setIncludeImagesHor(b);
   1.436  		reposition();
   1.437  	}	
   1.438 +	*/
   1.439  }
   1.440  
   1.441 -void VymModel::setHideLinkUnselected (bool b)
   1.442 -{
   1.443 +void VymModel::setHideLinkUnselected (bool b)//FIXME-2
   1.444 +{
   1.445 +/*
   1.446  	LinkableMapObj *sel=getSelectedLMO();
   1.447  	if (sel &&
   1.448  		(selectionType() == TreeItem::Branch || 
   1.449 @@ -1813,41 +1843,43 @@
   1.450  		);	
   1.451  		sel->setHideLinkUnselected(b);
   1.452  	}
   1.453 +*/
   1.454  }
   1.455  
   1.456  void VymModel::setHideExport(bool b)
   1.457  {
   1.458 -	BranchObj *bo=getSelectedBranch();
   1.459 -	if (bo)
   1.460 +	BranchItem *bi=getSelectedBranchItem();
   1.461 +	if (bi)
   1.462  	{
   1.463 -		bo->setHideInExport (b);
   1.464 +		bi->setHideInExport (b);
   1.465  		QString u= b ? "false" : "true";
   1.466  		QString r=!b ? "false" : "true";
   1.467  		
   1.468  		saveState(
   1.469 -			bo,
   1.470 +			bi,
   1.471  			QString ("setHideExport (%1)").arg(u),
   1.472 -			bo,
   1.473 +			bi,
   1.474  			QString ("setHideExport (%1)").arg(r),
   1.475 -			QString ("Set HideExport flag of %1 to %2").arg(getObjectName(bo)).arg (r)
   1.476 +			QString ("Set HideExport flag of %1 to %2").arg(getObjectName(bi)).arg (r)
   1.477  		);	
   1.478  		updateActions();
   1.479  		reposition();
   1.480 -		selection.update();
   1.481 +		// selection.update();
   1.482  		// FIXME-3 VM needed? scene()->update();
   1.483  	}
   1.484  }
   1.485  
   1.486  void VymModel::toggleHideExport()
   1.487  {
   1.488 -	BranchObj *bo=getSelectedBranch();
   1.489 -	if (bo)
   1.490 -		setHideExport ( !bo->hideInExport() );
   1.491 +	BranchItem *selbi=getSelectedBranchItem();
   1.492 +	if (selbi)
   1.493 +		setHideExport ( !selbi->hideInExport() );
   1.494  }
   1.495  
   1.496  
   1.497 -void VymModel::copy()
   1.498 -{
   1.499 +void VymModel::copy()	//FIXME-2
   1.500 +{
   1.501 +/*
   1.502  	LinkableMapObj *sel=getSelectedLMO();
   1.503  	if (sel &&
   1.504  		(selectionType() == TreeItem::Branch || 
   1.505 @@ -1870,11 +1902,13 @@
   1.506  		clipboardEmpty=false;
   1.507  		updateActions();
   1.508  	}	    
   1.509 +*/	
   1.510  }
   1.511  
   1.512  
   1.513 -void VymModel::pasteNoSave(const int &n)
   1.514 -{
   1.515 +void VymModel::pasteNoSave(const int &n)	//FIXME-2
   1.516 +{
   1.517 +/*
   1.518  	bool old=blockSaveState;
   1.519  	blockSaveState=true;
   1.520  	bool zippedOrg=zipped;
   1.521 @@ -1889,10 +1923,12 @@
   1.522  		load (clipboardDir+"/"+clipboardFile,ImportAdd, VymMap);
   1.523  	zipped=zippedOrg;
   1.524  	blockSaveState=old;
   1.525 +*/
   1.526  }
   1.527  
   1.528 -void VymModel::paste()		
   1.529 +void VymModel::paste()		//FIXME-2
   1.530  {   
   1.531 +/*
   1.532  	BranchObj *sel=getSelectedBranch();
   1.533  	if (sel)
   1.534  	{
   1.535 @@ -1905,15 +1941,18 @@
   1.536  		pasteNoSave(0);
   1.537  		reposition();
   1.538  	}
   1.539 +*/	
   1.540  }
   1.541  
   1.542 -void VymModel::cut()
   1.543 -{
   1.544 +void VymModel::cut()	//FIXME-2
   1.545 +{
   1.546 +/*
   1.547  	LinkableMapObj *sel=getSelectedLMO();
   1.548  	if ( sel && (selectionType() == TreeItem::Branch ||
   1.549  		selectionType()==TreeItem::MapCenter ||
   1.550  		selectionType()==TreeItem::Image))
   1.551  	{
   1.552 +*/
   1.553  	/* No savestate! savestate is called in cutNoSave
   1.554  		saveStateChangingPart(
   1.555  			sel->getParObj(),
   1.556 @@ -1922,14 +1961,16 @@
   1.557  			QString("Cut %1").arg(getObjectName(sel ))
   1.558  		);
   1.559  	*/	
   1.560 +/*	
   1.561  		copy();
   1.562  		deleteSelection();
   1.563  		reposition();
   1.564  	}
   1.565 -}
   1.566 -
   1.567 -void VymModel::moveBranchUp()
   1.568 -{
   1.569 +*/}
   1.570 +
   1.571 +void VymModel::moveBranchUp()	//FIXME-2
   1.572 +{
   1.573 +/*
   1.574  	BranchObj* bo=getSelectedBranch();
   1.575  	BranchObj* par;
   1.576  	if (bo)
   1.577 @@ -1943,10 +1984,12 @@
   1.578  		selection.update();
   1.579  		ensureSelectionVisible();
   1.580  	}
   1.581 +	*/
   1.582  }
   1.583  
   1.584 -void VymModel::moveBranchDown()
   1.585 -{
   1.586 +void VymModel::moveBranchDown()	//FIXME-2
   1.587 +{
   1.588 +/*
   1.589  	BranchObj* bo=getSelectedBranch();
   1.590  	BranchObj* par;
   1.591  	if (bo)
   1.592 @@ -1960,9 +2003,10 @@
   1.593  		selection.update();
   1.594  		ensureSelectionVisible();
   1.595  	}	
   1.596 +*/	
   1.597  }
   1.598  
   1.599 -void VymModel::sortChildren()	// FIXME-1 not implemented yet
   1.600 +void VymModel::sortChildren()	// FIXME-2 not implemented yet
   1.601  {
   1.602  /*
   1.603  	BranchObj* bo=getSelectedBranch();
   1.604 @@ -1979,10 +2023,11 @@
   1.605  */
   1.606  }
   1.607  
   1.608 -void VymModel::createMapCenter()
   1.609 -{
   1.610 -	MapCenterObj *mco=addMapCenter (QPointF (0,0) );
   1.611 -	select (mco);
   1.612 +MapCenterItem* VymModel::createMapCenter()
   1.613 +{
   1.614 +	MapCenterItem *mci=addMapCenter (QPointF (0,0) );
   1.615 +	select (mci);
   1.616 +	return mci;
   1.617  }
   1.618  
   1.619  BranchItem* VymModel::createBranch()	// FIXME-2 switcht addNewBrancInt to BranchItem...
   1.620 @@ -1991,8 +2036,9 @@
   1.621  	return (BranchItem*)bo->getTreeItem();
   1.622  }
   1.623  
   1.624 -TreeItem* VymModel::createImage()
   1.625 -{
   1.626 +TreeItem* VymModel::createImage()	//FIXME-2
   1.627 +{
   1.628 +/*
   1.629  	BranchObj *bo=getSelectedBranch();
   1.630  	if (bo)
   1.631  	{
   1.632 @@ -2015,25 +2061,26 @@
   1.633  		}
   1.634  	}
   1.635  	return NULL;
   1.636 +*/
   1.637  }
   1.638  
   1.639 -MapCenterObj* VymModel::addMapCenter ()
   1.640 -{
   1.641 -	MapCenterObj *mco=addMapCenter (contextPos);
   1.642 +MapCenterItem* VymModel::addMapCenter ()
   1.643 +{
   1.644 +	MapCenterItem *mci=addMapCenter (contextPos);	//FIXME-2 get rid of MCO here
   1.645  	//FIXME-3 selection.select (mco);
   1.646  	updateActions();
   1.647  	ensureSelectionVisible();
   1.648  	saveState (
   1.649 -		mco,
   1.650 +		mci,
   1.651  		"delete()",
   1.652  		NULL,
   1.653  		QString ("addMapCenter (%1,%2)").arg (contextPos.x()).arg(contextPos.y()),
   1.654  		QString ("Adding MapCenter to (%1,%2)").arg (contextPos.x()).arg(contextPos.y())
   1.655  	);	
   1.656 -	return mco;	
   1.657 +	return mci;	
   1.658  }
   1.659  
   1.660 -MapCenterObj* VymModel::addMapCenter(QPointF absPos)
   1.661 +MapCenterItem* VymModel::addMapCenter(QPointF absPos)
   1.662  {
   1.663  
   1.664  	// Create TreeItem
   1.665 @@ -2046,10 +2093,11 @@
   1.666  
   1.667  	QList<QVariant> cData;
   1.668  	cData << "VM:addMapCenter" << "undef"<<"undef";
   1.669 -	MapCenterItem *ti=new MapCenterItem (cData,rootItem);
   1.670 -	cout << "VM::addMapCenter  ti="<<ti<<endl;
   1.671 -	ti->setType (TreeItem::MapCenter);
   1.672 -	rootItem->appendChild (ti);
   1.673 +	MapCenterItem *mci=new MapCenterItem (cData,rootItem);
   1.674 +	cout << "VM::addMapCenter  mci="<<mci<<endl;
   1.675 +	mci->setType (TreeItem::MapCenter);
   1.676 +	mci->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
   1.677 +	rootItem->appendChild (mci);
   1.678  
   1.679  	endInsertRows();
   1.680  	emit (newChildObject (parix));
   1.681 @@ -2058,12 +2106,13 @@
   1.682  	// Create MapObj
   1.683  	MapCenterObj *mapCenter = new MapCenterObj(mapScene,this);
   1.684  	mapCenter->setMapEditor(mapEditor);		//FIXME-3 VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects
   1.685 -	mapCenter->setTreeItem (ti);	// TreeItem needs to exist before setVisibility
   1.686 -	ti->setLMO (mapCenter);
   1.687 +	mapCenter->setTreeItem (mci);	// TreeItem needs to exist before setVisibility
   1.688 +	mci->setLMO (mapCenter);
   1.689 +	mapCenter->updateHeading();
   1.690  	mapCenter->move (absPos);
   1.691      mapCenter->setVisibility (true);
   1.692 -	mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
   1.693 -	mapCenters.append(mapCenter);
   1.694 +	//mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
   1.695 +	mapCenters.append(mapCenter);	//FIXME-1 get rid of mapCenters...
   1.696  	// Testing
   1.697  /*
   1.698  	qWarning ("MW::insertRow a");
   1.699 @@ -2074,11 +2123,12 @@
   1.700  	qWarning ("MW::insertRow b");
   1.701  */
   1.702  
   1.703 -	return mapCenter;
   1.704 +	return mci;
   1.705  }
   1.706  
   1.707 -MapCenterObj* VymModel::removeMapCenter(MapCenterObj* mco)
   1.708 -{
   1.709 +MapCenterItem* VymModel::removeMapCenter(MapCenterItem* mci) //FIXME-2
   1.710 +{
   1.711 +/*
   1.712  	int i=mapCenters.indexOf (mco);
   1.713  	if (i>=0)
   1.714  	{
   1.715 @@ -2086,6 +2136,7 @@
   1.716  		delete (mco);
   1.717  		if (i>0) return mapCenters.at(i-1);	// Return previous MCO
   1.718  	}
   1.719 +*/	
   1.720  	return NULL;
   1.721  }
   1.722  
   1.723 @@ -2107,7 +2158,7 @@
   1.724  	// -1		insert in children of parent below selection 
   1.725  	// 0..n		insert in children of parent at pos
   1.726  	BranchObj *newbo=NULL;
   1.727 -	BranchObj *bo=getSelectedBranch();
   1.728 +	BranchObj *bo=getSelectedBranchObj();	//FIXME-2
   1.729  	BranchItem *bi=getSelectedBranchItem();
   1.730  	if (bo)
   1.731  	{
   1.732 @@ -2125,6 +2176,7 @@
   1.733  			beginInsertRows (parix,n,n+1);
   1.734  			bi=new BranchItem (cData,parbi);
   1.735  			bi->setType (TreeItem::Branch);
   1.736 +			bi->setHeading (QApplication::translate("Heading of new branch in map", "new"));
   1.737  
   1.738  			parbi->appendChild (bi);
   1.739  			endInsertRows ();
   1.740 @@ -2139,7 +2191,7 @@
   1.741  			{
   1.742  				bi->setLMO (newbo);
   1.743  				newbo->setTreeItem (bi);
   1.744 -				select (newbo); // FIXME-2 VM really needed here?
   1.745 +				select (bi); 
   1.746  			}
   1.747  			
   1.748  		}else if (num==-1)
   1.749 @@ -2163,7 +2215,7 @@
   1.750  	// -1	add above
   1.751  	//  0	add as child
   1.752  	// +1	add below
   1.753 -	BranchObj *bo = getSelectedBranch();
   1.754 +	BranchObj *bo = getSelectedBranchObj();	//FIXME-2
   1.755  	BranchObj *newbo=NULL;
   1.756  
   1.757  	if (bo)
   1.758 @@ -2175,9 +2227,9 @@
   1.759  		if (newbo)
   1.760  		{
   1.761  			saveState(
   1.762 -				newbo,		
   1.763 +				newbo->getTreeItem(),		
   1.764  				"delete ()",
   1.765 -				bo,
   1.766 +				bo->getTreeItem(),
   1.767  				QString ("addBranch (%1)").arg(pos),
   1.768  				QString ("Add new branch to %1").arg(getObjectName(bo)));	
   1.769  
   1.770 @@ -2197,8 +2249,9 @@
   1.771  }
   1.772  
   1.773  
   1.774 -BranchObj* VymModel::addNewBranchBefore()
   1.775 -{
   1.776 +BranchObj* VymModel::addNewBranchBefore()	//FIXME-2
   1.777 +{
   1.778 +/*
   1.779  	BranchObj *newbo=NULL;
   1.780  	BranchObj *bo = getSelectedBranch();
   1.781  	if (bo && selectionType()==TreeItem::Branch)
   1.782 @@ -2228,14 +2281,18 @@
   1.783  	}	
   1.784  	latestSelectionString=selection.getSelectString();
   1.785  	return newbo;
   1.786 +	*/
   1.787 +	return NULL;
   1.788  }
   1.789  
   1.790  void VymModel::deleteSelection()
   1.791  {
   1.792 -	BranchObj *bo = getSelectedBranch();	// FIXME-2 VM should not be necessary
   1.793 -	if (!bo) return;
   1.794 -
   1.795 -	QModelIndex ix=getSelectedIndex();
   1.796 +	BranchObj *bo = getSelectedBranchObj();	// FIXME-2 VM should not be necessary
   1.797 +	BranchItem *selbi=getSelectedBranchItem();
   1.798 +
   1.799 +	if (!selbi) return;
   1.800 +
   1.801 +	QModelIndex ix=index (selbi);
   1.802  	if (!ix.isValid() ) return;
   1.803  
   1.804  	QModelIndex parentIndex=parent(ix);
   1.805 @@ -2246,45 +2303,45 @@
   1.806  	return;
   1.807  	}
   1.808  */	
   1.809 -	TreeItem *ti=bo->getTreeItem();
   1.810  	
   1.811 -	if (selectionType()==TreeItem::MapCenter)	
   1.812 +	/*
   1.813 +	if (selbi->getType()==TreeItem::MapCenter)	
   1.814  	{
   1.815  	//	BranchObj* par=(BranchObj*)(bo->getParObj());
   1.816  		//selection.unselect();
   1.817 -		/* FIXME-1 VM Note:  does saveStateRemovingPart work for MCO? (No parent!)
   1.818 -		saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
   1.819 -		*/	
   1.820 +		// FIXME-1 VM Note:  does saveStateRemovingPart work for MCO? (No parent!)
   1.821 +		//saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
   1.822  		emit (layoutAboutToBeChanged() );
   1.823  
   1.824 -		parentIndex=parent(index(ti));
   1.825 -		cout << "VM::delete  ti="<<ti<<"  row="<<ix.row()<<"  parIndex.valid="<<parentIndex.isValid()<<endl;
   1.826 +		parentIndex=parent(index(selbi));
   1.827 +		cout << "VM::delete  selbi="<<selbi<<"  row="<<ix.row()<<"  parIndex.valid="<<parentIndex.isValid()<<endl;
   1.828  		int n=ix.row();
   1.829  		beginRemoveRows (parentIndex,n,n);
   1.830  		removeRows (n,1,parentIndex);
   1.831 -		bo=removeMapCenter ((MapCenterObj*)bo);
   1.832 +		MapCenterItem *mci=removeMapCenter (selbi);
   1.833  		endRemoveRows();
   1.834 -		if (bo) 
   1.835 +		if (mci) 
   1.836  		{
   1.837 -			select (bo);
   1.838 -			ensureSelectionVisible();
   1.839 +			select (mci);
   1.840  			ensureSelectionVisible();
   1.841  			reposition();
   1.842  		}	
   1.843  
   1.844  		emit (layoutChanged() );
   1.845  	}
   1.846 -	if (selectionType()==TreeItem::Branch)
   1.847 +	if (selbi->getType()==TreeItem::Branch)
   1.848 +	*/
   1.849 +	if (selbi->isBranchLikeType() )
   1.850  	{
   1.851  
   1.852  		BranchObj* par=(BranchObj*)bo->getParObj();
   1.853  		unselect();
   1.854 -		saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
   1.855 +		saveStateRemovingPart (selbi, QString ("Delete %1").arg(getObjectName(bo)));
   1.856  
   1.857  		emit (layoutAboutToBeChanged() );
   1.858  
   1.859 -		cout << "VM::delete  ti="<<ti<<"  row="<<ix.row()<<endl;
   1.860 -		parentIndex=parent(index(ti));
   1.861 +		cout << "VM::delete  selbi="<<selbi<<"  row="<<ix.row()<<endl;
   1.862 +		parentIndex=parent(index(selbi));
   1.863  		int n=ix.row();
   1.864  		beginRemoveRows (parentIndex,n,n);
   1.865  		removeRows (n,1,parentIndex);
   1.866 @@ -2319,9 +2376,10 @@
   1.867  	*/
   1.868  }
   1.869  
   1.870 -void VymModel::deleteKeepChildren()		//FIXME-1 VM still missing
   1.871 -
   1.872 -{
   1.873 +void VymModel::deleteKeepChildren()		//FIXME-2 VM still missing
   1.874 +
   1.875 +{
   1.876 +/*
   1.877  	BranchObj *bo=getSelectedBranch();
   1.878  	BranchObj *par;
   1.879  	if (bo)
   1.880 @@ -2354,11 +2412,12 @@
   1.881  		getSelectedBranch()->move2RelPos (p);
   1.882  		reposition();
   1.883  	}	
   1.884 -}
   1.885 -
   1.886 -void VymModel::deleteChildren()		//FIXME-1 VM still missing
   1.887 -
   1.888 -{
   1.889 +*/}
   1.890 +
   1.891 +void VymModel::deleteChildren()		//FIXME-2 VM still missing
   1.892 +
   1.893 +{
   1.894 +/*
   1.895  	BranchObj *bo=getSelectedBranch();
   1.896  	if (bo)
   1.897  	{		
   1.898 @@ -2371,7 +2430,7 @@
   1.899  		bo->removeChildren();
   1.900  		reposition();
   1.901  	}	
   1.902 -}
   1.903 +*/}
   1.904  
   1.905  
   1.906  bool VymModel::scrollBranch(BranchItem *bi)
   1.907 @@ -2384,7 +2443,7 @@
   1.908  		QString u,r;
   1.909  		r="scroll";
   1.910  		u="unscroll";
   1.911 -		/* FIXME-1 no savestate yet
   1.912 +		/* FIXME-3 no savestate yet
   1.913  		saveState(
   1.914  			bo,
   1.915  			QString ("%1 ()").arg(u),
   1.916 @@ -2412,7 +2471,7 @@
   1.917  		QString u,r;
   1.918  		u="scroll";
   1.919  		r="unscroll";
   1.920 -		/* FIXME-1 no savestate yet
   1.921 +		/* FIXME-3 no savestate yet
   1.922  		saveState(
   1.923  			bo,
   1.924  			QString ("%1 ()").arg(u),
   1.925 @@ -2458,8 +2517,9 @@
   1.926  */	
   1.927  }
   1.928  
   1.929 -void VymModel::addFloatImage (const QPixmap &img) 
   1.930 -{
   1.931 +void VymModel::addFloatImage (const QPixmap &img) //FIXME-2
   1.932 +{
   1.933 +/*
   1.934  	BranchObj *bo=getSelectedBranch();
   1.935  	if (bo)
   1.936    {
   1.937 @@ -2472,11 +2532,13 @@
   1.938      reposition();
   1.939      // FIXME-3 VM needed? scene()->update();
   1.940    }
   1.941 +*/
   1.942  }
   1.943  
   1.944  
   1.945 -void VymModel::colorBranch (QColor c)
   1.946 -{
   1.947 +void VymModel::colorBranch (QColor c)	//FIXME-2
   1.948 +{
   1.949 +/*
   1.950  	BranchObj *bo=getSelectedBranch();
   1.951  	if (bo)
   1.952  	{
   1.953 @@ -2489,10 +2551,12 @@
   1.954  		);	
   1.955  		bo->setColor(c); // color branch
   1.956  	}
   1.957 +*/
   1.958  }
   1.959  
   1.960 -void VymModel::colorSubtree (QColor c)
   1.961 -{
   1.962 +void VymModel::colorSubtree (QColor c) //FIXME-2
   1.963 +{
   1.964 +/*
   1.965  	BranchObj *bo=getSelectedBranch();
   1.966  	if (bo) 
   1.967  	{
   1.968 @@ -2504,21 +2568,25 @@
   1.969  		);	
   1.970  		bo->setColorSubtree (c); // color links, color children
   1.971  	}
   1.972 +*/	
   1.973  }
   1.974  
   1.975 -QColor VymModel::getCurrentHeadingColor()
   1.976 -{
   1.977 +QColor VymModel::getCurrentHeadingColor()	//FIXME-2
   1.978 +{
   1.979 +/*
   1.980  	BranchObj *bo=getSelectedBranch();
   1.981  	if (bo) return bo->getColor(); 
   1.982  	
   1.983  	QMessageBox::warning(0,"Warning","Can't get color of heading,\nthere's no branch selected");
   1.984 +	*/
   1.985  	return Qt::black;
   1.986  }
   1.987  
   1.988  
   1.989  
   1.990 -void VymModel::editURL()
   1.991 -{
   1.992 +void VymModel::editURL()	//FIXME-2
   1.993 +{
   1.994 +/*
   1.995  	BranchObj *bo=getSelectedBranch();
   1.996  	if (bo)
   1.997  	{		
   1.998 @@ -2530,10 +2598,12 @@
   1.999  			// user entered something and pressed OK
  1.1000  			setURL(text);
  1.1001  	}
  1.1002 +*/
  1.1003  }
  1.1004  
  1.1005 -void VymModel::editLocalURL()
  1.1006 -{
  1.1007 +void VymModel::editLocalURL()	//FIXME-2
  1.1008 +{
  1.1009 +/*
  1.1010  	BranchObj *bo=getSelectedBranch();
  1.1011  	if (bo)
  1.1012  	{		
  1.1013 @@ -2557,28 +2627,34 @@
  1.1014  			setURL (fd->selectedFile() );
  1.1015  		}
  1.1016  	}
  1.1017 +	*/
  1.1018  }
  1.1019  
  1.1020  
  1.1021 -void VymModel::editHeading2URL()
  1.1022 -{
  1.1023 +void VymModel::editHeading2URL() //FIXME-2
  1.1024 +{
  1.1025 +/*
  1.1026  	BranchObj *bo=getSelectedBranch();
  1.1027  	if (bo)
  1.1028  		setURL (bo->getHeading());
  1.1029 +*/		
  1.1030  }	
  1.1031  
  1.1032 -void VymModel::editBugzilla2URL()
  1.1033 -{
  1.1034 +void VymModel::editBugzilla2URL()	//FIXME-2
  1.1035 +{
  1.1036 +/*
  1.1037  	BranchObj *bo=getSelectedBranch();
  1.1038  	if (bo)
  1.1039  	{		
  1.1040  		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
  1.1041  		setURL (url);
  1.1042  	}
  1.1043 +*/	
  1.1044  }	
  1.1045  
  1.1046 -void VymModel::editFATE2URL()
  1.1047 -{
  1.1048 +void VymModel::editFATE2URL()	//FIXME-2
  1.1049 +{
  1.1050 +/*
  1.1051  	BranchObj *bo=getSelectedBranch();
  1.1052  	if (bo)
  1.1053  	{		
  1.1054 @@ -2593,12 +2669,13 @@
  1.1055  		bo->setURL (url);
  1.1056  		updateActions();
  1.1057  	}
  1.1058 +*/	
  1.1059  }	
  1.1060  
  1.1061  void VymModel::editVymLink()
  1.1062  {
  1.1063 -	BranchObj *bo=getSelectedBranch();
  1.1064 -	if (bo)
  1.1065 +	BranchItem *bi=getSelectedBranchItem();
  1.1066 +	if (bi)
  1.1067  	{		
  1.1068  		QStringList filters;
  1.1069  		filters <<"VYM map (*.vym)";
  1.1070 @@ -2606,8 +2683,8 @@
  1.1071  		fd->setFilters (filters);
  1.1072  		fd->setCaption(vymName+" - " +tr("Link to another map"));
  1.1073  		fd->setDirectory (lastFileDir);
  1.1074 -		if (! bo->getVymLink().isEmpty() )
  1.1075 -			fd->selectFile( bo->getVymLink() );
  1.1076 +		if (! bi->getVymLink().isEmpty() )
  1.1077 +			fd->selectFile( bi->getVymLink() );
  1.1078  		fd->show();
  1.1079  
  1.1080  		QString fn;
  1.1081 @@ -2615,44 +2692,45 @@
  1.1082  		{
  1.1083  			lastFileDir=QDir (fd->directory().path());
  1.1084  			saveState(
  1.1085 -				bo,
  1.1086 -				"setVymLink (\""+bo->getVymLink()+"\")",
  1.1087 -				bo,
  1.1088 +				bi,
  1.1089 +				"setVymLink (\""+bi->getVymLink()+"\")",
  1.1090 +				bi,
  1.1091  				"setVymLink (\""+fd->selectedFile()+"\")",
  1.1092 -				QString("Set vymlink of %1 to %2").arg(getObjectName(bo)).arg(fd->selectedFile())
  1.1093 +				QString("Set vymlink of %1 to %2").arg(getObjectName(bi)).arg(fd->selectedFile())
  1.1094  			);	
  1.1095  			setVymLink (fd->selectedFile() );	// FIXME-2 ok?
  1.1096  		}
  1.1097  	}
  1.1098  }
  1.1099  
  1.1100 -void VymModel::setVymLink (const QString &s)
  1.1101 +void VymModel::setVymLink (const QString &s)	// FIXME-3 no savestate?
  1.1102  {
  1.1103  	// Internal function, no saveState needed
  1.1104 -	BranchObj *bo=getSelectedBranch();
  1.1105 -	if (bo)
  1.1106 +	BranchItem *bi=getSelectedBranchItem();
  1.1107 +	if (bi)
  1.1108  	{
  1.1109 -		bo->setVymLink(s);
  1.1110 +		bi->getBranchObj()->setVymLink(s);	//FIXME-3 check getBO
  1.1111  		reposition();
  1.1112  		updateActions();
  1.1113 -		selection.update();
  1.1114 +		//selection.update();
  1.1115  		ensureSelectionVisible();
  1.1116  	}
  1.1117  }
  1.1118  
  1.1119  void VymModel::deleteVymLink()
  1.1120  {
  1.1121 -	BranchObj *bo=getSelectedBranch();
  1.1122 -	if (bo)
  1.1123 +	BranchItem *bi=getSelectedBranchItem();
  1.1124 +	if (bi)
  1.1125  	{		
  1.1126  		saveState(
  1.1127 -			bo,
  1.1128 -			"setVymLink (\""+bo->getVymLink()+"\")",
  1.1129 -			bo,
  1.1130 +			bi,
  1.1131 +			"setVymLink (\""+bi->getBranchObj()->getVymLink()+"\")", //FIXME-3 check getBO
  1.1132 +
  1.1133 +			bi,
  1.1134  			"setVymLink (\"\")",
  1.1135 -			QString("Unset vymlink of %1").arg(getObjectName(bo))
  1.1136 +			QString("Unset vymlink of %1").arg(getObjectName(bi))
  1.1137  		);	
  1.1138 -		bo->setVymLink ("" );
  1.1139 +		bi->getBranchObj()->setVymLink ("" );	//FIXME-3 check getBO
  1.1140  		updateActions();
  1.1141  		reposition();
  1.1142  		// FIXME-3 VM needed? scene()->update();
  1.1143 @@ -2661,9 +2739,9 @@
  1.1144  
  1.1145  QString VymModel::getVymLink()
  1.1146  {
  1.1147 -	BranchObj *bo=getSelectedBranch();
  1.1148 -	if (bo)
  1.1149 -		return bo->getVymLink();
  1.1150 +	BranchItem *bi=getSelectedBranchItem();
  1.1151 +	if (bi)
  1.1152 +		return bi->getBranchObj()->getVymLink();	//FIXME-3 check getBO here...
  1.1153  	else	
  1.1154  		return "";
  1.1155  	
  1.1156 @@ -2689,8 +2767,10 @@
  1.1157  }
  1.1158  
  1.1159  
  1.1160 -void VymModel::followXLink(int i)
  1.1161 -{
  1.1162 +void VymModel::followXLink(int i)	// FIXME-2
  1.1163 +{
  1.1164 +	i=0;
  1.1165 +	/*
  1.1166  	BranchObj *bo=getSelectedBranch();
  1.1167  	if (bo)
  1.1168  	{
  1.1169 @@ -2701,10 +2781,13 @@
  1.1170  			ensureSelectionVisible();
  1.1171  		}
  1.1172  	}
  1.1173 +	*/
  1.1174  }
  1.1175  
  1.1176 -void VymModel::editXLink(int i)	// FIXME-1 VM missing saveState
  1.1177 -{
  1.1178 +void VymModel::editXLink(int i)	// FIXME-2 VM missing saveState
  1.1179 +{
  1.1180 +	i=0;
  1.1181 +	/*
  1.1182  	BranchObj *bo=getSelectedBranch();
  1.1183  	if (bo)
  1.1184  	{
  1.1185 @@ -2726,6 +2809,7 @@
  1.1186  			}
  1.1187  		}	
  1.1188  	}
  1.1189 +*/	
  1.1190  }
  1.1191  
  1.1192  
  1.1193 @@ -2738,7 +2822,7 @@
  1.1194  
  1.1195  void VymModel::parseAtom(const QString &atom)
  1.1196  {
  1.1197 -	BranchObj *selb=getSelectedBranch();
  1.1198 +	//BranchObj *selb=getSelectedBranch();	// FIXME-4
  1.1199  	TreeItem* selti=getSelectedItem();
  1.1200  	BranchItem *selbi=getSelectedBranchItem();
  1.1201  	QString s,t;
  1.1202 @@ -2757,7 +2841,7 @@
  1.1203  		if (!selti)
  1.1204  		{
  1.1205  			parser.setError (Aborted,"Nothing selected");
  1.1206 -		} else if (! selb )
  1.1207 +		} else if (! selbi )
  1.1208  		{				  
  1.1209  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1210  		} else 
  1.1211 @@ -2781,7 +2865,7 @@
  1.1212  		if (!selti)
  1.1213  		{
  1.1214  			parser.setError (Aborted,"Nothing selected");
  1.1215 -		} else if (! selb )
  1.1216 +		} else if (! selbi )
  1.1217  		{				  
  1.1218  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1219  		} else 
  1.1220 @@ -2809,7 +2893,7 @@
  1.1221  		if (!selti)
  1.1222  		{
  1.1223  			parser.setError (Aborted,"Nothing selected");
  1.1224 -		} else if (! selb )
  1.1225 +		} else if (! selbi )
  1.1226  		{				  
  1.1227  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1228  		} else if (parser.checkParCount(1))
  1.1229 @@ -2817,7 +2901,7 @@
  1.1230  			//s=parser.parString (ok,0);	// selection
  1.1231  			t=parser.parString (ok,0);	// path to map
  1.1232  			if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
  1.1233 -			addMapReplaceInt(getSelectString(selb),t);	
  1.1234 +			addMapReplaceInt(getSelectString(selbi),t);	
  1.1235  		}
  1.1236  	/////////////////////////////////////////////////////////////////////
  1.1237  	} else if (com==QString("addMapInsert"))
  1.1238 @@ -2825,7 +2909,7 @@
  1.1239  		if (!selti)
  1.1240  		{
  1.1241  			parser.setError (Aborted,"Nothing selected");
  1.1242 -		} else if (! selb )
  1.1243 +		} else if (! selbi )
  1.1244  		{				  
  1.1245  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1246  		} else 
  1.1247 @@ -2839,12 +2923,12 @@
  1.1248  			}
  1.1249  		}
  1.1250  	/////////////////////////////////////////////////////////////////////
  1.1251 -	} else if (com=="clearFlags")
  1.1252 +	} else /*if (com=="clearFlags")	// FIXME-2
  1.1253  	{
  1.1254  		if (!selti )
  1.1255  		{
  1.1256  			parser.setError (Aborted,"Nothing selected");
  1.1257 -		} else if (! selb )
  1.1258 +		} else if (! selbi )
  1.1259  		{				  
  1.1260  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1261  		} else if (parser.checkParCount(0))
  1.1262 @@ -2853,12 +2937,12 @@
  1.1263  			selb->updateFlagsToolbar();
  1.1264  		}
  1.1265  	/////////////////////////////////////////////////////////////////////
  1.1266 -	} else if (com=="colorBranch")
  1.1267 +	} else */ if (com=="colorBranch")
  1.1268  	{
  1.1269  		if (!selti)
  1.1270  		{
  1.1271  			parser.setError (Aborted,"Nothing selected");
  1.1272 -		} else if (! selb )
  1.1273 +		} else if (! selbi )
  1.1274  		{				  
  1.1275  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1276  		} else if (parser.checkParCount(1))
  1.1277 @@ -2872,7 +2956,7 @@
  1.1278  		if (!selti)
  1.1279  		{
  1.1280  			parser.setError (Aborted,"Nothing selected");
  1.1281 -		} else if (! selb )
  1.1282 +		} else if (! selbi )
  1.1283  		{				  
  1.1284  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1285  		} else if (parser.checkParCount(1))
  1.1286 @@ -2886,7 +2970,7 @@
  1.1287  		if (!selti)
  1.1288  		{
  1.1289  			parser.setError (Aborted,"Nothing selected");
  1.1290 -		} else if (! selb )
  1.1291 +		} else if (! selbi )
  1.1292  		{				  
  1.1293  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1294  		} else if (parser.checkParCount(0))
  1.1295 @@ -2930,7 +3014,7 @@
  1.1296  		if (!selti)
  1.1297  		{
  1.1298  			parser.setError (Aborted,"Nothing selected");
  1.1299 -		} else if (! selb )
  1.1300 +		} else if (! selbi )
  1.1301  		{
  1.1302  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1303  		} else if (parser.checkParCount(0))
  1.1304 @@ -2943,7 +3027,7 @@
  1.1305  		if (!selti)
  1.1306  		{
  1.1307  			parser.setError (Aborted,"Nothing selected");
  1.1308 -		} else if (! selb)
  1.1309 +		} else if (! selbi)
  1.1310  		{
  1.1311  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1312  		} else if (parser.checkParCount(0))
  1.1313 @@ -3021,7 +3105,7 @@
  1.1314  		if (!selti)
  1.1315  		{
  1.1316  			parser.setError (Aborted,"Nothing selected");
  1.1317 -		} else if (! selb )
  1.1318 +		} else if (! selbi )
  1.1319  		{				  
  1.1320  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1321  		} else if (parser.checkParCount(1))
  1.1322 @@ -3030,12 +3114,12 @@
  1.1323  			if (ok) importDirInt(s);
  1.1324  		}	
  1.1325  	/////////////////////////////////////////////////////////////////////
  1.1326 -	} else if (com=="linkTo")
  1.1327 +	} else /* FIXME-2 if (com=="linkTo")
  1.1328  	{
  1.1329  		if (!selti)
  1.1330  		{
  1.1331  			parser.setError (Aborted,"Nothing selected");
  1.1332 -		} else if ( selb)
  1.1333 +		} else if ( selbi)
  1.1334  		{
  1.1335  			if (parser.checkParCount(4))
  1.1336  			{
  1.1337 @@ -3065,7 +3149,7 @@
  1.1338  							y=parser.parDouble(ok,3);
  1.1339  							if (ok) 
  1.1340  							{
  1.1341 -								selb->move (x,y);
  1.1342 +								selbi->move (x,y);
  1.1343  								selection.update();
  1.1344  							}
  1.1345  						}
  1.1346 @@ -3090,12 +3174,12 @@
  1.1347  		} else
  1.1348  			parser.setError (Aborted,"Type of selection is not a floatimage or branch");
  1.1349  	/////////////////////////////////////////////////////////////////////
  1.1350 -	} else if (com=="loadImage")
  1.1351 +	} else */ if (com=="loadImage")
  1.1352  	{
  1.1353  		if (!selti)
  1.1354  		{
  1.1355  			parser.setError (Aborted,"Nothing selected");
  1.1356 -		} else if (! selb )
  1.1357 +		} else if (! selbi )
  1.1358  		{				  
  1.1359  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1360  		} else if (parser.checkParCount(1))
  1.1361 @@ -3109,7 +3193,7 @@
  1.1362  		if (!selti )
  1.1363  		{
  1.1364  			parser.setError (Aborted,"Nothing selected");
  1.1365 -		} else if (! selb )
  1.1366 +		} else if (! selbi )
  1.1367  		{				  
  1.1368  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1369  		} else if (parser.checkParCount(0))
  1.1370 @@ -3122,7 +3206,7 @@
  1.1371  		if (!selti )
  1.1372  		{
  1.1373  			parser.setError (Aborted,"Nothing selected");
  1.1374 -		} else if (! selb )
  1.1375 +		} else if (! selbi )
  1.1376  		{				  
  1.1377  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1378  		} else if (parser.checkParCount(0))
  1.1379 @@ -3178,7 +3262,7 @@
  1.1380  		if (!selti )
  1.1381  		{
  1.1382  			parser.setError (Aborted,"Nothing selected");
  1.1383 -		} else if (! selb )
  1.1384 +		} else if (! selbi )
  1.1385  		{				  
  1.1386  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1387  		} else if (parser.checkParCount(1))
  1.1388 @@ -3192,7 +3276,7 @@
  1.1389  		if (!selti )
  1.1390  		{
  1.1391  			parser.setError (Aborted,"Nothing selected");
  1.1392 -		} else if (! selb )
  1.1393 +		} else if (! selbi )
  1.1394  		{				  
  1.1395  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1396  		} else if (parser.checkParCount(4))
  1.1397 @@ -3232,12 +3316,12 @@
  1.1398  									parser.setError (Aborted,"Unknown operator: "+t);
  1.1399  								} else
  1.1400  								{
  1.1401 -									if (! selb    )
  1.1402 +									if (! selbi    )
  1.1403  									{
  1.1404  										parser.setError (Aborted,"Type of selection is not a branch");
  1.1405  									} else
  1.1406  									{
  1.1407 -										if (selb->getHeading() == u)
  1.1408 +										if (selbi->getHeading() == u)
  1.1409  										{
  1.1410  											cout << "PASSED: " << qPrintable (c)  << endl;
  1.1411  										} else
  1.1412 @@ -3296,7 +3380,7 @@
  1.1413  		if (!selti )
  1.1414  		{
  1.1415  			parser.setError (Aborted,"Nothing selected");
  1.1416 -		} else if (! selb )
  1.1417 +		} else if (! selbi )
  1.1418  		{				  
  1.1419  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1420  		} else if (parser.checkParCount(0))
  1.1421 @@ -3308,12 +3392,12 @@
  1.1422  				
  1.1423  		}	
  1.1424  	/////////////////////////////////////////////////////////////////////
  1.1425 -	} else if (com=="selectLastImage")
  1.1426 +	} else /* FIXME-2 if (com=="selectLastImage")
  1.1427  	{
  1.1428  		if (!selti )
  1.1429  		{
  1.1430  			parser.setError (Aborted,"Nothing selected");
  1.1431 -		} else if (! selb )
  1.1432 +		} else if (! selbi )
  1.1433  		{				  
  1.1434  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1435  		} else if (parser.checkParCount(0))
  1.1436 @@ -3325,7 +3409,7 @@
  1.1437  				
  1.1438  		}	
  1.1439  	/////////////////////////////////////////////////////////////////////
  1.1440 -	} else if (com=="selectLatestAdded")
  1.1441 +	} else */ if (com=="selectLatestAdded")
  1.1442  	{
  1.1443  		if (latestSelectionString.isEmpty() )
  1.1444  		{
  1.1445 @@ -3417,7 +3501,7 @@
  1.1446  		if (!selti )
  1.1447  		{
  1.1448  			parser.setError (Aborted,"Nothing selected");
  1.1449 -		} else if (! getSelectedBranch() )
  1.1450 +		} else if (! selbi )
  1.1451  		{				  
  1.1452  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1453  		} else if (parser.checkParCount(1))
  1.1454 @@ -3431,7 +3515,7 @@
  1.1455  		if (!selti )
  1.1456  		{
  1.1457  			parser.setError (Aborted,"Nothing selected");
  1.1458 -		} else if (! selb )
  1.1459 +		} else if (! selbi )
  1.1460  		{				  
  1.1461  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1462  		} else if (parser.checkParCount(1))
  1.1463 @@ -3453,7 +3537,7 @@
  1.1464  		if (!selti )
  1.1465  		{
  1.1466  			parser.setError (Aborted,"Nothing selected");
  1.1467 -		} else if (! selb )
  1.1468 +		} else if (! selbi )
  1.1469  		{				  
  1.1470  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1471  		} else if (parser.checkParCount(1))
  1.1472 @@ -3482,7 +3566,7 @@
  1.1473  		if (!selti )
  1.1474  		{
  1.1475  			parser.setError (Aborted,"Nothing selected");
  1.1476 -		} else if (! selb)
  1.1477 +		} else if (! selbi)
  1.1478  		{				  
  1.1479  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1480  		} else if (parser.checkParCount(1))
  1.1481 @@ -3496,7 +3580,7 @@
  1.1482  		if (!selti )
  1.1483  		{
  1.1484  			parser.setError (Aborted,"Nothing selected");
  1.1485 -		} else if (! selb)
  1.1486 +		} else if (! selbi)
  1.1487  		{				  
  1.1488  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1489  		} else if (parser.checkParCount(1))
  1.1490 @@ -3532,7 +3616,7 @@
  1.1491  		if (!selti )
  1.1492  		{
  1.1493  			parser.setError (Aborted,"Nothing selected");
  1.1494 -		} else if (! selb )
  1.1495 +		} else if (! selbi )
  1.1496  		{				  
  1.1497  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1498  		} else if (parser.checkParCount(1))
  1.1499 @@ -3546,7 +3630,7 @@
  1.1500  		if (!selti )
  1.1501  		{
  1.1502  			parser.setError (Aborted,"Nothing selected");
  1.1503 -		} else if (! selb )
  1.1504 +		} else if (! selbi )
  1.1505  		{				  
  1.1506  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1507  		} else if (parser.checkParCount(1))
  1.1508 @@ -3556,12 +3640,12 @@
  1.1509  		}	
  1.1510  	}
  1.1511  	/////////////////////////////////////////////////////////////////////
  1.1512 -	else if (com=="setFlag")
  1.1513 +	else /* FIXME-2 if (com=="setFlag")
  1.1514  	{
  1.1515  		if (!selti )
  1.1516  		{
  1.1517  			parser.setError (Aborted,"Nothing selected");
  1.1518 -		} else if (! selb )
  1.1519 +		} else if (! selbi )
  1.1520  		{				  
  1.1521  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1522  		} else if (parser.checkParCount(1))
  1.1523 @@ -3574,7 +3658,7 @@
  1.1524  			}	
  1.1525  		}
  1.1526  	/////////////////////////////////////////////////////////////////////
  1.1527 -	} else if (com=="setFrameType")
  1.1528 +	} else */ /* FIXME-2 if (com=="setFrameType")
  1.1529  	{
  1.1530  		if (!selti )
  1.1531  		{
  1.1532 @@ -3589,12 +3673,12 @@
  1.1533  				setFrameType (s);
  1.1534  		}
  1.1535  	/////////////////////////////////////////////////////////////////////
  1.1536 -	} else if (com=="sortChildren")
  1.1537 +	} else*/ if (com=="sortChildren")
  1.1538  	{
  1.1539  		if (!selti )
  1.1540  		{
  1.1541  			parser.setError (Aborted,"Nothing selected");
  1.1542 -		} else if (! selb )
  1.1543 +		} else if (! selbi )
  1.1544  		{				  
  1.1545  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1546  		} else if (parser.checkParCount(0))
  1.1547 @@ -3602,12 +3686,12 @@
  1.1548  			sortChildren();
  1.1549  		}
  1.1550  	/////////////////////////////////////////////////////////////////////
  1.1551 -	} else if (com=="toggleFlag")
  1.1552 +	} else /* FIXME-2 if (com=="toggleFlag")
  1.1553  	{
  1.1554  		if (!selti )
  1.1555  		{
  1.1556  			parser.setError (Aborted,"Nothing selected");
  1.1557 -		} else if (! selb )
  1.1558 +		} else if (! selbi )
  1.1559  		{				  
  1.1560  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1561  		} else if (parser.checkParCount(1))
  1.1562 @@ -3615,17 +3699,17 @@
  1.1563  			s=parser.parString(ok,0);
  1.1564  			if (ok) 
  1.1565  			{
  1.1566 -				selb->toggleStandardFlag(s);	
  1.1567 +				selbi->toggleStandardFlag(s);	
  1.1568  				selb->updateFlagsToolbar();
  1.1569  			}	
  1.1570  		}
  1.1571  	/////////////////////////////////////////////////////////////////////
  1.1572 -	} else if (com=="unscroll")
  1.1573 +	} else */ if (com=="unscroll")
  1.1574  	{
  1.1575  		if (!selti)
  1.1576  		{
  1.1577  			parser.setError (Aborted,"Nothing selected");
  1.1578 -		} else if (! selb )
  1.1579 +		} else if (! selbi )
  1.1580  		{				  
  1.1581  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1582  		} else if (parser.checkParCount(0))
  1.1583 @@ -3639,7 +3723,7 @@
  1.1584  		if (!selti)
  1.1585  		{
  1.1586  			parser.setError (Aborted,"Nothing selected");
  1.1587 -		} else if (! selb )
  1.1588 +		} else if (! selbi )
  1.1589  		{				  
  1.1590  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1591  		} else if (parser.checkParCount(0))
  1.1592 @@ -3647,12 +3731,12 @@
  1.1593  			unscrollChildren ();
  1.1594  		}	
  1.1595  	/////////////////////////////////////////////////////////////////////
  1.1596 -	} else if (com=="unsetFlag")
  1.1597 +	} else /* FIXME-2 if (com=="unsetFlag")
  1.1598  	{
  1.1599  		if (selection.isEmpty() )
  1.1600  		{
  1.1601  			parser.setError (Aborted,"Nothing selected");
  1.1602 -		} else if (! selb )
  1.1603 +		} else if (! selbi )
  1.1604  		{				  
  1.1605  			parser.setError (Aborted,"Type of selection is not a branch");
  1.1606  		} else if (parser.checkParCount(1))
  1.1607 @@ -3664,7 +3748,7 @@
  1.1608  				selb->updateFlagsToolbar();
  1.1609  			}	
  1.1610  		}
  1.1611 -	} else
  1.1612 +	} else */
  1.1613  		parser.setError (Aborted,"Unknown command");
  1.1614  
  1.1615  	// Any errors?
  1.1616 @@ -3694,9 +3778,9 @@
  1.1617  	// should be called before and after exports
  1.1618  	// depending on the settings
  1.1619  	if (b && settings.value("/export/useHideExport","true")=="true")
  1.1620 -		setHideTmpMode (HideExport);
  1.1621 +		setHideTmpMode (TreeItem::HideExport);
  1.1622  	else	
  1.1623 -		setHideTmpMode (HideNone);
  1.1624 +		setHideTmpMode (TreeItem::HideNone);
  1.1625  }
  1.1626  
  1.1627  void VymModel::exportImage(QString fname, bool askName, QString format)
  1.1628 @@ -3897,7 +3981,7 @@
  1.1629  		mapCenters.at(i)->updateRelPositions();
  1.1630  }
  1.1631  
  1.1632 -void VymModel::reposition()
  1.1633 +void VymModel::reposition()	//FIXME-2 get rid of mapCenters...
  1.1634  {
  1.1635  	for (int i=0;i<mapCenters.count(); i++)
  1.1636  		mapCenters.at(i)->reposition();	//	for positioning heading
  1.1637 @@ -3937,7 +4021,7 @@
  1.1638  
  1.1639  }
  1.1640  
  1.1641 -void VymModel::moveAway(LinkableMapObj *lmo)
  1.1642 +void VymModel::moveAway(LinkableMapObj *lmo)	//FIXME-5
  1.1643  {
  1.1644  	// Autolayout:
  1.1645  	//
  1.1646 @@ -3955,6 +4039,7 @@
  1.1647  		pA=shape (boA);
  1.1648  		pB=shape (boB);
  1.1649  		PolygonCollisionResult r = PolygonCollision(pA, pB, QPoint(0,0));
  1.1650 +		/*
  1.1651  		cout <<"------->"
  1.1652  			<<"="<<r.intersect
  1.1653  			<<"  ("<<qPrintable(boA->getHeading() )<<")"
  1.1654 @@ -3962,6 +4047,7 @@
  1.1655  			<<")  willIntersect"
  1.1656  			<<r.willIntersect 
  1.1657  			<<"  minT="<<r.minTranslation<<endl<<endl;
  1.1658 +			*/
  1.1659  	}
  1.1660  }
  1.1661  
  1.1662 @@ -4147,7 +4233,7 @@
  1.1663  	mapScene->setBackgroundBrush(brush);
  1.1664  }
  1.1665  
  1.1666 -void VymModel::selectMapBackgroundColor()	// FIXME-1 move to ME
  1.1667 +void VymModel::selectMapBackgroundColor()	// FIXME-3 move to ME
  1.1668  {
  1.1669  	QColor col = QColorDialog::getColor( mapScene->backgroundBrush().color(), NULL);
  1.1670  	if ( !col.isValid() ) return;
  1.1671 @@ -4155,7 +4241,7 @@
  1.1672  }
  1.1673  
  1.1674  
  1.1675 -void VymModel::setMapBackgroundColor(QColor col)	// FIXME-1 move to ME
  1.1676 +void VymModel::setMapBackgroundColor(QColor col)	// FIXME-3 move to ME
  1.1677  {
  1.1678  	QColor oldcol=mapScene->backgroundBrush().color();
  1.1679  	saveState(
  1.1680 @@ -4165,44 +4251,46 @@
  1.1681  	mapScene->setBackgroundBrush(col);
  1.1682  }
  1.1683  
  1.1684 -QColor VymModel::getMapBackgroundColor()	// FIXME-1 move to ME
  1.1685 +QColor VymModel::getMapBackgroundColor()	// FIXME-3 move to ME
  1.1686  {
  1.1687      return mapScene->backgroundBrush().color();
  1.1688  }
  1.1689  
  1.1690  
  1.1691 -LinkableMapObj::ColorHint VymModel::getMapLinkColorHint()	// FIXME-1 move to ME
  1.1692 +LinkableMapObj::ColorHint VymModel::getMapLinkColorHint()	// FIXME-3 move to ME
  1.1693  {
  1.1694  	return linkcolorhint;
  1.1695  }
  1.1696  
  1.1697 -QColor VymModel::getMapDefLinkColor()	// FIXME-1 move to ME
  1.1698 +QColor VymModel::getMapDefLinkColor()	// FIXME-3 move to ME
  1.1699  {
  1.1700  	return defLinkColor;
  1.1701  }
  1.1702  
  1.1703 -void VymModel::setMapDefXLinkColor(QColor col)	// FIXME-1 move to ME
  1.1704 +void VymModel::setMapDefXLinkColor(QColor col)	// FIXME-3 move to ME
  1.1705  {
  1.1706  	defXLinkColor=col;
  1.1707  }
  1.1708  
  1.1709 -QColor VymModel::getMapDefXLinkColor()	// FIXME-1 move to ME
  1.1710 +QColor VymModel::getMapDefXLinkColor()	// FIXME-3 move to ME
  1.1711  {
  1.1712  	return defXLinkColor;
  1.1713  }
  1.1714  
  1.1715 -void VymModel::setMapDefXLinkWidth (int w)	// FIXME-1 move to ME
  1.1716 +void VymModel::setMapDefXLinkWidth (int w)	// FIXME-3 move to ME
  1.1717  {
  1.1718  	defXLinkWidth=w;
  1.1719  }
  1.1720  
  1.1721 -int VymModel::getMapDefXLinkWidth()	// FIXME-1 move to ME
  1.1722 +int VymModel::getMapDefXLinkWidth()	// FIXME-3 move to ME
  1.1723  {
  1.1724  	return defXLinkWidth;
  1.1725  }
  1.1726  
  1.1727 -void VymModel::move(const double &x, const double &y)
  1.1728 -{
  1.1729 +void VymModel::move(const double &x, const double &y)	// FIXME-3
  1.1730 +{
  1.1731 +	int i=x; i=y;
  1.1732 +/*
  1.1733  	BranchObj *bo = getSelectedBranch();
  1.1734  	if (bo && 
  1.1735  		(selectionType()==TreeItem::Branch ||
  1.1736 @@ -4225,10 +4313,13 @@
  1.1737              selection.update();
  1.1738          }
  1.1739  	}
  1.1740 +*/	
  1.1741  }
  1.1742  
  1.1743 -void VymModel::moveRel (const double &x, const double &y)
  1.1744 -{
  1.1745 +void VymModel::moveRel (const double &x, const double &y)	// FIXME-3
  1.1746 +{
  1.1747 +	int i=x; i=y;
  1.1748 +/*
  1.1749  	BranchObj *bo = getSelectedBranch();
  1.1750  	if (bo && 
  1.1751  		(selectionType()==TreeItem::Branch ||
  1.1752 @@ -4253,6 +4344,7 @@
  1.1753              selection.update();
  1.1754          }
  1.1755  	}
  1.1756 +*/	
  1.1757  }
  1.1758  
  1.1759  
  1.1760 @@ -4501,11 +4593,11 @@
  1.1761  	return mapEditor->getSelectionColor();
  1.1762  }
  1.1763  
  1.1764 -void VymModel::setHideTmpMode (HideTmpMode mode)
  1.1765 +void VymModel::setHideTmpMode (TreeItem::HideTmpMode mode)
  1.1766  {
  1.1767  	hidemode=mode;
  1.1768 -	for (int i=0;i<mapCenters.count(); i++)
  1.1769 -		mapCenters.at(i)->setHideTmp (mode);	
  1.1770 +	for (int i=0;i<rootItem->childCount();i++)
  1.1771 +		rootItem->child(i)->setHideTmp (mode);	
  1.1772  	reposition();
  1.1773  	// FIXME-3 needed? scene()->update();
  1.1774  }
  1.1775 @@ -4607,10 +4699,16 @@
  1.1776  	if (lmo &&mapEditor) mapEditor->ensureVisible (lmo->getBBox() );
  1.1777  }
  1.1778  
  1.1779 -void VymModel::emitContentHasChanged (TreeItem *ti)
  1.1780 +void VymModel::emitNoteHasChanged (TreeItem *ti)
  1.1781  {
  1.1782  	QModelIndex ix=index(ti);
  1.1783 -	emit (contentHasChanged (ix) );
  1.1784 +	emit (noteHasChanged (ix) );
  1.1785 +}
  1.1786 +
  1.1787 +void VymModel::emitDataHasChanged (TreeItem *ti)
  1.1788 +{
  1.1789 +	QModelIndex ix=index(ti);
  1.1790 +	emit (dataHasChanged (ix) );
  1.1791  }
  1.1792  
  1.1793  
  1.1794 @@ -4637,8 +4735,8 @@
  1.1795  void VymModel::selectNextBranchInt()
  1.1796  {
  1.1797  	// Increase number of branch
  1.1798 -	LinkableMapObj *sel=getSelectedBranch();
  1.1799 -	if (sel)
  1.1800 +	BranchItem *selbi=getSelectedBranchItem();
  1.1801 +	if (selbi)
  1.1802  	{
  1.1803  		QString s=getSelectString();
  1.1804  		QString part;
  1.1805 @@ -4664,7 +4762,7 @@
  1.1806  		// try to increase the parental number in order to
  1.1807  		// find a successor with same depth
  1.1808  
  1.1809 -		int d=getSelectedLMO()->getDepth();
  1.1810 +		int d=getSelectedBranchItem()->depth();
  1.1811  		int oldDepth=d;
  1.1812  		int i;
  1.1813  		bool found=false;
  1.1814 @@ -4685,7 +4783,7 @@
  1.1815  			} else
  1.1816  			{
  1.1817  				// Special case, look at orientation
  1.1818 -				if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter)
  1.1819 +				if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter)	// FIXME-3 check access to LMO
  1.1820  					num=QString ("%1").arg(num.toUInt()+1);
  1.1821  				else	
  1.1822  					num=QString ("%1").arg(num.toUInt()-1);
  1.1823 @@ -4745,7 +4843,7 @@
  1.1824  		// try to decrease the parental number in order to
  1.1825  		// find a precessor with same depth
  1.1826  
  1.1827 -		int d=getSelectedLMO()->getDepth();
  1.1828 +		int d=getSelectedBranchItem()->depth();
  1.1829  		int oldDepth=d;
  1.1830  		int i;
  1.1831  		bool found=false;
  1.1832 @@ -4766,7 +4864,7 @@
  1.1833  			} else
  1.1834  			{
  1.1835  				// Special case, look at orientation
  1.1836 -				if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter)
  1.1837 +				if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter)	// FIXME-3 check access to LMO
  1.1838  					num=QString ("%1").arg(num.toInt()-1);
  1.1839  				else	
  1.1840  					num=QString ("%1").arg(num.toInt()+1);
  1.1841 @@ -4799,13 +4897,13 @@
  1.1842  {
  1.1843  	if (selection.isBlocked() ) return;
  1.1844  
  1.1845 -	BranchObj *bo=getSelectedBranch();
  1.1846 -	if (bo && selectionType()==TreeItem::Branch)
  1.1847 +	BranchItem *bi=getSelectedBranchItem();
  1.1848 +	if (bi && bi->getType()==TreeItem::Branch)
  1.1849  	{
  1.1850 -		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
  1.1851 +		if (bi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter)	//FIXME-3 check getBO
  1.1852  			selectPrevBranchInt();
  1.1853  		else
  1.1854 -			if (bo->getDepth()==1)
  1.1855 +			if (bi->depth()==1)
  1.1856  				selectNextBranchInt();
  1.1857  			else
  1.1858  				selectPrevBranchInt();
  1.1859 @@ -4816,13 +4914,13 @@
  1.1860  {
  1.1861  	if (selection.isBlocked() ) return;
  1.1862  
  1.1863 -	BranchObj *bo=getSelectedBranch();
  1.1864 -	if (bo && selectionType()==TreeItem::Branch)
  1.1865 +	BranchItem *bi=getSelectedBranchItem();
  1.1866 +	if (bi && bi->getType()==TreeItem::Branch)
  1.1867  	{
  1.1868 -		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
  1.1869 +		if (bi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter)	//FIXME-3 check getBO
  1.1870  			selectNextBranchInt();
  1.1871  		else
  1.1872 -			if (bo->getDepth()==1)
  1.1873 +			if (bi->depth()==1)
  1.1874  				selectPrevBranchInt();
  1.1875  			else
  1.1876  				selectNextBranchInt();
  1.1877 @@ -4836,31 +4934,31 @@
  1.1878  
  1.1879  	QItemSelection oldsel=selModel->selection();
  1.1880  
  1.1881 -	BranchObj* par;
  1.1882 -	LinkableMapObj *sel=getSelectedBranch();
  1.1883 -	if (sel)
  1.1884 +	BranchItem* par;
  1.1885 +	BranchItem *selbi=getSelectedBranchItem();
  1.1886 +	TreeItem::Type type=selbi->getType();
  1.1887 +	if (selbi)
  1.1888  	{
  1.1889 -		if (selectionType()== TreeItem::MapCenter)
  1.1890 +		if (type == TreeItem::MapCenter)
  1.1891  		{
  1.1892 -			QModelIndex ix=getSelectedIndex();
  1.1893 +			QModelIndex ix=index(selbi);
  1.1894  			selModel->select (index (rowCount(ix)-1,0,ix),QItemSelectionModel::ClearAndSelect  );
  1.1895  		} else
  1.1896  		{
  1.1897 -			par=(BranchObj*)(sel->getParObj());
  1.1898 -			if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
  1.1899 +			par=(BranchItem*)selbi->parent();
  1.1900 +			if (selbi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter)	//FIXME-3 check getBO...
  1.1901  			{
  1.1902  				// right of center
  1.1903 -				if (selectionType() == TreeItem::Branch ||
  1.1904 -					selectionType() == TreeItem::Image)
  1.1905 +				if (type == TreeItem::Branch ||
  1.1906 +					type == TreeItem::Image)
  1.1907  				{
  1.1908 -					QModelIndex ix=getSelectedIndex();
  1.1909 -					ix=parent(ix);
  1.1910 +					QModelIndex ix=index (selbi->parent());
  1.1911  					selModel->select (ix,QItemSelectionModel::ClearAndSelect  );
  1.1912  				}
  1.1913  			} else
  1.1914  			{
  1.1915  				// left of center
  1.1916 -				if (selectionType() == TreeItem::Branch )
  1.1917 +				if (type == TreeItem::Branch )
  1.1918  				{
  1.1919  					selectLastSelectedBranch();
  1.1920  					return;
  1.1921 @@ -4877,21 +4975,22 @@
  1.1922  
  1.1923  	QItemSelection oldsel=selModel->selection();
  1.1924  
  1.1925 -	BranchObj* par;
  1.1926 -	LinkableMapObj *sel=getSelectedBranch();
  1.1927 -	if (sel)
  1.1928 +	BranchItem* par;
  1.1929 +	BranchItem *selbi=getSelectedBranchItem();
  1.1930 +	TreeItem::Type type=selbi->getType();
  1.1931 +	if (selbi)
  1.1932  	{
  1.1933 -		if (selectionType()== TreeItem::MapCenter)
  1.1934 +		if (type==TreeItem::MapCenter)
  1.1935  		{
  1.1936 -			QModelIndex ix=getSelectedIndex();
  1.1937 +			QModelIndex ix=index(selbi);
  1.1938  			selModel->select (index (0,0,ix),QItemSelectionModel::ClearAndSelect  );
  1.1939  		} else
  1.1940  		{
  1.1941 -			par=(BranchObj*)(sel->getParObj());
  1.1942 -			if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
  1.1943 +			par=(BranchItem*)selbi->parent();
  1.1944 +			if (selbi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter)	//FIXME-3 check getBO
  1.1945  			{
  1.1946  				// right of center
  1.1947 -				if (selectionType() == TreeItem::Branch )
  1.1948 +				if ( type== TreeItem::Branch )
  1.1949  				{
  1.1950  					selectLastSelectedBranch();
  1.1951  					return;
  1.1952 @@ -4899,11 +4998,10 @@
  1.1953  			} else
  1.1954  			{
  1.1955  				// left of center
  1.1956 -				if (selectionType() == TreeItem::Branch ||
  1.1957 -					selectionType() == TreeItem::Image)
  1.1958 +				if (type == TreeItem::Branch ||
  1.1959 +					type == TreeItem::Image)
  1.1960  				{
  1.1961 -					QModelIndex ix=getSelectedIndex();
  1.1962 -					ix=parent(ix);
  1.1963 +					QModelIndex ix=index(selbi->parent());
  1.1964  					selModel->select (ix,QItemSelectionModel::ClearAndSelect  );
  1.1965  				}
  1.1966  			}
  1.1967 @@ -4995,7 +5093,7 @@
  1.1968  	return NULL;
  1.1969  }
  1.1970  
  1.1971 -BranchObj* VymModel::getSelectedBranch()
  1.1972 +BranchObj* VymModel::getSelectedBranchObj()	// FIXME-3 this should not be needed in the end!!!
  1.1973  {
  1.1974  	TreeItem *ti = getSelectedBranchItem();
  1.1975  	if (ti)
  1.1976 @@ -5017,6 +5115,19 @@
  1.1977  	return NULL;
  1.1978  }
  1.1979  
  1.1980 +MapCenterItem* VymModel::getSelectedMapCenterItem()
  1.1981 +{
  1.1982 +	QModelIndexList list=selModel->selectedIndexes();
  1.1983 +	if (!list.isEmpty() )
  1.1984 +	{
  1.1985 +		TreeItem *ti = getItem (list.first() );
  1.1986 +		TreeItem::Type type=ti->getType();
  1.1987 +		if (ti->getType()==TreeItem::MapCenter)
  1.1988 +			return (MapCenterItem*)ti;
  1.1989 +	}
  1.1990 +	return NULL;
  1.1991 +}
  1.1992 +
  1.1993  TreeItem* VymModel::getSelectedItem()
  1.1994  {
  1.1995  	QModelIndexList list=selModel->selectedIndexes();