more fixes
authorinsilmaril
Mon Jun 29 10:27:42 2009 +0000 (2009-06-29)
changeset 7778acac4fade1b
parent 776 25e634a7e1dc
child 778 7b4e73ac247e
more fixes
branchitem.cpp
branchitem.h
branchpropwindow.cpp
exports.cpp
floatobj.cpp
mainwindow.cpp
mapeditor.cpp
mapitem.cpp
mapitem.h
ornamentedobj.cpp
ornamentedobj.h
treeitem.cpp
treeitem.h
version.h
vymmodel.cpp
vymmodel.h
vymview.cpp
xml-vym.cpp
     1.1 --- a/branchitem.cpp	Mon Jun 08 11:36:56 2009 +0000
     1.2 +++ b/branchitem.cpp	Mon Jun 29 10:27:42 2009 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4  
     1.5  using namespace std;
     1.6  
     1.7 -BranchItem::BranchItem(const QList<QVariant> &data, MapItem *parent):MapItem (data,parent)
     1.8 +BranchItem::BranchItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
     1.9  {
    1.10  	//cout << "Constr. BranchItem\n";
    1.11  
    1.12 @@ -105,11 +105,9 @@
    1.13      s+=valueElement("heading", getHeading(),
    1.14  		attribut ("textColor",QColor( bo->getColor()).name()));
    1.15  
    1.16 -/*	
    1.17 -	// Save frame  //FIXME-2
    1.18 -	if (frame->getFrameType()!=FrameObj::NoFrame) 
    1.19 -		s+=frame->saveToDir ();
    1.20 -*/		
    1.21 +	// Save frame  //FIXME-4 not saved if there is no LMO
    1.22 +	if (lmo && ((OrnamentedObj*)lmo)->getFrame()->getFrameType()!=FrameObj::NoFrame) 
    1.23 +		s+=((OrnamentedObj*)lmo)->getFrame()->saveToDir ();
    1.24  
    1.25  	// save names of flags set
    1.26  	s+=standardFlags.saveToDir(tmpdir,prefix,0);
    1.27 @@ -354,7 +352,7 @@
    1.28  
    1.29  	if (lmo)
    1.30  	{
    1.31 -		lmo->setParObj ( ((MapItem*)parentItem)->getLMO() );
    1.32 +		lmo->setParObj ( parentItem->getLMO() );
    1.33  	}
    1.34  }
    1.35  
    1.36 @@ -376,9 +374,9 @@
    1.37  		newbo->setFrameType (FrameObj::Rectangle);
    1.38  	} else
    1.39  	{
    1.40 -		newbo->setParObj( ((MapItem*)parentItem)->getLMO() );
    1.41 +		newbo->setParObj( parentItem->getLMO() );
    1.42  		// Set visibility depending on parents
    1.43 -		if (((BranchItem*)parentItem)->scrolled || !((MapItem*)parentItem)->getLMO()->isVisibleObj() )
    1.44 +		if (((BranchItem*)parentItem)->scrolled || !parentItem->getLMO()->isVisibleObj() )
    1.45  			newbo->setVisibility (false);
    1.46  	}
    1.47  	newbo->setDefAttr(BranchObj::NewBranch);
     2.1 --- a/branchitem.h	Mon Jun 08 11:36:56 2009 +0000
     2.2 +++ b/branchitem.h	Mon Jun 29 10:27:42 2009 +0000
     2.3 @@ -1,17 +1,17 @@
     2.4  #ifndef BRANCHITEM_H
     2.5  #define BRANCHITEM_H
     2.6  
     2.7 -#include "mapitem.h"
     2.8 +#include "treeitem.h"
     2.9  
    2.10  
    2.11  class QString;
    2.12  class BranchObj;
    2.13  class QGraphicsScene;
    2.14  
    2.15 -class BranchItem:public MapItem
    2.16 +class BranchItem:public TreeItem
    2.17  {
    2.18  public:
    2.19 -    BranchItem(const QList<QVariant> &data, MapItem *parent = 0);
    2.20 +    BranchItem(const QList<QVariant> &data, TreeItem *parent = 0);
    2.21      virtual ~BranchItem();
    2.22  	void copy (BranchItem *item);
    2.23  
     3.1 --- a/branchpropwindow.cpp	Mon Jun 08 11:36:56 2009 +0000
     3.2 +++ b/branchpropwindow.cpp	Mon Jun 29 10:27:42 2009 +0000
     3.3 @@ -57,12 +57,13 @@
     3.4  	settings.setValue( "/satellite/propertywindow/showWithMain",isVisible() );
     3.5  }
     3.6  
     3.7 -void BranchPropertyWindow::setBranch (BranchObj *bo)	//FIXME-2 maybe do this via signals emitted anyway from model?
     3.8 +void BranchPropertyWindow::setBranch (BranchObj *bo)	
     3.9  {
    3.10  	disconnectSignals();
    3.11  	branch=bo;
    3.12  	if (bo) 
    3.13  	{
    3.14 +		qWarning ("BPW::setBranch");
    3.15  		ui.tabWidget->setEnabled (true);
    3.16  
    3.17  		// Frame
     4.1 --- a/exports.cpp	Mon Jun 08 11:36:56 2009 +0000
     4.2 +++ b/exports.cpp	Mon Jun 29 10:27:42 2009 +0000
     4.3 @@ -131,7 +131,7 @@
     4.4  	caption=vymName+ " -" +QObject::tr("Export as ASCII")+" "+QObject::tr("(still experimental)");
     4.5  }
     4.6  
     4.7 -void ExportASCII::doExport()	//FIXME-1 segfaults...
     4.8 +void ExportASCII::doExport()	
     4.9  {
    4.10  	QFile file (outputFile);
    4.11  	if ( !file.open( QIODevice::WriteOnly ) )
     5.1 --- a/floatobj.cpp	Mon Jun 08 11:36:56 2009 +0000
     5.2 +++ b/floatobj.cpp	Mon Jun 29 10:27:42 2009 +0000
     5.3 @@ -35,7 +35,8 @@
     5.4  	floatExport=true;
     5.5  	zPlane=Z_ICON;
     5.6  	setLinkStyle (LinkableMapObj::Parabel);
     5.7 -	setHideLinkUnselected(true);
     5.8 +	setHideLinkUnselected(false);
     5.9 +	//FIXME-2 setHideLinkUnselected(true);
    5.10  }
    5.11  
    5.12  void FloatObj::copy (FloatObj* other)
     6.1 --- a/mainwindow.cpp	Mon Jun 08 11:36:56 2009 +0000
     6.2 +++ b/mainwindow.cpp	Mon Jun 29 10:27:42 2009 +0000
     6.3 @@ -3249,7 +3249,7 @@
     6.4  
     6.5  void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
     6.6  {
     6.7 -	//branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select(). Maybe use signal now...
     6.8 +	branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select(). Maybe use signal now...
     6.9  
    6.10  	if (model && model==currentModel() )
    6.11  	{
     7.1 --- a/mapeditor.cpp	Mon Jun 08 11:36:56 2009 +0000
     7.2 +++ b/mapeditor.cpp	Mon Jun 29 10:27:42 2009 +0000
     7.3 @@ -189,7 +189,7 @@
     7.4  		LinkableMapObj* lmo=NULL;
     7.5  		TreeItem *ti= static_cast<TreeItem*>(index.internalPointer());
     7.6  		if (ti->getType()==TreeItem::Image ||ti->isBranchLikeType() )
     7.7 -			lmo=((MapItem*)ti)->getLMO();
     7.8 +			lmo=ti->getLMO();
     7.9  		if (lmo) setScrollBarPosTarget (lmo->getBBox() );
    7.10  	}
    7.11  }
    7.12 @@ -599,7 +599,7 @@
    7.13      QPointF p = mapToScene(e->pos());
    7.14      TreeItem *ti=findMapItem (p, NULL);
    7.15      LinkableMapObj* lmo=NULL;
    7.16 -	if (ti) lmo=((MapItem*)ti)->getLMO();
    7.17 +	if (ti) lmo=ti->getLMO();
    7.18  	
    7.19      if (lmo) 
    7.20  	{	// MapObj was found
    7.21 @@ -683,7 +683,7 @@
    7.22      QPointF p = mapToScene(e->pos());
    7.23      TreeItem *ti=findMapItem (p, NULL);
    7.24      LinkableMapObj* lmo=NULL;
    7.25 -	if (ti) lmo=((MapItem*)ti)->getLMO();
    7.26 +	if (ti) lmo=ti->getLMO();
    7.27  	
    7.28  	e->accept();
    7.29  
    7.30 @@ -763,8 +763,6 @@
    7.31  		// Left Button	    Move Branches
    7.32  		if (e->button() == Qt::LeftButton )
    7.33  		{
    7.34 -			//movingObj_start.setX( p.x() - selection->x() );// TODO replaced selection->lmo here	
    7.35 -			//movingObj_start.setY( p.y() - selection->y() );	
    7.36  			movingObj_start.setX( p.x() - lmo->x() );	
    7.37  			movingObj_start.setY( p.y() - lmo->y() );	
    7.38  			movingObj_orgPos.setX (lmo->x() );
    7.39 @@ -818,9 +816,9 @@
    7.40  {
    7.41      QPointF p = mapToScene(e->pos());
    7.42  	TreeItem *seli=model->getSelectedItem();
    7.43 -	LinkableMapObj* lmosel=NULL;		//FIXME-2 get rid of lmosel
    7.44 +	LinkableMapObj* lmosel=NULL;	
    7.45  	if (seli && (seli->isBranchLikeType() ||seli->getType()==TreeItem::Image))
    7.46 -		lmosel=((MapItem*)seli)->getLMO();
    7.47 +		lmosel=seli->getLMO();
    7.48  
    7.49      // Move the selected MapObj
    7.50      if ( lmosel && movingObj) 
    7.51 @@ -840,15 +838,18 @@
    7.52  		// of selection back to absPos)
    7.53  		
    7.54  		// Check if we could link 
    7.55 -		TreeItem *dsti=findMapItem (p, seli);
    7.56 +		TreeItem *ti=findMapItem (p, seli);
    7.57 +		BranchItem *dsti=NULL;
    7.58  		LinkableMapObj* dst=NULL;
    7.59 -		if (dsti && dsti!=seli && dsti->isBranchLikeType())
    7.60 -			dst=((MapItem*)dsti)->getLMO(); 
    7.61 -		else
    7.62 +		if (ti && ti!=seli && ti->isBranchLikeType())
    7.63 +		{
    7.64 +			dsti=(BranchItem*)ti;
    7.65 +			dst=dsti->getLMO(); 
    7.66 +		} else
    7.67  			dsti=NULL;
    7.68  		
    7.69  
    7.70 -		if (lmosel && seli->getType()==TreeItem::Image)
    7.71 +		if (lmosel && seli->getType()==TreeItem::Image)	
    7.72  		{
    7.73  			FloatObj *fio=(FloatImageObj*)lmosel;
    7.74  			fio->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
    7.75 @@ -858,23 +859,23 @@
    7.76  
    7.77  			// Relink float to new mapcenter or branch, if shift is pressed	
    7.78  			// Only relink, if selection really has a new parent
    7.79 -			if ( (e->modifiers()==Qt::ShiftModifier) && dst && ( dst != fio->getParObj())  
    7.80 -				)
    7.81 +			if ( e->modifiers()==Qt::ShiftModifier && dsti &&  dsti != seli->parent()  )
    7.82  			{
    7.83  				// Also save the move which was done so far
    7.84  				QString pold=qpointfToString(movingObj_orgRelPos);
    7.85  				QString pnow=qpointfToString(fio->getRelPos());
    7.86  				model->saveState(
    7.87 -					fio->getTreeItem(),  // FIXME-3 
    7.88 +					seli,
    7.89  					"moveRel "+pold,
    7.90 -					fio->getTreeItem(),
    7.91 +					seli,
    7.92  					"moveRel "+pnow,
    7.93  					QString("Move %1 to relative position %2").arg(model->getObjectName(fio)).arg(pnow));
    7.94  				fio->getParObj()->requestReposition();
    7.95  				model->reposition();
    7.96  
    7.97 -				model->linkFloatImageTo (model->getSelectString(dst));
    7.98 -				//movingObj=lmosel;
    7.99 +				model->relinkImage ((ImageItem*) seli,dsti);
   7.100 +				model->select (seli);
   7.101 +				//movingObj=lmosel;	//FIXME-3
   7.102  				//movingObj_orgRelPos=lmosel->getRelPos();	
   7.103  
   7.104  				model->reposition();
   7.105 @@ -967,7 +968,7 @@
   7.106  	if (seli) dsti=findMapItem(p, seli);
   7.107  	LinkableMapObj* dst=NULL;
   7.108  	if (dsti && dsti->isBranchLikeType ()) 
   7.109 -		dst=((MapItem*)dsti)->getLMO();	
   7.110 +		dst=dsti->getLMO();	
   7.111  	else
   7.112  		dsti=NULL;
   7.113  
   7.114 @@ -1012,7 +1013,7 @@
   7.115      {	
   7.116  		if (seli->getType()==TreeItem::Image)
   7.117  		{
   7.118 -			FloatImageObj *fio=(FloatImageObj*)(((MapItem*)seli)->getLMO());
   7.119 +			FloatImageObj *fio=(FloatImageObj*)(seli->getLMO());
   7.120  			if(fio)
   7.121  			{
   7.122  				// Moved FloatObj. Maybe we need to reposition
   7.123 @@ -1049,8 +1050,8 @@
   7.124  	
   7.125  		if (seli->isBranchLikeType() ) //(seli->getType() == TreeItem::Branch )
   7.126  		{	// A branch was moved
   7.127 -			LinkableMapObj* lmosel=NULL;		//FIXME-2 get rid of lmosel
   7.128 -			lmosel=((MapItem*)seli)->getLMO();
   7.129 +			LinkableMapObj* lmosel=NULL;		
   7.130 +			lmosel=seli->getLMO();
   7.131  				
   7.132  			// save the position in case we link to mapcenter
   7.133  			QPointF savePos=QPointF (lmosel->getAbsPos()  );
   7.134 @@ -1343,7 +1344,7 @@
   7.135  	{
   7.136  		index=newsel.indexes().at(i);
   7.137  		ti= static_cast<TreeItem*>(index.internalPointer());
   7.138 -		lmo=((MapItem*)ti)->getLMO();
   7.139 +		lmo=ti->getLMO();
   7.140  		bbox=lmo->getBBox();
   7.141  		sb->setRect (
   7.142  			bbox.x(),bbox.y(), 
   7.143 @@ -1369,7 +1370,7 @@
   7.144  	
   7.145  	if (ti->isBranchLikeType())
   7.146  	{
   7.147 -		BranchObj *bo=(BranchObj*) ((MapItem*)ti)->getLMO();
   7.148 +		BranchObj *bo=(BranchObj*) (ti->getLMO());
   7.149  		bo->updateData();
   7.150  	}
   7.151  
     8.1 --- a/mapitem.cpp	Mon Jun 08 11:36:56 2009 +0000
     8.2 +++ b/mapitem.cpp	Mon Jun 29 10:27:42 2009 +0000
     8.3 @@ -3,20 +3,11 @@
     8.4  #include "linkablemapobj.h"
     8.5  #include "ornamentedobj.h"
     8.6  
     8.7 -#include <iostream>
     8.8 -using namespace std;
     8.9 -#include "misc.h"	//cout << QPointF
    8.10 -
    8.11  MapItem::MapItem()
    8.12  {
    8.13  	init();
    8.14  }
    8.15  
    8.16 -MapItem::MapItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
    8.17 -{
    8.18 -	init();
    8.19 -}
    8.20 -
    8.21  void MapItem::init()
    8.22  {
    8.23  	lmo=NULL;
    8.24 @@ -72,35 +63,3 @@
    8.25  	}
    8.26  }
    8.27  
    8.28 -QString MapItem::getAttr()
    8.29 -{
    8.30 -	QString s;
    8.31 -	if (parentItem==rootItem)
    8.32 -		posMode=Absolute;
    8.33 -	else
    8.34 -	{
    8.35 -		if (type==TreeItem::Image ||depth()==1)
    8.36 -			posMode=Relative;
    8.37 -		else
    8.38 -			posMode=Unused;
    8.39 -	}
    8.40 -	switch (posMode)
    8.41 -	{
    8.42 -		case Relative:	
    8.43 -			if (lmo) pos=lmo->getRelPos();
    8.44 -			s= attribut("relPosX",QString().setNum(pos.x())) +
    8.45 -			   attribut("relPosY",QString().setNum(pos.y())); 
    8.46 -			break;
    8.47 -		case Absolute:	
    8.48 -			if (lmo) pos=lmo->getAbsPos();
    8.49 -			s=attribut("absPosX",QString().setNum(pos.x())) +
    8.50 -			  attribut("absPosY",QString().setNum(pos.y())); 
    8.51 -			break;
    8.52 -		default: break;
    8.53 -	}
    8.54 -	if (hideExport)
    8.55 -		return s+attribut("hideInExport","true");
    8.56 -	else	
    8.57 -		return s;
    8.58 -}
    8.59 -
     9.1 --- a/mapitem.h	Mon Jun 08 11:36:56 2009 +0000
     9.2 +++ b/mapitem.h	Mon Jun 29 10:27:42 2009 +0000
     9.3 @@ -3,11 +3,9 @@
     9.4  
     9.5  #include <QPointF>
     9.6  
     9.7 -#include "treeitem.h"
     9.8  #include "xmlobj.h"
     9.9  
    9.10  class LinkableMapObj;
    9.11 -class TreeItem;
    9.12  
    9.13  /*! /brief MapItem is used to store information of MapObj and inherited
    9.14     classes.
    9.15 @@ -17,7 +15,7 @@
    9.16  	but just a treeview instead.
    9.17  */
    9.18  
    9.19 -class MapItem:public TreeItem, public XMLObj
    9.20 +class MapItem:public XMLObj
    9.21  {
    9.22  public:
    9.23  	enum PositionMode {Unused,Absolute,Relative};
    9.24 @@ -27,7 +25,6 @@
    9.25  
    9.26  public:
    9.27  	MapItem();
    9.28 -	MapItem (const QList<QVariant> &data, TreeItem *parent = 0);
    9.29  	void init();
    9.30  
    9.31  	/*! Used to save relative position while map is not in QGraphicsView */
    9.32 @@ -52,8 +49,6 @@
    9.33  	/*! Initialize LinkableMapObj with data in MapItem */
    9.34  	virtual void initLMO();
    9.35  
    9.36 -	/*! Return data as attributes for saving in XML */
    9.37 -	virtual QString getAttr();
    9.38  };
    9.39  
    9.40  
    10.1 --- a/ornamentedobj.cpp	Mon Jun 08 11:36:56 2009 +0000
    10.2 +++ b/ornamentedobj.cpp	Mon Jun 29 10:27:42 2009 +0000
    10.3 @@ -76,6 +76,11 @@
    10.4      return heading->getColor();
    10.5  }
    10.6  
    10.7 +FrameObj* OrnamentedObj::getFrame()
    10.8 +{
    10.9 +	return frame;
   10.10 +}
   10.11 +
   10.12  FrameObj::FrameType OrnamentedObj::getFrameType()
   10.13  {
   10.14  	return frame->getFrameType();
    11.1 --- a/ornamentedobj.h	Mon Jun 08 11:36:56 2009 +0000
    11.2 +++ b/ornamentedobj.h	Mon Jun 29 10:27:42 2009 +0000
    11.3 @@ -30,6 +30,7 @@
    11.4  	virtual void setColor(QColor);			// set the color of text and link
    11.5  	QColor getColor ();						// get color of heading
    11.6  
    11.7 +	virtual FrameObj* getFrame();
    11.8  	virtual FrameObj::FrameType getFrameType ();
    11.9  	virtual QString getFrameTypeName ();
   11.10  	virtual void setFrameType (const FrameObj::FrameType &);
    12.1 --- a/treeitem.cpp	Mon Jun 08 11:36:56 2009 +0000
    12.2 +++ b/treeitem.cpp	Mon Jun 29 10:27:42 2009 +0000
    12.3 @@ -13,6 +13,7 @@
    12.4  
    12.5  TreeItem::TreeItem()
    12.6  {
    12.7 +	//cout << "Constr. TI\n";
    12.8  	init();
    12.9  	itemData.clear();
   12.10  	rootItem=this;
   12.11 @@ -60,6 +61,9 @@
   12.12  
   12.13      parentItem = NULL;
   12.14      itemData.clear();
   12.15 +	QList<QVariant> cData;
   12.16 +	itemData<< "VM:addMapCenter" << "undef"<<"undef";
   12.17 +
   12.18  
   12.19  	branchOffset=0;
   12.20  	branchCounter=0;
   12.21 @@ -120,6 +124,10 @@
   12.22  	item->rootItem=rootItem;
   12.23  	item->setModel (model);
   12.24  
   12.25 +	// If lmo exists, also set parObj there
   12.26 +	if (lmo && item->lmo)
   12.27 +		item->lmo->setParObj (lmo);
   12.28 +
   12.29  	if (item->type == Image)
   12.30  	{
   12.31  		childItems.insert (imageCounter,item);
   12.32 @@ -665,11 +673,10 @@
   12.33  	if (type==Branch || type==Image)
   12.34  	{
   12.35  		hideExport=b;
   12.36 -		// FIXME-1 call setVis and updateContentsSize...
   12.37  		if (b)
   12.38 -			systemFlags.activate("hideInExport");
   12.39 +			systemFlags.activate("system-hideInExport");
   12.40  		else	
   12.41 -			systemFlags.deactivate("hideInExport");
   12.42 +			systemFlags.deactivate("system-hideInExport");
   12.43  	}
   12.44  }	
   12.45  
   12.46 @@ -683,5 +690,37 @@
   12.47  	return hidden;
   12.48  }	
   12.49  
   12.50 +QString TreeItem::getAttr()
   12.51 +{
   12.52 +	QString s;
   12.53 +	if (parentItem==rootItem)
   12.54 +		posMode=Absolute;
   12.55 +	else
   12.56 +	{
   12.57 +		if (type==TreeItem::Image ||depth()==1)
   12.58 +			posMode=Relative;
   12.59 +		else
   12.60 +			posMode=Unused;
   12.61 +	}
   12.62 +	switch (posMode)
   12.63 +	{
   12.64 +		case Relative:	
   12.65 +			if (lmo) pos=lmo->getRelPos();
   12.66 +			s= attribut("relPosX",QString().setNum(pos.x())) +
   12.67 +			   attribut("relPosY",QString().setNum(pos.y())); 
   12.68 +			break;
   12.69 +		case Absolute:	
   12.70 +			if (lmo) pos=lmo->getAbsPos();
   12.71 +			s=attribut("absPosX",QString().setNum(pos.x())) +
   12.72 +			  attribut("absPosY",QString().setNum(pos.y())); 
   12.73 +			break;
   12.74 +		default: break;
   12.75 +	}
   12.76 +	if (hideExport)
   12.77 +		return s+attribut("hideInExport","true");
   12.78 +	else	
   12.79 +		return s;
   12.80 +}
   12.81  
   12.82  
   12.83 +
    13.1 --- a/treeitem.h	Mon Jun 08 11:36:56 2009 +0000
    13.2 +++ b/treeitem.h	Mon Jun 29 10:27:42 2009 +0000
    13.3 @@ -6,6 +6,7 @@
    13.4  #include <QVariant>
    13.5  
    13.6  #include "flagrow.h"
    13.7 +#include "mapitem.h"
    13.8  #include "noteobj.h"
    13.9  #include "xmlobj.h"
   13.10  
   13.11 @@ -16,10 +17,10 @@
   13.12  class ImageItem;
   13.13  class VymModel;
   13.14  
   13.15 -class TreeItem
   13.16 +class TreeItem:public MapItem
   13.17  {
   13.18  public:
   13.19 -	enum Type {Undefined,MapCenter,Branch,Image};
   13.20 +	enum Type {Undefined,MapCenter,Branch,Image};	//FIXME-3 MapCenter still needed?
   13.21  	enum HideTmpMode {HideNone, HideExport};
   13.22  
   13.23      TreeItem();
   13.24 @@ -164,6 +165,7 @@
   13.25  	virtual void setHideInExport(bool);		// set export of object (and children)
   13.26  	virtual bool hideInExport();
   13.27  	virtual bool isHidden ();		
   13.28 +	virtual QString getAttr();				//! Get attributes for saving as XML
   13.29  
   13.30  	
   13.31  protected:
    14.1 --- a/version.h	Mon Jun 08 11:36:56 2009 +0000
    14.2 +++ b/version.h	Mon Jun 29 10:27:42 2009 +0000
    14.3 @@ -7,7 +7,7 @@
    14.4  #define __VYM_VERSION "1.13.0"
    14.5  //#define __VYM_CODENAME "Codename: RC-1"
    14.6  #define __VYM_CODENAME "Codename: development version, not for production!"
    14.7 -#define __VYM_BUILD_DATE "2009-06-08"
    14.8 +#define __VYM_BUILD_DATE "2009-06-29"
    14.9  
   14.10  
   14.11  bool checkVersion(const QString &);
    15.1 --- a/vymmodel.cpp	Mon Jun 08 11:36:56 2009 +0000
    15.2 +++ b/vymmodel.cpp	Mon Jun 29 10:27:42 2009 +0000
    15.3 @@ -1609,162 +1609,154 @@
    15.4  	return urls;
    15.5  }
    15.6  
    15.7 -void VymModel::linkFloatImageTo(const QString &dstString)	// FIXME-0
    15.8 -{
    15.9 -	//FIXME-0 FloatImageObj *fio=selection.getFloatImage();
   15.10 -	FloatImageObj *fio=NULL;
   15.11 -	if (fio)
   15.12 +
   15.13 +void VymModel::setFrameType(const FrameObj::FrameType &t)	//FIXME-4 not saved if there is no LMO
   15.14 +{
   15.15 +	BranchItem *bi=getSelectedBranchItem();
   15.16 +	if (bi)
   15.17  	{
   15.18 -		TreeItem *dst=findBySelectString (dstString);
   15.19 -		if (dst && dst->isBranchLikeType() )
   15.20 -		{			
   15.21 -			TreeItem *dstPar=dst->parent();
   15.22 -			QString parString=getSelectString(dstPar);
   15.23 -			QString fioPreSelectString=getSelectString(fio);
   15.24 -			QString fioPreParentSelectString=getSelectString (fio->getParObj());
   15.25 -			// FIXME-0 ((BranchObj*)dst)->addFloatImage (fio);
   15.26 -			unselect();
   15.27 -			// ((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
   15.28 -			fio=((BranchObj*)dst)->getLastFloatImage();
   15.29 -			fio->setRelPos();
   15.30 -			fio->reposition();
   15.31 -			// select (fio);
   15.32 -			saveState(
   15.33 -				getSelectString(fio),
   15.34 -				QString("linkTo (\"%1\")").arg(fioPreParentSelectString), 
   15.35 -				fioPreSelectString, 
   15.36 -				QString ("linkTo (\"%1\")").arg(dstString),
   15.37 -				QString ("Link floatimage to %1").arg(getObjectName(dst)));
   15.38 +		BranchObj *bo=(BranchObj*)(bi->getLMO());
   15.39 +		if (bo)
   15.40 +		{
   15.41 +			QString s=bo->getFrameTypeName();
   15.42 +			bo->setFrameType (t);
   15.43 +			saveState (bi, QString("setFrameType (\"%1\")").arg(s),
   15.44 +				bi, QString ("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),QString ("set type of frame to %1").arg(s));
   15.45 +			reposition();
   15.46 +			bo->updateLink();
   15.47  		}
   15.48  	}
   15.49  }
   15.50  
   15.51 -
   15.52 -void VymModel::setFrameType(const FrameObj::FrameType &t)	//FIXME-2
   15.53 +void VymModel::setFrameType(const QString &s)	//FIXME-4 not saved if there is no LMO
   15.54 +{
   15.55 +	BranchItem *bi=getSelectedBranchItem();
   15.56 +	if (bi)
   15.57 +	{
   15.58 +		BranchObj *bo=(BranchObj*)(bi->getLMO());
   15.59 +		if (bo)
   15.60 +		{
   15.61 +			saveState (bi, QString("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),
   15.62 +				bi, QString ("setFrameType (\"%1\")").arg(s),QString ("set type of frame to %1").arg(s));
   15.63 +			bo->setFrameType (s);
   15.64 +			reposition();
   15.65 +			bo->updateLink();
   15.66 +		}
   15.67 +	}
   15.68 +}
   15.69 +
   15.70 +void VymModel::setFramePenColor(const QColor &c)	//FIXME-4 not saved if there is no LMO
   15.71 +
   15.72 +{
   15.73 +	BranchItem *bi=getSelectedBranchItem();
   15.74 +	if (bi)
   15.75 +	{
   15.76 +		BranchObj *bo=(BranchObj*)(bi->getLMO());
   15.77 +		if (bo)
   15.78 +		{
   15.79 +			saveState (bi, QString("setFramePenColor (\"%1\")").arg(bo->getFramePenColor().name() ),
   15.80 +				bi, QString ("setFramePenColor (\"%1\")").arg(c.name() ),QString ("set pen color of frame to %1").arg(c.name() ));
   15.81 +			bo->setFramePenColor (c);
   15.82 +		}	
   15.83 +	}	
   15.84 +}
   15.85 +
   15.86 +void VymModel::setFrameBrushColor(const QColor &c)	//FIXME-4 not saved if there is no LMO
   15.87 +{
   15.88 +	BranchItem *bi=getSelectedBranchItem();
   15.89 +	if (bi)
   15.90 +	{
   15.91 +		BranchObj *bo=(BranchObj*)(bi->getLMO());
   15.92 +		if (bo)
   15.93 +		{
   15.94 +			saveState (bi, QString("setFrameBrushColor (\"%1\")").arg(bo->getFrameBrushColor().name() ),
   15.95 +				bi, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
   15.96 +			bo->setFrameBrushColor (c);
   15.97 +		}	
   15.98 +	}	
   15.99 +}
  15.100 +
  15.101 +void VymModel::setFramePadding (const int &i) //FIXME-4 not saved if there is no LMO
  15.102 +{
  15.103 +	BranchItem *bi=getSelectedBranchItem();
  15.104 +	if (bi)
  15.105 +	{
  15.106 +		BranchObj *bo=(BranchObj*)(bi->getLMO());
  15.107 +		if (bo)
  15.108 +		{
  15.109 +			saveState (bi, QString("setFramePadding (\"%1\")").arg(bo->getFramePadding() ),
  15.110 +				bi, QString ("setFramePadding (\"%1\")").arg(i),QString ("set brush color of frame to %1").arg(i));
  15.111 +			bo->setFramePadding (i);
  15.112 +			reposition();
  15.113 +			bo->updateLink();
  15.114 +		}	
  15.115 +	}	
  15.116 +}
  15.117 +
  15.118 +void VymModel::setFrameBorderWidth(const int &i) //FIXME-4 not saved if there is no LMO
  15.119 +{
  15.120 +	BranchItem *bi=getSelectedBranchItem();
  15.121 +	if (bi)
  15.122 +	{
  15.123 +		BranchObj *bo=(BranchObj*)(bi->getLMO());
  15.124 +		if (bo)
  15.125 +		{
  15.126 +			saveState (bi, QString("setFrameBorderWidth (\"%1\")").arg(bo->getFrameBorderWidth() ),
  15.127 +				bi, QString ("setFrameBorderWidth (\"%1\")").arg(i),QString ("set border width of frame to %1").arg(i));
  15.128 +			bo->setFrameBorderWidth (i);
  15.129 +			reposition();
  15.130 +			bo->updateLink();
  15.131 +		}	
  15.132 +	}	
  15.133 +}
  15.134 +
  15.135 +void VymModel::setIncludeImagesVer(bool b)	//FIXME-2
  15.136  {
  15.137  /*
  15.138 -	BranchObj *bo=getSelectedBranch();
  15.139 -	if (bo)
  15.140 +	BranchItem *bi=getSelectedBranchItem();
  15.141 +	if (ti)
  15.142  	{
  15.143 -		QString s=bo->getFrameTypeName();
  15.144 -		bo->setFrameType (t);
  15.145 -		saveState (bo, QString("setFrameType (\"%1\")").arg(s),
  15.146 -			bo, QString ("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),QString ("set type of frame to %1").arg(s));
  15.147 -		reposition();
  15.148 -		bo->updateLink();
  15.149 -	}
  15.150 -*/	
  15.151 -}
  15.152 -
  15.153 -void VymModel::setFrameType(const QString &s)	//FIXME-2
  15.154 -{
  15.155 -/*
  15.156 -	BranchObj *bo=getSelectedBranch();
  15.157 -	if (bo)
  15.158 -	{
  15.159 -		saveState (bo, QString("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),
  15.160 -			bo, QString ("setFrameType (\"%1\")").arg(s),QString ("set type of frame to %1").arg(s));
  15.161 -		bo->setFrameType (s);
  15.162 -		reposition();
  15.163 -		bo->updateLink();
  15.164 -	}
  15.165 -*/
  15.166 -}
  15.167 -
  15.168 -void VymModel::setFramePenColor(const QColor &c)	//FIXME-2
  15.169 -{
  15.170 -/*
  15.171 -	BranchObj *bo=getSelectedBranch();
  15.172 -	if (bo)
  15.173 -	{
  15.174 -		saveState (bo, QString("setFramePenColor (\"%1\")").arg(bo->getFramePenColor().name() ),
  15.175 -			bo, QString ("setFramePenColor (\"%1\")").arg(c.name() ),QString ("set pen color of frame to %1").arg(c.name() ));
  15.176 -		bo->setFramePenColor (c);
  15.177 -	}	
  15.178 -*/	
  15.179 -}
  15.180 -
  15.181 -void VymModel::setFrameBrushColor(const QColor &c)	//FIXME-2
  15.182 -{
  15.183 -/*
  15.184 -	BranchObj *bo=getSelectedBranch();
  15.185 -	if (bo)
  15.186 -	{
  15.187 -		saveState (bo, QString("setFrameBrushColor (\"%1\")").arg(bo->getFrameBrushColor().name() ),
  15.188 -			bo, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
  15.189 -		bo->setFrameBrushColor (c);
  15.190 +		BranchObj *bo=bi->getLMO();
  15.191 +		if (bo)
  15.192 +		{
  15.193 +			QString u= b ? "false" : "true";
  15.194 +			QString r=!b ? "false" : "true";
  15.195 +			
  15.196 +			saveState(
  15.197 +				bo,
  15.198 +				QString("setIncludeImagesVertically (%1)").arg(u),
  15.199 +				bo, 
  15.200 +				QString("setIncludeImagesVertically (%1)").arg(r),
  15.201 +				QString("Include images vertically in %1").arg(getObjectName(bo))
  15.202 +			);	
  15.203 +			bo->setIncludeImagesVer(b);
  15.204 +			reposition();
  15.205 +		}	
  15.206  	}	
  15.207  */}
  15.208  
  15.209 -void VymModel::setFramePadding (const int &i) //FIXME-2
  15.210 +void VymModel::setIncludeImagesHor(bool b)	//FIXME-2
  15.211  {
  15.212  /*
  15.213 -	BranchObj *bo=getSelectedBranch();
  15.214 -	if (bo)
  15.215 +	TreeItem *bi=getSelectedBranchItem();
  15.216 +	if (ti)
  15.217  	{
  15.218 -		saveState (bo, QString("setFramePadding (\"%1\")").arg(bo->getFramePadding() ),
  15.219 -			bo, QString ("setFramePadding (\"%1\")").arg(i),QString ("set brush color of frame to %1").arg(i));
  15.220 -		bo->setFramePadding (i);
  15.221 -		reposition();
  15.222 -		bo->updateLink();
  15.223 -	}	
  15.224 -	*/
  15.225 -}
  15.226 -
  15.227 -void VymModel::setFrameBorderWidth(const int &i) //FIXME-2
  15.228 -{
  15.229 -/*
  15.230 -	BranchObj *bo=getSelectedBranch();
  15.231 -	if (bo)
  15.232 -	{
  15.233 -		saveState (bo, QString("setFrameBorderWidth (\"%1\")").arg(bo->getFrameBorderWidth() ),
  15.234 -			bo, QString ("setFrameBorderWidth (\"%1\")").arg(i),QString ("set border width of frame to %1").arg(i));
  15.235 -		bo->setFrameBorderWidth (i);
  15.236 -		reposition();
  15.237 -		bo->updateLink();
  15.238 -	}	
  15.239 -*/	
  15.240 -}
  15.241 -
  15.242 -void VymModel::setIncludeImagesVer(bool b)	//FIXME-2
  15.243 -{
  15.244 -/*
  15.245 -	BranchObj *bo=getSelectedBranch();
  15.246 -	if (bo)
  15.247 -	{
  15.248 -		QString u= b ? "false" : "true";
  15.249 -		QString r=!b ? "false" : "true";
  15.250 -		
  15.251 -		saveState(
  15.252 -			bo,
  15.253 -			QString("setIncludeImagesVertically (%1)").arg(u),
  15.254 -			bo, 
  15.255 -			QString("setIncludeImagesVertically (%1)").arg(r),
  15.256 -			QString("Include images vertically in %1").arg(getObjectName(bo))
  15.257 -		);	
  15.258 -		bo->setIncludeImagesVer(b);
  15.259 -		reposition();
  15.260 -	}	
  15.261 -*/}
  15.262 -
  15.263 -void VymModel::setIncludeImagesHor(bool b)	//FIXME-2
  15.264 -{
  15.265 -/*
  15.266 -	BranchObj *bo=getSelectedBranch();
  15.267 -	if (bo)
  15.268 -	{
  15.269 -		QString u= b ? "false" : "true";
  15.270 -		QString r=!b ? "false" : "true";
  15.271 -		
  15.272 -		saveState(
  15.273 -			bo,
  15.274 -			QString("setIncludeImagesHorizontally (%1)").arg(u),
  15.275 -			bo, 
  15.276 -			QString("setIncludeImagesHorizontally (%1)").arg(r),
  15.277 -			QString("Include images horizontally in %1").arg(getObjectName(bo))
  15.278 -		);	
  15.279 -		bo->setIncludeImagesHor(b);
  15.280 -		reposition();
  15.281 +		BranchObj *bo=bi->getLMO();
  15.282 +		if (bo)
  15.283 +		{
  15.284 +			QString u= b ? "false" : "true";
  15.285 +			QString r=!b ? "false" : "true";
  15.286 +			
  15.287 +			saveState(
  15.288 +				bo,
  15.289 +				QString("setIncludeImagesHorizontally (%1)").arg(u),
  15.290 +				bo, 
  15.291 +				QString("setIncludeImagesHorizontally (%1)").arg(r),
  15.292 +				QString("Include images horizontally in %1").arg(getObjectName(bo))
  15.293 +			);	
  15.294 +			bo->setIncludeImagesHor(b);
  15.295 +			reposition();
  15.296 +		}	
  15.297  	}	
  15.298  	*/
  15.299  }
  15.300 @@ -1795,22 +1787,22 @@
  15.301  
  15.302  void VymModel::setHideExport(bool b)
  15.303  {
  15.304 -	MapItem *mi=(MapItem*)getSelectedItem();
  15.305 -	if (mi && 
  15.306 -		(mi->getType()==TreeItem::Image ||mi->isBranchLikeType()))
  15.307 +	TreeItem *ti=getSelectedItem();
  15.308 +	if (ti && 
  15.309 +		(ti->getType()==TreeItem::Image ||ti->isBranchLikeType()))
  15.310  	{
  15.311 -		mi->setHideInExport (b);
  15.312 +		ti->setHideInExport (b);
  15.313  		QString u= b ? "false" : "true";
  15.314  		QString r=!b ? "false" : "true";
  15.315  		
  15.316  		saveState(
  15.317 -			mi,
  15.318 +			ti,
  15.319  			QString ("setHideExport (%1)").arg(u),
  15.320 -			mi,
  15.321 +			ti,
  15.322  			QString ("setHideExport (%1)").arg(r),
  15.323 -			QString ("Set HideExport flag of %1 to %2").arg(getObjectName(mi)).arg (r)
  15.324 +			QString ("Set HideExport flag of %1 to %2").arg(getObjectName(ti)).arg (r)
  15.325  		);	
  15.326 -			emitDataHasChanged(mi);
  15.327 +			emitDataHasChanged(ti);
  15.328  			emitSelectionChanged();
  15.329  		updateActions();
  15.330  		reposition();
  15.331 @@ -1962,11 +1954,12 @@
  15.332  	{
  15.333  		QModelIndex parix;
  15.334  		int n;
  15.335 +
  15.336  		QList<QVariant> cData;
  15.337 -		cData << "VM::createImage" << "undef"<<"undef";
  15.338 -
  15.339 -		ImageItem *newii=new ImageItem (cData);	
  15.340 -		newii->setHeading (QApplication::translate("Heading of new image in map", "new image"));
  15.341 +		cData << "new" << "undef"<<"undef";
  15.342 +
  15.343 +		ImageItem *newii=new ImageItem(cData) ;	
  15.344 +		//newii->setHeading (QApplication::translate("Heading of new image in map", "new image"));
  15.345  
  15.346  		emit (layoutAboutToBeChanged() );
  15.347  
  15.348 @@ -2187,6 +2180,43 @@
  15.349  	return false;
  15.350  }
  15.351  
  15.352 +bool VymModel::relinkImage (ImageItem *image, BranchItem *dst)
  15.353 +{
  15.354 +	if (image && dst)
  15.355 +	{
  15.356 +		emit (layoutAboutToBeChanged() );
  15.357 +
  15.358 +		BranchItem *pi=(BranchItem*)(image->parent());
  15.359 +		QString oldParString=getSelectString (pi);
  15.360 +		// Remove at current position
  15.361 +		int n=image->childNum();
  15.362 +		beginRemoveRows (index(pi),n,n);
  15.363 +		pi->removeChild (n);
  15.364 +		endRemoveRows();
  15.365 +
  15.366 +		// Add at dst
  15.367 +		QModelIndex dstix=index(dst);
  15.368 +		n=dst->getRowNumAppend (image);
  15.369 +		beginInsertRows (dstix,n,n+1);	
  15.370 +		dst->appendChild (image);	
  15.371 +		endInsertRows ();
  15.372 +
  15.373 +		// Set new parent also for lmo
  15.374 +		if (image->getLMO() && dst->getLMO() )
  15.375 +			image->getLMO()->setParObj (dst->getLMO() );
  15.376 +
  15.377 +		emit (layoutChanged() );
  15.378 +		saveState(
  15.379 +			image,
  15.380 +			QString("relinkTo (\"%1\")").arg(oldParString), 
  15.381 +			image,
  15.382 +			QString ("relinkTo (\"%1\")").arg(getSelectString (dst)),
  15.383 +			QString ("Relink floatimage to %1").arg(getObjectName(dst)));
  15.384 +		return true;	
  15.385 +	}
  15.386 +	return false;
  15.387 +}
  15.388 +
  15.389  void VymModel::deleteSelection()
  15.390  {
  15.391  	BranchItem *selbi=getSelectedBranchItem();
  15.392 @@ -2436,7 +2466,7 @@
  15.393  	}
  15.394  }
  15.395  
  15.396 -void VymModel::addFloatImage (const QPixmap &img) //FIXME-0
  15.397 +void VymModel::addFloatImage (const QPixmap &img) //FIXME-2 drag & drop
  15.398  {
  15.399  /*
  15.400  	BranchObj *bo=getSelectedBranch();
  15.401 @@ -3067,10 +3097,8 @@
  15.402  				TreeItem *dst=findBySelectString (s);
  15.403  				if (dst)
  15.404  				{	
  15.405 -					/* FIXME-0 relink img
  15.406  					if (dst->isBranchLikeType())
  15.407 -						linkFloatImageTo (getSelectString(dst));
  15.408 -					*/	
  15.409 +						relinkImage ( ((ImageItem*)selti),(BranchItem*)dst);
  15.410  				} else	
  15.411  					parser.setError (Aborted,"Destination is not a branch");
  15.412  			}		
  15.413 @@ -3871,7 +3899,6 @@
  15.414  
  15.415  void VymModel::updateRelPositions()		//FIXME-3 VM should have no need to updateRelPos
  15.416  {
  15.417 -	cout << "VM::updateRelPos...\n";
  15.418  	/* FIXME-3 ???
  15.419  	for (int i=0; i<rootItem->branchCount(); i++)
  15.420  		((MapCenterObj*)rootItem->getBranchObjNum(i))->updateRelPositions();
  15.421 @@ -4927,7 +4954,7 @@
  15.422  		TreeItem::Type type=ti->getType();
  15.423  		if (type ==TreeItem::Branch || type==TreeItem::MapCenter || type==TreeItem::Image)
  15.424  		{
  15.425 -			return ((MapItem*)ti)->getLMO();
  15.426 +			return ti->getLMO();
  15.427  		}	
  15.428  	}
  15.429  	return NULL;
  15.430 @@ -4937,7 +4964,7 @@
  15.431  {
  15.432  	TreeItem *ti = getSelectedBranchItem();
  15.433  	if (ti)
  15.434 -		return (BranchObj*)((MapItem*)ti)->getLMO();
  15.435 +		return (BranchObj*)(ti->getLMO());
  15.436  	else	
  15.437  		return NULL;
  15.438  }
  15.439 @@ -4996,28 +5023,22 @@
  15.440  	return getSelectString (lmo->getTreeItem() );
  15.441  }
  15.442  
  15.443 -QString VymModel::getSelectString (TreeItem *ti)
  15.444 +QString VymModel::getSelectString (TreeItem *ti) //FIXME-1 does not return "mc:"
  15.445  {
  15.446  	QString s;
  15.447  	if (!ti) return s;
  15.448 -	if (ti->isBranchLikeType())
  15.449 -	{	
  15.450 -		TreeItem *par=ti->parent();
  15.451 -		if (par)
  15.452 -		{
  15.453 -			if (ti->depth() ==1)
  15.454 -				// Mainbranch, return 
  15.455 -				s= "bo:" + QString("%1").arg(ti->num() );
  15.456 -			else	
  15.457 -				// Branch, call myself recursively
  15.458 -				s= getSelectString(par) + ",bo:" + QString("%1").arg(ti->num());
  15.459 -		} else
  15.460 -		{
  15.461 -			// MapCenter
  15.462 -			int i=rootItem->num(ti);
  15.463 -			if (i>=0) s=QString("mc:%1").arg(i);
  15.464 -		}	
  15.465 -	}	
  15.466 +	switch (ti->getType())
  15.467 +	{
  15.468 +		case TreeItem::MapCenter: s="mc:"; break;
  15.469 +		case TreeItem::Branch: s="bo:";break;
  15.470 +		case TreeItem::Image: s="fi:";break;
  15.471 +		default:break;
  15.472 +	}
  15.473 +	s=  s + QString("%1").arg(ti->num());
  15.474 +	if (ti->depth() >0)
  15.475 +		// call myself recursively
  15.476 +		s= getSelectString(ti->parent()) +","+s;
  15.477 +			
  15.478  	return s;
  15.479  }
  15.480  
    16.1 --- a/vymmodel.h	Mon Jun 08 11:36:56 2009 +0000
    16.2 +++ b/vymmodel.h	Mon Jun 29 10:27:42 2009 +0000
    16.3 @@ -250,7 +250,6 @@
    16.4  	QString getURL();						// returns URL of selection or ""
    16.5  	QStringList getURLs();					// returns URLs of subtree
    16.6  
    16.7 -	void linkFloatImageTo(const QString &);
    16.8  
    16.9  	void setFrameType(const FrameObj::FrameType &);
   16.10  	void setFrameType(const QString &);
   16.11 @@ -322,6 +321,7 @@
   16.12  		Returns true if relinking was successful.
   16.13  	*/	
   16.14  	bool relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1);	
   16.15 +	bool relinkImage  (ImageItem* image, BranchItem* dst);	
   16.16  
   16.17      void deleteSelection();				//!< Delete selection
   16.18  	void deleteKeepChildren();			//!< remove branch, but keep children
    17.1 --- a/vymview.cpp	Mon Jun 08 11:36:56 2009 +0000
    17.2 +++ b/vymview.cpp	Mon Jun 29 10:27:42 2009 +0000
    17.3 @@ -105,7 +105,9 @@
    17.4  void VymView::changeSelection (const QItemSelection &newsel, const QItemSelection &oldsel)
    17.5  {
    17.6  	// Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...)
    17.7 -	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-3 maybe connect VymModel <-> MainWindow directly?
    17.8 +	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-5 maybe connect VymModel <-> MainWindow directly?
    17.9 +	// would require to also get current model in mainWindow
   17.10 +
   17.11  	//showSelection();
   17.12  }
   17.13  
    18.1 --- a/xml-vym.cpp	Mon Jun 08 11:36:56 2009 +0000
    18.2 +++ b/xml-vym.cpp	Mon Jun 29 10:27:42 2009 +0000
    18.3 @@ -279,13 +279,13 @@
    18.4  			mainWindow->removeProgressBar();
    18.5  			break;
    18.6          case StateMapCenter: 
    18.7 -			model->selectParent();
    18.8 +			model->selectParent();	// FIXME-3 really needed to "select"? Maybe optimize...
    18.9  			model->emitDataHasChanged (lastBranch);
   18.10  			lastBranch=(BranchItem*)(lastBranch->parent());
   18.11  			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
   18.12              break;
   18.13          case StateBranch: 
   18.14 -			model->selectParent();
   18.15 +			model->selectParent();// FIXME-3 really needed to "select"? Maybe optimize...
   18.16  			model->emitDataHasChanged (lastBranch);
   18.17  			lastBranch=(BranchItem*)(lastBranch->parent());
   18.18  			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
   18.19 @@ -382,36 +382,42 @@
   18.20  	return true;	
   18.21  }
   18.22  
   18.23 -bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)
   18.24 +bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)	// FIXME-4 does not work if there is no lmo for treeitem
   18.25  {
   18.26 -	bool ok;
   18.27 -	int x;
   18.28 -	/* FIXME-2 if (lastOO)
   18.29 +	if (lastMI)
   18.30  	{
   18.31 -		if (!a.value( "frameType").isEmpty() ) 
   18.32 -			lastOO->setFrameType (a.value("frameType"));
   18.33 -		if (!a.value( "penColor").isEmpty() ) 
   18.34 -			lastOO->setFramePenColor (a.value("penColor"));
   18.35 -		if (!a.value( "brushColor").isEmpty() ) 
   18.36 -			lastOO->setFrameBrushColor (a.value("brushColor"));
   18.37 -		if (!a.value( "padding").isEmpty() ) 
   18.38 +		OrnamentedObj* oo=(OrnamentedObj*)(lastMI->getLMO()); 
   18.39 +		if (oo)
   18.40  		{
   18.41 -			x=a.value("padding").toInt(&ok);
   18.42 -			if (ok) lastOO->setFramePadding(x);
   18.43 -		}	
   18.44 -		if (!a.value( "borderWidth").isEmpty() ) 
   18.45 -		{
   18.46 -			x=a.value("borderWidth").toInt(&ok);
   18.47 -			if (ok) lastOO->setFrameBorderWidth(x);
   18.48 -		}	
   18.49 -	}		
   18.50 -	*/
   18.51 -	return true;
   18.52 +			bool ok;
   18.53 +			int x;
   18.54 +			{
   18.55 +				if (!a.value( "frameType").isEmpty() ) 
   18.56 +					oo->setFrameType (a.value("frameType"));
   18.57 +				if (!a.value( "penColor").isEmpty() ) 
   18.58 +					oo->setFramePenColor (a.value("penColor"));
   18.59 +				if (!a.value( "brushColor").isEmpty() ) 
   18.60 +					oo->setFrameBrushColor (a.value("brushColor"));
   18.61 +				if (!a.value( "padding").isEmpty() ) 
   18.62 +				{
   18.63 +					x=a.value("padding").toInt(&ok);
   18.64 +					if (ok) oo->setFramePadding(x);
   18.65 +				}	
   18.66 +				if (!a.value( "borderWidth").isEmpty() ) 
   18.67 +				{
   18.68 +					x=a.value("borderWidth").toInt(&ok);
   18.69 +					if (ok) oo->setFrameBorderWidth(x);
   18.70 +				}	
   18.71 +			}		
   18.72 +			return true;
   18.73 +		}
   18.74 +	}
   18.75 +	return false;
   18.76  }
   18.77  
   18.78  bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
   18.79  {
   18.80 -	if (lastMI)
   18.81 +	if (lastMI)	//FIXME-1  below lastBranch is used, not lastMI. So it might not work for images
   18.82  	{
   18.83  		bool okx,oky;
   18.84  		float x,y;
   18.85 @@ -516,7 +522,6 @@
   18.86  		{
   18.87  			QMessageBox::warning( 0, "Warning: " ,
   18.88  				"Couldn't load image\n"+parseHREF(a.value ("href") ));
   18.89 -			//FIXME-0 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
   18.90  			lastImage=NULL;
   18.91  			return true;
   18.92  		}
   18.93 @@ -534,19 +539,14 @@
   18.94  			x=a.value("relPosX").toFloat (&okx);
   18.95  			y=a.value("relPosY").toFloat (&oky);
   18.96  			if (okx && oky) 
   18.97 -				
   18.98 -				{
   18.99 -					lastImage->setRelPos (QPointF (x,y) );
  18.100 -					// make sure floats in mapcenter are repositioned to relative pos
  18.101 -					//FIXME-0 if (lastBranch->depth()==0) lastBranch->positionContents();
  18.102 -				}
  18.103 +				lastImage->setRelPos (QPointF (x,y) );
  18.104  			else
  18.105  				// Couldn't read relPos
  18.106  				return false;  
  18.107  		}           
  18.108  	}	
  18.109  	
  18.110 -	if (!readOOAttr(a)) return false;
  18.111 +	//FIXME-3 if (!readOOAttr(a)) return false;
  18.112  
  18.113  	if (!a.value ("originalName").isEmpty() )
  18.114  	{