Images basically work (again)
authorinsilmaril
Mon, 08 Jun 2009 11:36:56 +0000
changeset 77625e634a7e1dc
parent 775 6e4b586aa88a
child 777 8acac4fade1b
Images basically work (again)
branchitem.cpp
branchitem.h
branchobj.cpp
floatimageobj.cpp
floatimageobj.h
floatobj.cpp
floatobj.h
mainwindow.cpp
mapeditor.cpp
mapeditor.h
mapitem.cpp
mapitem.h
ornamentedobj.cpp
ornamentedobj.h
treeitem.cpp
treeitem.h
treemodel.cpp
version.h
vym.pro
vymmodel.cpp
vymmodel.h
xml-freemind.cpp
xml-vym.cpp
xml-vym.h
     1.1 --- a/branchitem.cpp	Wed Jun 03 20:37:17 2009 +0000
     1.2 +++ b/branchitem.cpp	Mon Jun 08 11:36:56 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, TreeItem *parent):TreeItem (data,parent)
     1.8 +BranchItem::BranchItem(const QList<QVariant> &data, MapItem *parent):MapItem (data,parent)
     1.9  {
    1.10  	//cout << "Constr. BranchItem\n";
    1.11  
    1.12 @@ -18,7 +18,7 @@
    1.13  
    1.14  BranchItem::~BranchItem()
    1.15  {
    1.16 -	//cout << "Destr. BranchItem "<<getHeadingStd()<<endl;
    1.17 +	cout << "Destr. BranchItem "<<getHeadingStd()<<endl;
    1.18  	if (lmo) 
    1.19  	{
    1.20  		delete lmo;
    1.21 @@ -94,7 +94,6 @@
    1.22  
    1.23      s=beginElement (elementName
    1.24  		+getAttr()
    1.25 -	//	+getOrnXMLAttr() 
    1.26  		+scrolledAttr 
    1.27  	//	+areaAttr 
    1.28  	//	+idAttr 
    1.29 @@ -115,11 +114,9 @@
    1.30  	// save names of flags set
    1.31  	s+=standardFlags.saveToDir(tmpdir,prefix,0);
    1.32  	
    1.33 -/*	
    1.34 -	// Save FloatImages
    1.35 -	for (int i=0; i<floatimage.size(); ++i)
    1.36 -		s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
    1.37 -*/
    1.38 +	// Save Images
    1.39 +	for (int i=0; i<imageCount(); ++i)
    1.40 +		s+=getImageNum(i)->saveToDir (tmpdir,prefix);
    1.41  
    1.42  	// save note
    1.43  	if (!note.isEmpty() )
    1.44 @@ -310,15 +307,19 @@
    1.45      if (getBranchObj()->isInClickBox (p) && (this != excludeTI) && getBranchObj()->isVisibleObj() ) 
    1.46  		return this;
    1.47  
    1.48 -/* FIXME-2 // Search float images
    1.49 -    for (int i=0; i<floatimage.size(); ++i )
    1.50 -		if (floatimage.at(i)->isInClickBox(p) && 
    1.51 -			(floatimage.at(i) != excludeTI) && 
    1.52 -			floatimage.at(i)->getParObj()!= excludeTI &&
    1.53 -			floatimage.at(i)->isVisibleObj() 
    1.54 -		) return floatimage.at(i)->getTreeItem();
    1.55 -*/
    1.56 -    return NULL;
    1.57 +	// Search images
    1.58 +	ImageItem *ii;
    1.59 +    for (int i=0; i<imageCount(); ++i )
    1.60 +	{
    1.61 +		ii=getImageNum (i);
    1.62 +		LinkableMapObj *mo=ii->getLMO();
    1.63 +		if (mo && mo->isInClickBox(p) && 
    1.64 +			(ii != excludeTI) && 
    1.65 +			this!= excludeTI &&
    1.66 +			mo->isVisibleObj() 
    1.67 +		) return ii;
    1.68 +	}
    1.69 +	return NULL;
    1.70  }
    1.71  
    1.72  TreeItem* BranchItem::findID (QString sid)
    1.73 @@ -353,7 +354,7 @@
    1.74  
    1.75  	if (lmo)
    1.76  	{
    1.77 -		lmo->setParObj (parentItem->getLMO() );
    1.78 +		lmo->setParObj ( ((MapItem*)parentItem)->getLMO() );
    1.79  	}
    1.80  }
    1.81  
    1.82 @@ -375,9 +376,9 @@
    1.83  		newbo->setFrameType (FrameObj::Rectangle);
    1.84  	} else
    1.85  	{
    1.86 -		newbo->setParObj(parentItem->getLMO() );
    1.87 +		newbo->setParObj( ((MapItem*)parentItem)->getLMO() );
    1.88  		// Set visibility depending on parents
    1.89 -		if (((BranchItem*)parentItem)->scrolled || !parentItem->getLMO()->isVisibleObj() )
    1.90 +		if (((BranchItem*)parentItem)->scrolled || !((MapItem*)parentItem)->getLMO()->isVisibleObj() )
    1.91  			newbo->setVisibility (false);
    1.92  	}
    1.93  	newbo->setDefAttr(BranchObj::NewBranch);
     2.1 --- a/branchitem.h	Wed Jun 03 20:37:17 2009 +0000
     2.2 +++ b/branchitem.h	Mon Jun 08 11:36:56 2009 +0000
     2.3 @@ -1,17 +1,17 @@
     2.4  #ifndef BRANCHITEM_H
     2.5  #define BRANCHITEM_H
     2.6  
     2.7 -#include "treeitem.h"
     2.8 +#include "mapitem.h"
     2.9  
    2.10  
    2.11  class QString;
    2.12  class BranchObj;
    2.13  class QGraphicsScene;
    2.14  
    2.15 -class BranchItem:public TreeItem
    2.16 +class BranchItem:public MapItem
    2.17  {
    2.18  public:
    2.19 -    BranchItem(const QList<QVariant> &data, TreeItem *parent = 0);
    2.20 +    BranchItem(const QList<QVariant> &data, MapItem *parent = 0);
    2.21      virtual ~BranchItem();
    2.22  	void copy (BranchItem *item);
    2.23  
     3.1 --- a/branchobj.cpp	Wed Jun 03 20:37:17 2009 +0000
     3.2 +++ b/branchobj.cpp	Mon Jun 08 11:36:56 2009 +0000
     3.3 @@ -272,8 +272,12 @@
     3.4  void BranchObj::move (double x, double y)
     3.5  {
     3.6  	OrnamentedObj::move (x,y);
     3.7 -    for (int i=0; i<floatimage.size(); ++i )
     3.8 -		floatimage.at(i)->reposition();
     3.9 +	FloatImageObj *fio;
    3.10 +    for (int i=0; i<treeItem->imageCount(); ++i )
    3.11 +	{
    3.12 +		fio=treeItem->getImageObjNum(i);
    3.13 +		if (fio) fio->reposition();
    3.14 +	}
    3.15      positionBBox();
    3.16  }
    3.17  
     4.1 --- a/floatimageobj.cpp	Wed Jun 03 20:37:17 2009 +0000
     4.2 +++ b/floatimageobj.cpp	Mon Jun 08 11:36:56 2009 +0000
     4.3 @@ -8,9 +8,6 @@
     4.4  // FloatImageObj
     4.5  /////////////////////////////////////////////////////////////////
     4.6  
     4.7 -uint FloatImageObj::saveCounter=0;		// make instance 
     4.8 -
     4.9 -
    4.10  FloatImageObj::FloatImageObj ():FloatObj()
    4.11  {
    4.12  //    cout << "Const FloatImageObj ()\n";
    4.13 @@ -20,7 +17,7 @@
    4.14  
    4.15  FloatImageObj::FloatImageObj (QGraphicsScene* s):FloatObj(s)
    4.16  {
    4.17 - //   cout << "Const FloatImageObj (s)  called from MapCenterObj (s)\n";
    4.18 +//   cout << "Const FloatImageObj (s)  called from MapCenterObj (s)\n";
    4.19      setParObj (this);	
    4.20      init();
    4.21  }
    4.22 @@ -155,58 +152,6 @@
    4.23  	// TODO
    4.24  }
    4.25  
    4.26 -QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix)
    4.27 -{
    4.28 -	//FIXME-2 if (hidden) return "";
    4.29 -
    4.30 -	saveCounter++;
    4.31 -	
    4.32 -	QString useOrientAttr;
    4.33 -	if (useOrientation)
    4.34 -		useOrientAttr=attribut ("useOrientation","true");
    4.35 -	else	
    4.36 -		useOrientAttr=attribut ("useOrientation","false");
    4.37 -		
    4.38 -	QString saveInMapAttr;
    4.39 -	if (saveInMap)
    4.40 -		saveInMapAttr=attribut ("saveInMap","true");
    4.41 -	else	
    4.42 -		
    4.43 -		saveInMapAttr=attribut ("saveInMap","false");
    4.44 -
    4.45 -	QString exportAttr;
    4.46 -	if (floatExport)
    4.47 -		exportAttr=attribut ("floatExport","true");
    4.48 -	else	
    4.49 -		exportAttr=attribut ("floatExport","false");
    4.50 -
    4.51 -	QString zAttr=attribut ("zPlane",QString().setNum(zPlane));
    4.52 -	QString url;
    4.53 -
    4.54 -	url="images/"+prefix+"image-" + QString().number(saveCounter,10) + ".png" ;
    4.55 -
    4.56 -	// And really save the image
    4.57 -	icon->save (tmpdir +"/"+ url, "PNG");
    4.58 - 
    4.59 -	QString nameAttr=attribut ("orgName",originalFilename);
    4.60 -
    4.61 -    return singleElement ("floatimage",  
    4.62 -		getOrnXMLAttr() 
    4.63 -		+useOrientAttr 
    4.64 -		+saveInMapAttr 
    4.65 -		+exportAttr  
    4.66 -		+zAttr  
    4.67 -		+attribut ("href",QString ("file:")+url)
    4.68 -		+nameAttr
    4.69 -	);	
    4.70 -}
    4.71 -
    4.72 -void FloatImageObj::resetSaveCounter()
    4.73 -{
    4.74 -	saveCounter=0;
    4.75 -}
    4.76 -
    4.77 -
    4.78  QRectF FloatImageObj::getTotalBBox()
    4.79  {
    4.80  	return bbox;
     5.1 --- a/floatimageobj.h	Wed Jun 03 20:37:17 2009 +0000
     5.2 +++ b/floatimageobj.h	Mon Jun 08 11:36:56 2009 +0000
     5.3 @@ -33,14 +33,10 @@
     5.4  	virtual QRectF getTotalBBox();			// return BBox including children			
     5.5  	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
     5.6  	virtual void calcBBoxSizeWithChildren();	// calc size of  BBox including children recursivly
     5.7 -	virtual QString saveToDir(const QString &,const QString&);
     5.8 -	virtual void resetSaveCounter();
     5.9 -
    5.10  
    5.11  protected:
    5.12  	ImageObj *icon;
    5.13  	bool saveInMap;
    5.14 -	static uint saveCounter;	// numerate the files during saveToDir
    5.15  	QString filetype;
    5.16  	QString filename;
    5.17  	QString originalFilename;
     6.1 --- a/floatobj.cpp	Wed Jun 03 20:37:17 2009 +0000
     6.2 +++ b/floatobj.cpp	Mon Jun 08 11:36:56 2009 +0000
     6.3 @@ -1,7 +1,5 @@
     6.4  #include "floatobj.h"
     6.5  
     6.6 -extern QAction* actionEditToggleFloatExport;
     6.7 -
     6.8  /////////////////////////////////////////////////////////////////
     6.9  // FloatObj
    6.10  /////////////////////////////////////////////////////////////////
    6.11 @@ -98,14 +96,3 @@
    6.12  	return bboxTotal;
    6.13  }
    6.14  
    6.15 -void FloatObj::select()
    6.16 -{
    6.17 -    LinkableMapObj::select();
    6.18 -	LinkableMapObj::setLinkColor(parObj->getLinkColor());
    6.19 -}
    6.20 -
    6.21 -void FloatObj::unselect()
    6.22 -{
    6.23 -	LinkableMapObj::unselect();
    6.24 -}
    6.25 -
     7.1 --- a/floatobj.h	Wed Jun 03 20:37:17 2009 +0000
     7.2 +++ b/floatobj.h	Mon Jun 08 11:36:56 2009 +0000
     7.3 @@ -29,11 +29,6 @@
     7.4  	virtual QRectF getTotalBBox();			// return BBox including children			
     7.5  	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
     7.6  
     7.7 -	virtual void resetSaveCounter()=0;
     7.8 -
     7.9 -	virtual void select();
    7.10 -	virtual void unselect();
    7.11 -
    7.12  protected:
    7.13  	bool floatExport;
    7.14  	int zPlane;
     8.1 --- a/mainwindow.cpp	Wed Jun 03 20:37:17 2009 +0000
     8.2 +++ b/mainwindow.cpp	Mon Jun 08 11:36:56 2009 +0000
     8.3 @@ -3448,14 +3448,11 @@
     8.4  			}
     8.5  			if ( selti->getType()==TreeItem::Image)
     8.6  			{
     8.7 -			/* FIXME-2
     8.8 -				FloatObj *fo=(FloatImageObj*)selection;
     8.9 -
    8.10  				actionOpenURL->setEnabled (false);
    8.11  				actionOpenVymLink->setEnabled (false);
    8.12  				actionDeleteVymLink->setEnabled (false);	
    8.13  				actionToggleHideExport->setEnabled (true);	
    8.14 -				actionToggleHideExport->setOn (fo->hideInExport() );	
    8.15 +				actionToggleHideExport->setOn (selti->hideInExport() );	
    8.16  
    8.17  
    8.18  				actionCopy->setEnabled (true);
    8.19 @@ -3464,11 +3461,10 @@
    8.20  				for (int i=0; i<actionListBranches.size(); ++i)	
    8.21  					actionListBranches.at(i)->setEnabled(false);
    8.22  				actionDelete->setEnabled (true);
    8.23 -				actionFormatHideLinkUnselected->setOn
    8.24 -					( selection->getHideLinkUnselected());
    8.25 +				// FIXME-2 actionFormatHideLinkUnselected->setOn
    8.26 +				//	( selection->getHideLinkUnselected());
    8.27  				actionMoveUp->setEnabled (false);
    8.28  				actionMoveDown->setEnabled (false);
    8.29 -				*/
    8.30  			}	//image
    8.31  
    8.32  		} else
     9.1 --- a/mapeditor.cpp	Wed Jun 03 20:37:17 2009 +0000
     9.2 +++ b/mapeditor.cpp	Mon Jun 08 11:36:56 2009 +0000
     9.3 @@ -186,7 +186,10 @@
     9.4  {
     9.5  	if (index.isValid())
     9.6  	{
     9.7 -		LinkableMapObj* lmo=(static_cast<TreeItem*>(index.internalPointer()))->getLMO();
     9.8 +		LinkableMapObj* lmo=NULL;
     9.9 +		TreeItem *ti= static_cast<TreeItem*>(index.internalPointer());
    9.10 +		if (ti->getType()==TreeItem::Image ||ti->isBranchLikeType() )
    9.11 +			lmo=((MapItem*)ti)->getLMO();
    9.12  		if (lmo) setScrollBarPosTarget (lmo->getBBox() );
    9.13  	}
    9.14  }
    9.15 @@ -596,7 +599,7 @@
    9.16      QPointF p = mapToScene(e->pos());
    9.17      TreeItem *ti=findMapItem (p, NULL);
    9.18      LinkableMapObj* lmo=NULL;
    9.19 -	if (ti) lmo=ti->getLMO();	//FIXME-2 get rid of lmo...
    9.20 +	if (ti) lmo=((MapItem*)ti)->getLMO();
    9.21  	
    9.22      if (lmo) 
    9.23  	{	// MapObj was found
    9.24 @@ -613,7 +616,7 @@
    9.25  			branchContextMenu->popup(e->globalPos() );
    9.26  		} else
    9.27  		{
    9.28 -			if (model->getSelectedFloatImage() )
    9.29 +			if (model->getSelectedImageItem() )
    9.30  			{
    9.31  				// Context Menu on floatimage
    9.32  				// model->updateActions(); FIXME-3 needed?
    9.33 @@ -680,7 +683,7 @@
    9.34      QPointF p = mapToScene(e->pos());
    9.35      TreeItem *ti=findMapItem (p, NULL);
    9.36      LinkableMapObj* lmo=NULL;
    9.37 -	if (ti) lmo=ti->getLMO();	//FIXME-3 get rid of lmo...
    9.38 +	if (ti) lmo=((MapItem*)ti)->getLMO();
    9.39  	
    9.40  	e->accept();
    9.41  
    9.42 @@ -750,18 +753,11 @@
    9.43  	/*
    9.44  		cout << "ME::mouse pressed\n";
    9.45  		cout << "  lmo="<<lmo<<endl;
    9.46 -		cout << "  h="<<((BranchObj*)lmo)->getHeading().toStdString()<<endl;
    9.47 +		cout << "   ti="<<ti->getHeadingStd()<<endl;
    9.48  	*/
    9.49  		// Select the clicked object
    9.50  
    9.51 -		// FIXME-2 VM better let "find" return an index instead of lmo...
    9.52 -		// Get index of clicked LMO
    9.53 -		TreeItem *ti=lmo->getTreeItem();
    9.54 -		/*
    9.55 -		cout << "  lmo="<<lmo<<"    lmo(ti)="<<ti->getLMO()<<endl;
    9.56 -		cout << "  ti ("<<ti->row()<<","<<ti->column()<<") = "<<ti<<endl;
    9.57 -		*/
    9.58 -		//QModelIndex ix=model->index( ti->row(), ti->column(), model->index (0,0,QModelIndex()) );
    9.59 +		// Get clicked LMO
    9.60  		model->select (ti);
    9.61  
    9.62  		// Left Button	    Move Branches
    9.63 @@ -823,8 +819,8 @@
    9.64      QPointF p = mapToScene(e->pos());
    9.65  	TreeItem *seli=model->getSelectedItem();
    9.66  	LinkableMapObj* lmosel=NULL;		//FIXME-2 get rid of lmosel
    9.67 -	if (seli)
    9.68 -		lmosel=seli->getLMO();
    9.69 +	if (seli && (seli->isBranchLikeType() ||seli->getType()==TreeItem::Image))
    9.70 +		lmosel=((MapItem*)seli)->getLMO();
    9.71  
    9.72      // Move the selected MapObj
    9.73      if ( lmosel && movingObj) 
    9.74 @@ -847,14 +843,14 @@
    9.75  		TreeItem *dsti=findMapItem (p, seli);
    9.76  		LinkableMapObj* dst=NULL;
    9.77  		if (dsti && dsti!=seli && dsti->isBranchLikeType())
    9.78 -			dst=dsti->getLMO(); //FIXME-2 get rid of lmo...
    9.79 +			dst=((MapItem*)dsti)->getLMO(); 
    9.80  		else
    9.81  			dsti=NULL;
    9.82  		
    9.83  
    9.84 -		FloatObj *fio=model->getSelectedFloatImage();
    9.85 -		if (fio)
    9.86 +		if (lmosel && seli->getType()==TreeItem::Image)
    9.87  		{
    9.88 +			FloatObj *fio=(FloatImageObj*)lmosel;
    9.89  			fio->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
    9.90  			fio->setRelPos();
    9.91  			fio->updateLink(); //no need for reposition, if we update link here
    9.92 @@ -971,7 +967,7 @@
    9.93  	if (seli) dsti=findMapItem(p, seli);
    9.94  	LinkableMapObj* dst=NULL;
    9.95  	if (dsti && dsti->isBranchLikeType ()) 
    9.96 -		dst=dsti->getLMO();	//FIXME-2 get rid of dst...
    9.97 +		dst=((MapItem*)dsti)->getLMO();	
    9.98  	else
    9.99  		dsti=NULL;
   9.100  
   9.101 @@ -1014,22 +1010,25 @@
   9.102      // Have we been moving something?
   9.103      if ( seli && movingObj ) 
   9.104      {	
   9.105 -		FloatImageObj *fo=model->getSelectedFloatImage();
   9.106 -		if(fo)
   9.107 +		if (seli->getType()==TreeItem::Image)
   9.108  		{
   9.109 -			// Moved FloatObj. Maybe we need to reposition
   9.110 -		    QString pold=qpointfToString(movingObj_orgRelPos);
   9.111 -		    QString pnow=qpointfToString(fo->getRelPos());
   9.112 -			model->saveState(
   9.113 -				fo->getTreeItem(),	// FIXME-3
   9.114 -				"moveRel "+pold,
   9.115 -				fo->getTreeItem(),	// FIXME-3
   9.116 -				"moveRel "+pnow,
   9.117 -				QString("Move %1 to relative position %2").arg(model->getObjectName(fo)).arg(pnow));
   9.118 +			FloatImageObj *fio=(FloatImageObj*)(((MapItem*)seli)->getLMO());
   9.119 +			if(fio)
   9.120 +			{
   9.121 +				// Moved FloatObj. Maybe we need to reposition
   9.122 +				QString pold=qpointfToString(movingObj_orgRelPos);
   9.123 +				QString pnow=qpointfToString(fio->getRelPos());
   9.124 +				model->saveState(
   9.125 +					seli,
   9.126 +					"moveRel "+pold,
   9.127 +					seli,
   9.128 +					"moveRel "+pnow,
   9.129 +					QString("Move %1 to relative position %2").arg(model->getObjectName(seli)).arg(pnow));
   9.130  
   9.131 -			fo->getParObj()->requestReposition();
   9.132 -			model->reposition();
   9.133 -		}	
   9.134 +				fio->getParObj()->requestReposition();
   9.135 +				model->reposition();
   9.136 +			}	
   9.137 +		}
   9.138  
   9.139  		BranchItem *bi=model->getSelectedBranchItem();
   9.140  		if (bi && bi->depth()==0)
   9.141 @@ -1051,7 +1050,7 @@
   9.142  		if (seli->isBranchLikeType() ) //(seli->getType() == TreeItem::Branch )
   9.143  		{	// A branch was moved
   9.144  			LinkableMapObj* lmosel=NULL;		//FIXME-2 get rid of lmosel
   9.145 -			lmosel=seli->getLMO();
   9.146 +			lmosel=((MapItem*)seli)->getLMO();
   9.147  				
   9.148  			// save the position in case we link to mapcenter
   9.149  			QPointF savePos=QPointF (lmosel->getAbsPos()  );
   9.150 @@ -1095,11 +1094,11 @@
   9.151  					QString postSelStr=model->getSelectString(lmosel);
   9.152  					QString postNum=QString::number (seli->num(),10);
   9.153  
   9.154 -					QString undoCom="linkTo (\""+ 
   9.155 +					QString undoCom="relinkTo (\""+ 
   9.156  						preParStr+ "\"," + preNum  +"," + 
   9.157  						QString ("%1,%2").arg(movingObj_orgPos.x()).arg(movingObj_orgPos.y())+ ")";
   9.158  
   9.159 -					QString redoCom="linkTo (\""+ 
   9.160 +					QString redoCom="relinkTo (\""+ 
   9.161  						preDstParStr + "\"," + postNum + "," +
   9.162  						QString ("%1,%2").arg(savePos.x()).arg(savePos.y())+ ")";
   9.163  
   9.164 @@ -1270,8 +1269,20 @@
   9.165  	event->acceptProposedAction();
   9.166  }
   9.167  
   9.168 -void MapEditor::updateSelection(const QItemSelection &newsel,const QItemSelection &oldsel)
   9.169 +void MapEditor::updateSelection(QItemSelection newsel,QItemSelection oldsel)
   9.170  {
   9.171 +	// Here in MapEditor we can only select Branches and Images
   9.172 +	QModelIndex ix;
   9.173 +	foreach (ix,newsel.indexes() )
   9.174 +	{
   9.175 +		TreeItem *ti= static_cast<TreeItem*>(ix.internalPointer());
   9.176 +		if (ti->getType()!=TreeItem::Branch && ti->getType()!=TreeItem::Image )
   9.177 +			newsel.indexes().removeOne (ix);
   9.178 +	}
   9.179 +
   9.180 +	while (newsel.indexes().count() < selboxList.count() )
   9.181 +		delete selboxList.takeFirst();
   9.182 +
   9.183  	// Take care to tmp scroll/unscroll
   9.184  	if (!oldsel.isEmpty())
   9.185  	{
   9.186 @@ -1332,7 +1343,7 @@
   9.187  	{
   9.188  		index=newsel.indexes().at(i);
   9.189  		ti= static_cast<TreeItem*>(index.internalPointer());
   9.190 -		lmo=ti->getLMO();
   9.191 +		lmo=((MapItem*)ti)->getLMO();
   9.192  		bbox=lmo->getBBox();
   9.193  		sb->setRect (
   9.194  			bbox.x(),bbox.y(), 
   9.195 @@ -1358,7 +1369,7 @@
   9.196  	
   9.197  	if (ti->isBranchLikeType())
   9.198  	{
   9.199 -		BranchObj *bo=(BranchObj*)ti->getLMO();
   9.200 +		BranchObj *bo=(BranchObj*) ((MapItem*)ti)->getLMO();
   9.201  		bo->updateData();
   9.202  	}
   9.203  
    10.1 --- a/mapeditor.h	Wed Jun 03 20:37:17 2009 +0000
    10.2 +++ b/mapeditor.h	Mon Jun 08 11:36:56 2009 +0000
    10.3 @@ -132,7 +132,7 @@
    10.4  	QColor selectionColor;
    10.5  
    10.6  public slots:
    10.7 -	void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
    10.8 +	void updateSelection(QItemSelection ,QItemSelection); // update selection
    10.9  	void updateData (const QModelIndex&); // update data
   10.10  public:
   10.11  	void setSelectionColor (QColor c);
    11.1 --- a/mapitem.cpp	Wed Jun 03 20:37:17 2009 +0000
    11.2 +++ b/mapitem.cpp	Mon Jun 08 11:36:56 2009 +0000
    11.3 @@ -5,9 +5,20 @@
    11.4  
    11.5  #include <iostream>
    11.6  using namespace std;
    11.7 +#include "misc.h"	//cout << QPointF
    11.8  
    11.9  MapItem::MapItem()
   11.10  {
   11.11 +	init();
   11.12 +}
   11.13 +
   11.14 +MapItem::MapItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
   11.15 +{
   11.16 +	init();
   11.17 +}
   11.18 +
   11.19 +void MapItem::init()
   11.20 +{
   11.21  	lmo=NULL;
   11.22  	posMode=Unused;
   11.23  }
   11.24 @@ -63,23 +74,33 @@
   11.25  
   11.26  QString MapItem::getAttr()
   11.27  {
   11.28 +	QString s;
   11.29 +	if (parentItem==rootItem)
   11.30 +		posMode=Absolute;
   11.31 +	else
   11.32 +	{
   11.33 +		if (type==TreeItem::Image ||depth()==1)
   11.34 +			posMode=Relative;
   11.35 +		else
   11.36 +			posMode=Unused;
   11.37 +	}
   11.38  	switch (posMode)
   11.39  	{
   11.40  		case Relative:	
   11.41  			if (lmo) pos=lmo->getRelPos();
   11.42 -			return
   11.43 -				attribut("relPosX",QString().setNum(pos.x())) +
   11.44 -				attribut("relPosY",QString().setNum(pos.y())); 
   11.45 +			s= attribut("relPosX",QString().setNum(pos.x())) +
   11.46 +			   attribut("relPosY",QString().setNum(pos.y())); 
   11.47  			break;
   11.48  		case Absolute:	
   11.49  			if (lmo) pos=lmo->getAbsPos();
   11.50 -			return
   11.51 -				attribut("absPosX",QString().setNum(pos.x())) +
   11.52 -				attribut("absPosY",QString().setNum(pos.y())); 
   11.53 +			s=attribut("absPosX",QString().setNum(pos.x())) +
   11.54 +			  attribut("absPosY",QString().setNum(pos.y())); 
   11.55  			break;
   11.56 -		default:
   11.57 -			return QString();
   11.58 -			break;
   11.59 +		default: break;
   11.60  	}
   11.61 +	if (hideExport)
   11.62 +		return s+attribut("hideInExport","true");
   11.63 +	else	
   11.64 +		return s;
   11.65  }
   11.66  
    12.1 --- a/mapitem.h	Wed Jun 03 20:37:17 2009 +0000
    12.2 +++ b/mapitem.h	Mon Jun 08 11:36:56 2009 +0000
    12.3 @@ -3,9 +3,11 @@
    12.4  
    12.5  #include <QPointF>
    12.6  
    12.7 +#include "treeitem.h"
    12.8  #include "xmlobj.h"
    12.9  
   12.10  class LinkableMapObj;
   12.11 +class TreeItem;
   12.12  
   12.13  /*! /brief MapItem is used to store information of MapObj and inherited
   12.14     classes.
   12.15 @@ -15,7 +17,7 @@
   12.16  	but just a treeview instead.
   12.17  */
   12.18  
   12.19 -class MapItem: public XMLObj
   12.20 +class MapItem:public TreeItem, public XMLObj
   12.21  {
   12.22  public:
   12.23  	enum PositionMode {Unused,Absolute,Relative};
   12.24 @@ -25,6 +27,8 @@
   12.25  
   12.26  public:
   12.27  	MapItem();
   12.28 +	MapItem (const QList<QVariant> &data, TreeItem *parent = 0);
   12.29 +	void init();
   12.30  
   12.31  	/*! Used to save relative position while map is not in QGraphicsView */
   12.32  	virtual void setRelPos(const QPointF&);	
    13.1 --- a/ornamentedobj.cpp	Wed Jun 03 20:37:17 2009 +0000
    13.2 +++ b/ornamentedobj.cpp	Mon Jun 08 11:36:56 2009 +0000
    13.3 @@ -1,11 +1,6 @@
    13.4 -#include <typeinfo> 
    13.5 -
    13.6  #include "ornamentedobj.h"
    13.7 -#include "texteditor.h"
    13.8 -#include "mapeditor.h"
    13.9  #include "linkablemapobj.h"
   13.10 -
   13.11 -extern TextEditor *textEditor;
   13.12 +#include "vymmodel.h"
   13.13  
   13.14  /////////////////////////////////////////////////////////////////
   13.15  // OrnamentedObj
   13.16 @@ -250,48 +245,8 @@
   13.17  }
   13.18  
   13.19  
   13.20 -QString OrnamentedObj::getSystemFlagName(const QPointF &p)
   13.21 +QString OrnamentedObj::getSystemFlagName(const QPointF &p) //FIXME-3
   13.22  {
   13.23  	return systemFlags->getFlagName(p);	
   13.24  }
   13.25  
   13.26 -/* FIXME-3 should move to VymView ?!  void OrnamentedObj::getNoteFromTextEditor ()
   13.27 -{
   13.28 -	note.setFilenameHint (textEditor->getFilename());
   13.29 -	note.setFontHint (textEditor->getFontHint() );
   13.30 -	setNote( textEditor->getText() );
   13.31 -}
   13.32 -*/
   13.33 -
   13.34 -QString OrnamentedObj::getOrnXMLAttr()	//FIXME-2 still needed?
   13.35 -{
   13.36 -	QString posAttr;
   13.37 -
   13.38 -	if (treeItem->depth()==0)
   13.39 -		posAttr=		
   13.40 -			attribut("absPosX",QString().setNum(absPos.x())) +
   13.41 -			attribut("absPosY",QString().setNum(absPos.y())); 
   13.42 -	else
   13.43 -	{
   13.44 -	/* FIXME-2
   13.45 -		if (treeItem->depth()==1 || typid (*this)==typid (FloatImageObj))
   13.46 -		{
   13.47 -			if (relPos.x()==0 && relPos.y()==0)
   13.48 -				setRelPos();
   13.49 -			posAttr=
   13.50 -				attribut("relPosX",QString().setNum(relPos.x())) +
   13.51 -				attribut("relPosY",QString().setNum(relPos.y())); 
   13.52 -		} else
   13.53 -			posAttr="";
   13.54 -	*/		
   13.55 -	}	
   13.56 -
   13.57 -/* FIXME-2 QString hideExpAttr;
   13.58 -	if (hideExport)
   13.59 -		hideExpAttr= attribut("hideInExport","true");
   13.60 -	else	
   13.61 -		hideExpAttr="";
   13.62 -*/
   13.63 -	return posAttr +getLinkAttr() ;//+hideExpAttr;
   13.64 -}
   13.65 -
    14.1 --- a/ornamentedobj.h	Wed Jun 03 20:37:17 2009 +0000
    14.2 +++ b/ornamentedobj.h	Mon Jun 08 11:36:56 2009 +0000
    14.3 @@ -55,9 +55,6 @@
    14.4  	virtual void deactivateStandardFlag(const QString &name);
    14.5  	virtual QString getSystemFlagName (const QPointF &p);
    14.6  
    14.7 -	//virtual void getNoteFromTextEditor ();// FIXME-3 should move to vymview?!
    14.8 -	virtual QString getOrnXMLAttr();		// get attributes for saveToDir
    14.9 -
   14.10  protected:
   14.11      HeadingObj *heading;			// Heading
   14.12  	FlagRowObj *systemFlags;		// System Flags
    15.1 --- a/treeitem.cpp	Wed Jun 03 20:37:17 2009 +0000
    15.2 +++ b/treeitem.cpp	Mon Jun 08 11:36:56 2009 +0000
    15.3 @@ -11,7 +11,15 @@
    15.4  
    15.5  extern FlagRow* standardFlagsMaster;
    15.6  
    15.7 -TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent):MapItem()
    15.8 +TreeItem::TreeItem()
    15.9 +{
   15.10 +	init();
   15.11 +	itemData.clear();
   15.12 +	rootItem=this;
   15.13 +	parentItem=NULL;
   15.14 +}
   15.15 +
   15.16 +TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
   15.17  {
   15.18  	//cout << "Constructor TreeItem this="<<this<<"  parent="<<parent<<endl;
   15.19  	init();
   15.20 @@ -65,6 +73,7 @@
   15.21  	// isNoteInEditor=false;
   15.22  
   15.23  	hidden=false;
   15.24 +	hideExport=false;
   15.25  
   15.26  	// Reset ID
   15.27  	objID="";
   15.28 @@ -94,15 +103,37 @@
   15.29  	return model;
   15.30  }
   15.31  
   15.32 +int TreeItem::getRowNumAppend (TreeItem *item)
   15.33 +{	
   15.34 +	switch (item->type)
   15.35 +	{
   15.36 +		case MapCenter: return branchOffset + branchCounter;
   15.37 +		case Branch: return branchOffset + branchCounter;
   15.38 +		case Image: return imageOffset + imageCounter;
   15.39 +		default: return -1;
   15.40 +	}
   15.41 +}
   15.42 +
   15.43  void TreeItem::appendChild(TreeItem *item)
   15.44  {
   15.45 -    childItems.append(item);
   15.46  	item->parentItem=this;
   15.47  	item->rootItem=rootItem;
   15.48  	item->setModel (model);
   15.49  
   15.50 -	if (item->type == Branch || item->type ==MapCenter)
   15.51 +	if (item->type == Image)
   15.52  	{
   15.53 +		childItems.insert (imageCounter,item);
   15.54 +		// images are on top of list
   15.55 +		if (imageCounter==0)
   15.56 +			imageOffset=0;
   15.57 +		imageCounter++;
   15.58 +		branchOffset++;
   15.59 +	}
   15.60 +
   15.61 +	if (item->isBranchLikeType())
   15.62 +	{
   15.63 +		// branches are on bottom of list
   15.64 +		childItems.append(item);
   15.65  		if (branchCounter==0)
   15.66  			branchOffset=childItems.count()-1;
   15.67  		branchCounter++;
   15.68 @@ -117,6 +148,12 @@
   15.69  	{
   15.70  		if (childItems.at(row)->isBranchLikeType())
   15.71  			branchCounter--;
   15.72 +		if (childItems.at(row)->type==Image)
   15.73 +		{
   15.74 +			imageCounter--;
   15.75 +			if (branchOffset>0) 
   15.76 +				branchOffset--;
   15.77 +		}	
   15.78  		childItems.removeAt (row);
   15.79  	}
   15.80  }
   15.81 @@ -160,8 +197,7 @@
   15.82  
   15.83  int TreeItem::imageCount() const
   15.84  {
   15.85 -	int imageCounter=0;
   15.86 -    return imageCounter; // FIXME-1 imageCounter needs to be calculated...
   15.87 +    return imageCounter; 
   15.88  }
   15.89  
   15.90  int TreeItem::xlinkCount() const // FIXME-2 check if xlinks are stored in a different way (global to model?)
   15.91 @@ -209,10 +245,9 @@
   15.92  {
   15.93  	switch (type)
   15.94  	{
   15.95 -		case Undefined: return -1;
   15.96 -		case MapCenter: return parentItem->childItems.indexOf (this) - branchOffset;
   15.97 -		case Branch: return parentItem->childItems.indexOf (this) - branchOffset;
   15.98 -		case Image: return parentItem->childItems.indexOf (this) - imageOffset;
   15.99 +		case MapCenter: return parentItem->childItems.indexOf (this) - parentItem->branchOffset;
  15.100 +		case Branch: return parentItem->childItems.indexOf (this) - parentItem->branchOffset;
  15.101 +		case Image: return parentItem->childItems.indexOf (this) - parentItem->imageOffset;
  15.102  		default: return -1;
  15.103  	}
  15.104  }
  15.105 @@ -220,9 +255,9 @@
  15.106  int TreeItem::num (TreeItem *item)
  15.107  {
  15.108  	if (!item) return -1;
  15.109 +	if (!childItems.contains(item)) return -1;
  15.110  	switch (item->getType())
  15.111  	{
  15.112 -		case Undefined: return -1;
  15.113  		case MapCenter: return childItems.indexOf (item) - branchOffset;
  15.114  		case Branch: return childItems.indexOf (item) - branchOffset;
  15.115  		case Image: return parentItem->childItems.indexOf (item) - imageOffset;
  15.116 @@ -348,8 +383,7 @@
  15.117  	systemFlags.deactivate ("system-note");
  15.118  }
  15.119  
  15.120 -void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor) //FIXME-1 setNoteObj is called for every select or so???
  15.121 -{
  15.122 +void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor){
  15.123  	note=n;
  15.124  	if (!note.isEmpty() && !systemFlags.isActive ("system-note"))
  15.125  		systemFlags.activate ("system-note");
  15.126 @@ -426,13 +460,12 @@
  15.127  	return &standardFlags;
  15.128  }
  15.129  
  15.130 -/*
  15.131 -void TreeItem::updateToolBar()
  15.132 +/* FIXME-3 void TreeItem::updateToolBar()
  15.133  {
  15.134  	standardFlags.updateToolBar();
  15.135  }
  15.136  */
  15.137 -QStringList TreeItem::activeSystemFlagNames ()	//FIXME-1 missing: scrolled-tmp,hideInExport
  15.138 +QStringList TreeItem::activeSystemFlagNames ()
  15.139  {
  15.140  	return systemFlags.activeFlagNames();
  15.141  }
  15.142 @@ -521,7 +554,7 @@
  15.143  
  15.144  BranchItem* TreeItem::getBranchNum(const int &n)
  15.145  {
  15.146 -	if (branchCounter>0)
  15.147 +	if (n>=0 && n<branchCounter)
  15.148  		return (BranchItem*)getChildNum (branchOffset + n);
  15.149  	else
  15.150  		return NULL;
  15.151 @@ -529,9 +562,9 @@
  15.152  
  15.153  BranchObj* TreeItem::getBranchObjNum(const int &n)
  15.154  {
  15.155 -	if (branchCounter>0)
  15.156 +	if (n>=0 && n<branchCounter)
  15.157  	{
  15.158 -		return (BranchObj*)(getChildNum (branchOffset+n)->lmo);
  15.159 +		return (BranchObj*)(getBranchNum(n)->getLMO());
  15.160  	} else
  15.161  		return NULL;
  15.162  }
  15.163 @@ -552,6 +585,21 @@
  15.164  	return getBranchNum (lastSelectedBranchNum);
  15.165  }
  15.166  
  15.167 +ImageItem* TreeItem::getImageNum (const int &n)
  15.168 +{
  15.169 +	if (n>=0 && n<imageCounter)
  15.170 +		return (ImageItem*)getChildNum (imageOffset + n);
  15.171 +	else
  15.172 +		return NULL;
  15.173 +}
  15.174 +
  15.175 +FloatImageObj* TreeItem::getImageObjNum (const int &n)	// FIXME-5 what about SVGs later?
  15.176 +{
  15.177 +	if (imageCounter>0 )
  15.178 +		return (FloatImageObj*)(getImageNum(n)->getLMO());
  15.179 +	else
  15.180 +		return NULL;
  15.181 +}
  15.182  
  15.183  void TreeItem::setHideTmp (HideTmpMode mode)
  15.184  {
  15.185 @@ -614,18 +662,14 @@
  15.186  
  15.187  void TreeItem::setHideInExport(bool b) 
  15.188  {
  15.189 -	if (isBranchLikeType() )
  15.190 +	if (type==Branch || type==Image)
  15.191  	{
  15.192  		hideExport=b;
  15.193 -		/* FIXME-1 call setVis and updateContentsSize...
  15.194 +		// FIXME-1 call setVis and updateContentsSize...
  15.195  		if (b)
  15.196 -			systemFlags->activate("hideInExport");
  15.197 +			systemFlags.activate("hideInExport");
  15.198  		else	
  15.199 -			systemFlags->deactivate("hideInExport");
  15.200 -		calcBBoxSize();
  15.201 -		positionBBox();
  15.202 -		requestReposition();	
  15.203 -		*/
  15.204 +			systemFlags.deactivate("hideInExport");
  15.205  	}
  15.206  }	
  15.207  
    16.1 --- a/treeitem.h	Wed Jun 03 20:37:17 2009 +0000
    16.2 +++ b/treeitem.h	Mon Jun 08 11:36:56 2009 +0000
    16.3 @@ -6,21 +6,23 @@
    16.4  #include <QVariant>
    16.5  
    16.6  #include "flagrow.h"
    16.7 -#include "mapitem.h"
    16.8  #include "noteobj.h"
    16.9  #include "xmlobj.h"
   16.10  
   16.11  class LinkableMapObj;
   16.12  class BranchObj;
   16.13  class BranchItem;
   16.14 +class FloatImageObj;
   16.15 +class ImageItem;
   16.16  class VymModel;
   16.17  
   16.18 -class TreeItem:public MapItem
   16.19 +class TreeItem
   16.20  {
   16.21  public:
   16.22  	enum Type {Undefined,MapCenter,Branch,Image};
   16.23  	enum HideTmpMode {HideNone, HideExport};
   16.24  
   16.25 +    TreeItem();
   16.26      TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
   16.27      ~TreeItem();
   16.28  	void init();
   16.29 @@ -29,6 +31,11 @@
   16.30  	virtual void setModel (VymModel *m);
   16.31  	virtual VymModel* getModel();
   16.32  
   16.33 +
   16.34 +	/*! Return number of item, as it would be after it would have been appended.
   16.35 +	    This is used to notify view about layout changes before model is modified. */
   16.36 +	virtual int getRowNumAppend (TreeItem *child);
   16.37 +
   16.38      virtual void appendChild (TreeItem *child);
   16.39  	virtual void removeChild (int row);
   16.40  	virtual void removeChildBranches ();
   16.41 @@ -95,7 +102,8 @@
   16.42  	virtual void clearNote();
   16.43  	virtual QString getNote();
   16.44  	virtual bool hasEmptyNote();
   16.45 -	virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true);
   16.46 +	virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true); //FIXME-1 setNoteObj is called for every select or so???
   16.47 +
   16.48  	virtual NoteObj getNoteObj();			
   16.49  	virtual QString getNoteASCII(const QString &indent, const int &width); // returns note	(ASCII)
   16.50      virtual QString getNoteASCII();			// returns note	(ASCII)
   16.51 @@ -146,6 +154,8 @@
   16.52  	virtual void setLastSelectedBranch(int i);	//! Set last selected branch directly
   16.53  	virtual TreeItem* getLastSelectedBranch();
   16.54  
   16.55 +	virtual ImageItem* getImageNum(const int &n);
   16.56 +	virtual FloatImageObj* getImageObjNum(const int &n);
   16.57  protected:
   16.58  	bool hideExport;							//! Hide this item in export
   16.59  public:
    17.1 --- a/treemodel.cpp	Wed Jun 03 20:37:17 2009 +0000
    17.2 +++ b/treemodel.cpp	Mon Jun 08 11:36:56 2009 +0000
    17.3 @@ -5,6 +5,7 @@
    17.4  
    17.5  #include "branchitem.h"
    17.6  #include "treeitem.h"
    17.7 +#include "imageitem.h"
    17.8  #include "treemodel.h"
    17.9  
   17.10  TreeModel::TreeModel(QObject *parent)
   17.11 @@ -108,6 +109,12 @@
   17.12  
   17.13  BranchItem* TreeModel::next(BranchItem* &current, BranchItem* &previous, BranchItem* start)
   17.14  {
   17.15 +/*FIXME-3	cout << "TM::next \n"; 
   17.16 +	std::string ch="()"; if (current) ch=current->getHeadingStd();
   17.17 +	std::string ph="()"; if (previous) ph=previous->getHeadingStd();
   17.18 +	cout << "  cur="<<ch << " prev="<<ph<<endl;
   17.19 +*/
   17.20 +
   17.21  	// Walk through map beginning at current with previous==0
   17.22  	// Start at root, if current==NULL
   17.23  	if (!current) current=(BranchItem*)rootItem;
   17.24 @@ -121,32 +128,42 @@
   17.25  		return current;
   17.26  	}
   17.27  
   17.28 -	//std::cout << " cur="<<current->getHeading().toStdString();
   17.29 -	//std::cout << " prev="<<previous->getHeading().toStdString()<<std::endl;
   17.30 -
   17.31  	// Going up or down (deeper)?
   17.32  	if (current->depth() > previous->depth() )
   17.33  	{	
   17.34  		// Coming from above
   17.35  		// Trying  to go down deeper
   17.36 +//		cout << "  trying to go deeper\n";
   17.37  		if (current->branchCount() >0 )
   17.38  		{
   17.39 +//			cout << "  yes, going deeper\n";
   17.40  			previous=current;
   17.41  			current=current->getFirstBranch();
   17.42  			return current;
   17.43  		}	
   17.44  		// turn around and go up again
   17.45 +//		cout << "  sorry, turn around\n";
   17.46 +		BranchItem *bi=current;
   17.47 +		current=previous;
   17.48 +		previous=bi;
   17.49  	}	
   17.50  
   17.51 +/*
   17.52 +	cout << "  coming from below\n";
   17.53 +	ch="()"; if (current) ch=current->getHeadingStd();
   17.54 +	ph="()"; if (previous) ph=previous->getHeadingStd();
   17.55 +	cout << "  cur="<<ch << " prev="<<ph<<endl;
   17.56 +*/	
   17.57  	// Coming from below
   17.58 -
   17.59  	// Trying to go down again to siblings
   17.60  
   17.61  	BranchItem *sibling=current->getBranchNum (previous->num()+1);
   17.62 +//	cout <<"    prev->num()="<<previous->num()<<endl;
   17.63  
   17.64  	if (sibling)
   17.65  	{	
   17.66  		// Found sibling of previous, go there
   17.67 +//		cout << "  sib=cur="<<sibling->getHeadingStd()<<endl;
   17.68  		previous=current;
   17.69  		current=sibling;
   17.70  		return current;
   17.71 @@ -156,6 +173,7 @@
   17.72  	if (start==current) return NULL;
   17.73  
   17.74  	// Go up and try to find siblings of current
   17.75 +//	cout <<"  going up again...\n";
   17.76  	previous=current;
   17.77  	current=(BranchItem*)current->parent();
   17.78  
   17.79 @@ -186,6 +204,9 @@
   17.80  			case TreeItem::Branch:
   17.81  				delete (BranchItem*)ti; 
   17.82  				break;
   17.83 +			case TreeItem::Image:
   17.84 +				delete (ImageItem*)ti; 
   17.85 +				break;
   17.86  			default:
   17.87  				delete ti;
   17.88  				break;
    18.1 --- a/version.h	Wed Jun 03 20:37:17 2009 +0000
    18.2 +++ b/version.h	Mon Jun 08 11:36:56 2009 +0000
    18.3 @@ -7,7 +7,7 @@
    18.4  #define __VYM_VERSION "1.13.0"
    18.5  //#define __VYM_CODENAME "Codename: RC-1"
    18.6  #define __VYM_CODENAME "Codename: development version, not for production!"
    18.7 -#define __VYM_BUILD_DATE "2009-06-03"
    18.8 +#define __VYM_BUILD_DATE "2009-06-08"
    18.9  
   18.10  
   18.11  bool checkVersion(const QString &);
    19.1 --- a/vym.pro	Wed Jun 03 20:37:17 2009 +0000
    19.2 +++ b/vym.pro	Mon Jun 08 11:36:56 2009 +0000
    19.3 @@ -59,6 +59,7 @@
    19.4  	headingobj.h \
    19.5  	highlighter.h \
    19.6  	historywindow.h \
    19.7 +	imageitem.h \
    19.8  	imageobj.h \
    19.9  	imports.h \
   19.10  	linkablemapobj.h \
   19.11 @@ -118,6 +119,7 @@
   19.12  	headingobj.cpp \
   19.13  	highlighter.cpp \
   19.14  	historywindow.cpp \
   19.15 +	imageitem.cpp \
   19.16  	imageobj.cpp \
   19.17  	imports.cpp \
   19.18  	linkablemapobj.cpp \
    20.1 --- a/vymmodel.cpp	Wed Jun 03 20:37:17 2009 +0000
    20.2 +++ b/vymmodel.cpp	Mon Jun 08 11:36:56 2009 +0000
    20.3 @@ -234,7 +234,7 @@
    20.4  	
    20.5  	// Reset the counters before saving
    20.6  	// TODO constr. of FIO creates lots of objects, better do this in some other way...
    20.7 -	FloatImageObj (mapScene).resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe...
    20.8 +	ImageItem().resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe...
    20.9  
   20.10  	// Build xml recursivly
   20.11  	if (!saveSel || saveSel->getType()==TreeItem::MapCenter)
   20.12 @@ -260,6 +260,8 @@
   20.13  	xml.decIndent();
   20.14  	s+=xml.endElement("vymmap");
   20.15  
   20.16 +	//cout << s.toStdString() << endl;
   20.17 +
   20.18  	if (writeflags) standardFlagsMaster->saveToDir (tmpdir+"/flags/","",writeflags);
   20.19  	return s;
   20.20  }
   20.21 @@ -623,7 +625,7 @@
   20.22  	return err;
   20.23  }
   20.24  
   20.25 -void VymModel::addMapReplaceInt(const QString &undoSel, const QString &path)
   20.26 +void VymModel::addMapReplaceInt(const QString &undoSel, const QString &path)	// FIXME-1 test e.g. with undo color subtree
   20.27  {
   20.28  	QString pathDir=path.left(path.findRev("/"));
   20.29  	QDir d(pathDir);
   20.30 @@ -700,15 +702,14 @@
   20.31  */
   20.32  }
   20.33  
   20.34 -FloatImageObj* VymModel::loadFloatImageInt (BranchItem *dst,QString fn)
   20.35 -{
   20.36 -	TreeItem *fi=createImage(dst);
   20.37 -	if (fi)
   20.38 +ImageItem* VymModel::loadFloatImageInt (BranchItem *dst,QString fn)
   20.39 +{
   20.40 +	ImageItem *ii=createImage(dst);
   20.41 +	if (ii)
   20.42  	{
   20.43 -		FloatImageObj *fio= ((FloatImageObj*)fi->getLMO());
   20.44 -		fio->load (fn);
   20.45 +		ii->load (fn);
   20.46  		reposition();
   20.47 -		return fio;
   20.48 +		return ii;
   20.49  	}
   20.50  	return NULL;
   20.51  }	
   20.52 @@ -735,16 +736,15 @@
   20.53  			// TODO loadFIO in QT4 use:	lastImageDir=fd->directory();
   20.54  			lastImageDir=QDir (fd->dirPath());
   20.55  			QString s;
   20.56 -			FloatImageObj *fio;
   20.57 +			ImageItem *ii;
   20.58  			for (int j=0; j<fd->selectedFiles().count(); j++)
   20.59  			{
   20.60  				s=fd->selectedFiles().at(j);
   20.61 -				fio=loadFloatImageInt (selbi,s);
   20.62 -				//FIXME-1 savestate for loadImage missing
   20.63 -				/*
   20.64 -				if (fio)
   20.65 +				ii=loadFloatImageInt (selbi,s);
   20.66 +				//FIXME-3 check savestate for loadImage 
   20.67 +				if (ii)
   20.68  					saveState(
   20.69 -						(LinkableMapObj*)fio,
   20.70 +						(TreeItem*)ii,
   20.71  						"delete ()",
   20.72  						selbi, 
   20.73  						QString ("loadImage (%1)").arg(s ),
   20.74 @@ -753,7 +753,6 @@
   20.75  				else
   20.76  					// TODO loadFIO error handling
   20.77  					qWarning ("Failed to load "+s);
   20.78 -					*/
   20.79  			}
   20.80  		}
   20.81  		delete (p);
   20.82 @@ -761,16 +760,15 @@
   20.83  	}
   20.84  }
   20.85  
   20.86 -void VymModel::saveFloatImageInt  (FloatImageObj *fio, const QString &type, const QString &fn)
   20.87 -{
   20.88 -	fio->save (fn,type);
   20.89 +void VymModel::saveFloatImageInt  (ImageItem *ii, const QString &type, const QString &fn)
   20.90 +{
   20.91 +	ii->save (fn,type);
   20.92  }
   20.93  
   20.94  void VymModel::saveFloatImage ()
   20.95  {
   20.96 -	//FIXME-1 FloatImageObj *fio=selection.getFloatImage();
   20.97 -	FloatImageObj *fio=NULL;
   20.98 -	if (fio)
   20.99 +	ImageItem *ii=getSelectedImageItem();
  20.100 +	if (ii)
  20.101  	{
  20.102  		QFileDialog *fd=new QFileDialog( NULL);
  20.103  		fd->setFilters (imageIO.getFilters());
  20.104 @@ -808,7 +806,7 @@
  20.105  						break;
  20.106  				}
  20.107  			}
  20.108 -			saveFloatImageInt (fio,fd->selectedFilter(),fn );
  20.109 +			saveFloatImageInt (ii,fd->selectedFilter(),fn );
  20.110  		}
  20.111  		delete (fd);
  20.112  	}
  20.113 @@ -992,40 +990,24 @@
  20.114  	findReset();
  20.115  }
  20.116  
  20.117 -QString VymModel::getObjectName (const LinkableMapObj *lmo)	// FIXME-3 should be obsolete
  20.118 -{
  20.119 -	QString s;
  20.120 -	if (!lmo) return QString("Error: NULL has no name!");
  20.121 -
  20.122 -	TreeItem *ti=lmo->getTreeItem();
  20.123 -	if (ti->isBranchLikeType() )
  20.124 -	{
  20.125 -		
  20.126 -		s=lmo->getTreeItem()->getHeading();
  20.127 -		if (s=="") s="unnamed";
  20.128 -		return QString("branch (%1)").arg(s);
  20.129 -	}	
  20.130 -	if (ti->getType()==TreeItem::Image)
  20.131 -		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
  20.132 -	return QString("Unknown type has no name!");
  20.133 +QString VymModel::getObjectName (LinkableMapObj *lmo)	// FIXME-3 should be obsolete
  20.134 +{
  20.135 +	if (!lmo || !lmo->getTreeItem() ) return QString();
  20.136 +	return getObjectName (lmo->getTreeItem() );
  20.137  }
  20.138  
  20.139  
  20.140 -QString VymModel::getObjectName (const TreeItem *ti)
  20.141 +QString VymModel::getObjectName (TreeItem *ti)
  20.142  {
  20.143  	QString s;
  20.144  	if (!ti) return QString("Error: NULL has no name!");
  20.145 -
  20.146 -	if (ti->isBranchLikeType() )
  20.147 -	{
  20.148 -		s=ti->getHeading();
  20.149 -		if (s=="") s="unnamed";
  20.150 +	s=ti->getHeading();
  20.151 +	if (s=="") s="unnamed";
  20.152 +
  20.153 +	if (ti->isBranchLikeType() )	//FIXME-3 shouldnt there also be mapcenter??
  20.154  		return QString("branch (%1)").arg(s);
  20.155 -	}	
  20.156 -	/* FIXME-2 move floatimage to TreeModel first
  20.157 -	if (type==TreeItem::Image)
  20.158 -		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
  20.159 -	*/	
  20.160 +	if (ti->getType()==TreeItem::Image)
  20.161 +		return QString ("image (%1)").arg(ti->getHeading());
  20.162  	return QString("Unknown type has no name!");
  20.163  }
  20.164  
  20.165 @@ -1480,7 +1462,7 @@
  20.166  	return QDate::currentDate().toString ("yyyy-MM-dd");
  20.167  }
  20.168  
  20.169 -int VymModel::branchCount()	// FIXME-2 Optimize this: use internal counter instead of going through whole map each time...
  20.170 +int VymModel::branchCount()	// FIXME-4 Optimize this: use internal counter instead of going through whole map each time...
  20.171  {
  20.172  	int c=0;
  20.173  	BranchItem *cur=NULL;
  20.174 @@ -1627,9 +1609,9 @@
  20.175  	return urls;
  20.176  }
  20.177  
  20.178 -void VymModel::linkFloatImageTo(const QString &dstString)	// FIXME-1
  20.179 -{
  20.180 -	//FIXME-1 FloatImageObj *fio=selection.getFloatImage();
  20.181 +void VymModel::linkFloatImageTo(const QString &dstString)	// FIXME-0
  20.182 +{
  20.183 +	//FIXME-0 FloatImageObj *fio=selection.getFloatImage();
  20.184  	FloatImageObj *fio=NULL;
  20.185  	if (fio)
  20.186  	{
  20.187 @@ -1640,7 +1622,7 @@
  20.188  			QString parString=getSelectString(dstPar);
  20.189  			QString fioPreSelectString=getSelectString(fio);
  20.190  			QString fioPreParentSelectString=getSelectString (fio->getParObj());
  20.191 -			// FIXME-1 ((BranchObj*)dst)->addFloatImage (fio);
  20.192 +			// FIXME-0 ((BranchObj*)dst)->addFloatImage (fio);
  20.193  			unselect();
  20.194  			// ((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
  20.195  			fio=((BranchObj*)dst)->getLastFloatImage();
  20.196 @@ -1813,20 +1795,23 @@
  20.197  
  20.198  void VymModel::setHideExport(bool b)
  20.199  {
  20.200 -	BranchItem *bi=getSelectedBranchItem();
  20.201 -	if (bi)
  20.202 +	MapItem *mi=(MapItem*)getSelectedItem();
  20.203 +	if (mi && 
  20.204 +		(mi->getType()==TreeItem::Image ||mi->isBranchLikeType()))
  20.205  	{
  20.206 -		bi->setHideInExport (b);
  20.207 +		mi->setHideInExport (b);
  20.208  		QString u= b ? "false" : "true";
  20.209  		QString r=!b ? "false" : "true";
  20.210  		
  20.211  		saveState(
  20.212 -			bi,
  20.213 +			mi,
  20.214  			QString ("setHideExport (%1)").arg(u),
  20.215 -			bi,
  20.216 +			mi,
  20.217  			QString ("setHideExport (%1)").arg(r),
  20.218 -			QString ("Set HideExport flag of %1 to %2").arg(getObjectName(bi)).arg (r)
  20.219 +			QString ("Set HideExport flag of %1 to %2").arg(getObjectName(mi)).arg (r)
  20.220  		);	
  20.221 +			emitDataHasChanged(mi);
  20.222 +			emitSelectionChanged();
  20.223  		updateActions();
  20.224  		reposition();
  20.225  		// emitSelectionChanged();
  20.226 @@ -1836,9 +1821,9 @@
  20.227  
  20.228  void VymModel::toggleHideExport()
  20.229  {
  20.230 -	BranchItem *selbi=getSelectedBranchItem();
  20.231 -	if (selbi)
  20.232 -		setHideExport ( !selbi->hideInExport() );
  20.233 +	TreeItem *selti=getSelectedItem();
  20.234 +	if (selti)
  20.235 +		setHideExport ( !selti->hideInExport() );
  20.236  }
  20.237  
  20.238  
  20.239 @@ -1971,31 +1956,35 @@
  20.240  		return NULL;
  20.241  }
  20.242  
  20.243 -TreeItem* VymModel::createImage(BranchItem *dst)	//FIXME-1
  20.244 -{
  20.245 -	return NULL;
  20.246 -/*
  20.247 +ImageItem* VymModel::createImage(BranchItem *dst)
  20.248 +{
  20.249  	if (dst)
  20.250  	{
  20.251 -		FloatImageObj *newfio=bo->addFloatImage(); // FIXME-1 VM Old model, merge with below
  20.252 -
  20.253 -		// Create TreeItem
  20.254 +		QModelIndex parix;
  20.255 +		int n;
  20.256  		QList<QVariant> cData;
  20.257 -		cData << "VM:createImage" << "undef"<<"undef";
  20.258 -		TreeItem *parti=bo->getTreeItem();
  20.259 -		TreeItem *ti=new TreeItem (cData,parti);
  20.260 -		ti->setLMO (newfio);
  20.261 -		ti->setType (TreeItem::Image);
  20.262 -		parti->appendChild (ti);
  20.263 -
  20.264 -		if (newfio)
  20.265 -		{
  20.266 -			newfio->setTreeItem (ti);
  20.267 -			select (newfio); // FIXME-2 VM really needed here?
  20.268 -			return ti;
  20.269 -		}
  20.270 -	}
  20.271 -*/
  20.272 +		cData << "VM::createImage" << "undef"<<"undef";
  20.273 +
  20.274 +		ImageItem *newii=new ImageItem (cData);	
  20.275 +		newii->setHeading (QApplication::translate("Heading of new image in map", "new image"));
  20.276 +
  20.277 +		emit (layoutAboutToBeChanged() );
  20.278 +
  20.279 +			parix=index(dst);
  20.280 +			n=dst->getRowNumAppend(newii);
  20.281 +			beginInsertRows (parix,n,n+1);
  20.282 +			dst->appendChild (newii);	
  20.283 +			endInsertRows ();
  20.284 +
  20.285 +		emit (layoutChanged() );
  20.286 +
  20.287 +		// save scroll state. If scrolled, automatically select
  20.288 +		// new branch in order to tmp unscroll parent...
  20.289 +		newii->createMapObj(mapScene);
  20.290 +		reposition();
  20.291 +		return newii;
  20.292 +	} 
  20.293 +	return NULL;
  20.294  }
  20.295  
  20.296  BranchItem* VymModel::addMapCenter ()
  20.297 @@ -2065,7 +2054,7 @@
  20.298  	{
  20.299  		parbi=dst;
  20.300  		parix=index(parbi);
  20.301 -		n=parbi->childCount();
  20.302 +		n=parbi->getRowNumAppend (newbi);
  20.303  		beginInsertRows (parix,n,n+1);	
  20.304  		parbi->appendChild (newbi);	
  20.305  		endInsertRows ();
  20.306 @@ -2073,8 +2062,9 @@
  20.307  	{
  20.308  		// insert below selection
  20.309  		parbi=(BranchItem*)dst->parent();
  20.310 -		parix=index(parbi);
  20.311 -		n=dst->childNumber()+ (3+num)/2;	//-1 |-> 1;-3 |-> 0
  20.312 +		parix=index(parbi);  
  20.313 +		
  20.314 +		n=dst->childNumber() + (3+num)/2;	//-1 |-> 1;-3 |-> 0
  20.315  		beginInsertRows (parix,n,n);	
  20.316  		parbi->insertBranch(n,newbi);	
  20.317  		endInsertRows ();
  20.318 @@ -2201,52 +2191,39 @@
  20.319  {
  20.320  	BranchItem *selbi=getSelectedBranchItem();
  20.321  
  20.322 -	if (!selbi) return;
  20.323 -
  20.324 -	TreeItem *pi=selbi->parent();
  20.325 -	QModelIndex parentIndex=index(pi);
  20.326 -	
  20.327 -	if (selbi->isBranchLikeType() )
  20.328 +	if (selbi && selbi->isBranchLikeType() )
  20.329  	{
  20.330  		unselect();
  20.331  		saveStateRemovingPart (selbi, QString ("Delete %1").arg(getObjectName(selbi)));
  20.332  
  20.333 -		emit (layoutAboutToBeChanged() );
  20.334 -
  20.335 -		int n=selbi->childNum();
  20.336 -		beginRemoveRows (parentIndex,n,n);
  20.337 -		removeRows (n,1,parentIndex);
  20.338 -		endRemoveRows();
  20.339 -		select (pi);
  20.340 -		emitShowSelection();
  20.341 -		reposition();
  20.342 -
  20.343 -		emit (layoutChanged() );
  20.344 +		TreeItem *pi=deleteItem (selbi);
  20.345 +		if (pi)
  20.346 +		{
  20.347 +			select (pi);
  20.348 +			emitShowSelection();
  20.349 +		}
  20.350  		return;
  20.351  	}
  20.352 -	//FloatImageObj *fio=selection.getFloatImage(); 	//FIXME-1 VM still missing
  20.353 -
  20.354 -/*
  20.355 -	if (fio)
  20.356 +	ImageItem *ii=getSelectedImageItem();
  20.357 +	if (ii)
  20.358  	{
  20.359 -		BranchObj* par=(BranchObj*)fio->getParObj();
  20.360 +		BranchItem *pi=(BranchItem*)(ii->parent());
  20.361  		saveStateChangingPart(
  20.362 -			par, 
  20.363 -			fio,
  20.364 +			pi, 
  20.365 +			ii,
  20.366  			"delete ()",
  20.367 -			QString("Delete %1").arg(getObjectName(fio))
  20.368 +			QString("Delete %1").arg(getObjectName(ii))
  20.369  		);
  20.370  		unselect();
  20.371 -		par->removeFloatImage(fio);
  20.372 -		select (par);
  20.373 +		deleteItem (ii);
  20.374 +		select (pi);
  20.375  		reposition();
  20.376  		emitShowSelection();
  20.377  		return;
  20.378  	}
  20.379 -	*/
  20.380  }
  20.381  
  20.382 -void VymModel::deleteKeepChildren()	
  20.383 +void VymModel::deleteKeepChildren()	//FIXME-2 does not work yet for mapcenters
  20.384  
  20.385  {
  20.386  	BranchItem *selbi=getSelectedBranchItem();
  20.387 @@ -2275,7 +2252,15 @@
  20.388  
  20.389  		QString sel=getSelectString(selbi);
  20.390  		unselect();
  20.391 -		//FIXME-0 missing in VM pi->removeBranchHere(selbi);
  20.392 +		int pos=selbi->num();
  20.393 +		BranchItem *bi=selbi->getFirstBranch();
  20.394 +		while (bi)
  20.395 +		{
  20.396 +			relinkBranch (bi,pi,pos);
  20.397 +			bi=selbi->getFirstBranch();
  20.398 +			pos++;
  20.399 +		}
  20.400 +		deleteItem (selbi);
  20.401  		reposition();
  20.402  		select (sel);
  20.403  		BranchObj *bo=getSelectedBranchObj();
  20.404 @@ -2311,6 +2296,27 @@
  20.405  	}	
  20.406  }
  20.407  
  20.408 +TreeItem* VymModel::deleteItem (TreeItem *ti)
  20.409 +{
  20.410 +	if (ti)
  20.411 +	{
  20.412 +		TreeItem *pi=ti->parent();
  20.413 +		QModelIndex parentIndex=index(pi);
  20.414 +
  20.415 +		emit (layoutAboutToBeChanged() );
  20.416 +
  20.417 +		int n=ti->childNum();
  20.418 +		beginRemoveRows (parentIndex,n,n);
  20.419 +		removeRows (n,1,parentIndex);
  20.420 +		endRemoveRows();
  20.421 +		reposition();
  20.422 +
  20.423 +		emit (layoutChanged() );
  20.424 +		if (pi->depth()>0) return pi;
  20.425 +	}	
  20.426 +	return NULL;
  20.427 +}
  20.428 +
  20.429  bool VymModel::scrollBranch(BranchItem *bi)
  20.430  {
  20.431  	if (bi)	
  20.432 @@ -2430,7 +2436,7 @@
  20.433  	}
  20.434  }
  20.435  
  20.436 -void VymModel::addFloatImage (const QPixmap &img) //FIXME-2
  20.437 +void VymModel::addFloatImage (const QPixmap &img) //FIXME-0
  20.438  {
  20.439  /*
  20.440  	BranchObj *bo=getSelectedBranch();
  20.441 @@ -3010,7 +3016,7 @@
  20.442  			if (ok) importDirInt(s);
  20.443  		}	
  20.444  	/////////////////////////////////////////////////////////////////////
  20.445 -	} else /* FIXME-2 if (com=="linkTo")
  20.446 +	} else if (com=="relinkTo")
  20.447  	{
  20.448  		if (!selti)
  20.449  		{
  20.450 @@ -3023,21 +3029,21 @@
  20.451  				// 1	num in parent (for branches)
  20.452  				// 2,3	x,y of mainbranch or mapcenter
  20.453  				s=parser.parString(ok,0);
  20.454 -				LinkableMapObj *dst=findObjBySelect (s);
  20.455 +				TreeItem *dst=findBySelectString (s);
  20.456  				if (dst)
  20.457  				{	
  20.458 -					if (typid(*dst) == typid(BranchObj) ) 
  20.459 +					if (dst->getType()==TreeItem::Branch) 
  20.460  					{
  20.461  						// Get number in parent
  20.462  						n=parser.parInt (ok,1);
  20.463  						if (ok)
  20.464  						{
  20.465 -							selb->linkTo ((BranchObj*)(dst),n);
  20.466 +							relinkBranch (selbi,(BranchItem*)dst,n);
  20.467  							emitSelectionChanged();
  20.468  						}	
  20.469 -					} else if (typid(*dst) == typid(MapCenterObj) ) 
  20.470 +					} else if (dst->getType()==TreeItem::MapCenter) 
  20.471  					{
  20.472 -						selb->linkTo ((BranchObj*)(dst),-1);
  20.473 +						relinkBranch (selbi,(BranchItem*)dst);
  20.474  						// Get coordinates of mainbranch
  20.475  						x=parser.parDouble(ok,2);
  20.476  						if (ok)
  20.477 @@ -3045,32 +3051,33 @@
  20.478  							y=parser.parDouble(ok,3);
  20.479  							if (ok) 
  20.480  							{
  20.481 -								selbi->move (x,y);
  20.482 +								if (selbi->getLMO()) selbi->getLMO()->move (x,y);
  20.483  								emitSelectionChanged();
  20.484  							}
  20.485  						}
  20.486  					}	
  20.487  				}	
  20.488  			}	
  20.489 -		} else if ( selectionType() == TreeItem::Image) 
  20.490 +		} else if ( selti->getType() == TreeItem::Image) 
  20.491  		{
  20.492  			if (parser.checkParCount(1))
  20.493  			{
  20.494  				// 0	selectstring of parent
  20.495  				s=parser.parString(ok,0);
  20.496 -				LinkableMapObj *dst=findObjBySelect (s);
  20.497 +				TreeItem *dst=findBySelectString (s);
  20.498  				if (dst)
  20.499  				{	
  20.500 -					if (typid(*dst) == typid(BranchObj) ||
  20.501 -						typid(*dst) == typid(MapCenterObj)) 
  20.502 +					/* FIXME-0 relink img
  20.503 +					if (dst->isBranchLikeType())
  20.504  						linkFloatImageTo (getSelectString(dst));
  20.505 +					*/	
  20.506  				} else	
  20.507  					parser.setError (Aborted,"Destination is not a branch");
  20.508  			}		
  20.509  		} else
  20.510  			parser.setError (Aborted,"Type of selection is not a floatimage or branch");
  20.511  	/////////////////////////////////////////////////////////////////////
  20.512 -	} else */ if (com=="loadImage")
  20.513 +	} else if (com=="loadImage")
  20.514  	{
  20.515  		if (!selti)
  20.516  		{
  20.517 @@ -3235,18 +3242,17 @@
  20.518  	/////////////////////////////////////////////////////////////////////
  20.519  	} else if (com=="saveImage")
  20.520  	{
  20.521 -		//FIXME-2 FloatImageObj *fio=selection.getFloatImage();
  20.522 -		FloatImageObj* fio=NULL;
  20.523 -		if (!fio)
  20.524 +		ImageItem *ii=getSelectedImageItem();
  20.525 +		if (!ii )
  20.526  		{
  20.527 -			parser.setError (Aborted,"Type of selection is not an image");
  20.528 +			parser.setError (Aborted,"No image selected");
  20.529  		} else if (parser.checkParCount(2))
  20.530  		{
  20.531  			s=parser.parString(ok,0);
  20.532  			if (ok)
  20.533  			{
  20.534  				t=parser.parString(ok,1);
  20.535 -				if (ok) saveFloatImageInt (fio,t,s);
  20.536 +				if (ok) saveFloatImageInt (ii,t,s);
  20.537  			}
  20.538  		}	
  20.539  	/////////////////////////////////////////////////////////////////////
  20.540 @@ -4553,10 +4559,7 @@
  20.541  
  20.542  bool VymModel::select ()
  20.543  {
  20.544 -	QModelIndex index=selModel->selectedIndexes().first();	// TODO no multiselections yet
  20.545 -
  20.546 -	TreeItem *item = getItem (index);
  20.547 -	return select (item->getLMO() );
  20.548 +	return select (selModel->selectedIndexes().first());	// TODO no multiselections yet
  20.549  }
  20.550  
  20.551  bool VymModel::select (const QString &s)
  20.552 @@ -4924,7 +4927,7 @@
  20.553  		TreeItem::Type type=ti->getType();
  20.554  		if (type ==TreeItem::Branch || type==TreeItem::MapCenter || type==TreeItem::Image)
  20.555  		{
  20.556 -			return ti->getLMO();
  20.557 +			return ((MapItem*)ti)->getLMO();
  20.558  		}	
  20.559  	}
  20.560  	return NULL;
  20.561 @@ -4934,7 +4937,7 @@
  20.562  {
  20.563  	TreeItem *ti = getSelectedBranchItem();
  20.564  	if (ti)
  20.565 -		return (BranchObj*)ti->getLMO();
  20.566 +		return (BranchObj*)((MapItem*)ti)->getLMO();
  20.567  	else	
  20.568  		return NULL;
  20.569  }
  20.570 @@ -4970,9 +4973,15 @@
  20.571  		return list.first();
  20.572  }
  20.573  
  20.574 -FloatImageObj* VymModel::getSelectedFloatImage()
  20.575 -{
  20.576 -	//FIXME-2 return selection.getFloatImage();	
  20.577 +ImageItem* VymModel::getSelectedImageItem()
  20.578 +{
  20.579 +	QModelIndexList list=selModel->selectedIndexes();
  20.580 +	if (!list.isEmpty())
  20.581 +	{
  20.582 +		TreeItem *ti=getItem (list.first());
  20.583 +		if (ti && ti->getType()==TreeItem::Image)
  20.584 +			return (ImageItem*)ti;
  20.585 +	}
  20.586  	return NULL;
  20.587  }
  20.588  
  20.589 @@ -4991,8 +5000,7 @@
  20.590  {
  20.591  	QString s;
  20.592  	if (!ti) return s;
  20.593 -	if (ti->getType() == TreeItem::Branch ||
  20.594 -	    ti->getType() == TreeItem::MapCenter)
  20.595 +	if (ti->isBranchLikeType())
  20.596  	{	
  20.597  		TreeItem *par=ti->parent();
  20.598  		if (par)
    21.1 --- a/vymmodel.h	Wed Jun 03 20:37:17 2009 +0000
    21.2 +++ b/vymmodel.h	Mon Jun 08 11:36:56 2009 +0000
    21.3 @@ -5,7 +5,7 @@
    21.4  #include <QtNetwork>
    21.5  
    21.6  #include "file.h"
    21.7 -#include "floatimageobj.h"
    21.8 +#include "imageitem.h"
    21.9  #include "mapeditor.h"
   21.10  #include "parser.h"
   21.11  #include "treeitem.h"
   21.12 @@ -107,8 +107,8 @@
   21.13      void addMapReplaceInt(const QString & undoSel, const QString & path);
   21.14      void addMapInsertInt (const QString & path, int pos);
   21.15  
   21.16 -	FloatImageObj* loadFloatImageInt (BranchItem *dst,QString);
   21.17 -	void saveFloatImageInt (FloatImageObj*, const QString &, const QString &);
   21.18 +	ImageItem* loadFloatImageInt (BranchItem *dst,QString);
   21.19 +	void saveFloatImageInt (ImageItem*, const QString &, const QString &);
   21.20  public:	
   21.21  	void loadFloatImage ();
   21.22  	void saveFloatImage ();
   21.23 @@ -151,8 +151,8 @@
   21.24  	  Returns heading of a branch or name of an object for use in comment
   21.25  	  of undo/redo history
   21.26  	*/ 
   21.27 -	QString getObjectName(const LinkableMapObj*);	
   21.28 -	QString getObjectName(const TreeItem*);	
   21.29 +	QString getObjectName(LinkableMapObj*);	
   21.30 +	QString getObjectName(TreeItem*);	
   21.31  
   21.32      void redo();						//!< Redo last action
   21.33  	bool isRedoAvailable();				//!< True, if redo is available
   21.34 @@ -282,7 +282,7 @@
   21.35  	// The create methods are used to quickly parse a XML file
   21.36  	BranchItem* createMapCenter();				//!< Create MapCenter 
   21.37  	BranchItem* createBranch(BranchItem *dst);	//!< Create Branch
   21.38 -	TreeItem* createImage(BranchItem *dst);		//!< Create image
   21.39 +	ImageItem* createImage(BranchItem *dst);		//!< Create image
   21.40  
   21.41  	/*! \brief Add new mapcenter
   21.42  
   21.43 @@ -323,11 +323,12 @@
   21.44  	*/	
   21.45  	bool relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1);	
   21.46  
   21.47 -    void deleteSelection();					//!< Delete selection
   21.48 -	void deleteKeepChildren();				//!< remove branch, but keep children
   21.49 -	void deleteChildren();					//!< keep branch, but remove children
   21.50 +    void deleteSelection();				//!< Delete selection
   21.51 +	void deleteKeepChildren();			//!< remove branch, but keep children
   21.52 +	void deleteChildren();				//!< keep branch, but remove children
   21.53  
   21.54  private:	
   21.55 +	TreeItem* deleteItem(TreeItem*);	//!< Delete item and return parent (if parent!= rootItem)
   21.56  	bool scrollBranch(BranchItem *);
   21.57  	bool unscrollBranch(BranchItem *);
   21.58  public:	
   21.59 @@ -578,11 +579,11 @@
   21.60  public:
   21.61  	TreeItem::Type selectionType();
   21.62  	LinkableMapObj* getSelectedLMO();
   21.63 -	BranchObj* getSelectedBranchObj();	// FIXME-2 replace by item...
   21.64 +	BranchObj* getSelectedBranchObj();	// FIXME-3 replace by item...
   21.65  	BranchItem* getSelectedBranchItem();
   21.66  	TreeItem* getSelectedItem();
   21.67  	QModelIndex getSelectedIndex();
   21.68 -	FloatImageObj* getSelectedFloatImage();
   21.69 +	ImageItem* getSelectedImageItem();
   21.70  	QString getSelectString ();
   21.71  	QString getSelectString (LinkableMapObj *lmo);
   21.72  	QString getSelectString (TreeItem *item);
    22.1 --- a/xml-freemind.cpp	Wed Jun 03 20:37:17 2009 +0000
    22.2 +++ b/xml-freemind.cpp	Mon Jun 08 11:36:56 2009 +0000
    22.3 @@ -70,10 +70,7 @@
    22.4  		//FIXME-3 TreeItem *ti=model->first();	//  this will be NULL !!!
    22.5  		TreeItem *ti=NULL;
    22.6  
    22.7 -		BranchObj *bo;
    22.8 -		if (ti->getType()==TreeItem::MapCenter)
    22.9 -			bo=(BranchObj*)(ti->getLMO());
   22.10 -		else
   22.11 +		if (ti->getType()!=TreeItem::MapCenter)
   22.12  			qWarning ("parseFreeMindHandler::startElement  no mapCenter!!");
   22.13  
   22.14  		//cout <<"model="<<model<<"   first="<<model->first()<<endl;
    23.1 --- a/xml-vym.cpp	Wed Jun 03 20:37:17 2009 +0000
    23.2 +++ b/xml-vym.cpp	Mon Jun 08 11:36:56 2009 +0000
    23.3 @@ -13,8 +13,8 @@
    23.4  #include "mainwindow.h"
    23.5  #include "version.h"
    23.6  
    23.7 -static FloatObj *lastFloat;
    23.8 -static OrnamentedObj *lastOO;
    23.9 +static ImageItem *lastImageItem;
   23.10 +static MapItem *lastMI;
   23.11  
   23.12  extern Main *mainWindow;
   23.13  extern Settings settings;
   23.14 @@ -54,7 +54,7 @@
   23.15  		{
   23.16  			// Create mapCenter
   23.17  			model->clear();
   23.18 -			lastBranchItem=NULL;
   23.19 +			lastBranch=NULL;
   23.20  
   23.21  			if (!atts.value( "author").isEmpty() )
   23.22  				model->setAuthor(atts.value( "author" ) );
   23.23 @@ -140,7 +140,7 @@
   23.24  		{	
   23.25  			// Really use the found mapcenter as MCO in a new map
   23.26  
   23.27 -			lastBranchItem=(BranchItem*)model->createMapCenter(); 
   23.28 +			lastBranch=model->createMapCenter(); 
   23.29  		} else
   23.30  		{
   23.31  			// Treat the found mapcenter as a branch 
   23.32 @@ -148,10 +148,10 @@
   23.33  			BranchItem *bi=model->getSelectedBranchItem();
   23.34  			if (bi)
   23.35  			{
   23.36 -				lastBranchItem=bi;
   23.37 +				lastBranch=bi;
   23.38  				if (loadMode==ImportAdd)
   23.39  				{
   23.40 -					lastBranchItem=model->createBranch(lastBranchItem);
   23.41 +					lastBranch=model->createBranch(lastBranch);
   23.42  				} //else
   23.43  					//FIXME-3 lastBranch->clear();
   23.44  			} else
   23.45 @@ -170,7 +170,7 @@
   23.46  		if (!atts.value( "textColor").isEmpty() ) 
   23.47  		{
   23.48  			col.setNamedColor(atts.value("textColor"));
   23.49 -			lastBranchItem->setHeadingColor(col );
   23.50 +			lastBranch->setHeadingColor(col );
   23.51  		}	    
   23.52  	} else if ( eName == "note" && 
   23.53  				(state == StateMapCenter ||state==StateBranch))
   23.54 @@ -184,10 +184,9 @@
   23.55      } else if ( eName == "floatimage" && 
   23.56  				(state == StateMapCenter ||state==StateBranch)) 
   23.57  	{
   23.58 -		state=StateFloatImage;
   23.59 -        //FIXME-2 lastBranch->addFloatImage();
   23.60 -		//FIXME-2 lastFloat=lastBranch->getLastFloatImage();
   23.61 -		if (!readFloatImageAttr(atts)) return false;
   23.62 +		state=StateImage;
   23.63 +		lastImage=model->createImage(lastBranch);
   23.64 +		if (!readImageAttr(atts)) return false;
   23.65  	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   23.66  	{
   23.67  		// This is used in vymparts, which have no mapcenter!
   23.68 @@ -205,29 +204,28 @@
   23.69  		}	
   23.70  		if (ti && ti->isBranchLikeType() )
   23.71  		{
   23.72 -			lastBranchItem=(BranchItem*)ti;
   23.73 +			lastBranch=(BranchItem*)ti;
   23.74  			if (eName=="branch")
   23.75  			{
   23.76  				state=StateBranch;
   23.77  				if (loadMode==ImportAdd)
   23.78  				{
   23.79 -					lastBranchItem=model->createBranch(lastBranchItem);
   23.80 +					lastBranch=model->createBranch(lastBranch);
   23.81  					
   23.82  				} else
   23.83  					//FIXME-2 lastBranch->clear();
   23.84  				readBranchAttr (atts);
   23.85  			} else if (eName=="floatimage")
   23.86  			{
   23.87 -				state=StateFloatImage;
   23.88 -				//FIXME-2 lastBranch->addFloatImage();
   23.89 -				//FIXME-2 lastFloat=lastBranch->getLastFloatImage();
   23.90 -				if (!readFloatImageAttr(atts)) return false;
   23.91 +				state=StateImage;
   23.92 +				lastImage=model->createImage (lastBranch);
   23.93 +				if (!readImageAttr(atts)) return false;
   23.94  			} else return false;
   23.95  		} else return false;
   23.96  	} else if ( eName == "branch" && state == StateMapCenter) 
   23.97  	{
   23.98  		state=StateBranch;
   23.99 -		lastBranchItem=model->createBranch(lastBranchItem);
  23.100 +		lastBranch=model->createBranch(lastBranch);
  23.101  		readBranchAttr (atts);
  23.102  	} else if ( eName == "htmlnote" && state == StateBranch) 
  23.103  	{
  23.104 @@ -247,7 +245,7 @@
  23.105  		if (!readXLinkAttr (atts)) return false;
  23.106      } else if ( eName == "branch" && state == StateBranch ) 
  23.107  	{
  23.108 -		lastBranchItem=model->createBranch(lastBranchItem);
  23.109 +		lastBranch=model->createBranch(lastBranch);
  23.110  		readBranchAttr (atts);
  23.111      } else if ( eName == "html" && state == StateHtmlNote ) 
  23.112  	{
  23.113 @@ -282,15 +280,15 @@
  23.114  			break;
  23.115          case StateMapCenter: 
  23.116  			model->selectParent();
  23.117 -			model->emitDataHasChanged (lastBranchItem);
  23.118 -			lastBranchItem=(BranchItem*)(lastBranchItem->parent());
  23.119 -			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
  23.120 +			model->emitDataHasChanged (lastBranch);
  23.121 +			lastBranch=(BranchItem*)(lastBranch->parent());
  23.122 +			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
  23.123              break;
  23.124          case StateBranch: 
  23.125  			model->selectParent();
  23.126 -			model->emitDataHasChanged (lastBranchItem);
  23.127 -			lastBranchItem=(BranchItem*)(lastBranchItem->parent());
  23.128 -			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
  23.129 +			model->emitDataHasChanged (lastBranch);
  23.130 +			lastBranch=(BranchItem*)(lastBranch->parent());
  23.131 +			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
  23.132              break;
  23.133          case StateHtml: 
  23.134  			htmldata+="</"+eName+">";
  23.135 @@ -299,7 +297,7 @@
  23.136  				state=StateHtmlNote;  
  23.137  				htmldata.replace ("<br></br>","<br />");
  23.138  				no.setNote (htmldata);
  23.139 -				lastBranchItem->setNoteObj (no);
  23.140 +				lastBranch->setNoteObj (no);
  23.141  			}	
  23.142  			break;
  23.143  		default: 
  23.144 @@ -327,19 +325,19 @@
  23.145  		case StateMapSetting:break;
  23.146          case StateMapCenter: break;
  23.147          case StateNote:
  23.148 -			lastBranchItem->setNote(ch_simplified);
  23.149 +			lastBranch->setNote(ch_simplified);
  23.150  			break;
  23.151          case StateBranch: break;
  23.152          case StateStandardFlag: 
  23.153 -            lastBranchItem->activateStandardFlag(ch_simplified); 
  23.154 +            lastBranch->activateStandardFlag(ch_simplified); 
  23.155              break;
  23.156 -        case StateFloatImage: break;
  23.157 +        case StateImage: break;
  23.158          case StateHtmlNote: break;
  23.159          case StateHtml:
  23.160  			htmldata+=ch_org;
  23.161  			break;
  23.162          case StateHeading: 
  23.163 -            lastBranchItem->setHeading(ch_simplified);
  23.164 +            lastBranch->setHeading(ch_simplified);
  23.165              break;
  23.166          default: 
  23.167  			return false;
  23.168 @@ -356,10 +354,12 @@
  23.169  {
  23.170  	mainWindow->setProgressValue (branchesCurrent++);
  23.171  
  23.172 +	lastMI=lastBranch;
  23.173 +
  23.174  	if (!readOOAttr(a)) return false;
  23.175  
  23.176  	if (!a.value( "scrolled").isEmpty() )
  23.177 -		lastBranchItem->toggleScroll();
  23.178 +		lastBranch->toggleScroll();
  23.179  /*
  23.180  	if (!a.value( "frameType").isEmpty() ) 
  23.181  		lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
  23.182 @@ -386,7 +386,7 @@
  23.183  {
  23.184  	bool ok;
  23.185  	int x;
  23.186 -	if (lastOO)
  23.187 +	/* FIXME-2 if (lastOO)
  23.188  	{
  23.189  		if (!a.value( "frameType").isEmpty() ) 
  23.190  			lastOO->setFrameType (a.value("frameType"));
  23.191 @@ -405,12 +405,13 @@
  23.192  			if (ok) lastOO->setFrameBorderWidth(x);
  23.193  		}	
  23.194  	}		
  23.195 +	*/
  23.196  	return true;
  23.197  }
  23.198  
  23.199  bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
  23.200  {
  23.201 -	if (lastBranchItem)
  23.202 +	if (lastMI)
  23.203  	{
  23.204  		bool okx,oky;
  23.205  		float x,y;
  23.206 @@ -421,7 +422,7 @@
  23.207  				x=a.value("relPosX").toFloat (&okx);
  23.208  				y=a.value("relPosY").toFloat (&oky);
  23.209  				if (okx && oky  )
  23.210 -					lastBranchItem->setRelPos (QPointF(x,y));
  23.211 +					lastBranch->setRelPos (QPointF(x,y));
  23.212  				else
  23.213  					return false;   // Couldn't read relPos
  23.214  			}           
  23.215 @@ -433,21 +434,21 @@
  23.216  				x=a.value("absPosX").toFloat (&okx);
  23.217  				y=a.value("absPosY").toFloat (&oky);
  23.218  				if (okx && oky  )
  23.219 -					lastBranchItem->setAbsPos (QPointF(x,y));
  23.220 +					lastBranch->setAbsPos (QPointF(x,y));
  23.221  				else
  23.222  					return false;   // Couldn't read absPos
  23.223  			}           
  23.224  		}           
  23.225  		//if (!a.value( "id").isEmpty() ) 
  23.226 -		//	lastBranchItem->setID (a.value ("id"));
  23.227 +		//	lastBranch->setID (a.value ("id"));
  23.228  			
  23.229  		if (!a.value( "url").isEmpty() ) 
  23.230 -			lastBranchItem->setURL (a.value ("url"));
  23.231 +			lastBranch->setURL (a.value ("url"));
  23.232  		if (!a.value( "vymLink").isEmpty() ) 
  23.233 -			lastBranchItem->setVymLink (a.value ("vymLink"));
  23.234 +			lastBranch->setVymLink (a.value ("vymLink"));
  23.235  		if (!a.value( "hideInExport").isEmpty() ) 
  23.236  			if (a.value("hideInExport")=="true")
  23.237 -				lastBranchItem->setHideInExport(true);
  23.238 +				lastBranch->setHideInExport(true);
  23.239  
  23.240  		/* FIXME-2
  23.241  		if (!a.value( "hideLink").isEmpty()) 
  23.242 @@ -490,46 +491,39 @@
  23.243  	}		
  23.244  	if (!a.value( "fonthint").isEmpty() ) 
  23.245  		no.setFontHint(a.value ("fonthint") );
  23.246 -	lastBranchItem->setNoteObj(no);
  23.247 +	lastBranch->setNoteObj(no);
  23.248  	return true;
  23.249  }
  23.250  
  23.251 -bool parseVYMHandler::readFloatImageAttr (const QXmlAttributes& a)
  23.252 +bool parseVYMHandler::readImageAttr (const QXmlAttributes& a)
  23.253  {
  23.254 -	lastOO=lastFloat;
  23.255 +	lastMI=lastImage;
  23.256  	
  23.257  	//if (!readOOAttr(a)) return false;
  23.258  
  23.259 -	if (!a.value( "useOrientation").isEmpty() ) 
  23.260 +	/* FIXME-1 if (!a.value( "useOrientation").isEmpty() ) 
  23.261  	{
  23.262  		if (a.value ("useOrientation") =="true")
  23.263 -			lastFloat->setUseOrientation (true);
  23.264 +			lastImage->setUseOrientation (true);
  23.265  		else	
  23.266 -			lastFloat->setUseOrientation (false);
  23.267 +			lastImage->setUseOrientation (false);
  23.268  	}	
  23.269 +	*/
  23.270  	if (!a.value( "href").isEmpty() )
  23.271  	{
  23.272 -		// Load FloatImage
  23.273 -		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
  23.274 +		// Load Image
  23.275 +		if (!lastImage->load (parseHREF(a.value ("href") ) ))
  23.276  		{
  23.277  			QMessageBox::warning( 0, "Warning: " ,
  23.278 -				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
  23.279 -			//FIXME-2 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
  23.280 -			lastFloat=NULL;
  23.281 +				"Couldn't load image\n"+parseHREF(a.value ("href") ));
  23.282 +			//FIXME-0 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
  23.283 +			lastImage=NULL;
  23.284  			return true;
  23.285  		}
  23.286  		
  23.287  	}	
  23.288 -	if (!a.value( "floatExport").isEmpty() ) 
  23.289 -	{
  23.290 -		// Only for compatibility. THis is not used since 1.7.11 
  23.291 -		if (a.value ("floatExport") =="true")
  23.292 -			lastFloat->setFloatExport(true);
  23.293 -		else	
  23.294 -			lastFloat->setFloatExport (false);
  23.295 -	}	
  23.296  	if (!a.value( "zPlane").isEmpty() ) 
  23.297 -		lastFloat->setZValue (a.value("zPlane").toInt ());
  23.298 +		lastImage->setZValue (a.value("zPlane").toInt ());
  23.299      float x,y;
  23.300      bool okx,oky;
  23.301  	if (!a.value( "relPosX").isEmpty() ) 
  23.302 @@ -542,9 +536,9 @@
  23.303  			if (okx && oky) 
  23.304  				
  23.305  				{
  23.306 -					lastFloat->setRelPos (QPointF (x,y) );
  23.307 +					lastImage->setRelPos (QPointF (x,y) );
  23.308  					// make sure floats in mapcenter are repositioned to relative pos
  23.309 -					//FIXME-2 if (lastBranchItem->depth()==0) lastBranch->positionContents();
  23.310 +					//FIXME-0 if (lastBranch->depth()==0) lastBranch->positionContents();
  23.311  				}
  23.312  			else
  23.313  				// Couldn't read relPos
  23.314 @@ -554,9 +548,9 @@
  23.315  	
  23.316  	if (!readOOAttr(a)) return false;
  23.317  
  23.318 -	if (!a.value ("orgName").isEmpty() )
  23.319 +	if (!a.value ("originalName").isEmpty() )
  23.320  	{
  23.321 -		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
  23.322 +		lastImage->setOriginalFilename (a.value("originalName"));
  23.323  	}
  23.324  	return true;
  23.325  }
    24.1 --- a/xml-vym.h	Wed Jun 03 20:37:17 2009 +0000
    24.2 +++ b/xml-vym.h	Mon Jun 08 11:36:56 2009 +0000
    24.3 @@ -20,7 +20,7 @@
    24.4  	bool readFrameAttr (const QXmlAttributes&);
    24.5  	bool readOOAttr (const QXmlAttributes&);
    24.6  	bool readNoteAttr (const QXmlAttributes&);
    24.7 -	bool readFloatImageAttr (const QXmlAttributes&);
    24.8 +	bool readImageAttr (const QXmlAttributes&);
    24.9  	bool readXLinkAttr (const QXmlAttributes&);
   24.10  	bool readHtmlAttr (const QXmlAttributes&);
   24.11  	bool readSettingAttr (const QXmlAttributes&);
   24.12 @@ -40,7 +40,7 @@
   24.13  		StateFrame,
   24.14  		StateStandardFlag,
   24.15  		StateNote,
   24.16 -		StateFloatImage,
   24.17 +		StateImage,
   24.18  		StateHeading
   24.19  	 };
   24.20  
   24.21 @@ -53,6 +53,7 @@
   24.22  	QString htmldata;
   24.23  	NoteObj no;
   24.24  
   24.25 -	BranchItem* lastBranchItem;
   24.26 +	BranchItem* lastBranch;
   24.27 +	ImageItem* lastImage;
   24.28  }; 
   24.29  #endif