Started to restructure for later use of Model/View
authorinsilmaril
Wed, 16 Jul 2008 10:46:14 +0000
changeset 72112958f987bcf
parent 720 192e1392ba6a
child 722 462d39502273
Started to restructure for later use of Model/View
aboutdialog.cpp
animpoint.cpp
branchobj.cpp
branchobj.h
branchpropwindow.cpp
branchpropwindow.h
demos/math.vym
demos/vym-projectplan.vym
editxlinkdialog.cpp
exports.cpp
file.cpp
floatimageobj.cpp
floatimageobj.h
floatobj.cpp
floatobj.h
lang/vym_de.ts
lang/vym_it.ts
linkablemapobj.cpp
linkablemapobj.h
main.cpp
mainwindow.cpp
mainwindow.h
mapcenterobj.cpp
noteobj.cpp
ornamentedobj.cpp
ornamentedobj.h
selection.cpp
selection.h
version.h
vym.pro
vymmodel.cpp
vymmodel.h
xml-vym.cpp
xmlobj.cpp
xmlobj.h
     1.1 --- a/aboutdialog.cpp	Wed Jul 16 10:44:44 2008 +0000
     1.2 +++ b/aboutdialog.cpp	Wed Jul 16 10:46:14 2008 +0000
     1.3 @@ -54,10 +54,7 @@
     1.4  	"  <ul>"
     1.5  	"    <li>Spanish: <a href=\"http://ieee.udistrital.edu.co/aclibre\">"
     1.6  	"                 ACLibre (Academia y Conocimiento Libre)</a> </li>"
     1.7 -	"    <li>French: Philippe Caillaud and Claude </li>"
     1.8 -	"    <li>Italian: Seyed Puria Nafisi Azizi </li>"
     1.9 -	"    <li>Brasilian: Amadeu Júnior</li>"
    1.10 -	"    <li>Russion: Anton Olenev</li>"
    1.11 +	"    <li>French: Philippe Caillaud, Claude ?</li>"
    1.12  	"  </ul>"
    1.13  	"</li>"
    1.14  	"<li> Patches"
     2.1 --- a/animpoint.cpp	Wed Jul 16 10:44:44 2008 +0000
     2.2 +++ b/animpoint.cpp	Wed Jul 16 10:46:14 2008 +0000
     2.3 @@ -88,7 +88,7 @@
     2.4  
     2.5  uint AnimPoint::getTicks()
     2.6  {
     2.7 -	return animTicks;
     2.8 +	return (uint) animTicks;
     2.9  }
    2.10  
    2.11  void AnimPoint::setAnimated(bool b)
    2.12 @@ -110,15 +110,13 @@
    2.13  	{
    2.14  		vector=QPointF(0,0);
    2.15  		animated=false;
    2.16 +		setX (destPos.x() );
    2.17 +		setY (destPos.y() );
    2.18  		return animated;
    2.19  	}
    2.20 -
    2.21  	setX (startPos.x() + vector.x()*sqrt(n/animTicks) );
    2.22  	setY (startPos.y() + vector.y()*sqrt(n/animTicks) );
    2.23 -	/*
    2.24 -	setX (startPos.x() + vector.x()*(n/animTicks) );
    2.25 -	setY (startPos.y() + vector.y()*(n/animTicks) );
    2.26 -	*/
    2.27 +
    2.28  	return animated;
    2.29  }
    2.30  
     3.1 --- a/branchobj.cpp	Wed Jul 16 10:44:44 2008 +0000
     3.2 +++ b/branchobj.cpp	Wed Jul 16 10:46:14 2008 +0000
     3.3 @@ -21,7 +21,7 @@
     3.4  BranchObj* BranchObj::itFirst=NULL;
     3.5  
     3.6  
     3.7 -BranchObj::BranchObj () :OrnamentedObj()
     3.8 +BranchObj::BranchObj () :OrnamentedObj()	// FIXME needed at all?
     3.9  {
    3.10  //    cout << "Const BranchObj ()\n";
    3.11      setParObj (this);	
    3.12 @@ -103,7 +103,7 @@
    3.13  	branch.clear();
    3.14  	for (int i=0; i<other->branch.size(); ++i)
    3.15  		// Make deep copy of b
    3.16 -		// Because addBranch again calls copy for the childs,
    3.17 +		// Because addBranch again calls copy for the children,
    3.18  		// Those will get a deep copy, too
    3.19  		addBranch(other->branch.at(i) );	
    3.20  
    3.21 @@ -214,7 +214,7 @@
    3.22  		if (off==0)
    3.23  		{
    3.24  			// new parent is just a branch, link to it
    3.25 -			QRectF t=o->getBBoxSizeWithChilds();
    3.26 +			QRectF t=o->getBBoxSizeWithChildren();
    3.27  			if (o->getLastBranch())
    3.28  				y=t.y() + t.height() ;
    3.29  			else
    3.30 @@ -343,10 +343,10 @@
    3.31  		standardFlags->setVisibility(v);
    3.32  		LinkableMapObj::setVisibility (v);
    3.33  		
    3.34 -		// Only change childs, if I am not scrolled
    3.35 +		// Only change children, if I am not scrolled
    3.36  		if (!scrolled && (depth < toDepth))
    3.37  		{
    3.38 -			// Now go recursivly through all childs
    3.39 +			// Now go recursivly through all children
    3.40  			int i;
    3.41  			for (i=0; i<branch.size(); ++i)
    3.42  				branch.at(i)->setVisibility (v,toDepth);	
    3.43 @@ -370,9 +370,9 @@
    3.44  	// Overloaded from LinkableMapObj
    3.45  	// BranchObj can use color of heading
    3.46  
    3.47 -	if (mapEditor)
    3.48 +	if (model)
    3.49  	{
    3.50 -		if (mapEditor->getMapLinkColorHint()==HeadingColor)
    3.51 +		if (model->getMapLinkColorHint()==HeadingColor)
    3.52  			LinkableMapObj::setLinkColor (heading->getColor() );
    3.53  		else	
    3.54  			LinkableMapObj::setLinkColor ();
    3.55 @@ -409,13 +409,13 @@
    3.56  		// no itLast, we are just beginning
    3.57  		if (bo) 
    3.58  		{
    3.59 -			// we have childs, return first one
    3.60 +			// we have children, return first one
    3.61  			itLast=this;
    3.62  			return bo;
    3.63  		}	
    3.64  		else
    3.65  		{
    3.66 -			// No childs, so there is no next
    3.67 +			// No children, so there is no next
    3.68  			itLast=this;
    3.69  			return NULL;
    3.70  		}	
    3.71 @@ -426,12 +426,12 @@
    3.72  	{	// We come from parent
    3.73  		if (bo)
    3.74  		{
    3.75 -			// there are childs, go there
    3.76 +			// there are children, go there
    3.77  			itLast=this;
    3.78  			return bo;
    3.79  		}	
    3.80  		else
    3.81 -		{	// no childs, try to go up again
    3.82 +		{	// no children, try to go up again
    3.83  			if (po)
    3.84  			{
    3.85  				// go back to parent and try to find next there
    3.86 @@ -450,17 +450,17 @@
    3.87  		}
    3.88  	}
    3.89  
    3.90 -	// We don't come from parent, but from brother or childs
    3.91 +	// We don't come from parent, but from brother or children
    3.92  
    3.93 -	// Try to find last child, where we came from, in my own childs
    3.94 +	// Try to find last child, where we came from, in my own children
    3.95  	bool searching=true;
    3.96  	int i=0;
    3.97  	while (i<branch.size())
    3.98  	{
    3.99 -		// Try to find itLast in my own childs
   3.100 +		// Try to find itLast in my own children
   3.101  		if (itLast==branch.at(i))
   3.102  		{
   3.103 -			// ok, we come from my own childs
   3.104 +			// ok, we come from my own children
   3.105  			if (i<branch.size()-1)
   3.106  				bo=branch.at(i+1);
   3.107  			 else
   3.108 @@ -471,7 +471,7 @@
   3.109  		++i;	
   3.110  	}
   3.111  	if (!searching)
   3.112 -	{	// found itLast in my childs
   3.113 +	{	// found itLast in my children
   3.114  		if (bo)
   3.115  		{
   3.116  			// found a brother of lastLMO 
   3.117 @@ -756,7 +756,7 @@
   3.118  		hidden=false;
   3.119  	}	
   3.120  
   3.121 -	// And take care of my childs
   3.122 +	// And take care of my children
   3.123  	for (int i=0; i<branch.size(); ++i)
   3.124  		branch.at(i)->setHideTmp (mode);
   3.125  }
   3.126 @@ -1114,7 +1114,7 @@
   3.127  void BranchObj::removeBranchHere(BranchObj* borem)
   3.128  {
   3.129  	// This removes the branch bo from list, but 
   3.130 -	// inserts its childs at the place of bo
   3.131 +	// inserts its children at the place of bo
   3.132  	BranchObj *bo;
   3.133  	bo=borem->getLastBranch();
   3.134  	int pos=borem->getNum();
   3.135 @@ -1126,7 +1126,7 @@
   3.136  	removeBranch (borem);
   3.137  }
   3.138  
   3.139 -void BranchObj::removeChilds()
   3.140 +void BranchObj::removeChildren()
   3.141  {
   3.142  	clear();
   3.143  }
   3.144 @@ -1302,7 +1302,7 @@
   3.145  	}	
   3.146  }
   3.147  
   3.148 -void BranchObj::alignRelativeTo (QPointF ref)
   3.149 +void BranchObj::alignRelativeTo (QPointF ref,bool alignSelf)
   3.150  {
   3.151  	qreal th = bboxTotal.height();	
   3.152  // TODO testing
   3.153 @@ -1313,9 +1313,11 @@
   3.154  		"  ref="<<ref<<
   3.155  //		"  bbox.topLeft="<<bboxTotal.topLeft()<<
   3.156  		"  absPos="<<absPos<<
   3.157 -		"  relPos="<<relPos<<
   3.158 -		"  parPos="<<pp<<
   3.159 +//		"  relPos="<<relPos<<
   3.160 +//		"  parPos="<<pp<<
   3.161 +		"  width="<<bbox.width()<<
   3.162  		"  orient="<<orientation<<
   3.163 +		"  alignSelf="<<alignSelf<<
   3.164  //		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
   3.165  //		"  hidden="<<hidden<<
   3.166  //		"  th="<<th<<
   3.167 @@ -1351,24 +1353,26 @@
   3.168  		{
   3.169  			LinkableMapObj::Orientation o;
   3.170  			o=parObj->getOrientation();
   3.171 -			switch (orientation) 
   3.172 -			{
   3.173 -				case LinkableMapObj::LeftOfCenter:
   3.174 -					move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
   3.175 -				break;
   3.176 -				case LinkableMapObj::RightOfCenter:	
   3.177 -					move (ref.x() , ref.y() + (th-bbox.height())/2  );
   3.178 -				break;
   3.179 -				default:
   3.180 -					qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
   3.181 -				break;
   3.182 -			}	
   3.183 +			if (alignSelf)
   3.184 +				switch (orientation) 
   3.185 +				{
   3.186 +					case LinkableMapObj::LeftOfCenter:
   3.187 +						move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
   3.188 +						//move (ref.x() , ref.y() + (th-bbox.height())/2 );
   3.189 +					break;
   3.190 +					case LinkableMapObj::RightOfCenter:	
   3.191 +						move (ref.x() , ref.y() + (th-bbox.height())/2  );
   3.192 +					break;
   3.193 +					default:
   3.194 +						qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
   3.195 +					break;
   3.196 +				}
   3.197  		}
   3.198      }		
   3.199  
   3.200  	if (scrolled) return;
   3.201  
   3.202 -    // Set reference point for alignment of childs
   3.203 +    // Set reference point for alignment of children
   3.204      QPointF ref2;
   3.205      if (orientation==LinkableMapObj::LeftOfCenter)
   3.206  		ref2.setX(bbox.topLeft().x() - linkwidth);
   3.207 @@ -1380,13 +1384,15 @@
   3.208  	else	
   3.209  		ref2.setY(ref.y() );	
   3.210  
   3.211 -    // Align the childs depending on reference point 
   3.212 +    // Align the children depending on reference point 
   3.213  	for (int i=0; i<branch.size(); ++i)
   3.214      {	
   3.215  		if (!branch.at(i)->isHidden())
   3.216  		{
   3.217 -			branch.at(i)->alignRelativeTo (ref2);
   3.218 -			ref2.setY(ref2.y() + branch.at(i)->getBBoxSizeWithChilds().height() );
   3.219 +			branch.at(i)->alignRelativeTo (ref2,true);
   3.220 +
   3.221 +			// append next branch below current one
   3.222 +			ref2.setY(ref2.y() + branch.at(i)->getBBoxSizeWithChildren().height() );
   3.223  		}
   3.224      }
   3.225  }
   3.226 @@ -1408,7 +1414,7 @@
   3.227  		// only calculate the sizes once. If the deepest LMO 
   3.228  		// changes its height,
   3.229  		// all upper LMOs have to change, too.
   3.230 -		calcBBoxSizeWithChilds();
   3.231 +		calcBBoxSizeWithChildren();
   3.232  		updateLink();	// This update is needed if the scene is resized 
   3.233  						// due to excessive moving of a FIO
   3.234  
   3.235 @@ -1472,12 +1478,12 @@
   3.236  	return r;
   3.237  }
   3.238  
   3.239 -QRectF BranchObj::getBBoxSizeWithChilds()
   3.240 +QRectF BranchObj::getBBoxSizeWithChildren()
   3.241  {
   3.242  	return bboxTotal;
   3.243  }
   3.244  
   3.245 -void BranchObj::calcBBoxSizeWithChilds()
   3.246 +void BranchObj::calcBBoxSizeWithChildren()
   3.247  {	
   3.248  	// This is initially called only from reposition and
   3.249  	// and only for mapcenter. So it won't be
   3.250 @@ -1485,11 +1491,11 @@
   3.251  	// action
   3.252  	
   3.253  
   3.254 -	// Calculate size of LMO including all childs (to align them later)
   3.255 +	// Calculate size of LMO including all children (to align them later)
   3.256  	bboxTotal.setX(bbox.x() );
   3.257  	bboxTotal.setY(bbox.y() );
   3.258  
   3.259 -	// if branch is scrolled, ignore childs, but still consider floatimages
   3.260 +	// if branch is scrolled, ignore children, but still consider floatimages
   3.261  	if (scrolled)
   3.262  	{
   3.263  		bboxTotal.setWidth (bbox.width());
   3.264 @@ -1523,8 +1529,8 @@
   3.265  	{
   3.266  		if (!branch.at(i)->isHidden())
   3.267  		{
   3.268 -			branch.at(i)->calcBBoxSizeWithChilds();
   3.269 -			br=branch.at(i)->getBBoxSizeWithChilds();
   3.270 +			branch.at(i)->calcBBoxSizeWithChildren();
   3.271 +			br=branch.at(i)->getBBoxSizeWithChildren();
   3.272  			r.setWidth( max (br.width(), r.width() ));
   3.273  			r.setHeight(br.height() + r.height() );
   3.274  			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
   3.275 @@ -1573,14 +1579,14 @@
   3.276  	updateFlagsToolbar();
   3.277  
   3.278  	// Update actions
   3.279 -	mapEditor->updateActions();
   3.280 +	model->updateActions();
   3.281  }
   3.282  
   3.283  void BranchObj::unselect()
   3.284  {
   3.285  	LinkableMapObj::unselect();
   3.286  	// Delete any messages like vymLink in StatusBar
   3.287 -	mainWindow->statusMessage ("");
   3.288 +	mainWindow->statusMessage ("");		//FIXME this causes segfault, when MainWindow is already gone in global destructor on quitting vym
   3.289  
   3.290  	// Save current note
   3.291  	if (isNoteInEditor) getNoteFromTextEditor();
   3.292 @@ -1609,7 +1615,11 @@
   3.293  bool BranchObj::animate()
   3.294  {
   3.295  	anim.animate ();
   3.296 -	setRelPos (anim);
   3.297 -	return anim.isAnimated();
   3.298 +	if ( anim.isAnimated() )
   3.299 +	{
   3.300 +		setRelPos (anim);
   3.301 +		return true;
   3.302 +	}
   3.303 +	return false;
   3.304  }
   3.305  
     4.1 --- a/branchobj.h	Wed Jul 16 10:44:44 2008 +0000
     4.2 +++ b/branchobj.h	Wed Jul 16 10:46:14 2008 +0000
     4.3 @@ -11,7 +11,7 @@
     4.4  
     4.5  /*! \brief A branch visible in the map */
     4.6  
     4.7 -/*! If HideExport is used, this branch and its childs will be hidden in export */
     4.8 +/*! If HideExport is used, this branch and its children will be hidden in export */
     4.9  enum HideTmpMode {HideNone, HideExport};
    4.10  
    4.11  
    4.12 @@ -102,7 +102,7 @@
    4.13      virtual BranchObj* insertBranch(BranchObj*,int);
    4.14      virtual BranchObj* insertBranchPtr (BranchObj*,int);
    4.15      virtual void removeBranchHere(BranchObj*);  
    4.16 -    virtual void removeChilds();  
    4.17 +    virtual void removeChildren();  
    4.18      virtual void removeBranch(BranchObj*);  
    4.19      virtual void removeBranchPtr (BranchObj*);  
    4.20      virtual void setLastSelectedBranch(BranchObj*);
    4.21 @@ -116,14 +116,14 @@
    4.22      virtual BranchObj* moveBranchDown(BranchObj*);
    4.23      virtual void sortChildren();
    4.24      virtual BranchObj* linkTo (BranchObj*, int);
    4.25 -    virtual void alignRelativeTo(const QPointF );
    4.26 +    virtual void alignRelativeTo(const QPointF, bool alignSelf=false );
    4.27  	virtual void reposition();
    4.28  	virtual void unsetAllRepositionRequests();
    4.29  
    4.30  	virtual QPolygonF shape();				//!< Returns arbitrary bounding polygon
    4.31 -	virtual QRectF getTotalBBox();			// return BBox including childs			
    4.32 -	virtual QRectF getBBoxSizeWithChilds();	// return size of BBox including childs  
    4.33 -	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
    4.34 +	virtual QRectF getTotalBBox();			// return BBox including children			
    4.35 +	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
    4.36 +	virtual void calcBBoxSizeWithChildren();	// calc size of  BBox including children recursivly
    4.37  
    4.38      virtual void select();
    4.39      virtual void unselect();
    4.40 @@ -144,7 +144,7 @@
    4.41  	float angle;					// used in mainbranch to reorder mainbranches
    4.42  protected:	
    4.43      int lastSelectedBranch;			// for going deeper into tree
    4.44 -	bool scrolled;					// true if all childs are scrolled and thus invisible
    4.45 +	bool scrolled;					// true if all children are scrolled and thus invisible
    4.46  	bool tmpUnscrolled;				// can only be true (temporary) for a scrolled subtree
    4.47  	bool includeImagesVer;			// include floatimages in bbox vertically
    4.48  	bool includeImagesHor;			// include floatimages in bbox horizontally
     5.1 --- a/branchpropwindow.cpp	Wed Jul 16 10:44:44 2008 +0000
     5.2 +++ b/branchpropwindow.cpp	Wed Jul 16 10:46:14 2008 +0000
     5.3 @@ -16,7 +16,7 @@
     5.4  	setCaption(vymName +" - " +tr ("Property Editor","Window caption"));
     5.5  
     5.6  	branch=NULL;
     5.7 -	mapEditor=NULL;
     5.8 +	model=NULL;
     5.9  
    5.10  	ui.tabWidget->setEnabled(false);
    5.11  
    5.12 @@ -125,7 +125,8 @@
    5.13  		// Attributes
    5.14  		attributeModel->removeRows(0, attributeModel->rowCount(), QModelIndex());
    5.15  
    5.16 -		// FIXME some samples for testing
    5.17 +/*
    5.18 +		// FIXME some samples for attribute testing
    5.19  		QStringList attrTypes=mapEditor->attributeTable()->getTypes();
    5.20  		for (int i=0; i<attrTypes.count()-1;i++)
    5.21  		{
    5.22 @@ -141,7 +142,7 @@
    5.23  		// Initialize Delegate
    5.24  		delegate.setAttributeTable (mapEditor->attributeTable());
    5.25  		ui.attributeTableView->setItemDelegate (&delegate);
    5.26 -
    5.27 +*/
    5.28  
    5.29  		// Finally activate signals
    5.30  		connectSignals();
    5.31 @@ -151,11 +152,11 @@
    5.32  	}
    5.33  }
    5.34  
    5.35 -void BranchPropertyWindow::setMapEditor (MapEditor *me)
    5.36 +void BranchPropertyWindow::setModel (VymModel *m)
    5.37  {
    5.38 -	mapEditor=me;
    5.39 -	if (mapEditor) 
    5.40 -		setBranch (mapEditor->getSelectedBranch() );
    5.41 +	model=m;
    5.42 +	if (model) 
    5.43 +		setBranch (model->getSelectedBranch() );
    5.44  	else
    5.45  		ui.tabWidget->setEnabled (false);
    5.46  		
    5.47 @@ -163,17 +164,17 @@
    5.48  
    5.49  void BranchPropertyWindow::frameTypeChanged (int i)
    5.50  {
    5.51 -	if (mapEditor)
    5.52 +	if (model)
    5.53  	{
    5.54  		switch (i)
    5.55  		{
    5.56 -			case 0: mapEditor->setFrameType (FrameObj::NoFrame); break;
    5.57 +			case 0: model->setFrameType (FrameObj::NoFrame); break;
    5.58  			case 1: 
    5.59 -				mapEditor->setFrameType (FrameObj::Rectangle); 
    5.60 +				model->setFrameType (FrameObj::Rectangle); 
    5.61  				break;
    5.62  			case 2: 
    5.63 -				mapEditor->setFrameType (FrameObj::Ellipse); 
    5.64 -				mapEditor->setFramePadding (5); 
    5.65 +				model->setFrameType (FrameObj::Ellipse); 
    5.66 +				model->setFramePadding (5); 
    5.67  				break;
    5.68  		}
    5.69  		setBranch (branch);
    5.70 @@ -182,54 +183,54 @@
    5.71  
    5.72  void BranchPropertyWindow::framePenColorClicked()
    5.73  {
    5.74 -	if (mapEditor) 
    5.75 +	if (model) 
    5.76  	{	
    5.77  		QColor col = QColorDialog::getColor( penColor, this );
    5.78  		if ( col.isValid() ) 
    5.79  		{
    5.80  			penColor=col;
    5.81 -			mapEditor->setFramePenColor (penColor);
    5.82 +			model->setFramePenColor (penColor);
    5.83  		}	
    5.84  	}
    5.85  }
    5.86  
    5.87  void BranchPropertyWindow::frameBrushColorClicked()
    5.88  {
    5.89 -	if (mapEditor) 
    5.90 +	if (model) 
    5.91  	{
    5.92  		QColor col = QColorDialog::getColor( brushColor, this );
    5.93  		if ( col.isValid() ) 
    5.94  		{
    5.95  			brushColor=col;
    5.96 -			mapEditor->setFrameBrushColor (brushColor);
    5.97 +			model->setFrameBrushColor (brushColor);
    5.98  		}	
    5.99  	}	
   5.100  }
   5.101  
   5.102  void BranchPropertyWindow::framePaddingChanged(int i)
   5.103  {
   5.104 -	if (mapEditor) mapEditor->setFramePadding (i);
   5.105 +	if (model) model->setFramePadding (i);
   5.106  }
   5.107  
   5.108  void BranchPropertyWindow::frameBorderWidthChanged(int i)
   5.109  {
   5.110 -	if (mapEditor) mapEditor->setFrameBorderWidth(i);
   5.111 +	if (model) model->setFrameBorderWidth(i);
   5.112  }
   5.113  
   5.114  void BranchPropertyWindow::linkHideUnselectedChanged (int i)
   5.115  {
   5.116  	if (!branch) return;
   5.117 -	mapEditor->setHideLinkUnselected(i);
   5.118 +	model->setHideLinkUnselected(i);
   5.119  }
   5.120  
   5.121  void BranchPropertyWindow::incImgVerChanged (int  i)
   5.122  {
   5.123 -	if (mapEditor) mapEditor->setIncludeImagesVer (i);
   5.124 +	if (model) model->setIncludeImagesVer (i);
   5.125  }
   5.126  
   5.127  void BranchPropertyWindow::incImgHorChanged (int  i)
   5.128  {
   5.129 -	if (mapEditor) mapEditor->setIncludeImagesHor (i);
   5.130 +	if (model) model->setIncludeImagesHor (i);
   5.131  }
   5.132  
   5.133  void BranchPropertyWindow::closeEvent( QCloseEvent* ce )
   5.134 @@ -262,7 +263,7 @@
   5.135  
   5.136  void BranchPropertyWindow::deleteAttributeClicked()
   5.137  {
   5.138 -	cout << "BPW::delete\n";
   5.139 +	//FIXME cout << "BPW::delete\n";
   5.140  }
   5.141  
   5.142  void BranchPropertyWindow::connectSignals()
     6.1 --- a/branchpropwindow.h	Wed Jul 16 10:44:44 2008 +0000
     6.2 +++ b/branchpropwindow.h	Wed Jul 16 10:46:14 2008 +0000
     6.3 @@ -10,8 +10,7 @@
     6.4  
     6.5  #include "attributedelegate.h"
     6.6  #include "branchobj.h"
     6.7 -#include "mapeditor.h"
     6.8 -
     6.9 +#include "vymmodel.h"
    6.10  
    6.11  class QAbstractItemModel;
    6.12  
    6.13 @@ -22,7 +21,7 @@
    6.14  	BranchPropertyWindow (QWidget *parent=0);
    6.15  	~BranchPropertyWindow ();
    6.16  	void setBranch (BranchObj *);
    6.17 -	void setMapEditor (MapEditor *);
    6.18 +	void setModel (VymModel *);
    6.19  
    6.20  private slots:
    6.21  	void frameTypeChanged (int);
    6.22 @@ -49,7 +48,7 @@
    6.23  	Ui::BranchPropertyWindow ui;
    6.24  
    6.25  	BranchObj *branch;
    6.26 -	MapEditor *mapEditor;
    6.27 +	VymModel *model;
    6.28  
    6.29  	QColor penColor;
    6.30  	QColor brushColor;
     7.1 Binary file demos/math.vym has changed
     8.1 Binary file demos/vym-projectplan.vym has changed
     9.1 --- a/editxlinkdialog.cpp	Wed Jul 16 10:44:44 2008 +0000
     9.2 +++ b/editxlinkdialog.cpp	Wed Jul 16 10:46:14 2008 +0000
     9.3 @@ -62,8 +62,8 @@
     9.4  	if (xlo)
     9.5  	{	
     9.6  		if (selection && 
     9.7 -			((typeid(*selection) == typeid(BranchObj)) || 
     9.8 -			 (typeid(*selection) == typeid(MapCenterObj)))  )
     9.9 +			(typeid(*selection) == typeid(BranchObj)) || 
    9.10 +			(typeid(*selection) == typeid(MapCenterObj))  )
    9.11  		{
    9.12  			QColor col=((BranchObj*)(selection))->getColor();
    9.13  			xlo->setColor(col);
    10.1 --- a/exports.cpp	Wed Jul 16 10:44:44 2008 +0000
    10.2 +++ b/exports.cpp	Wed Jul 16 10:46:14 2008 +0000
    10.3 @@ -251,92 +251,77 @@
    10.4  ////////////////////////////////////////////////////////////////////////
    10.5  void ExportKDEBookmarks::doExport() 
    10.6  {
    10.7 -	MapEditor *me=model->getMapEditor();
    10.8 -	if (me)
    10.9 +	WarningDialog dia;
   10.10 +	dia.showCancelButton (true);
   10.11 +	dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
   10.12 +	dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
   10.13 +	dia.setShowAgainName("/exports/KDE/overwriteKDEBookmarks");
   10.14 +	if (dia.exec()==QDialog::Accepted)
   10.15  	{
   10.16 -		WarningDialog dia;
   10.17 -		dia.showCancelButton (true);
   10.18 -		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
   10.19 -		dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
   10.20 -		dia.setShowAgainName("/exports/KDE/overwriteKDEBookmarks");
   10.21 -		if (dia.exec()==QDialog::Accepted)
   10.22 +		model->exportXML(tmpDir.path(),false);
   10.23 +
   10.24 +		XSLTProc p;
   10.25 +		p.setInputFile (tmpDir.path()+"/"+model->getMapName()+".xml");
   10.26 +		p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
   10.27 +		p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
   10.28 +		p.process();
   10.29 +
   10.30 +		QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
   10.31 +		QProcess *proc= new QProcess ;
   10.32 +		proc->start( ub);
   10.33 +		if (!proc->waitForStarted())
   10.34  		{
   10.35 -			me->exportXML(tmpDir.path(),false);
   10.36 -
   10.37 -			XSLTProc p;
   10.38 -			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
   10.39 -			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
   10.40 -			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
   10.41 -			p.process();
   10.42 -
   10.43 -			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
   10.44 -			QProcess *proc= new QProcess ;
   10.45 -			proc->start( ub);
   10.46 -			if (!proc->waitForStarted())
   10.47 -			{
   10.48 -				QMessageBox::warning(0, 
   10.49 -					QObject::tr("Warning"),
   10.50 -					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
   10.51 -			}	
   10.52 -		}
   10.53 +			QMessageBox::warning(0, 
   10.54 +				QObject::tr("Warning"),
   10.55 +				QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
   10.56 +		}	
   10.57  	}
   10.58 -
   10.59  }
   10.60  
   10.61  ////////////////////////////////////////////////////////////////////////
   10.62  void ExportFirefoxBookmarks::doExport() 
   10.63  {
   10.64 -	MapEditor *me=model->getMapEditor();
   10.65 -	if (me)
   10.66 +	WarningDialog dia;
   10.67 +	dia.showCancelButton (true);
   10.68 +	dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("Firefox"));
   10.69 +	dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("Firefox"));
   10.70 +	dia.setShowAgainName("/vym/warnings/overwriteImportBookmarks");
   10.71 +	if (dia.exec()==QDialog::Accepted)
   10.72  	{
   10.73 -		WarningDialog dia;
   10.74 -		dia.showCancelButton (true);
   10.75 -		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("Firefox"));
   10.76 -		dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("Firefox"));
   10.77 -		dia.setShowAgainName("/vym/warnings/overwriteImportBookmarks");
   10.78 -		if (dia.exec()==QDialog::Accepted)
   10.79 -		{
   10.80 -			me->exportXML(tmpDir.path(),false);
   10.81 +		model->exportXML(tmpDir.path(),false);
   10.82  
   10.83  /*
   10.84 -			XSLTProc p;
   10.85 -			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
   10.86 -			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
   10.87 -			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
   10.88 -			p.process();
   10.89 +		XSLTProc p;
   10.90 +		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
   10.91 +		p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
   10.92 +		p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
   10.93 +		p.process();
   10.94  
   10.95 -			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
   10.96 -			QProcess *proc = new QProcess( );
   10.97 -			proc->addArgument(ub);
   10.98 +		QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
   10.99 +		QProcess *proc = new QProcess( );
  10.100 +		proc->addArgument(ub);
  10.101  
  10.102 -			if ( !proc->start() ) 
  10.103 -			{
  10.104 -				QMessageBox::warning(0, 
  10.105 -					QObject::tr("Warning"),
  10.106 -					QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
  10.107 -			}	
  10.108 +		if ( !proc->start() ) 
  10.109 +		{
  10.110 +			QMessageBox::warning(0, 
  10.111 +				QObject::tr("Warning"),
  10.112 +				QObject::tr("Couldn't find script %1\nto notifiy Browsers of changed bookmarks.").arg(ub));
  10.113 +		}	
  10.114  
  10.115  */
  10.116 -
  10.117 -		}
  10.118  	}
  10.119  }
  10.120  
  10.121  ////////////////////////////////////////////////////////////////////////
  10.122  void ExportTaskjuggler::doExport() 
  10.123  {
  10.124 -	MapEditor *me=model->getMapEditor();
  10.125 -	if (me)
  10.126 -	{
  10.127 -		me->exportXML(tmpDir.path(),false);
  10.128 +	model->exportXML(tmpDir.path(),false);
  10.129  
  10.130 -		XSLTProc p;
  10.131 -		p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
  10.132 -		p.setOutputFile (outputFile);
  10.133 -		p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
  10.134 -		p.process();
  10.135 -	}
  10.136 -
  10.137 +	XSLTProc p;
  10.138 +	p.setInputFile (tmpDir.path()+"/"+model->getMapName()+".xml");
  10.139 +	p.setOutputFile (outputFile);
  10.140 +	p.setXSLFile (vymBaseDir.path()+"/styles/vym2taskjuggler.xsl");
  10.141 +	p.process();
  10.142  }
  10.143  
  10.144  ////////////////////////////////////////////////////////////////////////
    11.1 --- a/file.cpp	Wed Jul 16 10:44:44 2008 +0000
    11.2 +++ b/file.cpp	Wed Jul 16 10:46:14 2008 +0000
    11.3 @@ -354,8 +354,6 @@
    11.4      // Set up members of the STARTUPINFO structure.
    11.5      ::ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
    11.6      siStartInfo.cb = sizeof(STARTUPINFO);
    11.7 -    siStartInfo.dwFlags = STARTF_USESHOWWINDOW;
    11.8 -    siStartInfo.wShowWindow = SW_MINIMIZE;
    11.9  
   11.10      // Create command line.
   11.11      QString argv("unzip -o ");
   11.12 @@ -364,32 +362,26 @@
   11.13      argv.append(QDir::convertSeparators(zipDir.path()));
   11.14  
   11.15      // Create the child process.
   11.16 -    if (!::CreateProcess(NULL, 
   11.17 -                         (LPWSTR) argv.unicode(), // command line
   11.18 -                         NULL, // process security attributes
   11.19 -                         NULL, // primary thread security attributes
   11.20 -                         TRUE, // handles are inherited
   11.21 -                         0, // creation flags
   11.22 -                         NULL, // use parent's environment
   11.23 -                         NULL, // use parent's current directory
   11.24 -                         &siStartInfo, // STARTUPINFO pointer
   11.25 -                         &piProcInfo) ) // receives PROCESS_INFORMATION
   11.26 +    if( !::CreateProcess(NULL, 
   11.27 +        (LPWSTR)argv.unicode(), // command line
   11.28 +        NULL, // process security attributes
   11.29 +        NULL, // primary thread security attributes
   11.30 +        TRUE, // handles are inherited
   11.31 +        0, // creation flags
   11.32 +        NULL, // use parent's environment
   11.33 +        NULL, // use parent's current directory
   11.34 +        &siStartInfo, // STARTUPINFO pointer
   11.35 +        &piProcInfo) ) // receives PROCESS_INFORMATION
   11.36      {
   11.37 -		QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
   11.38 -                               QObject::tr("Couldn't start unzip to decompress data."));
   11.39          err = aborted;
   11.40      }
   11.41      else
   11.42      {
   11.43          // Wait for it to finish.
   11.44 -        ::WaitForSingleObject( piProcInfo.hProcess, INFINITE );
   11.45 -
   11.46 -        // Clean up handles.
   11.47 -        CloseHandle(piProcInfo.hThread);
   11.48 -        CloseHandle(piProcInfo.hProcess);
   11.49 +        ::WaitForSingleObject( piProcInfo.hProcess, 10000 );
   11.50      }
   11.51  #endif
   11.52 -	return err;
   11.53 +	return err;	
   11.54  }
   11.55  
   11.56  bool loadStringFromDisk (const QString &fname, QString &s)
   11.57 @@ -503,3 +495,5 @@
   11.58  		if (imageFilters.at(i)==filter) return imageTypes.at(i);
   11.59  	return QString();	
   11.60  }
   11.61 +
   11.62 +
    12.1 --- a/floatimageobj.cpp	Wed Jul 16 10:44:44 2008 +0000
    12.2 +++ b/floatimageobj.cpp	Wed Jul 16 10:46:14 2008 +0000
    12.3 @@ -214,13 +214,13 @@
    12.4  	return bbox;
    12.5  }
    12.6  
    12.7 -QRectF FloatImageObj::getBBoxSizeWithChilds()
    12.8 +QRectF FloatImageObj::getBBoxSizeWithChildren()
    12.9  {
   12.10  	//TODO abstract in linkablemapobj.h, not calculated
   12.11  	return bboxTotal;
   12.12  }
   12.13  
   12.14 -void FloatImageObj::calcBBoxSizeWithChilds()
   12.15 +void FloatImageObj::calcBBoxSizeWithChildren()
   12.16  {
   12.17  	//TODO abstract in linkablemapobj.h
   12.18  }
    13.1 --- a/floatimageobj.h	Wed Jul 16 10:44:44 2008 +0000
    13.2 +++ b/floatimageobj.h	Wed Jul 16 10:46:14 2008 +0000
    13.3 @@ -30,9 +30,9 @@
    13.4      virtual void move (QPointF);
    13.5  	virtual void positionBBox();
    13.6  	virtual void calcBBoxSize();
    13.7 -	virtual QRectF getTotalBBox();			// return BBox including childs			
    13.8 -	virtual QRectF getBBoxSizeWithChilds();	// return size of BBox including childs  
    13.9 -	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
   13.10 +	virtual QRectF getTotalBBox();			// return BBox including children			
   13.11 +	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
   13.12 +	virtual void calcBBoxSizeWithChildren();	// calc size of  BBox including children recursivly
   13.13  	virtual QString saveToDir(const QString &,const QString&);
   13.14  	virtual void resetSaveCounter();
   13.15  
    14.1 --- a/floatobj.cpp	Wed Jul 16 10:44:44 2008 +0000
    14.2 +++ b/floatobj.cpp	Wed Jul 16 10:46:14 2008 +0000
    14.3 @@ -97,7 +97,7 @@
    14.4  	return bbox;
    14.5  }
    14.6  
    14.7 -QRectF FloatObj::getBBoxSizeWithChilds()
    14.8 +QRectF FloatObj::getBBoxSizeWithChildren()
    14.9  {
   14.10  	return bboxTotal;
   14.11  }
    15.1 --- a/floatobj.h	Wed Jul 16 10:44:44 2008 +0000
    15.2 +++ b/floatobj.h	Wed Jul 16 10:46:14 2008 +0000
    15.3 @@ -26,8 +26,8 @@
    15.4  	virtual void setDockPos();
    15.5  	virtual void reposition();
    15.6  											
    15.7 -	virtual QRectF getTotalBBox();			// return BBox including childs			
    15.8 -	virtual QRectF getBBoxSizeWithChilds();	// return size of BBox including childs  
    15.9 +	virtual QRectF getTotalBBox();			// return BBox including children			
   15.10 +	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
   15.11  
   15.12  	virtual void resetSaveCounter()=0;
   15.13  
    16.1 --- a/lang/vym_de.ts	Wed Jul 16 10:44:44 2008 +0000
    16.2 +++ b/lang/vym_de.ts	Wed Jul 16 10:46:14 2008 +0000
    16.3 @@ -1838,7 +1838,7 @@
    16.4          <source>This map does not exist:
    16.5    %1
    16.6  Do you want to create a new one?</source>
    16.7 -        <translation>Diese Map gibt es nicht:
    16.8 +        <translation>Diese Map gibt es nich:
    16.9    %1
   16.10  Wollen Sie eine neue anlegen?</translation>
   16.11      </message>
    17.1 --- a/lang/vym_it.ts	Wed Jul 16 10:44:44 2008 +0000
    17.2 +++ b/lang/vym_it.ts	Wed Jul 16 10:46:14 2008 +0000
    17.3 @@ -1,6 +1,5 @@
    17.4  <?xml version="1.0" encoding="utf-8"?>
    17.5  <!DOCTYPE TS><TS version="1.1" language="it">
    17.6 -<defaultcodec></defaultcodec>
    17.7  <context>
    17.8      <name>AboutDialog</name>
    17.9      <message>
   17.10 @@ -59,17 +58,17 @@
   17.11      <message>
   17.12          <location filename="../attributedialog.cpp" line="48"/>
   17.13          <source>Attributes</source>
   17.14 -        <translation>Attributi</translation>
   17.15 +        <translation type="unfinished"></translation>
   17.16      </message>
   17.17      <message>
   17.18          <location filename="../attributedialog.cpp" line="49"/>
   17.19          <source>Add key</source>
   17.20 -        <translation>Aggiungi chiave</translation>
   17.21 +        <translation type="unfinished"></translation>
   17.22      </message>
   17.23      <message>
   17.24          <location filename="../attributedialog.cpp" line="50"/>
   17.25          <source>Close</source>
   17.26 -        <translation>Chiudi</translation>
   17.27 +        <translation type="unfinished">Chiudi</translation>
   17.28      </message>
   17.29  </context>
   17.30  <context>
   17.31 @@ -77,7 +76,7 @@
   17.32      <message>
   17.33          <location filename="../attributewidget.ui" line="13"/>
   17.34          <source>Form</source>
   17.35 -        <translation>Form</translation>
   17.36 +        <translation type="unfinished"></translation>
   17.37      </message>
   17.38  </context>
   17.39  <context>
   17.40 @@ -86,55 +85,55 @@
   17.41          <location filename="../branchpropwindow.cpp" line="16"/>
   17.42          <source>Property Editor</source>
   17.43          <comment>Window caption</comment>
   17.44 -        <translation>Editor di proprietà</translation>
   17.45 +        <translation type="unfinished"></translation>
   17.46      </message>
   17.47      <message>
   17.48          <location filename="../branchpropwindow.cpp" line="32"/>
   17.49          <source>Name</source>
   17.50          <comment>Branchprop window: Attribute name</comment>
   17.51 -        <translation>Nome</translation>
   17.52 +        <translation type="unfinished"></translation>
   17.53      </message>
   17.54      <message>
   17.55          <location filename="../branchpropwindow.cpp" line="33"/>
   17.56          <source>Value</source>
   17.57          <comment>Branchprop window: Attribute value</comment>
   17.58 -        <translation>Valore</translation>
   17.59 +        <translation type="unfinished"></translation>
   17.60      </message>
   17.61      <message>
   17.62          <location filename="../branchpropwindow.cpp" line="34"/>
   17.63          <source>Type</source>
   17.64          <comment>Branchprop window: Attribute type</comment>
   17.65 -        <translation>Tipo</translation>
   17.66 +        <translation type="unfinished"></translation>
   17.67      </message>
   17.68      <message>
   17.69          <location filename="../branchpropwindow.ui" line="19"/>
   17.70          <source>Branch Property Editor</source>
   17.71 -        <translation>Editor di proprietà del Ramo</translation>
   17.72 +        <translation type="unfinished"></translation>
   17.73      </message>
   17.74      <message>
   17.75          <location filename="../branchpropwindow.ui" line="29"/>
   17.76          <source>Frame</source>
   17.77 -        <translation>Frame</translation>
   17.78 +        <translation type="unfinished"></translation>
   17.79      </message>
   17.80      <message>
   17.81          <location filename="../branchpropwindow.ui" line="50"/>
   17.82          <source>Geometry</source>
   17.83 -        <translation>Geometria</translation>
   17.84 +        <translation type="unfinished"></translation>
   17.85      </message>
   17.86      <message>
   17.87          <location filename="../branchpropwindow.ui" line="63"/>
   17.88          <source>No Frame</source>
   17.89 -        <translation>Senza Frame</translation>
   17.90 +        <translation type="unfinished">Senza Frame</translation>
   17.91      </message>
   17.92      <message>
   17.93          <location filename="../branchpropwindow.ui" line="68"/>
   17.94          <source>Rectangle</source>
   17.95 -        <translation>Rettangolo</translation>
   17.96 +        <translation type="unfinished">Rettangolo</translation>
   17.97      </message>
   17.98      <message>
   17.99          <location filename="../branchpropwindow.ui" line="73"/>
  17.100          <source>Ellipse</source>
  17.101 -        <translation>Ellisse</translation>
  17.102 +        <translation type="unfinished"></translation>
  17.103      </message>
  17.104      <message>
  17.105          <location filename="../branchpropwindow.ui" line="94"/>
  17.106 @@ -144,67 +143,67 @@
  17.107      <message>
  17.108          <location filename="../branchpropwindow.ui" line="101"/>
  17.109          <source>Borderline width</source>
  17.110 -        <translation>Spessore contorno</translation>
  17.111 +        <translation type="unfinished"></translation>
  17.112      </message>
  17.113      <message>
  17.114          <location filename="../branchpropwindow.ui" line="151"/>
  17.115          <source>Colors</source>
  17.116 -        <translation>Colori</translation>
  17.117 +        <translation type="unfinished"></translation>
  17.118      </message>
  17.119      <message>
  17.120          <location filename="../branchpropwindow.ui" line="194"/>
  17.121          <source>Borderline color</source>
  17.122 -        <translation>Colore Contorno</translation>
  17.123 +        <translation type="unfinished"></translation>
  17.124      </message>
  17.125      <message>
  17.126          <location filename="../branchpropwindow.ui" line="217"/>
  17.127          <source>Background color</source>
  17.128 -        <translation>Colore di sfondo</translation>
  17.129 +        <translation type="unfinished"></translation>
  17.130      </message>
  17.131      <message>
  17.132          <location filename="../branchpropwindow.ui" line="246"/>
  17.133          <source>Layout</source>
  17.134 -        <translation>Layout</translation>
  17.135 +        <translation type="unfinished"></translation>
  17.136      </message>
  17.137      <message>
  17.138          <location filename="../branchpropwindow.ui" line="254"/>
  17.139          <source>Include images horizontally</source>
  17.140 -        <translation>Includi immagini orizzontalmente</translation>
  17.141 +        <translation type="unfinished">Includi immagini orizzontalmente</translation>
  17.142      </message>
  17.143      <message>
  17.144          <location filename="../branchpropwindow.ui" line="261"/>
  17.145          <source>Include images vertically</source>
  17.146 -        <translation>Includi immagini verticalmente</translation>
  17.147 +        <translation type="unfinished">Includi immagini verticalmente</translation>
  17.148      </message>
  17.149      <message>
  17.150          <location filename="../branchpropwindow.ui" line="284"/>
  17.151          <source>Link</source>
  17.152 -        <translation>Puntatore</translation>
  17.153 +        <translation type="unfinished"></translation>
  17.154      </message>
  17.155      <message>
  17.156          <location filename="../branchpropwindow.ui" line="290"/>
  17.157          <source>Hide link if unselected</source>
  17.158 -        <translation>Nascondi puntatori se non seleionati</translation>
  17.159 +        <translation type="unfinished"></translation>
  17.160      </message>
  17.161      <message>
  17.162          <location filename="../branchpropwindow.ui" line="311"/>
  17.163          <source>Attributes</source>
  17.164 -        <translation>Attributi</translation>
  17.165 +        <translation type="unfinished"></translation>
  17.166      </message>
  17.167      <message>
  17.168          <location filename="../branchpropwindow.ui" line="337"/>
  17.169          <source>+</source>
  17.170 -        <translation>+</translation>
  17.171 +        <translation type="unfinished"></translation>
  17.172      </message>
  17.173      <message>
  17.174          <location filename="../branchpropwindow.ui" line="344"/>
  17.175          <source>-</source>
  17.176 -        <translation>-</translation>
  17.177 +        <translation type="unfinished"></translation>
  17.178      </message>
  17.179      <message>
  17.180          <location filename="../branchpropwindow.ui" line="413"/>
  17.181          <source>Close</source>
  17.182 -        <translation>Chiudi</translation>
  17.183 +        <translation type="unfinished">Chiudi</translation>
  17.184      </message>
  17.185  </context>
  17.186  <context>
  17.187 @@ -529,7 +528,7 @@
  17.188      <message>
  17.189          <location filename="../exportxhtmldialog.ui" line="165"/>
  17.190          <source>show warnings of xslt processor</source>
  17.191 -        <translation>mostra avvertimenti del processore xslt</translation>
  17.192 +        <translation type="unfinished"></translation>
  17.193      </message>
  17.194  </context>
  17.195  <context>
  17.196 @@ -603,7 +602,7 @@
  17.197      <message>
  17.198          <location filename="../vymmodel.cpp" line="105"/>
  17.199          <source>New map</source>
  17.200 -        <translation>Nuova Mappa</translation>
  17.201 +        <translation type="unfinished">Nuova Mappa</translation>
  17.202      </message>
  17.203  </context>
  17.204  <context>
  17.205 @@ -1132,7 +1131,7 @@
  17.206      <message>
  17.207          <location filename="../mainwindow.cpp" line="974"/>
  17.208          <source>Set &amp;Link Color</source>
  17.209 -        <translation>Specifica Co&amp;lore dei Collegamenti</translation>
  17.210 +        <translation type="unfinished">Specifica Co&amp;lore dei Collegamenti</translation>
  17.211      </message>
  17.212      <message>
  17.213          <location filename="../mainwindow.cpp" line="987"/>
  17.214 @@ -2773,149 +2772,149 @@
  17.215          <location filename="../mainwindow.cpp" line="301"/>
  17.216          <source>&amp;New map</source>
  17.217          <comment>File menu</comment>
  17.218 -        <translation>&amp;Nuova mappa</translation>
  17.219 +        <translation type="unfinished"></translation>
  17.220      </message>
  17.221      <message>
  17.222          <location filename="../mainwindow.cpp" line="308"/>
  17.223          <source>&amp;Copy to new map</source>
  17.224          <comment>File menu</comment>
  17.225 -        <translation>&amp;Copia in una nuova mappa</translation>
  17.226 +        <translation type="unfinished"></translation>
  17.227      </message>
  17.228      <message>
  17.229          <location filename="../mainwindow.cpp" line="309"/>
  17.230          <source>Copy selection to mapcenter of a new map</source>
  17.231          <comment>Status tip File menu</comment>
  17.232 -        <translation>Copia la selezione nel centro di una nuova mappa</translation>
  17.233 +        <translation type="unfinished"></translation>
  17.234      </message>
  17.235      <message>
  17.236          <location filename="../mainwindow.cpp" line="532"/>
  17.237          <source>Add mapcenter</source>
  17.238          <comment>Canvas context menu</comment>
  17.239 -        <translation>Aggiungi centro mappa</translation>
  17.240 +        <translation type="unfinished"></translation>
  17.241      </message>
  17.242      <message>
  17.243          <location filename="../mainwindow.cpp" line="631"/>
  17.244          <source>Sort children</source>
  17.245          <comment>Edit menu</comment>
  17.246 -        <translation>Ordina i figli</translation>
  17.247 +        <translation type="unfinished"></translation>
  17.248      </message>
  17.249      <message>
  17.250          <location filename="../mainwindow.cpp" line="661"/>
  17.251          <source>Unscroll childs</source>
  17.252          <comment>Edit menu</comment>
  17.253 -        <translation>Mostra i figli</translation>
  17.254 +        <translation type="unfinished"></translation>
  17.255      </message>
  17.256      <message>
  17.257          <location filename="../mainwindow.cpp" line="662"/>
  17.258          <source>Unscroll all scrolled branches in selected subtree</source>
  17.259 -        <translation>Mostra tutti i rami in sottorami selezionati</translation>
  17.260 +        <translation type="unfinished"></translation>
  17.261      </message>
  17.262      <message>
  17.263          <location filename="../mainwindow.cpp" line="707"/>
  17.264          <source>Edit local URL...</source>
  17.265          <comment>Edit menu</comment>
  17.266 -        <translation>Modifical URL locale...</translation>
  17.267 +        <translation type="unfinished"></translation>
  17.268      </message>
  17.269      <message>
  17.270          <location filename="../mainwindow.cpp" line="708"/>
  17.271          <source>Edit local URL</source>
  17.272 -        <translation>Modifica URL locale</translation>
  17.273 +        <translation type="unfinished"></translation>
  17.274      </message>
  17.275      <message>
  17.276          <location filename="../mainwindow.cpp" line="723"/>
  17.277          <source>Create URL to Novell Bugzilla</source>
  17.278          <comment>Edit menu</comment>
  17.279 -        <translation>Crea un URL al Novell Bugzilla</translation>
  17.280 +        <translation type="unfinished"></translation>
  17.281      </message>
  17.282      <message>
  17.283          <location filename="../mainwindow.cpp" line="724"/>
  17.284          <source>Create URL to Novell Bugzilla</source>
  17.285 -        <translation>Crea un URL al Novell Bugzilla</translation>
  17.286 +        <translation type="unfinished"></translation>
  17.287      </message>
  17.288      <message>
  17.289          <location filename="../mainwindow.cpp" line="730"/>
  17.290          <source>Create URL to Novell FATE</source>
  17.291          <comment>Edit menu</comment>
  17.292 -        <translation>Crea un URL al Novell FATE</translation>
  17.293 +        <translation type="unfinished"></translation>
  17.294      </message>
  17.295      <message>
  17.296          <location filename="../mainwindow.cpp" line="731"/>
  17.297          <source>Create URL to Novell FATE</source>
  17.298 -        <translation>Crea un URL al Novell FATE</translation>
  17.299 +        <translation type="unfinished"></translation>
  17.300      </message>
  17.301      <message>
  17.302          <location filename="../mainwindow.cpp" line="874"/>
  17.303          <source>Property window</source>
  17.304          <comment>Dialog to edit properties of selection</comment>
  17.305 -        <translation>Finestra di proprietà</translation>
  17.306 +        <translation type="unfinished"></translation>
  17.307      </message>
  17.308      <message>
  17.309          <location filename="../mainwindow.cpp" line="875"/>
  17.310          <source>Set properties for selection</source>
  17.311 -        <translation>Imposta le proprietà per la selezione</translation>
  17.312 +        <translation type="unfinished"></translation>
  17.313      </message>
  17.314      <message>
  17.315          <location filename="../mainwindow.cpp" line="939"/>
  17.316          <source>Linkstyle Curve</source>
  17.317 -        <translation>Collegamenti Curvilinei</translation>
  17.318 +        <translation type="unfinished"></translation>
  17.319      </message>
  17.320      <message>
  17.321          <location filename="../mainwindow.cpp" line="951"/>
  17.322          <source>Linkstyle Thick Curve</source>
  17.323 -        <translation>Collegamenti Curvilinei Spessi</translation>
  17.324 +        <translation type="unfinished"></translation>
  17.325      </message>
  17.326      <message>
  17.327          <location filename="../mainwindow.cpp" line="980"/>
  17.328          <source>Set &amp;Selection Color</source>
  17.329 -        <translation>Scegli Colore di &amp;Selezione</translation>
  17.330 +        <translation type="unfinished"></translation>
  17.331      </message>
  17.332      <message>
  17.333          <location filename="../mainwindow.cpp" line="981"/>
  17.334          <source>Set Selection Color</source>
  17.335 -        <translation>Scegli Colore di Selezione</translation>
  17.336 +        <translation type="unfinished"></translation>
  17.337      </message>
  17.338      <message>
  17.339          <location filename="../mainwindow.cpp" line="992"/>
  17.340          <source>Set &amp;Background image</source>
  17.341 -        <translation>Scegli immagine di S&amp;fondo</translation>
  17.342 +        <translation type="unfinished"></translation>
  17.343      </message>
  17.344      <message>
  17.345          <location filename="../mainwindow.cpp" line="993"/>
  17.346          <source>Set Background image</source>
  17.347 -        <translation>Scegli immagine di Sfondo</translation>
  17.348 +        <translation type="unfinished"></translation>
  17.349      </message>
  17.350      <message>
  17.351          <location filename="../mainwindow.cpp" line="1029"/>
  17.352          <source>Show selection</source>
  17.353          <comment>View action</comment>
  17.354 -        <translation>Mostra selezione</translation>
  17.355 +        <translation type="unfinished"></translation>
  17.356      </message>
  17.357      <message>
  17.358          <location filename="../mainwindow.cpp" line="1030"/>
  17.359          <source>Show selection</source>
  17.360 -        <translation>Mostra selezione</translation>
  17.361 +        <translation type="unfinished"></translation>
  17.362      </message>
  17.363      <message>
  17.364          <location filename="../mainwindow.cpp" line="1047"/>
  17.365          <source>History Window</source>
  17.366          <comment>View action</comment>
  17.367 -        <translation>Finestra di Cronologia</translation>
  17.368 +        <translation type="unfinished"></translation>
  17.369      </message>
  17.370      <message>
  17.371          <location filename="../mainwindow.cpp" line="1048"/>
  17.372          <source>Show History Window</source>
  17.373 -        <translation>Mostra la finestra di Cronologia</translation>
  17.374 +        <translation type="unfinished"></translation>
  17.375      </message>
  17.376      <message>
  17.377          <location filename="../mainwindow.cpp" line="1060"/>
  17.378          <source>Antialiasing</source>
  17.379          <comment>View action</comment>
  17.380 -        <translation>Antialiasing</translation>
  17.381 +        <translation type="unfinished"></translation>
  17.382      </message>
  17.383      <message>
  17.384          <location filename="../mainwindow.cpp" line="1061"/>
  17.385          <source>Antialiasing</source>
  17.386 -        <translation>Antialiasing</translation>
  17.387 +        <translation type="unfinished"></translation>
  17.388      </message>
  17.389      <message>
  17.390          <location filename="../mainwindow.cpp" line="1068"/>
  17.391 @@ -2927,127 +2926,127 @@
  17.392          <location filename="../mainwindow.cpp" line="1076"/>
  17.393          <source>Next Map</source>
  17.394          <comment>View action</comment>
  17.395 -        <translation>Mappa successiva</translation>
  17.396 +        <translation type="unfinished"></translation>
  17.397      </message>
  17.398      <message>
  17.399          <location filename="../mainwindow.cpp" line="1082"/>
  17.400          <source>Previous Map</source>
  17.401          <comment>View action</comment>
  17.402 -        <translation>Mappa precedente</translation>
  17.403 +        <translation type="unfinished"></translation>
  17.404      </message>
  17.405      <message>
  17.406          <location filename="../mainwindow.cpp" line="1136"/>
  17.407          <source>Note</source>
  17.408          <comment>SystemFlag</comment>
  17.409 -        <translation>Note</translation>
  17.410 +        <translation type="unfinished">Note</translation>
  17.411      </message>
  17.412      <message>
  17.413          <location filename="../mainwindow.cpp" line="1139"/>
  17.414          <source>URL to Document </source>
  17.415          <comment>SystemFlag</comment>
  17.416 -        <translation>URL al Documento </translation>
  17.417 +        <translation type="unfinished"></translation>
  17.418      </message>
  17.419      <message>
  17.420          <location filename="../mainwindow.cpp" line="1142"/>
  17.421          <source>Link to another vym map</source>
  17.422          <comment>SystemFlag</comment>
  17.423 -        <translation>Collega ad un&apos;altra mappa vym</translation>
  17.424 +        <translation type="unfinished">Collega ad un&apos;altra mappa vym</translation>
  17.425      </message>
  17.426      <message>
  17.427          <location filename="../mainwindow.cpp" line="1145"/>
  17.428          <source>subtree is scrolled</source>
  17.429          <comment>SystemFlag</comment>
  17.430 -        <translation>sottoalbero è espanso</translation>
  17.431 +        <translation type="unfinished">sottoalbero è espanso</translation>
  17.432      </message>
  17.433      <message>
  17.434          <location filename="../mainwindow.cpp" line="1148"/>
  17.435          <source>subtree is temporary scrolled</source>
  17.436          <comment>SystemFlag</comment>
  17.437 -        <translation>sottoalbero è temporaneamente espanso</translation>
  17.438 +        <translation type="unfinished">sottoalbero è temporaneamente espanso</translation>
  17.439      </message>
  17.440      <message>
  17.441          <location filename="../mainwindow.cpp" line="1151"/>
  17.442          <source>Hide object in exported maps</source>
  17.443          <comment>SystemFlag</comment>
  17.444 -        <translation>Nascondi oggetto nelle mappe esportate</translation>
  17.445 +        <translation type="unfinished">Nascondi oggetto nelle mappe esportate</translation>
  17.446      </message>
  17.447      <message>
  17.448          <location filename="../mainwindow.cpp" line="1235"/>
  17.449          <source>I just love...</source>
  17.450          <comment>Standardflag</comment>
  17.451 -        <translation> Lo amo... </translation>
  17.452 +        <translation type="unfinished"></translation>
  17.453      </message>
  17.454      <message>
  17.455          <location filename="../mainwindow.cpp" line="1256"/>
  17.456          <source>Important</source>
  17.457          <comment>Freemind-Flag</comment>
  17.458 -        <translation>Importante</translation>
  17.459 +        <translation type="unfinished">Importante</translation>
  17.460      </message>
  17.461      <message>
  17.462          <location filename="../mainwindow.cpp" line="1261"/>
  17.463          <source>Priority</source>
  17.464          <comment>Freemind-Flag</comment>
  17.465 -        <translation>Priorità</translation>
  17.466 +        <translation type="unfinished"></translation>
  17.467      </message>
  17.468      <message>
  17.469          <location filename="../mainwindow.cpp" line="1265"/>
  17.470          <source>Back</source>
  17.471          <comment>Freemind-Flag</comment>
  17.472 -        <translation>Indietro</translation>
  17.473 +        <translation type="unfinished"></translation>
  17.474      </message>
  17.475      <message>
  17.476          <location filename="../mainwindow.cpp" line="1268"/>
  17.477          <source>Forward</source>
  17.478          <comment>Freemind-Flag</comment>
  17.479 -        <translation>Avanti</translation>
  17.480 +        <translation type="unfinished"></translation>
  17.481      </message>
  17.482      <message>
  17.483          <location filename="../mainwindow.cpp" line="1271"/>
  17.484          <source>Look here</source>
  17.485          <comment>Freemind-Flag</comment>
  17.486 -        <translation>Guardami</translation>
  17.487 +        <translation type="unfinished"></translation>
  17.488      </message>
  17.489      <message>
  17.490          <location filename="../mainwindow.cpp" line="1274"/>
  17.491          <source>Dangerous</source>
  17.492          <comment>Freemind-Flag</comment>
  17.493 -        <translation>Pericoloso</translation>
  17.494 +        <translation type="unfinished">Pericoloso</translation>
  17.495      </message>
  17.496      <message>
  17.497          <location filename="../mainwindow.cpp" line="1277"/>
  17.498          <source>Don&apos;t forget</source>
  17.499          <comment>Freemind-Flag</comment>
  17.500 -        <translation>Non Trascurare</translation>
  17.501 +        <translation type="unfinished"></translation>
  17.502      </message>
  17.503      <message>
  17.504          <location filename="../mainwindow.cpp" line="1280"/>
  17.505          <source>Flag</source>
  17.506          <comment>Freemind-Flag</comment>
  17.507 -        <translation>Flag</translation>
  17.508 +        <translation type="unfinished"></translation>
  17.509      </message>
  17.510      <message>
  17.511          <location filename="../mainwindow.cpp" line="1284"/>
  17.512          <source>Home</source>
  17.513          <comment>Freemind-Flag</comment>
  17.514 -        <translation>Principio</translation>
  17.515 +        <translation type="unfinished"></translation>
  17.516      </message>
  17.517      <message>
  17.518          <location filename="../mainwindow.cpp" line="1288"/>
  17.519          <source>Telephone</source>
  17.520          <comment>Freemind-Flag</comment>
  17.521 -        <translation>Telefono</translation>
  17.522 +        <translation type="unfinished"></translation>
  17.523      </message>
  17.524      <message>
  17.525          <location filename="../mainwindow.cpp" line="1291"/>
  17.526          <source>Music</source>
  17.527          <comment>Freemind-Flag</comment>
  17.528 -        <translation>Musica</translation>
  17.529 +        <translation type="unfinished"></translation>
  17.530      </message>
  17.531      <message>
  17.532          <location filename="../mainwindow.cpp" line="1294"/>
  17.533          <source>Mailbox</source>
  17.534          <comment>Freemind-Flag</comment>
  17.535 -        <translation>Casella di Posta</translation>
  17.536 +        <translation type="unfinished"></translation>
  17.537      </message>
  17.538      <message>
  17.539          <location filename="../mainwindow.cpp" line="1297"/>
  17.540 @@ -3059,208 +3058,206 @@
  17.541          <location filename="../mainwindow.cpp" line="1300"/>
  17.542          <source>Password</source>
  17.543          <comment>Freemind-Flag</comment>
  17.544 -        <translation>Password</translation>
  17.545 +        <translation type="unfinished"></translation>
  17.546      </message>
  17.547      <message>
  17.548          <location filename="../mainwindow.cpp" line="1303"/>
  17.549          <source>To be improved</source>
  17.550          <comment>Freemind-Flag</comment>
  17.551 -        <translation>Da migliorare</translation>
  17.552 +        <translation type="unfinished"></translation>
  17.553      </message>
  17.554      <message>
  17.555          <location filename="../mainwindow.cpp" line="1306"/>
  17.556          <source>Stop</source>
  17.557          <comment>Freemind-Flag</comment>
  17.558 -        <translation>Stop</translation>
  17.559 +        <translation type="unfinished"></translation>
  17.560      </message>
  17.561      <message>
  17.562          <location filename="../mainwindow.cpp" line="1309"/>
  17.563          <source>Magic</source>
  17.564          <comment>Freemind-Flag</comment>
  17.565 -        <translation>Magico</translation>
  17.566 +        <translation type="unfinished"></translation>
  17.567      </message>
  17.568      <message>
  17.569          <location filename="../mainwindow.cpp" line="1312"/>
  17.570          <source>To be discussed</source>
  17.571          <comment>Freemind-Flag</comment>
  17.572 -        <translation>Da discutere</translation>
  17.573 +        <translation type="unfinished"></translation>
  17.574      </message>
  17.575      <message>
  17.576          <location filename="../mainwindow.cpp" line="1315"/>
  17.577          <source>Reminder</source>
  17.578          <comment>Freemind-Flag</comment>
  17.579 -        <translation>Appunto</translation>
  17.580 +        <translation type="unfinished"></translation>
  17.581      </message>
  17.582      <message>
  17.583          <location filename="../mainwindow.cpp" line="1318"/>
  17.584          <source>Excellent</source>
  17.585          <comment>Freemind-Flag</comment>
  17.586 -        <translation>Eccellente</translation>
  17.587 +        <translation type="unfinished"></translation>
  17.588      </message>
  17.589      <message>
  17.590          <location filename="../mainwindow.cpp" line="1321"/>
  17.591          <source>Linux</source>
  17.592          <comment>Freemind-Flag</comment>
  17.593 -        <translation>Linux</translation>
  17.594 +        <translation type="unfinished"></translation>
  17.595      </message>
  17.596      <message>
  17.597          <location filename="../mainwindow.cpp" line="1324"/>
  17.598          <source>Sweet</source>
  17.599          <comment>Freemind-Flag</comment>
  17.600 -        <translation>Dolce</translation>
  17.601 +        <translation type="unfinished"></translation>
  17.602      </message>
  17.603      <message>
  17.604          <location filename="../mainwindow.cpp" line="1390"/>
  17.605          <source>Set path for macros</source>
  17.606          <comment>Settings action</comment>
  17.607 -        <translation>Seleziona percorso per le macro</translation>
  17.608 +        <translation type="unfinished"></translation>
  17.609      </message>
  17.610      <message>
  17.611          <location filename="../mainwindow.cpp" line="1391"/>
  17.612          <source>Set path for macros</source>
  17.613 -        <translation>Seleziona percorso per le macro</translation>
  17.614 +        <translation type="unfinished"></translation>
  17.615      </message>
  17.616      <message>
  17.617          <location filename="../mainwindow.cpp" line="1395"/>
  17.618          <source>Set number of undo levels</source>
  17.619          <comment>Settings action</comment>
  17.620 -        <translation>Imposta numero di livelli Annulla</translation>
  17.621 +        <translation type="unfinished"></translation>
  17.622      </message>
  17.623      <message>
  17.624          <location filename="../mainwindow.cpp" line="1396"/>
  17.625          <source>Set number of undo levels</source>
  17.626 -        <translation>Imposta numero di livelli Annulla</translation>
  17.627 +        <translation type="unfinished"></translation>
  17.628      </message>
  17.629      <message>
  17.630          <location filename="../mainwindow.cpp" line="1402"/>
  17.631          <source>Autosave</source>
  17.632          <comment>Settings action</comment>
  17.633 -        <translation>Salva Automatico</translation>
  17.634 +        <translation type="unfinished"></translation>
  17.635      </message>
  17.636      <message>
  17.637          <location filename="../mainwindow.cpp" line="1403"/>
  17.638          <source>Autosave</source>
  17.639 -        <translation>Salva Automatico</translation>
  17.640 +        <translation type="unfinished"></translation>
  17.641      </message>
  17.642      <message>
  17.643          <location filename="../mainwindow.cpp" line="1410"/>
  17.644          <source>Autosave time</source>
  17.645          <comment>Settings action</comment>
  17.646 -        <translation>Tempo per salva automativo</translation>
  17.647 +        <translation type="unfinished"></translation>
  17.648      </message>
  17.649      <message>
  17.650          <location filename="../mainwindow.cpp" line="1411"/>
  17.651          <source>Autosave time</source>
  17.652 -        <translation>Tempo per salva automativo</translation>
  17.653 +        <translation type="unfinished"></translation>
  17.654      </message>
  17.655      <message>
  17.656          <location filename="../mainwindow.cpp" line="1416"/>
  17.657          <source>Write backup file on save</source>
  17.658          <comment>Settings action</comment>
  17.659 -        <translation>Scrivi un file di backup al Salvataggio</translation>
  17.660 +        <translation type="unfinished"></translation>
  17.661      </message>
  17.662      <message>
  17.663          <location filename="../mainwindow.cpp" line="1417"/>
  17.664          <source>Write backup file on save</source>
  17.665 -        <translation>Scrivi un file di backup al Salvataggio</translation>
  17.666 +        <translation type="unfinished"></translation>
  17.667      </message>
  17.668      <message>
  17.669          <location filename="../mainwindow.cpp" line="1469"/>
  17.670          <source>Animation</source>
  17.671          <comment>Settings action</comment>
  17.672 -        <translation>Animazione</translation>
  17.673 +        <translation type="unfinished"></translation>
  17.674      </message>
  17.675      <message>
  17.676          <location filename="../mainwindow.cpp" line="1470"/>
  17.677          <source>Animation</source>
  17.678 -        <translation>Animazione</translation>
  17.679 +        <translation type="unfinished"></translation>
  17.680      </message>
  17.681      <message>
  17.682          <location filename="../mainwindow.cpp" line="1514"/>
  17.683          <source>Open VYM example maps </source>
  17.684          <comment>Help action</comment>
  17.685 -        <translation>Apri mappe VYM di esempio</translation>
  17.686 +        <translation type="unfinished"></translation>
  17.687      </message>
  17.688      <message>
  17.689          <location filename="../mainwindow.cpp" line="1515"/>
  17.690          <source>Open VYM example maps </source>
  17.691 -        <translation>Apri mappe VYM di esempio </translation>
  17.692 +        <translation type="unfinished"></translation>
  17.693      </message>
  17.694      <message>
  17.695          <location filename="../mainwindow.cpp" line="1569"/>
  17.696          <source>References (URLs, vymLinks, ...)</source>
  17.697          <comment>Context menu name</comment>
  17.698 -        <translation>Referenze (URL, LinkVYM, ...)</translation>
  17.699 +        <translation type="unfinished"></translation>
  17.700      </message>
  17.701      <message>
  17.702          <location filename="../mainwindow.cpp" line="1645"/>
  17.703          <source>&amp;%1 %2</source>
  17.704 -        <translation>&amp;%1 %2</translation>
  17.705 +        <translation type="unfinished"></translation>
  17.706      </message>
  17.707      <message>
  17.708          <location filename="../mainwindow.cpp" line="2108"/>
  17.709          <source>Load Freemind map</source>
  17.710 -        <translation>Carica mappa Freemind</translation>
  17.711 +        <translation type="unfinished"></translation>
  17.712      </message>
  17.713      <message>
  17.714          <location filename="../mainwindow.cpp" line="2202"/>
  17.715          <source>Export as CSV</source>
  17.716 -        <translation>Esporta in CSV</translation>
  17.717 +        <translation type="unfinished"></translation>
  17.718      </message>
  17.719      <message>
  17.720          <location filename="../mainwindow.cpp" line="3268"/>
  17.721          <source>Directory with vym macros:</source>
  17.722 -        <translation>Cartella con macro vym:</translation>
  17.723 +        <translation type="unfinished"></translation>
  17.724      </message>
  17.725      <message>
  17.726          <location filename="../mainwindow.cpp" line="3300"/>
  17.727          <source>QInputDialog::getInteger()</source>
  17.728 -        <translation>QInputDialog::getInteger()</translation>
  17.729 +        <translation type="unfinished"></translation>
  17.730      </message>
  17.731      <message>
  17.732          <location filename="../mainwindow.cpp" line="3281"/>
  17.733          <source>Number of undo/redo levels:</source>
  17.734 -        <translation>Numero di livelli annulla/rifai:</translation>
  17.735 +        <translation type="unfinished"></translation>
  17.736      </message>
  17.737      <message>
  17.738          <location filename="../mainwindow.cpp" line="3286"/>
  17.739          <source>Settings have been changed. The next map opened will have &quot;%1&quot; undo/redo levels</source>
  17.740 -        <translation>Le impostazione sono state salvate. La prossima mappa avra &quot;%1&quot; livelli di annulla/rifai</translation>
  17.741 +        <translation type="unfinished"></translation>
  17.742      </message>
  17.743      <message>
  17.744          <location filename="../mainwindow.cpp" line="3301"/>
  17.745          <source>Number of seconds before autosave:</source>
  17.746 -        <translation>Numero di secondi prima del salvataggio automatico:</translation>
  17.747 +        <translation type="unfinished"></translation>
  17.748      </message>
  17.749      <message>
  17.750          <location filename="../mainwindow.cpp" line="3411"/>
  17.751          <source>History for %1</source>
  17.752          <comment>Window Caption</comment>
  17.753 -        <translation>Cronologia per %1</translation>
  17.754 +        <translation type="unfinished"></translation>
  17.755      </message>
  17.756      <message>
  17.757          <location filename="../mainwindow.cpp" line="3735"/>
  17.758          <source>Couldn&apos;t find the documentation %1 in:
  17.759  %2</source>
  17.760 -        <translation>Non è possibile trovare la documentazione %1 in:
  17.761 -%2</translation>
  17.762 +        <translation type="unfinished"></translation>
  17.763      </message>
  17.764      <message>
  17.765          <location filename="../mainwindow.cpp" line="3771"/>
  17.766          <source>Load vym example map</source>
  17.767 -        <translation>Carica mappa di esempio vym</translation>
  17.768 +        <translation type="unfinished"></translation>
  17.769      </message>
  17.770      <message>
  17.771          <location filename="../mainwindow.cpp" line="3820"/>
  17.772          <source>Couldn&apos;t find a macro at  %1.
  17.773  </source>
  17.774 -        <translation>Non è possibile trovare la macro in   %1.
  17.775 -</translation>
  17.776 +        <translation type="unfinished"></translation>
  17.777      </message>
  17.778      <message>
  17.779          <location filename="../mainwindow.cpp" line="3821"/>
  17.780          <source>Set directory for vym macros</source>
  17.781 -        <translation>Imposta la cartella con le macro vym</translation>
  17.782 +        <translation type="unfinished"></translation>
  17.783      </message>
  17.784  </context>
  17.785  <context>
  17.786 @@ -3612,20 +3609,19 @@
  17.787      <message>
  17.788          <location filename="../mapeditor.cpp" line="1795"/>
  17.789          <source>Critical Load Error</source>
  17.790 -        <translation>Errore Critico di Caricamento</translation>
  17.791 +        <translation type="unfinished">Errore Critico di Caricamento</translation>
  17.792      </message>
  17.793      <message>
  17.794          <location filename="../mapeditor.cpp" line="1602"/>
  17.795          <source>Couldn&apos;t create temporary directory before load
  17.796  </source>
  17.797 -        <translation>Non è possibile creare una cartella temporanea prima di caricare
  17.798 -</translation>
  17.799 +        <translation type="unfinished">Non è possibile creare una cartella temporanea prima di caricare</translation>
  17.800      </message>
  17.801      <message>
  17.802          <location filename="../mapeditor.cpp" line="1645"/>
  17.803          <source>Couldn&apos;t find a map (*.xml) in .vym archive.
  17.804  </source>
  17.805 -        <translation>Non è possibile trovare una mappa (*.xml) nell&apos;archivio .vym.
  17.806 +        <translation type="unfinished">Non è possibile trovare una mappa (*.xml) nell&apos;archivio .vym.
  17.807  </translation>
  17.808      </message>
  17.809      <message>
  17.810 @@ -3636,7 +3632,7 @@
  17.811  and flags and thus may overwrite files in the given directory
  17.812  
  17.813  Do you want to write the map</source>
  17.814 -        <translation>La mappa %1
  17.815 +        <translation type="unfinished">La mappa %1
  17.816  non usa il formato di compressione vym.
  17.817  Salvandolo in modo non compresso, salva anche le immagini 
  17.818  e le flag e quindi potrebbe sovvrascrivere dei file in questa cartella
  17.819 @@ -3645,94 +3641,92 @@
  17.820      <message>
  17.821          <location filename="../mapeditor.cpp" line="1746"/>
  17.822          <source>compressed (vym default)</source>
  17.823 -        <translation>compresso (predefinito in vym)</translation>
  17.824 +        <translation type="unfinished">compresso (predefinito in vym)</translation>
  17.825      </message>
  17.826      <message>
  17.827          <location filename="../mapeditor.cpp" line="1747"/>
  17.828          <source>uncompressed</source>
  17.829 -        <translation>non compresso</translation>
  17.830 +        <translation type="unfinished">non compresso</translation>
  17.831      </message>
  17.832      <message>
  17.833          <location filename="../mapeditor.cpp" line="1782"/>
  17.834          <source>Save Error</source>
  17.835 -        <translation>Errore di Salvataggio</translation>
  17.836 +        <translation type="unfinished">Errore di Salvataggio</translation>
  17.837      </message>
  17.838      <message>
  17.839          <location filename="../mapeditor.cpp" line="1778"/>
  17.840          <source>%1
  17.841  could not be removed before saving</source>
  17.842 -        <translation>%1
  17.843 -non può essere rimosso prima del salvataggio</translation>
  17.844 +        <translation type="unfinished"></translation>
  17.845      </message>
  17.846      <message>
  17.847          <location filename="../mapeditor.cpp" line="1783"/>
  17.848          <source>%1
  17.849  could not be renamed before saving</source>
  17.850 -        <translation>%1
  17.851 -non può essere rinominato prima del salvataggio</translation>
  17.852 +        <translation type="unfinished"></translation>
  17.853      </message>
  17.854      <message>
  17.855          <location filename="../mapeditor.cpp" line="1796"/>
  17.856          <source>Couldn&apos;t create temporary directory before save
  17.857  </source>
  17.858 -        <translation>Non è possibile creare una cartella temporanea prima di salvare
  17.859 +        <translation type="unfinished">Non è possibile creare una cartella temporanea prima di salvare
  17.860  </translation>
  17.861      </message>
  17.862      <message>
  17.863          <location filename="../mapeditor.cpp" line="2033"/>
  17.864          <source>Export map as image</source>
  17.865 -        <translation>Esporta mappa come immagine</translation>
  17.866 +        <translation type="unfinished">Esporta mappa come immagine</translation>
  17.867      </message>
  17.868      <message>
  17.869          <location filename="../mapeditor.cpp" line="2110"/>
  17.870          <source>Export XML to directory</source>
  17.871 -        <translation>Esporta XML in una cartella</translation>
  17.872 +        <translation type="unfinished">Esporta XML in una cartella</translation>
  17.873      </message>
  17.874      <message>
  17.875          <location filename="../mapeditor.cpp" line="2260"/>
  17.876          <source>Autosave disabled during undo.</source>
  17.877 -        <translation>Salvataggio automatico disabilitato durante annullamento.</translation>
  17.878 +        <translation type="unfinished"></translation>
  17.879      </message>
  17.880      <message>
  17.881          <location filename="../mapeditor.cpp" line="3268"/>
  17.882          <source>Load background image</source>
  17.883 -        <translation>Carica immagine di sfondo</translation>
  17.884 +        <translation type="unfinished"></translation>
  17.885      </message>
  17.886      <message>
  17.887          <location filename="../mapeditor.cpp" line="3489"/>
  17.888          <source>Text</source>
  17.889          <comment>Filedialog</comment>
  17.890 -        <translation>Testo</translation>
  17.891 +        <translation type="unfinished"></translation>
  17.892      </message>
  17.893      <message>
  17.894          <location filename="../mapeditor.cpp" line="3490"/>
  17.895          <source>Spreadsheet</source>
  17.896          <comment>Filedialog</comment>
  17.897 -        <translation>Foglio di calcolo</translation>
  17.898 +        <translation type="unfinished"></translation>
  17.899      </message>
  17.900      <message>
  17.901          <location filename="../mapeditor.cpp" line="3491"/>
  17.902          <source>Textdocument</source>
  17.903          <comment>Filedialog</comment>
  17.904 -        <translation>Documento di testo</translation>
  17.905 +        <translation type="unfinished"></translation>
  17.906      </message>
  17.907      <message>
  17.908          <location filename="../mapeditor.cpp" line="3492"/>
  17.909          <source>Images</source>
  17.910          <comment>Filedialog</comment>
  17.911 -        <translation>Immagini</translation>
  17.912 +        <translation type="unfinished">Immagini</translation>
  17.913      </message>
  17.914      <message>
  17.915          <location filename="../mapeditor.cpp" line="3495"/>
  17.916          <source>Set URL to a local file</source>
  17.917 -        <translation>Imposta URL come file locale</translation>
  17.918 +        <translation type="unfinished"></translation>
  17.919      </message>
  17.920      <message>
  17.921          <location filename="../mapeditor.cpp" line="3727"/>
  17.922          <source>%1 items on map
  17.923  </source>
  17.924          <comment>Info about map</comment>
  17.925 -        <translation>%1 oggetti nella mappa</translation>
  17.926 +        <translation type="unfinished"></translation>
  17.927      </message>
  17.928      <message>
  17.929          <location filename="../mapeditor.cpp" line="5291"/>
  17.930 @@ -3746,12 +3740,12 @@
  17.931      <message>
  17.932          <location filename="../mapeditor.cpp" line="5297"/>
  17.933          <source>Reload</source>
  17.934 -        <translation>Ricarica</translation>
  17.935 +        <translation type="unfinished"></translation>
  17.936      </message>
  17.937      <message>
  17.938          <location filename="../mapeditor.cpp" line="5298"/>
  17.939          <source>Ignore</source>
  17.940 -        <translation>Ignora</translation>
  17.941 +        <translation type="unfinished"></translation>
  17.942      </message>
  17.943  </context>
  17.944  <context>
  17.945 @@ -3885,27 +3879,26 @@
  17.946      <message>
  17.947          <location filename="../exports.cpp" line="131"/>
  17.948          <source>Export as ASCII</source>
  17.949 -        <translation>Esporta in ASCII</translation>
  17.950 +        <translation type="unfinished">Esporta in ASCII</translation>
  17.951      </message>
  17.952      <message>
  17.953          <location filename="../exports.cpp" line="131"/>
  17.954          <source>(still experimental)</source>
  17.955 -        <translation>(in via di sperimentazione)</translation>
  17.956 +        <translation type="unfinished">(in via di sperimentazione)</translation>
  17.957      </message>
  17.958      <message>
  17.959          <location filename="../file.cpp" line="99"/>
  17.960          <source>The directory %1 is not empty.
  17.961  Do you risk to overwrite its contents?</source>
  17.962          <comment>write directory</comment>
  17.963 -        <translation>La cartella %1 non è vuota. 
  17.964 +        <translation type="unfinished">La cartella %1 non è vuota. 
  17.965  Si rischia di sovvrascrivere i contenuti?</translation>
  17.966      </message>
  17.967      <message>
  17.968          <location filename="../main.cpp" line="193"/>
  17.969          <source>Couldn&apos;t open %1.
  17.970  </source>
  17.971 -        <translation>Non è possibile aprire %1.
  17.972 -</translation>
  17.973 +        <translation type="unfinished"></translation>
  17.974      </message>
  17.975  </context>
  17.976  <context>
  17.977 @@ -3931,7 +3924,7 @@
  17.978      <message>
  17.979          <location filename="../simplescripteditor.cpp" line="61"/>
  17.980          <source>Save script</source>
  17.981 -        <translation>Salva script</translation>
  17.982 +        <translation type="unfinished"></translation>
  17.983      </message>
  17.984      <message>
  17.985          <location filename="../simplescripteditor.cpp" line="73"/>
  17.986 @@ -3939,81 +3932,80 @@
  17.987  exists already.
  17.988  Do you want to overwrite it?</source>
  17.989          <comment>dialog &apos;save as&apos;</comment>
  17.990 -        <translation>Il file %1 
  17.991 +        <translation type="unfinished">Il file %1 
  17.992  esiste già.
  17.993  Vuoi sovvrascriverlo?</translation>
  17.994      </message>
  17.995      <message>
  17.996          <location filename="../simplescripteditor.cpp" line="78"/>
  17.997          <source>Overwrite</source>
  17.998 -        <translation>Sovvrascrivi</translation>
  17.999 +        <translation type="unfinished">Sovvrascrivi</translation>
 17.1000      </message>
 17.1001      <message>
 17.1002          <location filename="../simplescripteditor.cpp" line="79"/>
 17.1003          <source>Cancel</source>
 17.1004 -        <translation>Cancella</translation>
 17.1005 +        <translation type="unfinished">Cancella</translation>
 17.1006      </message>
 17.1007      <message>
 17.1008          <location filename="../simplescripteditor.cpp" line="105"/>
 17.1009          <source>Load script</source>
 17.1010 -        <translation>Carica script</translation>
 17.1011 +        <translation type="unfinished"></translation>
 17.1012      </message>
 17.1013      <message>
 17.1014          <location filename="../simplescripteditor.cpp" line="116"/>
 17.1015          <source>Error</source>
 17.1016 -        <translation>Errore</translation>
 17.1017 +        <translation type="unfinished">Errore</translation>
 17.1018      </message>
 17.1019      <message>
 17.1020          <location filename="../simplescripteditor.cpp" line="117"/>
 17.1021          <source>Couldn&apos;t open %1.
 17.1022  </source>
 17.1023 -        <translation>Non è possibile aprire %1.
 17.1024 -</translation>
 17.1025 +        <translation type="unfinished"></translation>
 17.1026      </message>
 17.1027      <message>
 17.1028          <location filename="../simplescripteditor.ui" line="13"/>
 17.1029          <source>Simple Script Editor</source>
 17.1030 -        <translation>Editor semplice di script</translation>
 17.1031 +        <translation type="unfinished"></translation>
 17.1032      </message>
 17.1033      <message>
 17.1034          <location filename="../simplescripteditor.ui" line="38"/>
 17.1035          <source>Save as</source>
 17.1036 -        <translation>Salva come</translation>
 17.1037 +        <translation type="unfinished"></translation>
 17.1038      </message>
 17.1039      <message>
 17.1040          <location filename="../simplescripteditor.ui" line="48"/>
 17.1041          <source>Save</source>
 17.1042 -        <translation>Salva</translation>
 17.1043 +        <translation type="unfinished">Salva</translation>
 17.1044      </message>
 17.1045      <message>
 17.1046          <location filename="../simplescripteditor.ui" line="51"/>
 17.1047          <source>Qt::CTRL + Qt::Key_S</source>
 17.1048 -        <translation>Qt::CTRL + Qt::Key_S</translation>
 17.1049 +        <translation type="unfinished"></translation>
 17.1050      </message>
 17.1051      <message>
 17.1052          <location filename="../simplescripteditor.ui" line="58"/>
 17.1053          <source>Open</source>
 17.1054 -        <translation>Apri</translation>
 17.1055 +        <translation type="unfinished">Apri</translation>
 17.1056      </message>
 17.1057      <message>
 17.1058          <location filename="../simplescripteditor.ui" line="61"/>
 17.1059          <source>Qt::CTRL +Qt::Key_O</source>
 17.1060 -        <translation>Qt::CTRL + Qt::Key_O</translation>
 17.1061 +        <translation type="unfinished"></translation>
 17.1062      </message>
 17.1063      <message>
 17.1064          <location filename="../simplescripteditor.ui" line="68"/>
 17.1065          <source>Run</source>
 17.1066 -        <translation>Avvia</translation>
 17.1067 +        <translation type="unfinished"></translation>
 17.1068      </message>
 17.1069      <message>
 17.1070          <location filename="../simplescripteditor.ui" line="71"/>
 17.1071          <source>Qt::CTRL + Qt::Key_R</source>
 17.1072 -        <translation>Qt::CTRL + Qt::Key_R</translation>
 17.1073 +        <translation type="unfinished"></translation>
 17.1074      </message>
 17.1075      <message>
 17.1076          <location filename="../simplescripteditor.ui" line="78"/>
 17.1077          <source>Close</source>
 17.1078 -        <translation>Chiudi</translation>
 17.1079 +        <translation type="unfinished">Chiudi</translation>
 17.1080      </message>
 17.1081  </context>
 17.1082  <context>
 17.1083 @@ -4495,7 +4487,7 @@
 17.1084      <message>
 17.1085          <location filename="../warningdialog.cpp" line="15"/>
 17.1086          <source>Show this message again</source>
 17.1087 -        <translation>Mostra ancora questo messaggio</translation>
 17.1088 +        <translation type="unfinished"></translation>
 17.1089      </message>
 17.1090  </context>
 17.1091  </TS>
    18.1 --- a/linkablemapobj.cpp	Wed Jul 16 10:44:44 2008 +0000
    18.2 +++ b/linkablemapobj.cpp	Wed Jul 16 10:46:14 2008 +0000
    18.3 @@ -1,8 +1,12 @@
    18.4 +#include <iostream>
    18.5  #include <math.h>
    18.6  
    18.7  #include "linkablemapobj.h"
    18.8  #include "branchobj.h"
    18.9 -#include "mapeditor.h"
   18.10 +#include "mapeditor.h"		// FIXME needed?
   18.11 +#include "vymmodel.h"
   18.12 +
   18.13 +using namespace std;
   18.14  
   18.15  /////////////////////////////////////////////////////////////////
   18.16  // LinkableMapObj
   18.17 @@ -54,6 +58,8 @@
   18.18  
   18.19  void LinkableMapObj::init ()
   18.20  {
   18.21 +	model=NULL;
   18.22 +
   18.23      depth=-1;	
   18.24  	mapEditor=NULL;
   18.25      childObj=NULL;
   18.26 @@ -99,6 +105,7 @@
   18.27  void LinkableMapObj::copy (LinkableMapObj* other)
   18.28  {
   18.29      MapObj::copy(other);
   18.30 +	model=other->model;
   18.31  	bboxTotal=other->bboxTotal;
   18.32      setLinkStyle(other->style);
   18.33      setLinkColor (other->linkcolor);
   18.34 @@ -107,6 +114,16 @@
   18.35  	objID=other->objID;
   18.36  }
   18.37  
   18.38 +void LinkableMapObj::setModel (VymModel *vm)
   18.39 +{
   18.40 +	model=vm;
   18.41 +}
   18.42 +
   18.43 +VymModel* LinkableMapObj::getModel()
   18.44 +{
   18.45 +	return model;
   18.46 +}
   18.47 +
   18.48  void LinkableMapObj::setChildObj(LinkableMapObj* o)
   18.49  {
   18.50      childObj=o;
   18.51 @@ -116,13 +133,14 @@
   18.52  {
   18.53      parObj=o;
   18.54  	mapEditor=parObj->getMapEditor();
   18.55 +	model=parObj->getModel();	// FIXME makes painting slow, but that's obvious because there are no links to paint, hmmm....
   18.56  }
   18.57  
   18.58 -void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int)
   18.59 +void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int)	// FIXME make pure virtual
   18.60  {
   18.61  }
   18.62  
   18.63 -void LinkableMapObj::unsetParObjTmp()
   18.64 +void LinkableMapObj::unsetParObjTmp()	// FIXME make pure virtual
   18.65  {
   18.66  }
   18.67  
   18.68 @@ -180,8 +198,12 @@
   18.69  
   18.70  LinkableMapObj::Style LinkableMapObj::getDefLinkStyle ()
   18.71  {
   18.72 -	if (!mapEditor) return UndefinedStyle;
   18.73 -	Style ls=mapEditor->getMapLinkStyle();
   18.74 +	if (!model)
   18.75 +	{
   18.76 +		qWarning ("LMO::getDefLinkStyle   model=NULL");
   18.77 +		return UndefinedStyle;
   18.78 +	}
   18.79 +	Style ls=model->getMapLinkStyle();
   18.80  	switch (ls)
   18.81  	{
   18.82  		case Line: 
   18.83 @@ -309,10 +331,10 @@
   18.84  
   18.85  void LinkableMapObj::setLinkColor()
   18.86  {
   18.87 -	// Overloaded in BranchObj and childs
   18.88 +	// Overloaded in BranchObj and children
   18.89  	// here only set default color
   18.90 -	if (mapEditor)
   18.91 -		setLinkColor (mapEditor->getMapDefLinkColor());
   18.92 +	if (model)
   18.93 +		setLinkColor (model->getMapDefLinkColor());
   18.94  }
   18.95  
   18.96  void LinkableMapObj::setLinkColor(QColor col)
   18.97 @@ -606,6 +628,7 @@
   18.98  void LinkableMapObj::setMapEditor (MapEditor *me)
   18.99  {
  18.100  	mapEditor=me;
  18.101 +	model=mapEditor->getModel();
  18.102  }
  18.103  
  18.104  MapEditor* LinkableMapObj::getMapEditor ()
  18.105 @@ -646,7 +669,7 @@
  18.106  	// we want to block expensive repositioning, but just do it once at
  18.107  	// the end, thus check first:
  18.108  
  18.109 -	if (mapEditor->isRepositionBlocked()) return;
  18.110 +	if (mapEditor->getModel()->isRepositionBlocked()) return;	// FIXME better go to model directly, maybe via a signal
  18.111  	
  18.112  	// Pass on the request to parental objects, if this hasn't been done yet
  18.113  	
    19.1 --- a/linkablemapobj.h	Wed Jul 16 10:44:44 2008 +0000
    19.2 +++ b/linkablemapobj.h	Wed Jul 16 10:46:14 2008 +0000
    19.3 @@ -9,6 +9,7 @@
    19.4  #define MAX_DEPTH 999
    19.5  
    19.6  class MapEditor;
    19.7 +class VymModel;
    19.8  
    19.9  
   19.10  
   19.11 @@ -55,6 +56,10 @@
   19.12  	virtual void delLink();
   19.13      virtual void init ();
   19.14      virtual void copy (LinkableMapObj*);
   19.15 +
   19.16 +	virtual void setModel (VymModel *vm);
   19.17 +	virtual VymModel* getModel ();
   19.18 +
   19.19      void setChildObj (LinkableMapObj*);
   19.20      virtual void setParObj (LinkableMapObj*);
   19.21      virtual void setParObjTmp (LinkableMapObj*,QPointF,int);	// Only for moving Obj around
   19.22 @@ -94,12 +99,12 @@
   19.23      LinkableMapObj* getParObj();			// returns pointer to toObj
   19.24      virtual LinkableMapObj* findObjBySelect(QString s);	// find obj by selectstring
   19.25  	virtual void setDockPos()=0;				// sets childPos and parPos
   19.26 -    QPointF getChildPos();					// returns pos where childs dock
   19.27 +    QPointF getChildPos();					// returns pos where children dock
   19.28      QPointF getParPos();						// returns pos where parents dock
   19.29      Orientation getOrientation();			// get orientation
   19.30      virtual int getDepth();					// return depth
   19.31 -	virtual void setMapEditor(MapEditor*);	// set MapEditor (needed in LMO::updateNoteFlag)
   19.32 -	virtual MapEditor* getMapEditor();		// get MapEditor (usually from parent);
   19.33 +	virtual void setMapEditor(MapEditor*);	// set MapEditor (needed in LMO::updateNoteFlag) FIXME not needed
   19.34 +	virtual MapEditor* getMapEditor();		// get MapEditor (usually from parent);          FIXME not needed
   19.35  	virtual QPointF getRandPos();			// make randomised position
   19.36  
   19.37  	virtual void reposition();
   19.38 @@ -108,7 +113,7 @@
   19.39  											// of mapeditor e.g. in noteeditor
   19.40  	virtual bool repositionRequested();
   19.41  
   19.42 -	virtual void calcBBoxSizeWithChilds()=0;// calc size of  BBox including childs recursivly
   19.43 +	virtual void calcBBoxSizeWithChildren()=0;// calc size of  BBox including children recursivly
   19.44  
   19.45      virtual void select();
   19.46      virtual void unselect();
   19.47 @@ -120,13 +125,15 @@
   19.48      QPointF childPos;
   19.49      QPointF parPos;
   19.50  	bool link2ParPos;				// While moving around, sometimes link to parent
   19.51 -	MapEditor* mapEditor;			// for and toggleScroll(), get default styles
   19.52 +	MapEditor* mapEditor;			// for and toggleScroll(), get default styles	FIXME should not be needed with model available
   19.53  									// and mapEditor->updateActions()
   19.54  									// and mapEditor->updateSelection()
   19.55 +
   19.56 +	VymModel* model;												
   19.57      Orientation orientation;     
   19.58      qreal linkwidth;				// width of a link
   19.59      int depth;						// depth: undef=-1 mapCenter=0 branch=1..n
   19.60 -	QRectF bboxTotal;				// bounding box including childs
   19.61 +	QRectF bboxTotal;				// bounding box including children
   19.62  
   19.63      LinkableMapObj* childObj;
   19.64      LinkableMapObj* parObj;
    20.1 --- a/main.cpp	Wed Jul 16 10:44:44 2008 +0000
    20.2 +++ b/main.cpp	Wed Jul 16 10:46:14 2008 +0000
    20.3 @@ -1,5 +1,8 @@
    20.4  #include <QApplication>
    20.5  
    20.6 +#include <iostream>
    20.7 +using namespace std;
    20.8 +
    20.9  #include "flagrowobj.h"
   20.10  #include "mainwindow.h"
   20.11  #include "options.h"
    21.1 --- a/mainwindow.cpp	Wed Jul 16 10:44:44 2008 +0000
    21.2 +++ b/mainwindow.cpp	Wed Jul 16 10:46:14 2008 +0000
    21.3 @@ -79,8 +79,6 @@
    21.4  {
    21.5  	mainWindow=this;
    21.6  
    21.7 -	setObjectName ("MainWindow");
    21.8 -
    21.9  	setCaption ("VYM - View Your Mind");
   21.10  
   21.11  	// Load window settings
   21.12 @@ -496,6 +494,7 @@
   21.13  	editMenu->addAction (a);
   21.14  	actionEditPaste=a;
   21.15  
   21.16 +/*
   21.17      // Shortcuts to modify heading:
   21.18      a = new QAction(tr( "Edit heading","Edit menu" ),this);
   21.19  	a->setStatusTip ( tr( "edit Heading" ));
   21.20 @@ -513,6 +512,8 @@
   21.21  	actionListBranches.append(a);
   21.22  	editMenu->addAction (a);
   21.23  	actionEditHeading=a;
   21.24 +
   21.25 +*/	
   21.26      a = new QAction( tr( "Edit heading","Edit menu" ), this);
   21.27  	a->setStatusTip (tr( "edit Heading" ));
   21.28  	//a->setShortcut ( Qt::Key_F2 );					//Edit heading
   21.29 @@ -660,10 +661,10 @@
   21.30  	addAction (alt);
   21.31  	actionListBranches.append(actionEditToggleScroll);
   21.32  	
   21.33 -    a = new QAction( tr( "Unscroll childs","Edit menu" ), this);
   21.34 +    a = new QAction( tr( "Unscroll children","Edit menu" ), this);
   21.35  	a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" ));
   21.36  	editMenu->addAction (a);
   21.37 -    connect( a, SIGNAL( triggered() ), this, SLOT( editUnscrollChilds() ) );
   21.38 +    connect( a, SIGNAL( triggered() ), this, SLOT( editUnscrollChildren() ) );
   21.39  	
   21.40  	editMenu->addSeparator();
   21.41  
   21.42 @@ -803,24 +804,24 @@
   21.43  	actionListBranches.append(a);
   21.44  	actionEditSaveBranch=a;
   21.45  
   21.46 -	// Only remove branch, not its childs
   21.47 +	// Only remove branch, not its children
   21.48      a = new QAction(tr( "Remove only branch ","Edit menu" ), this);
   21.49 -	a->setStatusTip ( tr( "Remove only branch and keep its childs" ));
   21.50 +	a->setStatusTip ( tr( "Remove only branch and keep its children" ));
   21.51  	a->setShortcut (Qt::ALT + Qt::Key_Delete );
   21.52 -    connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteKeepChilds() ) );
   21.53 +    connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteKeepChildren() ) );
   21.54  	a->setEnabled (false);
   21.55  	addAction (a);
   21.56  	actionListBranches.append(a);
   21.57 -	actionEditDeleteKeepChilds=a;
   21.58 -
   21.59 -	// Only remove childs of a branch
   21.60 -    a = new QAction( tr( "Remove childs","Edit menu" ), this);
   21.61 -	a->setStatusTip (tr( "Remove childs of branch" ));
   21.62 +	actionEditDeleteKeepChildren=a;
   21.63 +
   21.64 +	// Only remove children of a branch
   21.65 +    a = new QAction( tr( "Remove children","Edit menu" ), this);
   21.66 +	a->setStatusTip (tr( "Remove children of branch" ));
   21.67  	a->setShortcut (Qt::SHIFT + Qt::Key_Delete );
   21.68 -    connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteChilds() ) );
   21.69 +    connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteChildren() ) );
   21.70  	a->setEnabled (false);
   21.71  	actionListBranches.append(a);
   21.72 -	actionEditDeleteChilds=a;
   21.73 +	actionEditDeleteChildren=a;
   21.74  
   21.75      // Shortcuts for navigating with cursor:
   21.76      a = new QAction(tr( "Select upper branch","Edit menu" ), this);
   21.77 @@ -1554,8 +1555,8 @@
   21.78  		branchRemoveContextMenu =branchContextMenu->addMenu (tr ("Remove","Context menu name"));
   21.79  		branchRemoveContextMenu->addAction (actionEditCut);
   21.80  		branchRemoveContextMenu->addAction ( actionEditDelete );
   21.81 -		branchRemoveContextMenu->addAction ( actionEditDeleteKeepChilds );
   21.82 -		branchRemoveContextMenu->addAction ( actionEditDeleteChilds );
   21.83 +		branchRemoveContextMenu->addAction ( actionEditDeleteKeepChildren );
   21.84 +		branchRemoveContextMenu->addAction ( actionEditDeleteChildren );
   21.85  		
   21.86  
   21.87  	actionEditSaveBranch->addTo( branchContextMenu );
   21.88 @@ -1690,12 +1691,24 @@
   21.89  
   21.90  MapEditor* Main::currentMapEditor() const
   21.91  {
   21.92 +	// FIXME currentMapEditor should return the latest used editor for a model, or NULL if no editor is open
   21.93      if ( tabWidget->currentPage() &&
   21.94  	 tabWidget->currentPage()->inherits( "MapEditor" ) )
   21.95  		return (MapEditor*)tabWidget->currentPage();
   21.96      return NULL;	
   21.97  }
   21.98  
   21.99 +VymModel* Main::currentModel() const
  21.100 +{
  21.101 +	// FIXME better get currentModel from a maintained list,
  21.102 +	// just in case we allow other views in tabs later
  21.103 +	MapEditor *me=currentMapEditor();
  21.104 +	if (me) 
  21.105 +		return me->getModel();
  21.106 +	else
  21.107 +		return NULL;
  21.108 +}
  21.109 +
  21.110  
  21.111  void Main::editorChanged(QWidget *)
  21.112  {
  21.113 @@ -1704,11 +1717,11 @@
  21.114  	MapEditor *me;
  21.115  	for (int i=0;i<=tabWidget->count() -1;i++)
  21.116  	{
  21.117 +		
  21.118  		me=(MapEditor*)tabWidget->page(i);
  21.119 -		me->unselect();
  21.120 +		me->getModel()->unselect();
  21.121  	}	
  21.122 -	me=currentMapEditor();
  21.123 -	if (me) me->reselect();
  21.124 +	currentModel()->reselect();
  21.125  
  21.126  	// Update actions to in menus and toolbars according to editor
  21.127  	updateActions();
  21.128 @@ -1716,8 +1729,10 @@
  21.129  
  21.130  void Main::fileNew()
  21.131  {
  21.132 +	VymModel *m=new VymModel;
  21.133 +	models.append (m);
  21.134 +	MapEditor* me = new MapEditor (m);
  21.135  	QString fn="unnamed";
  21.136 -	MapEditor* me = new MapEditor ( NULL);
  21.137  	tabWidget->addTab (me,fn);
  21.138  	tabWidget->showPage(me);
  21.139  	me->viewport()->setFocus();
  21.140 @@ -1725,7 +1740,7 @@
  21.141  	me->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
  21.142  	
  21.143  	// For the very first map we do not have flagrows yet...
  21.144 -	me->select("mc:");
  21.145 +	currentModel()->select("mc:");
  21.146  }
  21.147  
  21.148  void Main::fileNewCopy()
  21.149 @@ -1734,8 +1749,10 @@
  21.150  	MapEditor* oldME =currentMapEditor();
  21.151  	if (oldME)
  21.152  	{
  21.153 -		oldME->copy();
  21.154 -		MapEditor* newME = new MapEditor ( NULL);
  21.155 +		oldME->getModel()->copy();
  21.156 +		VymModel *m=new VymModel;
  21.157 +		models.append (m);
  21.158 +		MapEditor* newME = new MapEditor ( m);
  21.159  		if (newME)
  21.160  		{
  21.161  			tabWidget->addTab (newME,fn);
  21.162 @@ -1744,8 +1761,8 @@
  21.163  			newME->setAntiAlias (actionViewToggleAntiAlias->isOn());
  21.164  			newME->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn());
  21.165  			// For the very first map we do not have flagrows yet...
  21.166 -			newME->select("mc:");
  21.167 -			newME->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap);
  21.168 +			m->select("mc:");
  21.169 +			m->load (clipboardDir+"/"+clipboardFile,ImportReplace, VymMap);
  21.170  		}
  21.171  
  21.172  	}
  21.173 @@ -1770,7 +1787,7 @@
  21.174  		while (i<=tabWidget->count() -1)
  21.175  		{
  21.176  			me=(MapEditor*)tabWidget->page(i);
  21.177 -			if (me->getFilePath() == fn)
  21.178 +			if (me->getModel()->getFilePath() == fn)
  21.179  			{
  21.180  				// Already there, ask for confirmation
  21.181  				QMessageBox mb( vymName,
  21.182 @@ -1809,9 +1826,11 @@
  21.183  		// Check first, if mapeditor exists
  21.184  		// If it is not default AND we want a new map, 
  21.185  		// create a new mapeditor in a new tab
  21.186 -		if ( lmode==NewMap && (!me || !me->isDefault() ) )
  21.187 +		if ( lmode==NewMap && (!me || !me->getModel()->isDefault() )  )
  21.188  		{
  21.189 -			me= new MapEditor ( NULL);
  21.190 +			VymModel *m=new VymModel;
  21.191 +			models.append (m);
  21.192 +			me= new MapEditor ( m);
  21.193  			tabWidget->addTab (me,fn);
  21.194  			tabIndex=tabWidget->indexOf (me);
  21.195  			tabWidget->setCurrentPage (tabIndex);
  21.196 @@ -1821,8 +1840,6 @@
  21.197  		
  21.198  		// Check, if file exists (important for creating new files
  21.199  		// from command line
  21.200 -		/*
  21.201 -		*/
  21.202  		if (!QFile(fn).exists() )
  21.203  		{
  21.204  			QMessageBox mb( vymName,
  21.205 @@ -1838,9 +1855,9 @@
  21.206  			{
  21.207  				case QMessageBox::Yes:
  21.208  					// Create new map
  21.209 -					currentMapEditor()->setFilePath(fn);
  21.210 +					currentMapEditor()->getModel()->setFilePath(fn);
  21.211  					tabWidget->setTabLabel (currentMapEditor(),
  21.212 -						currentMapEditor()->getFileName() );
  21.213 +						currentMapEditor()->getModel()->getFileName() );
  21.214  					statusBar()->message( "Created " + fn , statusbarTime );
  21.215  					return success;
  21.216  						
  21.217 @@ -1852,6 +1869,7 @@
  21.218  			}
  21.219  		}	
  21.220  
  21.221 +
  21.222  		//tabWidget->currentPage() won't be NULL here, because of above...
  21.223  		tabWidget->showPage(me);
  21.224  		me->viewport()->setFocus();
  21.225 @@ -1859,15 +1877,15 @@
  21.226  		if (err!=aborted)
  21.227  		{
  21.228  			// Save existing filename in case  we import
  21.229 -			QString fn_org=me->getFilePath();
  21.230 +			QString fn_org=me->getModel()->getFilePath();
  21.231  
  21.232  			// Finally load map into mapEditor
  21.233 -			me->setFilePath (fn);
  21.234 -			err=me->load(fn,lmode,ftype);
  21.235 +			me->getModel()->setFilePath (fn);
  21.236 +			err=me->getModel()->load(fn,lmode,ftype);
  21.237  
  21.238  			// Restore old (maybe empty) filepath, if this is an import
  21.239  			if (lmode!=NewMap)
  21.240 -				me->setFilePath (fn_org);
  21.241 +				me->getModel()->setFilePath (fn_org);
  21.242  		}	
  21.243  
  21.244  		// Finally check for errors and go home
  21.245 @@ -1879,13 +1897,13 @@
  21.246  		{
  21.247  			if (lmode==NewMap)
  21.248  			{
  21.249 -				me->setFilePath (fn);
  21.250 -				tabWidget->changeTab(tabWidget->page(tabIndex), me->getFileName());
  21.251 +				me->getModel()->setFilePath (fn);
  21.252 +				tabWidget->changeTab(tabWidget->page(tabIndex), me->getModel()->getFileName());
  21.253  				if (!isInTmpDir (fn))
  21.254  				{
  21.255  					// Only append to lastMaps if not loaded from a tmpDir
  21.256  					// e.g. imported bookmarks are in a tmpDir
  21.257 -					addRecentMap(me->getFilePath() );
  21.258 +					addRecentMap(me->getModel()->getFilePath() );
  21.259  				}
  21.260  				actionFilePrint->setEnabled (true);
  21.261  			}	
  21.262 @@ -1960,40 +1978,40 @@
  21.263  	setupRecentMapsMenu();
  21.264  }
  21.265  
  21.266 -void Main::fileSave(MapEditor *me, const SaveMode &savemode)
  21.267 +void Main::fileSave(VymModel *m, const SaveMode &savemode)
  21.268  {
  21.269 -	if (!me) return;
  21.270 -
  21.271 -	if ( me->getFilePath().isEmpty() ) 
  21.272 +	if (!m) return;
  21.273 +
  21.274 +	if ( m->getFilePath().isEmpty() ) 
  21.275  	{
  21.276  		// We have  no filepath yet,
  21.277  		// call fileSaveAs() now, this will call fileSave() 
  21.278  		// again.
  21.279  		// First switch to editor
  21.280 -		tabWidget->setCurrentWidget (me);
  21.281 +		tabWidget->setCurrentWidget (m->getMapEditor());
  21.282  		fileSaveAs(savemode);
  21.283  	}
  21.284  
  21.285 -	if (me->save (savemode)==success)
  21.286 +	if (m->save (savemode)==success)
  21.287  	{
  21.288  		statusBar()->message( 
  21.289 -			tr("Saved  %1").arg(me->getFilePath()), 
  21.290 +			tr("Saved  %1").arg(m->getFilePath()), 
  21.291  			statusbarTime );
  21.292 -		addRecentMap (me->getFilePath() );
  21.293 +		addRecentMap (m->getFilePath() );
  21.294  	} else		
  21.295  		statusBar()->message( 
  21.296 -			tr("Couldn't save ").arg(me->getFilePath()), 
  21.297 +			tr("Couldn't save ").arg(m->getFilePath()), 
  21.298  			statusbarTime );
  21.299  }
  21.300  
  21.301  void Main::fileSave()
  21.302  {
  21.303 -	fileSave (currentMapEditor(), CompleteMap);
  21.304 +	fileSave (currentModel(), CompleteMap);
  21.305  }
  21.306  
  21.307 -void Main::fileSave(MapEditor *me)
  21.308 +void Main::fileSave(VymModel *m)
  21.309  {
  21.310 -	fileSave (me,CompleteMap);
  21.311 +	fileSave (m,CompleteMap);
  21.312  }
  21.313  
  21.314  void Main::fileSaveAs(const SaveMode& savemode)
  21.315 @@ -2048,13 +2066,13 @@
  21.316  
  21.317  
  21.318  			// Save now
  21.319 -			currentMapEditor()->setFilePath(fn);
  21.320 -			fileSave(currentMapEditor(), savemode);
  21.321 +			currentModel()->setFilePath(fn);
  21.322 +			fileSave(currentModel(), savemode);
  21.323  
  21.324  			// Set name of tab
  21.325  			if (savemode==CompleteMap)
  21.326  				tabWidget->setTabLabel (currentMapEditor(),
  21.327 -					currentMapEditor()->getFileName() );
  21.328 +					currentModel()->getFileName() );
  21.329  			return;
  21.330  		} 
  21.331  	}
  21.332 @@ -2070,7 +2088,7 @@
  21.333  	ImportKDEBookmarks im;
  21.334  	im.transform();
  21.335  	if (success==fileLoad (im.getTransformedFile(),NewMap) && currentMapEditor() )
  21.336 -		currentMapEditor()->setFilePath ("");
  21.337 +		currentMapEditor()->getModel()->setFilePath ("");
  21.338  }
  21.339  
  21.340  void Main::fileImportFirefoxBookmarks()
  21.341 @@ -2093,7 +2111,7 @@
  21.342  			if (im.transform() && 
  21.343  				success==fileLoad (im.getTransformedFile(),NewMap,FreemindMap) && 
  21.344  				currentMapEditor() )
  21.345 -				currentMapEditor()->setFilePath ("");
  21.346 +				currentMapEditor()->getModel()->setFilePath ("");
  21.347  			++it;
  21.348  		}
  21.349  	}
  21.350 @@ -2122,7 +2140,7 @@
  21.351  			fn = *it;
  21.352  			if ( fileLoad (fn,NewMap, FreemindMap)  )
  21.353  			{	
  21.354 -				currentMapEditor()->setFilePath ("");
  21.355 +				currentMapEditor()->getModel()->setFilePath ("");
  21.356  			}	
  21.357  			++it;
  21.358  		}
  21.359 @@ -2153,80 +2171,78 @@
  21.360  			if (im.transform() && 
  21.361  				success==fileLoad (im.getTransformedFile(),NewMap) && 
  21.362  				currentMapEditor() )
  21.363 -				currentMapEditor()->setFilePath ("");
  21.364 -
  21.365 +				currentMapEditor()->getModel()->setFilePath ("");
  21.366  			++it;
  21.367  		}
  21.368  	}
  21.369  	delete (fd);
  21.370 -
  21.371  }
  21.372  
  21.373  void Main::fileImportDir()
  21.374  {
  21.375 -	if (currentMapEditor())
  21.376 -		currentMapEditor()->importDir();	
  21.377 +	VymModel *m=currentModel();
  21.378 +	if (m) m->importDir();
  21.379  }
  21.380  
  21.381  void Main::fileExportXML()	
  21.382  {
  21.383 -	MapEditor *me=currentMapEditor();
  21.384 -	if (me) me->exportXML();
  21.385 +	VymModel *m=currentModel();
  21.386 +	if (m) m->exportXML();
  21.387  }
  21.388  
  21.389  
  21.390  void Main::fileExportXHTML()	
  21.391  {
  21.392 -	MapEditor *me=currentMapEditor();
  21.393 -	if (me) me->exportXHTML();
  21.394 +	VymModel *m=currentModel();
  21.395 +	if (m) m->exportXHTML();
  21.396  }
  21.397  
  21.398  void Main::fileExportImage()	
  21.399  {
  21.400 -	MapEditor *me=currentMapEditor();
  21.401 -	if (me) me->exportImage();
  21.402 +	VymModel *m=currentModel();
  21.403 +	if (m) m->exportImage();
  21.404  }
  21.405  
  21.406  void Main::fileExportASCII()
  21.407  {
  21.408 -	MapEditor *me=currentMapEditor();
  21.409 -	if (me) me->exportASCII();
  21.410 +	VymModel *m=currentModel();
  21.411 +	if (m) m->exportASCII();
  21.412  }
  21.413  
  21.414  void Main::fileExportCSV()	//FIXME not scriptable yet
  21.415  {
  21.416 -	MapEditor *me=currentMapEditor();
  21.417 -	if (me)
  21.418 +	VymModel *m=currentModel();
  21.419 +	if (m)
  21.420  	{
  21.421  		ExportCSV ex;
  21.422 -		ex.setModel (me->getModel());
  21.423 +		ex.setModel (m);
  21.424  		ex.addFilter ("CSV (*.csv)");
  21.425  		ex.setDir(lastImageDir);
  21.426  		ex.setCaption(vymName+ " -" +tr("Export as CSV")+" "+tr("(still experimental)"));
  21.427  		if (ex.execDialog() ) 
  21.428  		{
  21.429 -			me->setExportMode(true);
  21.430 +			m->setExportMode(true);
  21.431  			ex.doExport();
  21.432 -			me->setExportMode(false);
  21.433 +			m->setExportMode(false);
  21.434  		}
  21.435  	}
  21.436  }
  21.437  
  21.438  void Main::fileExportLaTeX()	//FIXME not scriptable yet
  21.439  {
  21.440 -	MapEditor *me=currentMapEditor();
  21.441 -	if (me)
  21.442 +	VymModel *m=currentModel();
  21.443 +	if (m)
  21.444  	{
  21.445  		ExportLaTeX ex;
  21.446 -		ex.setModel (me->getModel());
  21.447 +		ex.setModel (m);
  21.448  		ex.addFilter ("Tex (*.tex)");
  21.449  		ex.setDir(lastImageDir);
  21.450  		ex.setCaption(vymName+ " -" +tr("Export as LaTeX")+" "+tr("(still experimental)"));
  21.451  		if (ex.execDialog() ) 
  21.452  		{
  21.453 -			me->setExportMode(true);
  21.454 +			m->setExportMode(true);
  21.455  			ex.doExport();
  21.456 -			me->setExportMode(false);
  21.457 +			m->setExportMode(false);
  21.458  		}
  21.459  	}
  21.460  }
  21.461 @@ -2234,10 +2250,10 @@
  21.462  void Main::fileExportKDEBookmarks()	//FIXME not scriptable yet
  21.463  {
  21.464  	ExportKDEBookmarks ex;
  21.465 -	MapEditor *me=currentMapEditor();
  21.466 -	if (me)
  21.467 +	VymModel *m=currentModel();
  21.468 +	if (m)
  21.469  	{
  21.470 -		ex.setModel (me->getModel());
  21.471 +		ex.setModel (m);
  21.472  		ex.doExport();
  21.473  	}	
  21.474  }
  21.475 @@ -2245,18 +2261,18 @@
  21.476  void Main::fileExportTaskjuggler()	//FIXME not scriptable yet
  21.477  {
  21.478  	ExportTaskjuggler ex;
  21.479 -	MapEditor *me=currentMapEditor();
  21.480 -	if (me)
  21.481 +	VymModel *m=currentModel();
  21.482 +	if (m)
  21.483  	{
  21.484 -		ex.setModel (me->getModel());
  21.485 +		ex.setModel (m);
  21.486  		ex.setCaption ( vymName+" - "+tr("Export to")+" Taskjuggler"+tr("(still experimental)"));
  21.487  		ex.setDir(lastImageDir);
  21.488  		ex.addFilter ("Taskjuggler (*.tjp)");
  21.489  		if (ex.execDialog() ) 
  21.490  		{
  21.491 -			me->setExportMode(true);
  21.492 +			m->setExportMode(true);
  21.493  			ex.doExport();
  21.494 -			me->setExportMode(false);
  21.495 +			m->setExportMode(false);
  21.496  		}
  21.497  	}	
  21.498  }
  21.499 @@ -2282,8 +2298,8 @@
  21.500  				fn +=".odp";
  21.501  
  21.502  			//lastImageDir=fn.left(fn.findRev ("/"));
  21.503 -			if (currentMapEditor())
  21.504 -				currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());	
  21.505 +			VymModel *m=currentModel();
  21.506 +			if (m) m->exportOOPresentation(fn,fd->selectedConfig());	
  21.507  		}
  21.508  	} else
  21.509  	{
  21.510 @@ -2296,12 +2312,13 @@
  21.511  void Main::fileCloseMap()
  21.512  {
  21.513  	MapEditor *me = currentMapEditor();
  21.514 -	if (me)
  21.515 +	VymModel *m=currentModel();
  21.516 +	if (m)
  21.517  	{
  21.518 -		if (me->hasChanged())
  21.519 +		if (m->hasChanged())
  21.520  		{
  21.521  			QMessageBox mb( vymName,
  21.522 -				tr("The map %1 has been modified but not saved yet. Do you want to").arg(me->getFileName()),
  21.523 +				tr("The map %1 has been modified but not saved yet. Do you want to").arg(me->getModel()->getFileName()),
  21.524  				QMessageBox::Warning,
  21.525  				QMessageBox::Yes | QMessageBox::Default,
  21.526  				QMessageBox::No,
  21.527 @@ -2312,7 +2329,7 @@
  21.528  			{
  21.529  				case QMessageBox::Yes:
  21.530  					// save and close
  21.531 -					fileSave(me, CompleteMap);
  21.532 +					fileSave(m, CompleteMap);
  21.533  					break;
  21.534  				case QMessageBox::No:
  21.535  				// close  without saving
  21.536 @@ -2322,13 +2339,12 @@
  21.537  				return;
  21.538  			}
  21.539  		} 
  21.540 -		//me->closeMap(); 
  21.541 -		tabWidget->removePage(me);
  21.542 +		//me->closeMap(); FIXME should not be necessary any longer
  21.543 +		me->close();
  21.544 +		tabWidget->removePage(m->getMapEditor());
  21.545  		if (tabWidget->count()==0)
  21.546  			actionFilePrint->setEnabled (false);
  21.547 -
  21.548 -        //delete me;
  21.549 -		me->clear();
  21.550 +        delete me;
  21.551  	}
  21.552  }
  21.553  
  21.554 @@ -2349,7 +2365,7 @@
  21.555  		me=(MapEditor*)tabWidget->page(i);
  21.556  
  21.557  		// If something changed, ask what to do
  21.558 -		if (me->hasChanged())
  21.559 +		if (me->getModel()->hasChanged())
  21.560  		{
  21.561  			tabWidget->setCurrentPage(i);
  21.562  			QMessageBox mb( vymName,
  21.563 @@ -2366,7 +2382,7 @@
  21.564  			switch( mb.exec() ) {
  21.565  				case QMessageBox::Yes:
  21.566  					// save (the changed editors) and exit
  21.567 -					fileSave(currentMapEditor(), CompleteMap);
  21.568 +					fileSave(currentModel(), CompleteMap);
  21.569  					break;
  21.570  				case QMessageBox::No:
  21.571  					// exit without saving
  21.572 @@ -2382,38 +2398,38 @@
  21.573  
  21.574  void Main::editUndo()
  21.575  {
  21.576 -	if (currentMapEditor())
  21.577 -		currentMapEditor()->undo();
  21.578 +	VymModel *m=currentModel();
  21.579 +	if (m) m->undo();
  21.580  }
  21.581  
  21.582  void Main::editRedo()	   
  21.583  {
  21.584 -	if (currentMapEditor())
  21.585 -		currentMapEditor()->redo();
  21.586 +	VymModel *m=currentModel();
  21.587 +	if (m) m->redo();
  21.588  }
  21.589  
  21.590  void Main::gotoHistoryStep (int i)	   
  21.591  {
  21.592 -	if (currentMapEditor())
  21.593 -		currentMapEditor()->gotoHistoryStep (i);
  21.594 +	VymModel *m=currentModel();
  21.595 +	if (m) m->gotoHistoryStep(i);
  21.596  }
  21.597  
  21.598  void Main::editCopy()
  21.599  {
  21.600 -	if (currentMapEditor())
  21.601 -		currentMapEditor()->copy();
  21.602 +	VymModel *m=currentModel();
  21.603 +	if (m) m->copy();
  21.604  }
  21.605  
  21.606  void Main::editPaste()
  21.607  {
  21.608 -	if (currentMapEditor())
  21.609 -		currentMapEditor()->paste();
  21.610 +	VymModel *m=currentModel();
  21.611 +	if (m) m->paste();
  21.612  }
  21.613  
  21.614  void Main::editCut()
  21.615  {
  21.616 -	if (currentMapEditor())
  21.617 -		currentMapEditor()->cut();
  21.618 +	VymModel *m=currentModel();
  21.619 +	if (m) m->cut();
  21.620  }
  21.621  
  21.622  void Main::editOpenFindWindow()
  21.623 @@ -2425,21 +2441,26 @@
  21.624  
  21.625  void Main::editFind(QString s)
  21.626  {
  21.627 -	bool cs=false;
  21.628 -	BranchObj *bo=currentMapEditor()->findText(s, cs);
  21.629 -	if (bo)
  21.630 -	{	
  21.631 -		statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
  21.632 -	} else
  21.633 +	VymModel *m=currentModel();
  21.634 +	if (m)
  21.635  	{
  21.636 -		QMessageBox::information( findWindow, tr( "VYM -Information:" ),
  21.637 -							   tr("No matches found for \"%1\"").arg(s));
  21.638 -	}	
  21.639 +		bool cs=false;
  21.640 +		BranchObj *bo=m->findText(s, cs);
  21.641 +		if (bo)
  21.642 +		{	
  21.643 +			statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
  21.644 +		} else
  21.645 +		{
  21.646 +			QMessageBox::information( findWindow, tr( "VYM -Information:" ),
  21.647 +								   tr("No matches found for \"%1\"").arg(s));
  21.648 +		}	
  21.649 +	}
  21.650  }
  21.651  
  21.652  void Main::editFindChanged()
  21.653  {	// Notify editor, to abort the current find process
  21.654 -	currentMapEditor()->findReset();
  21.655 +	VymModel *m=currentModel();
  21.656 +	if (m) m->findReset();
  21.657  }
  21.658  
  21.659  void Main::openTabs(QStringList urls)
  21.660 @@ -2527,9 +2548,10 @@
  21.661  void Main::editOpenURL()
  21.662  {
  21.663  	// Open new browser
  21.664 -	if (currentMapEditor())
  21.665 +	VymModel *m=currentModel();
  21.666 +	if (m)
  21.667  	{	
  21.668 -	    QString url=currentMapEditor()->getURL();
  21.669 +	    QString url=m->getURL();
  21.670  		QStringList args;
  21.671  		if (url=="") return;
  21.672  		QString browser=settings.value("/mainwindow/readerURL" ).toString();
  21.673 @@ -2549,19 +2571,21 @@
  21.674  }
  21.675  void Main::editOpenURLTab()
  21.676  {
  21.677 -	if (currentMapEditor())
  21.678 +	VymModel *m=currentModel();
  21.679 +	if (m)
  21.680  	{	
  21.681  	    QStringList urls;
  21.682 -		urls.append(currentMapEditor()->getURL());
  21.683 +		urls.append(m->getURL());
  21.684  		openTabs (urls);
  21.685  	}	
  21.686  }
  21.687  void Main::editOpenMultipleURLTabs()
  21.688  {
  21.689 -	if (currentMapEditor())
  21.690 +	VymModel *m=currentModel();
  21.691 +	if (m)
  21.692  	{	
  21.693  	    QStringList urls;
  21.694 -		urls=currentMapEditor()->getURLs();
  21.695 +		urls=m->getURLs();
  21.696  		openTabs (urls);
  21.697  	}	
  21.698  }
  21.699 @@ -2569,49 +2593,58 @@
  21.700  
  21.701  void Main::editURL()
  21.702  {
  21.703 -	if (currentMapEditor())
  21.704 -	    currentMapEditor()->editURL();
  21.705 +	VymModel *m=currentModel();
  21.706 +	if (m) m->editURL();
  21.707  }
  21.708  
  21.709  void Main::editLocalURL()
  21.710  {
  21.711 -	if (currentMapEditor())
  21.712 -	    currentMapEditor()->editLocalURL();
  21.713 +	VymModel *m=currentModel();
  21.714 +	if (m) m->editLocalURL();
  21.715  }
  21.716  
  21.717  void Main::editHeading2URL()
  21.718  {
  21.719 -	if (currentMapEditor())
  21.720 -	    currentMapEditor()->editHeading2URL();
  21.721 +	VymModel *m=currentModel();
  21.722 +	if (m) m->editHeading2URL();
  21.723  }
  21.724  
  21.725  void Main::editBugzilla2URL()
  21.726  {
  21.727 -	if (currentMapEditor())
  21.728 -	    currentMapEditor()->editBugzilla2URL();
  21.729 +	VymModel *m=currentModel();
  21.730 +	if (m) m->editBugzilla2URL();
  21.731  }
  21.732  
  21.733  void Main::editFATE2URL()
  21.734  {
  21.735 -	if (currentMapEditor())
  21.736 -	    currentMapEditor()->editFATE2URL();
  21.737 +	VymModel *m=currentModel();
  21.738 +	if (m) m->editFATE2URL();
  21.739  }
  21.740  
  21.741 -void Main::editHeadingFinished()
  21.742 +void Main::editHeadingFinished(VymModel *m)
  21.743  {
  21.744 +	if (m)
  21.745 +	{
  21.746 +		if (!actionSettingsAutoSelectNewBranch->isOn() && 
  21.747 +			!prevSelection.isEmpty()) 
  21.748 +			m->select(prevSelection);
  21.749 +		prevSelection="";
  21.750 +	}
  21.751 +
  21.752 +/* FIXME old code, remove now
  21.753  	// only called from editHeading(), so there is a currentME
  21.754 -	MapEditor *me=currentMapEditor();
  21.755 -	if (me)
  21.756 +	VymModel *m=currentModel();
  21.757 +	if (m)
  21.758  	{
  21.759 -		me->setStateEditHeading (false);
  21.760 +		m->setSelectionBlocked (false);
  21.761  		QPoint p;	//Not used here, only to find out pos of branch
  21.762  		bool ok;
  21.763 -		QString s=me->getHeading(ok,p);
  21.764 +		QString s=m->getHeading(ok,p);
  21.765  
  21.766  #if defined(Q_OS_MACX) || defined(Q_OS_WIN32)
  21.767  #else
  21.768  		if (ok && s!=lineedit->text())
  21.769 -			me->setHeading(lineedit->text());
  21.770 +			m->setHeading(lineedit->text());
  21.771  			
  21.772  		lineedit->releaseKeyboard();
  21.773  		lineedit->hide();
  21.774 @@ -2619,17 +2652,20 @@
  21.775  #endif	
  21.776  		if (!actionSettingsAutoSelectNewBranch->isOn() && 
  21.777  			!prevSelection.isEmpty()) 
  21.778 -			me->select(prevSelection);
  21.779 +			m->select(prevSelection);
  21.780  		prevSelection="";
  21.781  	}
  21.782 +*/
  21.783  }
  21.784  
  21.785 +/*
  21.786  void Main::editHeading()
  21.787  {
  21.788 -	if (currentMapEditor())
  21.789 +	MapEditor *me=currentMapEditor();
  21.790 +	VymModel *m=currentModel();
  21.791 +	if (me && m)
  21.792  	{
  21.793 -		MapEditor *me=currentMapEditor();
  21.794 -		QString oldSel=me->getSelectString();
  21.795 +		QString oldSel=m->getSelectString();
  21.796  
  21.797  		if (lineedit->isVisible())
  21.798  			editHeadingFinished();
  21.799 @@ -2637,11 +2673,11 @@
  21.800  		{
  21.801  			bool ok;
  21.802  			QPoint p;
  21.803 -			QString s=me->getHeading(ok,p);
  21.804 +			QString s=m->getHeading(ok,p);
  21.805  
  21.806  			if (ok)
  21.807  			{
  21.808 -				me->setStateEditHeading (true);
  21.809 +				m->setSelectionBlocked(true);
  21.810  #if defined(Q_OS_MACX) || defined(Q_OS_WIN32)
  21.811  				p=me->mapToGlobal (p);
  21.812  				QDialog *d =new QDialog(NULL);
  21.813 @@ -2654,7 +2690,7 @@
  21.814  				connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
  21.815  				d->activateWindow();
  21.816  				d->exec();
  21.817 -				me->setHeading (le->text());
  21.818 +				m->setHeading (le->text());
  21.819  				delete (le);
  21.820  				delete (d);
  21.821  				editHeadingFinished();
  21.822 @@ -2670,8 +2706,9 @@
  21.823  #endif
  21.824  			}
  21.825  		}
  21.826 -	} // currentMapEditor()	
  21.827 +	}
  21.828  }
  21.829 +*/	
  21.830  
  21.831  void Main::editAttributeFinished()
  21.832  {
  21.833 @@ -2707,10 +2744,11 @@
  21.834  #include "attributedialog.h"
  21.835  void Main::editAttribute()
  21.836  {
  21.837 +/*
  21.838  	MapEditor *me=currentMapEditor();
  21.839  	if (me)
  21.840  	{
  21.841 -		BranchObj *bo=me->getSelectedBranch();
  21.842 +		BranchObj *bo=me->getModel()->getSelectedBranch();
  21.843  		if (bo)
  21.844  		{
  21.845  			AttributeDialog dia(this);
  21.846 @@ -2721,6 +2759,7 @@
  21.847  			dia.exec();
  21.848  		}
  21.849  	}	
  21.850 +	*/
  21.851  	/*
  21.852  	if (currentMapEditor())
  21.853  	{
  21.854 @@ -2782,7 +2821,7 @@
  21.855  		for (i=0;i<=tabWidget->count() -1;i++)
  21.856  		{
  21.857  			me=(MapEditor*)tabWidget->page(i);
  21.858 -			if (vl.at(j)==me->getFilePath() )
  21.859 +			if (vl.at(j)==me->getModel()->getFilePath() )
  21.860  			{
  21.861  				index=i;
  21.862  				break;
  21.863 @@ -2807,10 +2846,11 @@
  21.864  
  21.865  void Main::editOpenVymLink()
  21.866  {
  21.867 -	if (currentMapEditor())
  21.868 +	VymModel *m=currentModel();
  21.869 +	if (m)
  21.870  	{
  21.871  		QStringList vl;
  21.872 -		vl.append(currentMapEditor()->getVymLink());	
  21.873 +		vl.append(m->getVymLink());	
  21.874  		openVymLinks (vl);
  21.875  	}
  21.876  }
  21.877 @@ -2818,168 +2858,204 @@
  21.878  void Main::editOpenMultipleVymLinks()
  21.879  {
  21.880  	QString currentVymLink;
  21.881 -	if (currentMapEditor())
  21.882 +	VymModel *m=currentModel();
  21.883 +	if (m)
  21.884  	{
  21.885 -		QStringList vl=currentMapEditor()->getVymLinks();
  21.886 +		QStringList vl=m->getVymLinks();
  21.887  		openVymLinks (vl);
  21.888  	}
  21.889  }
  21.890  
  21.891  void Main::editVymLink()
  21.892  {
  21.893 -	if (currentMapEditor())
  21.894 -		currentMapEditor()->editVymLink();	
  21.895 +	VymModel *m=currentModel();
  21.896 +	if (m)
  21.897 +		m->editVymLink();	
  21.898  }
  21.899  
  21.900  void Main::editDeleteVymLink()
  21.901  {
  21.902 -	if (currentMapEditor())
  21.903 -		currentMapEditor()->deleteVymLink();	
  21.904 +	VymModel *m=currentModel();
  21.905 +	if (m) m->deleteVymLink();	
  21.906  }
  21.907  
  21.908  void Main::editToggleHideExport()
  21.909  {
  21.910 -	if (currentMapEditor())
  21.911 -		currentMapEditor()->toggleHideExport();	
  21.912 +	VymModel *m=currentModel();
  21.913 +	if (m) m->toggleHideExport();	
  21.914  }
  21.915  
  21.916  void Main::editMapInfo()
  21.917  {
  21.918 -	if (currentMapEditor())
  21.919 -		currentMapEditor()->editMapInfo();	
  21.920 +	VymModel *m=currentModel();
  21.921 +
  21.922 +	ExtraInfoDialog dia;
  21.923 +	dia.setMapName (m->getFileName() );
  21.924 +	dia.setAuthor (m->getAuthor() );
  21.925 +	dia.setComment(m->getComment() );
  21.926 +
  21.927 +/* FIXME no stats at the moment (view dependent...)
  21.928 +	// Calc some stats
  21.929 +	QString stats;
  21.930 +    stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6);
  21.931 +
  21.932 +	uint b=0;
  21.933 +	uint f=0;
  21.934 +	uint n=0;
  21.935 +	uint xl=0;
  21.936 +	BranchObj *bo;
  21.937 +	bo=m->first();
  21.938 +	while (bo) 
  21.939 +	{
  21.940 +		if (!bo->getNote().isEmpty() ) n++;
  21.941 +		f+= bo->countFloatImages();
  21.942 +		b++;
  21.943 +		xl+=bo->countXLinks();
  21.944 +		bo=m->next(bo);
  21.945 +	}
  21.946 +    stats+=QString ("%1 branches\n").arg (b-1,6);
  21.947 +    stats+=QString ("%1 xLinks \n").arg (xl,6);
  21.948 +    stats+=QString ("%1 notes\n").arg (n,6);
  21.949 +    stats+=QString ("%1 images\n").arg (f,6);
  21.950 +	dia.setStats (stats);
  21.951 +
  21.952 +*/
  21.953 +	// Finally show dialog
  21.954 +	if (dia.exec() == QDialog::Accepted)
  21.955 +	{
  21.956 +		m->setAuthor (dia.getAuthor() );
  21.957 +		m->setComment (dia.getComment() );
  21.958 +	}
  21.959  }
  21.960  
  21.961  void Main::editMoveUp()
  21.962  {
  21.963 -	if (currentMapEditor())
  21.964 -	    currentMapEditor()->moveBranchUp();
  21.965 +	VymModel *m=currentModel();
  21.966 +	if (m) m->moveBranchUp();
  21.967  }
  21.968  
  21.969  void Main::editMoveDown()
  21.970  {
  21.971 -	if (currentMapEditor())
  21.972 -		currentMapEditor()->moveBranchDown();
  21.973 +	VymModel *m=currentModel();
  21.974 +	if (m) m->moveBranchDown();
  21.975  }
  21.976  
  21.977  void Main::editSortChildren()
  21.978  {
  21.979 -	if (currentMapEditor())
  21.980 -		currentMapEditor()->sortChildren();
  21.981 +	VymModel *m=currentModel();
  21.982 +	if (m) m->sortChildren();
  21.983  }
  21.984  
  21.985  void Main::editToggleScroll()
  21.986  {
  21.987 -	if (currentMapEditor())
  21.988 +	VymModel *m=currentModel();
  21.989 +	if (m) m->toggleScroll();
  21.990 +}
  21.991 +
  21.992 +void Main::editUnscrollChildren()
  21.993 +{
  21.994 +	VymModel *m=currentModel();
  21.995 +	if (m) m->unscrollChildren();
  21.996 +}
  21.997 +
  21.998 +void Main::editAddMapCenter()
  21.999 +{
 21.1000 +	VymModel *m=currentModel();
 21.1001 +	if (!lineedit->isVisible() && m)
 21.1002  	{
 21.1003 -		currentMapEditor()->toggleScroll();	
 21.1004 +		m->addMapCenter ();
 21.1005  	}	
 21.1006  }
 21.1007  
 21.1008 -void Main::editUnscrollChilds()
 21.1009 -{
 21.1010 -	if (currentMapEditor())
 21.1011 -		currentMapEditor()->unscrollChilds();	
 21.1012 -}
 21.1013 -
 21.1014 -void Main::editAddMapCenter()
 21.1015 -{
 21.1016 -	MapEditor *me=currentMapEditor();
 21.1017 -	if (!lineedit->isVisible() && me)
 21.1018 -	{
 21.1019 -		me->addMapCenter ();
 21.1020 -	}	
 21.1021 -}
 21.1022 -
 21.1023  void Main::editNewBranch()
 21.1024  {
 21.1025 -	MapEditor *me=currentMapEditor();
 21.1026 -	if (!lineedit->isVisible() && me)
 21.1027 +	VymModel *m=currentModel();
 21.1028 +	if (!lineedit->isVisible() && m)
 21.1029  	{
 21.1030 -		BranchObj *bo=(BranchObj*)me->getSelection();
 21.1031 -		BranchObj *newbo=me->addNewBranch(0);
 21.1032 -
 21.1033 -		prevSelection=me->getModel()->getSelectString(bo);
 21.1034 +		BranchObj *bo=(BranchObj*)m->getSelection();
 21.1035 +		BranchObj *newbo=m->addNewBranch(0);
 21.1036 +
 21.1037 +		prevSelection=m->getSelectString(bo);
 21.1038  		if (newbo) 
 21.1039 -			me->select (newbo);
 21.1040 +			m->select (newbo);
 21.1041  		else
 21.1042  			return;
 21.1043  
 21.1044  		if (actionSettingsAutoEditNewBranch->isOn())
 21.1045  		{
 21.1046 -			editHeading();
 21.1047 +			currentMapEditor()->editHeading();
 21.1048  			return;
 21.1049  		}	
 21.1050  		if (!prevSelection.isEmpty()) 
 21.1051  		{
 21.1052 -			me->select(prevSelection);
 21.1053 +			m->select(prevSelection);
 21.1054  			prevSelection="";
 21.1055  		}
 21.1056 -
 21.1057  	}	
 21.1058  }
 21.1059  
 21.1060  void Main::editNewBranchBefore()
 21.1061  {
 21.1062 -	MapEditor *me=currentMapEditor();
 21.1063 -	if (!lineedit->isVisible() && me)
 21.1064 +	VymModel *m=currentModel();
 21.1065 +	if (!lineedit->isVisible() &&  m)
 21.1066  	{
 21.1067 -		BranchObj *bo=(BranchObj*)me->getSelection();
 21.1068 -		BranchObj *newbo=me->addNewBranchBefore();
 21.1069 +		BranchObj *bo=(BranchObj*)m->getSelection();
 21.1070 +		BranchObj *newbo=m->addNewBranchBefore();
 21.1071  
 21.1072  		if (newbo) 
 21.1073 -			me->select (newbo);
 21.1074 +			m->select (newbo);
 21.1075  		else
 21.1076  			return;
 21.1077  
 21.1078  		if (actionSettingsAutoEditNewBranch->isOn())
 21.1079  		{
 21.1080  			if (!actionSettingsAutoSelectNewBranch->isOn())
 21.1081 -				prevSelection=me->getModel()->getSelectString(bo); //TODO access directly
 21.1082 -			editHeading();
 21.1083 +				prevSelection=m->getSelectString(bo); 
 21.1084 +			currentMapEditor()->editHeading();
 21.1085  		}
 21.1086  	}	
 21.1087  }
 21.1088  
 21.1089  void Main::editNewBranchAbove()
 21.1090  {
 21.1091 -	MapEditor *me=currentMapEditor();
 21.1092 -	if (!lineedit->isVisible() && me)
 21.1093 +	VymModel *m=currentModel();
 21.1094 +	if (!lineedit->isVisible() &&  m)
 21.1095  	{
 21.1096 -		BranchObj *bo=(BranchObj*)me->getSelection();
 21.1097 -		BranchObj *newbo=me->addNewBranch (-1);
 21.1098 +		BranchObj *bo=(BranchObj*)m->getSelection();
 21.1099 +		BranchObj *newbo=m->addNewBranch (-1);
 21.1100  
 21.1101  		if (newbo) 
 21.1102 -			me->select (newbo);
 21.1103 +			m->select (newbo);
 21.1104  		else
 21.1105  			return;
 21.1106  
 21.1107  		if (actionSettingsAutoEditNewBranch->isOn())
 21.1108  		{
 21.1109  			if (!actionSettingsAutoSelectNewBranch->isOn())
 21.1110 -				prevSelection=me->getModel()->getSelectString (bo);	// TODO access directly
 21.1111 -			editHeading();
 21.1112 +				prevSelection=m->getSelectString (bo);	
 21.1113 +			currentMapEditor()->editHeading();
 21.1114  		}
 21.1115  	}	
 21.1116  }
 21.1117  
 21.1118  void Main::editNewBranchBelow()
 21.1119  {
 21.1120 -	MapEditor *me=currentMapEditor();
 21.1121 -	if (!lineedit->isVisible() && me)
 21.1122 +	VymModel *m=currentModel();
 21.1123 +	if (!lineedit->isVisible() &&  m)
 21.1124  	{
 21.1125 -		BranchObj *bo=(BranchObj*)me->getSelection();
 21.1126 -		BranchObj *newbo=me->addNewBranch (1);
 21.1127 +		BranchObj *bo=(BranchObj*)m->getSelection();
 21.1128 +		BranchObj *newbo=m->addNewBranch (1);
 21.1129  
 21.1130  		if (newbo) 
 21.1131 -			me->select (newbo);
 21.1132 +			m->select (newbo);
 21.1133  		else
 21.1134  			return;
 21.1135  
 21.1136  		if (actionSettingsAutoEditNewBranch->isOn())
 21.1137  		{
 21.1138  			if (!actionSettingsAutoSelectNewBranch->isOn())
 21.1139 -				prevSelection=me->getModel()->getSelectString(bo);	//TODO access directly
 21.1140 -			editHeading();
 21.1141 +				prevSelection=m->getSelectString(bo);
 21.1142 +			currentMapEditor()->editHeading();
 21.1143  		}
 21.1144  	}	
 21.1145  }
 21.1146 @@ -2999,99 +3075,100 @@
 21.1147  	fileSaveAs (PartOfMap);
 21.1148  }
 21.1149  
 21.1150 -void Main::editDeleteKeepChilds()
 21.1151 +void Main::editDeleteKeepChildren()
 21.1152  {
 21.1153 -	if (currentMapEditor())
 21.1154 -		currentMapEditor()->deleteKeepChilds();
 21.1155 +	VymModel *m=currentModel();
 21.1156 +	 if (m) m->deleteKeepChildren();
 21.1157  }
 21.1158  
 21.1159 -void Main::editDeleteChilds()
 21.1160 +void Main::editDeleteChildren()
 21.1161  {
 21.1162 -	if (currentMapEditor())
 21.1163 -		currentMapEditor()->deleteChilds();
 21.1164 +	VymModel *m=currentModel();
 21.1165 +	if (m) m->deleteChildren();
 21.1166  }
 21.1167  
 21.1168  void Main::editDeleteSelection()
 21.1169  {
 21.1170 -	if (currentMapEditor() && actionSettingsUseDelKey->isOn())
 21.1171 -		currentMapEditor()->deleteSelection();
 21.1172 +	VymModel *m=currentModel();
 21.1173 +	if (m && actionSettingsUseDelKey->isOn())
 21.1174 +		m->deleteSelection();
 21.1175  }
 21.1176  
 21.1177  void Main::editUpperBranch()
 21.1178  {
 21.1179 -	if (currentMapEditor())
 21.1180 -		currentMapEditor()->selectUpperBranch();
 21.1181 +	VymModel *m=currentModel();
 21.1182 +	if (m) m->selectUpperBranch();
 21.1183  }
 21.1184  
 21.1185  void Main::editLowerBranch()
 21.1186  {
 21.1187 -	if (currentMapEditor())
 21.1188 -		currentMapEditor()->selectLowerBranch();
 21.1189 +	VymModel *m=currentModel();
 21.1190 +	if (m) m->selectLowerBranch();
 21.1191  }
 21.1192  
 21.1193  void Main::editLeftBranch()
 21.1194  {
 21.1195 -	if (currentMapEditor())
 21.1196 -		currentMapEditor()->selectLeftBranch();
 21.1197 +	VymModel *m=currentModel();
 21.1198 +	if (m) m->selectLeftBranch();
 21.1199  }
 21.1200  
 21.1201  void Main::editRightBranch()
 21.1202  {
 21.1203 -	if (currentMapEditor())
 21.1204 -		currentMapEditor()->selectRightBranch();
 21.1205 +	VymModel *m=currentModel();
 21.1206 +	if (m) m->selectRightBranch();
 21.1207  }
 21.1208  
 21.1209  void Main::editFirstBranch()
 21.1210  {
 21.1211 -	if (currentMapEditor())
 21.1212 -		currentMapEditor()->selectFirstBranch();
 21.1213 +	VymModel *m=currentModel();
 21.1214 +	if (m) m->selectFirstBranch();
 21.1215  }
 21.1216  
 21.1217  void Main::editLastBranch()
 21.1218  {
 21.1219 -	if (currentMapEditor())
 21.1220 -		currentMapEditor()->selectLastBranch();
 21.1221 +	VymModel *m=currentModel();
 21.1222 +	if (m) m->selectLastBranch();
 21.1223  }
 21.1224  
 21.1225  void Main::editLoadImage()
 21.1226  {
 21.1227 -	if (currentMapEditor())
 21.1228 -		currentMapEditor()->loadFloatImage();
 21.1229 +	VymModel *m=currentModel();
 21.1230 +	if (m) m->loadFloatImage();
 21.1231  }
 21.1232  
 21.1233  void Main::editSaveImage()
 21.1234  {
 21.1235 -	if (currentMapEditor())
 21.1236 -		currentMapEditor()->saveFloatImage();
 21.1237 +	VymModel *m=currentModel();
 21.1238 +	if (m) m->saveFloatImage();
 21.1239  }
 21.1240  
 21.1241  void Main::editFollowXLink(QAction *a)
 21.1242  {
 21.1243  
 21.1244 -	if (currentMapEditor())
 21.1245 -		currentMapEditor()->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
 21.1246 +	VymModel *m=currentModel();
 21.1247 +	if (m)
 21.1248 +		m->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
 21.1249  }
 21.1250  
 21.1251  void Main::editEditXLink(QAction *a)
 21.1252  {
 21.1253 -	if (currentMapEditor())
 21.1254 -		currentMapEditor()->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
 21.1255 +	VymModel *m=currentModel();
 21.1256 +	if (m)
 21.1257 +		m->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
 21.1258  }
 21.1259  
 21.1260  void Main::formatSelectColor()
 21.1261  {
 21.1262 -	if (currentMapEditor())
 21.1263 -	{
 21.1264 -		QColor col = QColorDialog::getColor((currentColor ), this );
 21.1265 -		if ( !col.isValid() ) return;
 21.1266 -		colorChanged( col );
 21.1267 -	}	
 21.1268 +	QColor col = QColorDialog::getColor((currentColor ), this );
 21.1269 +	if ( !col.isValid() ) return;
 21.1270 +	colorChanged( col );
 21.1271  }
 21.1272  
 21.1273  void Main::formatPickColor()
 21.1274  {
 21.1275 -	if (currentMapEditor())
 21.1276 -		colorChanged( currentMapEditor()->getCurrentHeadingColor() );
 21.1277 +	VymModel *m=currentModel();
 21.1278 +	if (m)
 21.1279 +		colorChanged( m->getCurrentHeadingColor() );
 21.1280  }
 21.1281  
 21.1282  void Main::colorChanged(QColor c)
 21.1283 @@ -3104,86 +3181,102 @@
 21.1284  
 21.1285  void Main::formatColorBranch()
 21.1286  {
 21.1287 -	if (currentMapEditor())
 21.1288 -		currentMapEditor()->colorBranch(currentColor);
 21.1289 +	VymModel *m=currentModel();
 21.1290 +	if (m) m->colorBranch(currentColor);
 21.1291  }
 21.1292  
 21.1293  void Main::formatColorSubtree()
 21.1294  {
 21.1295 -	if (currentMapEditor())
 21.1296 -		currentMapEditor()->colorSubtree (currentColor);
 21.1297 +	VymModel *m=currentModel();
 21.1298 +	if (m) m->colorSubtree (currentColor);
 21.1299  }
 21.1300  
 21.1301  void Main::formatLinkStyleLine()
 21.1302  {
 21.1303 -	if (currentMapEditor())
 21.1304 +	VymModel *m=currentModel();
 21.1305 +	if (m)
 21.1306      {
 21.1307 -		currentMapEditor()->setMapLinkStyle("StyleLine");
 21.1308 +		m->setMapLinkStyle("StyleLine");
 21.1309          actionFormatLinkStyleLine->setOn(true);
 21.1310      }
 21.1311  }
 21.1312  
 21.1313  void Main::formatLinkStyleParabel()
 21.1314  {
 21.1315 -	if (currentMapEditor())
 21.1316 +	VymModel *m=currentModel();
 21.1317 +	if (m)
 21.1318      {
 21.1319 -		currentMapEditor()->setMapLinkStyle("StyleParabel");
 21.1320 +		m->setMapLinkStyle("StyleParabel");
 21.1321          actionFormatLinkStyleParabel->setOn(true);
 21.1322      }
 21.1323  }
 21.1324  
 21.1325  void Main::formatLinkStylePolyLine()
 21.1326  {
 21.1327 -	if (currentMapEditor())
 21.1328 +	VymModel *m=currentModel();
 21.1329 +	if (m)
 21.1330      {
 21.1331 -		currentMapEditor()->setMapLinkStyle("StylePolyLine");
 21.1332 +		m->setMapLinkStyle("StylePolyLine");
 21.1333          actionFormatLinkStylePolyLine->setOn(true);
 21.1334      }
 21.1335  }
 21.1336  
 21.1337  void Main::formatLinkStylePolyParabel()
 21.1338  {
 21.1339 -	if (currentMapEditor())
 21.1340 +	VymModel *m=currentModel();
 21.1341 +	if (m)
 21.1342      {
 21.1343 -		currentMapEditor()->setMapLinkStyle("StylePolyParabel");
 21.1344 +		m->setMapLinkStyle("StylePolyParabel");
 21.1345          actionFormatLinkStylePolyParabel->setOn(true);
 21.1346      }
 21.1347  }
 21.1348  
 21.1349  void Main::formatSelectBackColor()
 21.1350  {
 21.1351 -	if (currentMapEditor())
 21.1352 -		currentMapEditor()->selectMapBackgroundColor();
 21.1353 +	VymModel *m=currentModel();
 21.1354 +	if (m) m->selectMapBackgroundColor();
 21.1355  }
 21.1356  
 21.1357  void Main::formatSelectBackImage()
 21.1358  {
 21.1359 -	if (currentMapEditor())
 21.1360 -		currentMapEditor()->selectMapBackgroundImage();
 21.1361 +	VymModel *m=currentModel();
 21.1362 +	if (m)
 21.1363 +		m->selectMapBackgroundImage();
 21.1364  }
 21.1365  
 21.1366  void Main::formatSelectLinkColor()
 21.1367  {
 21.1368 -	if (currentMapEditor())
 21.1369 -		currentMapEditor()->selectMapLinkColor();
 21.1370 +	VymModel *m=currentModel();
 21.1371 +	if (m)
 21.1372 +	{
 21.1373 +		QColor col = QColorDialog::getColor( m->getMapDefLinkColor(), this );
 21.1374 +		m->setMapDefLinkColor( col );
 21.1375 +	}
 21.1376  }
 21.1377  
 21.1378  void Main::formatSelectSelectionColor()
 21.1379  {
 21.1380 -	if (currentMapEditor())
 21.1381 -		currentMapEditor()->selectMapSelectionColor();
 21.1382 +	VymModel *m=currentModel();
 21.1383 +	if (m)
 21.1384 +	{
 21.1385 +		QColor col = QColorDialog::getColor( m->getMapDefLinkColor(), this );
 21.1386 +		m->setSelectionColor (col);
 21.1387 +	}
 21.1388 +
 21.1389  }
 21.1390  
 21.1391  void Main::formatToggleLinkColorHint()
 21.1392  {
 21.1393 -	currentMapEditor()->toggleMapLinkColorHint();
 21.1394 +	VymModel *m=currentModel();
 21.1395 +	if (m) m->toggleMapLinkColorHint();
 21.1396  }
 21.1397  
 21.1398  
 21.1399  void Main::formatHideLinkUnselected()	//FIXME get rid of this with imagepropertydialog
 21.1400  {
 21.1401 -	if (currentMapEditor())
 21.1402 -		currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
 21.1403 +	VymModel *m=currentModel();
 21.1404 +	if (m)
 21.1405 +		m->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
 21.1406  }
 21.1407  
 21.1408  void Main::viewZoomReset()
 21.1409 @@ -3218,23 +3311,20 @@
 21.1410  
 21.1411  void Main::viewCenter()
 21.1412  {
 21.1413 -	MapEditor *me=currentMapEditor();
 21.1414 -	if (me)
 21.1415 -	{
 21.1416 -		me->ensureSelectionVisible();
 21.1417 -	}	
 21.1418 +	VymModel *m=currentModel();
 21.1419 +	if (m) m->ensureSelectionVisible();
 21.1420  }
 21.1421  
 21.1422  void Main::networkStartServer()
 21.1423  {
 21.1424 -	MapEditor *me=currentMapEditor();
 21.1425 -	if (me) me->newServer();
 21.1426 +	VymModel *m=currentModel();
 21.1427 +	if (m) m->newServer();
 21.1428  }
 21.1429  
 21.1430  void Main::networkConnect()
 21.1431  {
 21.1432 -	MapEditor *me=currentMapEditor();
 21.1433 -	if (me) me->connectToServer();
 21.1434 +	VymModel *m=currentModel();
 21.1435 +	if (m) m->connectToServer();
 21.1436  }
 21.1437  
 21.1438  bool Main::settingsPDF()
 21.1439 @@ -3352,19 +3442,7 @@
 21.1440  		branchPropertyWindow->hide();
 21.1441  	else	
 21.1442  		branchPropertyWindow->show();
 21.1443 -
 21.1444 -	if(currentMapEditor())
 21.1445 -	{
 21.1446 -		BranchObj *bo=currentMapEditor()->getSelectedBranch();
 21.1447 -		if (bo) 
 21.1448 -		{
 21.1449 -			branchPropertyWindow->setMapEditor(currentMapEditor());
 21.1450 -			branchPropertyWindow->setBranch(bo);
 21.1451 -			return;
 21.1452 -		}
 21.1453 -		
 21.1454 -	}	
 21.1455 -	branchPropertyWindow->setBranch(NULL);
 21.1456 +	branchPropertyWindow->setModel (currentModel() );
 21.1457  }
 21.1458  
 21.1459  void Main::windowToggleAntiAlias()
 21.1460 @@ -3373,7 +3451,6 @@
 21.1461  	MapEditor *me;
 21.1462  	for (int i=0;i<tabWidget->count();i++)
 21.1463  	{
 21.1464 -		
 21.1465  		me=(MapEditor*)tabWidget->page(i);
 21.1466  		me->setAntiAlias(b);
 21.1467  	}	
 21.1468 @@ -3399,33 +3476,35 @@
 21.1469  
 21.1470  void Main::updateNoteFlag()
 21.1471  {
 21.1472 -	if (currentMapEditor())
 21.1473 -		currentMapEditor()->updateNoteFlag();
 21.1474 +	// this slot is connected to TextEditor::textHasChanged()
 21.1475 +
 21.1476 +	VymModel *m=currentModel();
 21.1477 +	if (m) m->updateNoteFlag();
 21.1478  }
 21.1479  
 21.1480  void Main::updateSatellites(MapEditor *me)
 21.1481  {
 21.1482 -	branchPropertyWindow->setMapEditor (me);
 21.1483 +	branchPropertyWindow->setModel (me->getModel() );
 21.1484  }
 21.1485  
 21.1486  void Main::updateActions()
 21.1487  {
 21.1488 -	MapEditor *me=currentMapEditor();
 21.1489 -	if (!me) return;
 21.1490 -
 21.1491 -	historyWindow->setCaption (vymName + " - " +tr("History for %1","Window Caption").arg(currentMapEditor()->getFileName()));
 21.1492 +	VymModel  *m =currentModel();
 21.1493 +	if (!m) return;
 21.1494 +
 21.1495 +	historyWindow->setCaption (vymName + " - " +tr("History for %1","Window Caption").arg(m->getFileName()));
 21.1496  
 21.1497  	// updateActions is also called when NoteEditor is closed
 21.1498  	actionViewToggleNoteEditor->setOn (textEditor->isVisible());
 21.1499  	actionViewToggleHistoryWindow->setOn (historyWindow->isVisible());
 21.1500  	actionViewTogglePropertyWindow->setOn (branchPropertyWindow->isVisible());
 21.1501  
 21.1502 -	if (me->getMapLinkColorHint()==LinkableMapObj::HeadingColor) 
 21.1503 +	if (m->getMapLinkColorHint()==LinkableMapObj::HeadingColor) 
 21.1504  		actionFormatLinkColorHint->setOn(true);
 21.1505  	else	
 21.1506  		actionFormatLinkColorHint->setOn(false);
 21.1507  
 21.1508 -	switch (me->getMapLinkStyle())
 21.1509 +	switch (m->getMapLinkStyle())
 21.1510  	{
 21.1511  		case LinkableMapObj::Line: 
 21.1512  			actionFormatLinkStyleLine->setOn(true);
 21.1513 @@ -3445,26 +3524,26 @@
 21.1514  
 21.1515  	// Update colors
 21.1516  	QPixmap pix( 16, 16 );
 21.1517 -    pix.fill( me->getMapBackgroundColor() );
 21.1518 +    pix.fill( m->getMapBackgroundColor() );
 21.1519      actionFormatBackColor->setIconSet( pix );
 21.1520 -    pix.fill( me->getSelectionColor() );
 21.1521 +    pix.fill( m->getSelectionColor() );
 21.1522      actionFormatSelectionColor->setIconSet( pix );
 21.1523 -    pix.fill( me->getMapDefLinkColor() );
 21.1524 +    pix.fill( m->getMapDefLinkColor() );
 21.1525      actionFormatLinkColor->setIconSet( pix );
 21.1526  
 21.1527  
 21.1528 -	actionFileSave->setEnabled( me->hasChanged() );
 21.1529 -	if (me->isUndoAvailable())
 21.1530 +	actionFileSave->setEnabled( m->hasChanged() );
 21.1531 +	if (m->isUndoAvailable())
 21.1532  		actionEditUndo->setEnabled( true);
 21.1533  	else	
 21.1534  		actionEditUndo->setEnabled( false);
 21.1535  
 21.1536 -	if (me->isRedoAvailable())
 21.1537 +	if (m->isRedoAvailable())
 21.1538  		actionEditRedo->setEnabled( true);
 21.1539  	else	
 21.1540  		actionEditRedo->setEnabled( false);
 21.1541  
 21.1542 -	LinkableMapObj *selection=me->getSelection();
 21.1543 +	LinkableMapObj *selection=m->getSelection();
 21.1544  	if (selection)
 21.1545  	{
 21.1546  		if ( (typeid(*selection) == typeid(BranchObj)) || 
 21.1547 @@ -3636,8 +3715,8 @@
 21.1548  
 21.1549  void Main::runScript (const QString &script)
 21.1550  {
 21.1551 -	if (currentMapEditor())
 21.1552 -		currentMapEditor()->runScript (script);
 21.1553 +	VymModel *m=currentModel();
 21.1554 +	if (m) m->runScript (script);
 21.1555  }
 21.1556  
 21.1557  void Main::runScriptEverywhere (const QString &script)
 21.1558 @@ -3646,7 +3725,7 @@
 21.1559  	for (int i=0;i<=tabWidget->count() -1;i++)
 21.1560  	{
 21.1561  		me=(MapEditor*)tabWidget->page(i);
 21.1562 -		if (me) me->runScript (script);
 21.1563 +		if (me) me->getModel()->runScript (script);
 21.1564  	}	
 21.1565  }
 21.1566  
 21.1567 @@ -3828,41 +3907,13 @@
 21.1568  		}	
 21.1569  
 21.1570  		QTextStream ts( &f );
 21.1571 -		QString m= ts.read();
 21.1572 -
 21.1573 -		if (! m.isEmpty())
 21.1574 +		QString macro= ts.read();
 21.1575 +
 21.1576 +		if (! macro.isEmpty())
 21.1577  		{
 21.1578 -			//cout <<"Main::callMacro  m="<<qPrintable (m)<<endl;
 21.1579 -			currentMapEditor()->runScript (m);
 21.1580 +			VymModel *m=currentModel();
 21.1581 +			if (m) m->runScript(macro);
 21.1582  		}	
 21.1583  	}	
 21.1584  }
 21.1585  
 21.1586 -
 21.1587 -
 21.1588 -//////////////////////////////////
 21.1589 -/*
 21.1590 -@@ -2544,18 +2576,27 @@
 21.1591 - 				// Try to open new tab in existing konqueror started previously by vym
 21.1592 - 				p=new QProcess (this);
 21.1593 - 				args.clear();
 21.1594 --				args<< QString("konqueror-%1").arg(procBrowser->pid())<< 
 21.1595 --					"konqueror-mainwindow#1"<< 
 21.1596 --					"newTab" << 
 21.1597 -+#if defined(Q_OS_WIN32)
 21.1598 -+                // In Win32, pid is not a longlong, but a pointer to a _PROCESS_INFORMATION structure.
 21.1599 -+                // Redundant change in Win32, as there's no konqueror, but I wanted to follow the original logic.
 21.1600 -+				args<< QString("konqueror-%1").arg(procBrowser->pid()->dwProcessId)<<
 21.1601 -+					"konqueror-mainwindow#1"<<
 21.1602 -+					"newTab" <<
 21.1603 - 					urls.at(i);
 21.1604 -+#else
 21.1605 -+				args<< QString("konqueror-%1").arg(procBrowser->pid())<<
 21.1606 -+					"konqueror-mainwindow#1"<<
 21.1607 -+					"newTab" <<
 21.1608 -+					urls.at(i);
 21.1609 -+#endif
 21.1610 - 				p->start ("dcop",args);
 21.1611 - 				if ( !p->waitForStarted() ) success=false;
 21.1612 - 			}
 21.1613 -*/			
    22.1 --- a/mainwindow.h	Wed Jul 16 10:44:44 2008 +0000
    22.2 +++ b/mainwindow.h	Wed Jul 16 10:46:14 2008 +0000
    22.3 @@ -4,6 +4,7 @@
    22.4  #include <QMainWindow>
    22.5  
    22.6  #include "branchpropwindow.h"
    22.7 +#include "extrainfodialog.h"
    22.8  #include "file.h"
    22.9  #include "findwindow.h"
   22.10  #include "historywindow.h"
   22.11 @@ -56,6 +57,7 @@
   22.12  	void hideEvent (QHideEvent * );
   22.13  	void showEvent (QShowEvent * );
   22.14  	MapEditor* currentMapEditor() const;
   22.15 +	VymModel* currentModel() const;
   22.16      
   22.17  private slots:
   22.18  	void editorChanged(QWidget*);
   22.19 @@ -65,10 +67,10 @@
   22.20      void fileLoad();
   22.21  	void fileLoadRecent();
   22.22  	void addRecentMap (const QString &);
   22.23 -    void fileSave(MapEditor*, const SaveMode & );
   22.24 +    void fileSave(VymModel*, const SaveMode & );
   22.25      void fileSave();
   22.26  public slots:	
   22.27 -    void fileSave(MapEditor *);	// autosave from MapEditor
   22.28 +    void fileSave(VymModel*);	// autosave from MapEditor
   22.29  private slots:	
   22.30      void fileSaveAs(const SaveMode &);
   22.31      void fileSaveAs();
   22.32 @@ -116,10 +118,10 @@
   22.33  	void openVymLinks(const QStringList &);
   22.34  	void editVymLink();
   22.35  	void editOpenMultipleVymLinks();
   22.36 -    void editHeadingFinished();
   22.37      void editAttributeFinished();
   22.38  public slots:
   22.39 -    void editHeading();
   22.40 +    void editHeadingFinished(VymModel *m);
   22.41 +//    void editHeading();
   22.42      void editAttribute();
   22.43  	void editOpenVymLink();
   22.44  private slots:
   22.45 @@ -130,7 +132,7 @@
   22.46      void editMoveDown();	
   22.47  	void editSortChildren();
   22.48      void editToggleScroll();
   22.49 -    void editUnscrollChilds();
   22.50 +    void editUnscrollChildren();
   22.51      void editAddMapCenter();
   22.52      void editNewBranch();
   22.53      void editNewBranchBefore();
   22.54 @@ -139,8 +141,8 @@
   22.55      void editImportAdd();
   22.56      void editImportReplace();
   22.57      void editSaveBranch();
   22.58 -    void editDeleteKeepChilds();
   22.59 -    void editDeleteChilds();
   22.60 +    void editDeleteKeepChildren();
   22.61 +    void editDeleteChildren();
   22.62      void editDeleteSelection();
   22.63      void editUpperBranch();
   22.64      void editLowerBranch();
   22.65 @@ -230,6 +232,8 @@
   22.66  
   22.67  	QStringList imageTypes;
   22.68  
   22.69 +	QList <VymModel*> models;
   22.70 +
   22.71  	QLineEdit *lineedit;	// to enter headings of branches
   22.72  	QString prevSelection;
   22.73  
   22.74 @@ -284,8 +288,8 @@
   22.75  	QAction *actionEditAddBranchBefore;
   22.76  	QAction *actionEditAddBranchAbove;
   22.77  	QAction *actionEditAddBranchBelow;
   22.78 -	QAction *actionEditDeleteKeepChilds;
   22.79 -	QAction *actionEditDeleteChilds;
   22.80 +	QAction *actionEditDeleteKeepChildren;
   22.81 +	QAction *actionEditDeleteChildren;
   22.82  	QAction *actionEditImportAdd;
   22.83  	QAction *actionEditImportReplace;
   22.84  	QAction *actionEditSaveBranch;
    23.1 --- a/mapcenterobj.cpp	Wed Jul 16 10:44:44 2008 +0000
    23.2 +++ b/mapcenterobj.cpp	Wed Jul 16 10:46:14 2008 +0000
    23.3 @@ -73,7 +73,7 @@
    23.4  
    23.5  void MapCenterObj::moveAllBy (double dx, double dy)
    23.6  {
    23.7 -	// Move myself and childs
    23.8 +	// Move myself and children
    23.9  	BranchObj::moveBy(dx,dy);
   23.10  }
   23.11  
    24.1 --- a/noteobj.cpp	Wed Jul 16 10:44:44 2008 +0000
    24.2 +++ b/noteobj.cpp	Wed Jul 16 10:46:14 2008 +0000
    24.3 @@ -51,6 +51,7 @@
    24.4  
    24.5  QString NoteObj::getNoteASCII(const QString &indent, const int &width)
    24.6  {
    24.7 +	// FIXME make use of width
    24.8  	QString r=note;
    24.9  
   24.10  	// Remove all <style...> ...</style>
   24.11 @@ -167,12 +168,13 @@
   24.12  {
   24.13  	QString n=note;
   24.14  
   24.15 -	// Remove the doctype, which will confuse parsing 
   24.16 +	// Remove the doctype, which will confuse parsing
   24.17  	// with XmlReader in Qt >= 4.4
   24.18  	QRegExp rx("<!DOCTYPE.*>");
   24.19  	rx.setMinimal(true);
   24.20  	n.replace (rx,"");
   24.21 -	
   24.22 +
   24.23 +
   24.24  	// QTextEdit may generate fontnames with unquoted &, like
   24.25  	// in "Lucida B&H". This is invalid in XML and thus would crash
   24.26  	// the XML parser
   24.27 @@ -183,6 +185,7 @@
   24.28  	bool inbracket=false;
   24.29  	int begin_bracket=0;
   24.30  	bool inquot=false;
   24.31 +
   24.32  	while (pos<n.length())
   24.33  	{
   24.34  		if (n.mid(pos,1)=="<") 
   24.35 @@ -197,7 +200,7 @@
   24.36  			int sl=s.length();
   24.37  			if (s.count("style=\"")>1)
   24.38  			{
   24.39 -				rx.setPattern("style=\\s*\"(.*)\"\\s*style=\\s*\"(.*)\"");
   24.40 +				rx.setPattern ("style=\\s*\"(.*)\"\\s*style=\\s*\"(.*)\"");
   24.41  				s.replace(rx,"style=\"\\1 \\2\"");
   24.42  				n.replace (begin_bracket,sl,s);
   24.43  				pos=pos-(sl-s.length());
   24.44 @@ -218,8 +221,6 @@
   24.45  		}
   24.46  		pos++;
   24.47  	}
   24.48 -
   24.49 -	
   24.50  	return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ n+ "\n" +endElement ("htmlnote");
   24.51  }
   24.52  
    25.1 --- a/ornamentedobj.cpp	Wed Jul 16 10:44:44 2008 +0000
    25.2 +++ b/ornamentedobj.cpp	Wed Jul 16 10:46:14 2008 +0000
    25.3 @@ -93,10 +93,10 @@
    25.4  
    25.5  void OrnamentedObj::setLinkColor()
    25.6  {
    25.7 -	if (mapEditor->getMapLinkColorHint()==HeadingColor)
    25.8 +	if (model->getMapLinkColorHint()==HeadingColor)
    25.9  		LinkableMapObj::setLinkColor (heading->getColor());
   25.10  	else	
   25.11 -		LinkableMapObj::setLinkColor (mapEditor->getMapDefLinkColor());
   25.12 +		LinkableMapObj::setLinkColor (model->getMapDefLinkColor());
   25.13  }
   25.14  
   25.15  void OrnamentedObj::setColor (QColor col)
   25.16 @@ -321,7 +321,7 @@
   25.17  		QDir d(s);
   25.18  		if (!d.path().startsWith ("/"))
   25.19  		{
   25.20 -			QString p=mapEditor->getDestPath();
   25.21 +			QString p=model->getDestPath();
   25.22  			int i=p.findRev("/",-1);
   25.23  			d.setPath(p.left(i)+"/"+s);
   25.24  			d.convertToAbs();
   25.25 @@ -432,7 +432,7 @@
   25.26  		if (!systemFlags->isActive ("note")) return;
   25.27  		systemFlags->deactivate("note");
   25.28  	}	
   25.29 -	mapEditor->setChanged();
   25.30 +	model->setChanged();
   25.31  	calcBBoxSize();
   25.32  	positionBBox();	
   25.33  	move (absPos.x(), absPos.y() );
   25.34 @@ -498,7 +498,7 @@
   25.35  
   25.36  	QString vymLinkAttr;
   25.37  	if (!vymLink.isEmpty())
   25.38 -		vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
   25.39 +		vymLinkAttr=attribut ("vymLink",convertToRel(model->getDestPath(),vymLink) );
   25.40  
   25.41  	QString hideExpAttr;
   25.42  	if (hideExport)
    26.1 --- a/ornamentedobj.h	Wed Jul 16 10:44:44 2008 +0000
    26.2 +++ b/ornamentedobj.h	Wed Jul 16 10:46:14 2008 +0000
    26.3 @@ -79,7 +79,7 @@
    26.4  	virtual void updateNoteFlag();
    26.5  	virtual void getNoteFromTextEditor ();
    26.6  	virtual void updateFlagsToolbar();
    26.7 -	virtual void setHideInExport(bool);		// set export of object (and childs)
    26.8 +	virtual void setHideInExport(bool);		// set export of object (and children)
    26.9  	virtual bool hideInExport();
   26.10  	virtual bool isHidden ();
   26.11  	virtual QString getOrnXMLAttr();		// get attributes for saveToDir
    27.1 --- a/selection.cpp	Wed Jul 16 10:44:44 2008 +0000
    27.2 +++ b/selection.cpp	Wed Jul 16 10:46:14 2008 +0000
    27.3 @@ -13,6 +13,7 @@
    27.4  Selection::Selection()
    27.5  {
    27.6  	color= QColor(255,255,0);
    27.7 +	blocked=false;
    27.8  }
    27.9  
   27.10  Selection::~Selection()
   27.11 @@ -37,7 +38,7 @@
   27.12  	lastSelectList.clear();
   27.13  }
   27.14  
   27.15 -void Selection::update()
   27.16 +void Selection::update() // FIXME this needs to be adapted to several views
   27.17  {
   27.18  	QRectF bbox;
   27.19  	int w=0;
   27.20 @@ -120,6 +121,21 @@
   27.21  	}	
   27.22  }
   27.23  
   27.24 +bool Selection::isBlocked()
   27.25 +{
   27.26 +	return blocked;
   27.27 +}
   27.28 +
   27.29 +void Selection::block()
   27.30 +{
   27.31 +	blocked=true;
   27.32 +}
   27.33 +
   27.34 +void Selection::unblock()
   27.35 +{
   27.36 +	blocked=false;
   27.37 +}
   27.38 +
   27.39  bool Selection::isEmpty()
   27.40  {
   27.41  	return selectList.isEmpty();
    28.1 --- a/selection.h	Wed Jul 16 10:44:44 2008 +0000
    28.2 +++ b/selection.h	Wed Jul 16 10:46:14 2008 +0000
    28.3 @@ -29,6 +29,9 @@
    28.4  	bool select (const QString &);
    28.5  	bool reselect ();
    28.6  	void unselect ();
    28.7 +	bool isBlocked ();
    28.8 +	void block();
    28.9 +	void unblock();
   28.10  	bool isEmpty();
   28.11  	uint count();
   28.12  	Type type();
   28.13 @@ -48,6 +51,8 @@
   28.14  	QGraphicsScene *scene;
   28.15  
   28.16  	QColor color;
   28.17 +	bool blocked;					//!< if true, no new selection possible
   28.18  };
   28.19 +
   28.20  #endif
   28.21  
    29.1 --- a/version.h	Wed Jul 16 10:44:44 2008 +0000
    29.2 +++ b/version.h	Wed Jul 16 10:46:14 2008 +0000
    29.3 @@ -4,10 +4,10 @@
    29.4  #include <QString>
    29.5  
    29.6  #define __VYM_NAME "VYM"
    29.7 -#define __VYM_VERSION "1.12.1"
    29.8 -#define __VYM_CODENAME "Maintenance Update"
    29.9 -//#define __VYM_CODENAME "Codename: development version"
   29.10 -#define __VYM_BUILD_DATE "2008-07-14"
   29.11 +#define __VYM_VERSION "1.13.0"
   29.12 +//#define __VYM_CODENAME "Codename: RC-1"
   29.13 +#define __VYM_CODENAME "Codename: development version"
   29.14 +#define __VYM_BUILD_DATE "2008-07-02"
   29.15  
   29.16  
   29.17  bool checkVersion(const QString &);
    30.1 --- a/vym.pro	Wed Jul 16 10:44:44 2008 +0000
    30.2 +++ b/vym.pro	Wed Jul 16 10:46:14 2008 +0000
    30.3 @@ -7,11 +7,10 @@
    30.4  TRANSLATIONS += lang/vym_de.ts
    30.5  TRANSLATIONS += lang/vym_en.ts
    30.6  TRANSLATIONS += lang/vym_es.ts
    30.7 +TRANSLATIONS += lang/vym_it.ts
    30.8  TRANSLATIONS += lang/vym_fr.ts
    30.9 -TRANSLATIONS += lang/vym_it.ts
   30.10 +TRANSLATIONS += lang/vym_zh_CN.ts
   30.11  TRANSLATIONS += lang/vym_pt_BR.ts
   30.12 -TRANSLATIONS += lang/vym_ru.ts
   30.13 -TRANSLATIONS += lang/vym_zh_CN.ts
   30.14  
   30.15  # Manifest embedding was suggested by Qt docs somewhere...
   30.16  win32: CONFIG += embed_manifest_exe
    31.1 --- a/vymmodel.cpp	Wed Jul 16 10:44:44 2008 +0000
    31.2 +++ b/vymmodel.cpp	Wed Jul 16 10:46:14 2008 +0000
    31.3 @@ -1,32 +1,122 @@
    31.4  #include <QApplication>
    31.5  #include <typeinfo>
    31.6  
    31.7 +#include "vymmodel.h"
    31.8 +
    31.9 +#include "editxlinkdialog.h"
   31.10 +#include "exports.h"
   31.11 +#include "exportxhtmldialog.h"
   31.12 +#include "file.h"
   31.13  #include "geometry.h"		// for addBBox
   31.14 -#include "vymmodel.h"
   31.15 -
   31.16 -
   31.17 +#include "mainwindow.h"
   31.18 +#include "mapcenterobj.h"
   31.19 +#include "misc.h"
   31.20 +#include "parser.h"
   31.21 +#include "selection.h"
   31.22 +
   31.23 +
   31.24 +#include "warningdialog.h"
   31.25 +#include "xml-freemind.h"
   31.26 +#include "xml-vym.h"
   31.27 +
   31.28 +
   31.29 +extern bool debug;
   31.30 +extern Main *mainWindow;
   31.31  extern Settings settings;
   31.32 +extern QString tmpVymDir;
   31.33 +
   31.34 +extern TextEditor *textEditor;
   31.35 +
   31.36 +
   31.37 +extern QString clipboardDir;
   31.38 +extern QString clipboardFile;
   31.39 +extern bool clipboardEmpty;
   31.40 +
   31.41 +extern ImageIO imageIO;
   31.42 +
   31.43 +extern QString vymName;
   31.44 +extern QString vymVersion;
   31.45 +extern QDir vymBaseDir;
   31.46 +
   31.47 +extern QDir lastImageDir;
   31.48 +extern QDir lastFileDir;
   31.49 +
   31.50 +extern FlagRowObj *standardFlagsDefault;
   31.51 +
   31.52 +extern Settings settings;
   31.53 +
   31.54 +
   31.55 +
   31.56 +int VymModel::mapNum=0;	// make instance
   31.57  
   31.58  VymModel::VymModel() 
   31.59  {
   31.60  //    cout << "Const VymModel\n";
   31.61 +	init();
   31.62  }
   31.63  
   31.64  
   31.65  VymModel::~VymModel() 
   31.66  {
   31.67  //    cout << "Destr VymModel\n";
   31.68 +	autosaveTimer->stop();
   31.69 +	fileChangedTimer->stop();
   31.70 +	clear();
   31.71  }	
   31.72  
   31.73  void VymModel::clear() 
   31.74  {
   31.75 +	selection.clear();
   31.76 +
   31.77  	while (!mapCenters.isEmpty())
   31.78  		delete mapCenters.takeFirst();
   31.79  }
   31.80  
   31.81  void VymModel::init () 
   31.82  {
   31.83 -	addMapCenter();
   31.84 +	// We should have at least one map center to start with
   31.85 +	// addMapCenter();  FIXME create this in MapEditor as long as model is part of that
   31.86 +
   31.87 +	// History 
   31.88 +	mapNum++;
   31.89 +    mapChanged=false;
   31.90 +	mapDefault=true;
   31.91 +	mapUnsaved=false;
   31.92 +
   31.93 +	curStep=0;
   31.94 +	redosAvail=0;
   31.95 +	undosAvail=0;
   31.96 +
   31.97 + 	stepsTotal=settings.readNumEntry("/history/stepsTotal",100);
   31.98 +	undoSet.setEntry ("/history/stepsTotal",QString::number(stepsTotal));
   31.99 +	mainWindow->updateHistory (undoSet);
  31.100 +
  31.101 +	// Create tmp dirs
  31.102 +	makeTmpDirectories();
  31.103 +	
  31.104 +	// Files
  31.105 +	zipped=true;
  31.106 +	filePath="";
  31.107 +	fileName=tr("unnamed");
  31.108 +	mapName="";
  31.109 +	blockReposition=false;
  31.110 +	blockSaveState=false;
  31.111 +
  31.112 +	autosaveTimer=new QTimer (this);
  31.113 +	connect(autosaveTimer, SIGNAL(timeout()), this, SLOT(autosave()));
  31.114 +
  31.115 +	fileChangedTimer=new QTimer (this);
  31.116 +	fileChangedTimer->start(3000);
  31.117 +	connect(fileChangedTimer, SIGNAL(timeout()), this, SLOT(fileChanged()));
  31.118 +
  31.119 +
  31.120 +	// selections
  31.121 +	selection.setModel (this);
  31.122 +	selection.unselect();
  31.123 +
  31.124 +	// find routine
  31.125 +	itFind=NULL;				
  31.126 +	EOFind=false;
  31.127  
  31.128  	// animations
  31.129  	animationUse=settings.readBoolEntry("/animation/use",false);
  31.130 @@ -36,8 +126,36 @@
  31.131  	animationTimer=new QTimer (this);
  31.132  	connect(animationTimer, SIGNAL(timeout()), this, SLOT(animate()));
  31.133  
  31.134 +	// View - map
  31.135 +	defLinkColor=QColor (0,0,255);
  31.136 +	defXLinkColor=QColor (180,180,180);
  31.137 +	linkcolorhint=LinkableMapObj::DefaultColor;
  31.138 +	linkstyle=LinkableMapObj::PolyParabel;
  31.139 +	defXLinkWidth=1;
  31.140 +	defXLinkColor=QColor (230,230,230);
  31.141 +
  31.142 +	hidemode=HideNone;
  31.143 +
  31.144 +
  31.145 +
  31.146 +	// Network
  31.147 +	netstate=Offline;
  31.148 +
  31.149 +	// Create MapCenter
  31.150 +	//  addMapCenter();  FIXME create this in MapEditor until BO and MCO are independent of scene
  31.151 +
  31.152  }
  31.153  
  31.154 +void VymModel::makeTmpDirectories()
  31.155 +{
  31.156 +	// Create unique temporary directories
  31.157 +	tmpMapDir = tmpVymDir+QString("/model-%1").arg(mapNum);
  31.158 +	histPath = tmpMapDir+"/history";
  31.159 +	QDir d;
  31.160 +	d.mkdir (tmpMapDir);
  31.161 +}
  31.162 +
  31.163 +
  31.164  void VymModel::setMapEditor(MapEditor *me)
  31.165  {
  31.166  	mapEditor=me;
  31.167 @@ -50,76 +168,1183 @@
  31.168  	return mapEditor;
  31.169  }
  31.170  
  31.171 -void VymModel::setVersion (const QString &s)
  31.172 +bool VymModel::isRepositionBlocked()
  31.173  {
  31.174 -	version=s;
  31.175 +	return blockReposition;
  31.176  }
  31.177  
  31.178 -void VymModel::setAuthor (const QString &s)
  31.179 +void VymModel::updateActions()	// FIXME  maybe don't update if blockReposition is set
  31.180  {
  31.181 -	author=s;
  31.182 +	// Tell mainwindow to update states of actions
  31.183 +	mainWindow->updateActions();
  31.184  }
  31.185  
  31.186 -QString VymModel::getAuthor()
  31.187 +
  31.188 +
  31.189 +QString VymModel::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel)
  31.190  {
  31.191 -	return author;
  31.192 +	// tmpdir		temporary directory to which data will be written
  31.193 +	// prefix		mapname, which will be appended to images etc.
  31.194 +	// writeflags	Only write flags for "real" save of map, not undo
  31.195 +	// offset		offset of bbox of whole map in scene. 
  31.196 +	//				Needed for XML export
  31.197 +	
  31.198 +	// Save Header
  31.199 +	QString ls;
  31.200 +	switch (linkstyle)
  31.201 +	{
  31.202 +		case LinkableMapObj::Line: 
  31.203 +			ls="StyleLine";
  31.204 +			break;
  31.205 +		case LinkableMapObj::Parabel:
  31.206 +			ls="StyleParabel";
  31.207 +			break;
  31.208 +		case LinkableMapObj::PolyLine:	
  31.209 +			ls="StylePolyLine";
  31.210 +			break;
  31.211 +		default:
  31.212 +			ls="StylePolyParabel";
  31.213 +			break;
  31.214 +	}	
  31.215 +
  31.216 +	QString s="<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE vymmap>\n";
  31.217 +	QString colhint="";
  31.218 +	if (linkcolorhint==LinkableMapObj::HeadingColor) 
  31.219 +		colhint=attribut("linkColorHint","HeadingColor");
  31.220 +
  31.221 +	QString mapAttr=attribut("version",vymVersion);
  31.222 +	if (!saveSel)
  31.223 +		mapAttr+= attribut("author",author) +
  31.224 +				  attribut("comment",comment) +
  31.225 +			      attribut("date",getDate()) +
  31.226 +		          attribut("backgroundColor", mapScene->backgroundBrush().color().name() ) +
  31.227 +		          attribut("selectionColor", selection.getColor().name() ) +
  31.228 +		          attribut("linkStyle", ls ) +
  31.229 +		          attribut("linkColor", defLinkColor.name() ) +
  31.230 +		          attribut("defXLinkColor", defXLinkColor.name() ) +
  31.231 +		          attribut("defXLinkWidth", QString().setNum(defXLinkWidth,10) ) +
  31.232 +		          colhint; 
  31.233 +	s+=beginElement("vymmap",mapAttr);
  31.234 +	incIndent();
  31.235 +
  31.236 +	// Find the used flags while traversing the tree
  31.237 +	standardFlagsDefault->resetUsedCounter();
  31.238 +	
  31.239 +	// Reset the counters before saving
  31.240 +	// TODO constr. of FIO creates lots of objects, better do this in some other way...
  31.241 +	FloatImageObj (mapScene).resetSaveCounter();
  31.242 +
  31.243 +	// Build xml recursivly
  31.244 +	if (!saveSel || typeid (*saveSel) == typeid (MapCenterObj))
  31.245 +		// Save complete map, if saveSel not set
  31.246 +		s+=saveToDir(tmpdir,prefix,writeflags,offset);
  31.247 +	else
  31.248 +	{
  31.249 +		if ( typeid(*saveSel) == typeid(BranchObj) )
  31.250 +			// Save Subtree
  31.251 +			s+=((BranchObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
  31.252 +		else if ( typeid(*saveSel) == typeid(FloatImageObj) )
  31.253 +			// Save image
  31.254 +			s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
  31.255 +	}
  31.256 +
  31.257 +	// Save local settings
  31.258 +	s+=settings.getDataXML (destPath);
  31.259 +
  31.260 +	// Save selection
  31.261 +	if (!selection.isEmpty() && !saveSel ) 
  31.262 +		s+=valueElement("select",selection.getSelectString());
  31.263 +
  31.264 +	decIndent();
  31.265 +	s+=endElement("vymmap");
  31.266 +
  31.267 +	if (writeflags)
  31.268 +		standardFlagsDefault->saveToDir (tmpdir+"/flags/","",writeflags);
  31.269 +	return s;
  31.270  }
  31.271  
  31.272 -void VymModel::setComment (const QString &s)
  31.273 +void VymModel::setFilePath(QString fpath, QString destname)
  31.274  {
  31.275 -	comment=s;
  31.276 +	if (fpath.isEmpty() || fpath=="")
  31.277 +	{
  31.278 +		filePath="";
  31.279 +		fileName="";
  31.280 +		destPath="";
  31.281 +	} else
  31.282 +	{
  31.283 +		filePath=fpath;		// becomes absolute path
  31.284 +		fileName=fpath;		// gets stripped of path
  31.285 +		destPath=destname;	// needed for vymlinks and during load to reset fileChangedTime
  31.286 +
  31.287 +		// If fpath is not an absolute path, complete it
  31.288 +		filePath=QDir(fpath).absPath();
  31.289 +		fileDir=filePath.left (1+filePath.findRev ("/"));
  31.290 +
  31.291 +		// Set short name, too. Search from behind:
  31.292 +		int i=fileName.findRev("/");
  31.293 +		if (i>=0) fileName=fileName.remove (0,i+1);
  31.294 +
  31.295 +		// Forget the .vym (or .xml) for name of map
  31.296 +		mapName=fileName.left(fileName.findRev(".",-1,true) );
  31.297 +	}
  31.298  }
  31.299  
  31.300 -QString VymModel::getComment ()
  31.301 +void VymModel::setFilePath(QString fpath)
  31.302  {
  31.303 -	return comment;
  31.304 +	setFilePath (fpath,fpath);
  31.305  }
  31.306  
  31.307 -QString VymModel::getDate ()
  31.308 +QString VymModel::getFilePath()
  31.309  {
  31.310 -	return QDate::currentDate().toString ("yyyy-MM-dd");
  31.311 +	return filePath;
  31.312  }
  31.313  
  31.314 -void VymModel::setScene (QGraphicsScene *s)
  31.315 +QString VymModel::getFileName()
  31.316  {
  31.317 -	mapScene=s;
  31.318 -    init();	// Here we have a mapScene set, 
  31.319 -			// which is (still) needed to create MapCenters
  31.320 +	return fileName;
  31.321  }
  31.322  
  31.323 +QString VymModel::getMapName()
  31.324 +{
  31.325 +	return mapName;
  31.326 +}
  31.327 +
  31.328 +QString VymModel::getDestPath()
  31.329 +{
  31.330 +	return destPath;
  31.331 +}
  31.332 +
  31.333 +ErrorCode VymModel::load (QString fname, const LoadMode &lmode, const FileType &ftype)
  31.334 +{
  31.335 +	ErrorCode err=success;
  31.336 +
  31.337 +	parseBaseHandler *handler;
  31.338 +	fileType=ftype;
  31.339 +	switch (fileType)
  31.340 +	{
  31.341 +		case VymMap: handler=new parseVYMHandler; break;
  31.342 +		case FreemindMap : handler=new parseFreemindHandler; break;
  31.343 +		default: 
  31.344 +			QMessageBox::critical( 0, tr( "Critical Parse Error" ),
  31.345 +				   "Unknown FileType in VymModel::load()");
  31.346 +		return aborted;	
  31.347 +	}
  31.348 +	if (lmode==NewMap)
  31.349 +	{
  31.350 +		selection.clear();
  31.351 +		// FIXME not needed??? model->setMapEditor(this);
  31.352 +		// (map state is set later at end of load...)
  31.353 +	} else
  31.354 +	{
  31.355 +		BranchObj *bo=selection.getBranch();
  31.356 +		if (!bo) return aborted;
  31.357 +		if (lmode==ImportAdd)
  31.358 +			saveStateChangingPart(
  31.359 +				bo,
  31.360 +				bo,
  31.361 +				QString("addMapInsert (%1)").arg(fname),
  31.362 +				QString("Add map %1 to %2").arg(fname).arg(getObjectName(bo)));
  31.363 +		else	
  31.364 +			saveStateChangingPart(
  31.365 +				bo,
  31.366 +				bo,
  31.367 +				QString("addMapReplace(%1)").arg(fname),
  31.368 +				QString("Add map %1 to %2").arg(fname).arg(getObjectName(bo)));
  31.369 +	}	
  31.370 +    
  31.371 +
  31.372 +	// Create temporary directory for packing
  31.373 +	bool ok;
  31.374 +	QString tmpZipDir=makeTmpDir (ok,"vym-pack");
  31.375 +	if (!ok)
  31.376 +	{
  31.377 +		QMessageBox::critical( 0, tr( "Critical Load Error" ),
  31.378 +		   tr("Couldn't create temporary directory before load\n"));
  31.379 +		return aborted; 
  31.380 +	}
  31.381 +
  31.382 +	// Try to unzip file
  31.383 +	err=unzipDir (tmpZipDir,fname);
  31.384 +	QString xmlfile;
  31.385 +	if (err==nozip)
  31.386 +	{
  31.387 +		xmlfile=fname;
  31.388 +		zipped=false;
  31.389 +	} else
  31.390 +	{
  31.391 +		zipped=true;
  31.392 +		
  31.393 +		// Look for mapname.xml
  31.394 +		xmlfile= fname.left(fname.findRev(".",-1,true));
  31.395 +		xmlfile=xmlfile.section( '/', -1 );
  31.396 +		QFile mfile( tmpZipDir + "/" + xmlfile + ".xml");
  31.397 +		if (!mfile.exists() )
  31.398 +		{
  31.399 +			// mapname.xml does not exist, well, 
  31.400 +			// maybe someone renamed the mapname.vym file...
  31.401 +			// Try to find any .xml in the toplevel 
  31.402 +			// directory of the .vym file
  31.403 +			QStringList flist=QDir (tmpZipDir).entryList("*.xml");
  31.404 +			if (flist.count()==1) 
  31.405 +			{
  31.406 +				// Only one entry, take this one
  31.407 +				xmlfile=tmpZipDir + "/"+flist.first();
  31.408 +			} else
  31.409 +			{
  31.410 +				for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
  31.411 +					*it=tmpZipDir + "/" + *it;
  31.412 +				// TODO Multiple entries, load all (but only the first one into this ME)
  31.413 +				//mainWindow->fileLoadFromTmp (flist);
  31.414 +				//returnCode=1;	// Silently forget this attempt to load
  31.415 +				qWarning ("MainWindow::load (fn)  multimap found...");
  31.416 +			}	
  31.417 +				
  31.418 +			if (flist.isEmpty() )
  31.419 +			{
  31.420 +				QMessageBox::critical( 0, tr( "Critical Load Error" ),
  31.421 +						   tr("Couldn't find a map (*.xml) in .vym archive.\n"));
  31.422 +				err=aborted;				   
  31.423 +			}	
  31.424 +		} //file doesn't exist	
  31.425 +		else
  31.426 +			xmlfile=mfile.name();
  31.427 +	}
  31.428 +
  31.429 +	QFile file( xmlfile);
  31.430 +
  31.431 +	// I am paranoid: file should exist anyway
  31.432 +	// according to check in mainwindow.
  31.433 +	if (!file.exists() )
  31.434 +	{
  31.435 +		QMessageBox::critical( 0, tr( "Critical Parse Error" ),
  31.436 +				   tr(QString("Couldn't open map %1").arg(file.name())));
  31.437 +		err=aborted;	
  31.438 +	} else
  31.439 +	{
  31.440 +		bool blockSaveStateOrg=blockSaveState;
  31.441 +		blockReposition=true;
  31.442 +		blockSaveState=true;
  31.443 +		QXmlInputSource source( file);
  31.444 +		QXmlSimpleReader reader;
  31.445 +		reader.setContentHandler( handler );
  31.446 +		reader.setErrorHandler( handler );
  31.447 +		handler->setModel ( this);
  31.448 +
  31.449 +
  31.450 +		// We need to set the tmpDir in order  to load files with rel. path
  31.451 +		QString tmpdir;
  31.452 +		if (zipped)
  31.453 +			tmpdir=tmpZipDir;
  31.454 +		else
  31.455 +			tmpdir=fname.left(fname.findRev("/",-1));	
  31.456 +		handler->setTmpDir (tmpdir);
  31.457 +		handler->setInputFile (file.name());
  31.458 +		handler->setLoadMode (lmode);
  31.459 +		bool ok = reader.parse( source );
  31.460 +		blockReposition=false;
  31.461 +		blockSaveState=blockSaveStateOrg;
  31.462 +		file.close();
  31.463 +		if ( ok ) 
  31.464 +		{
  31.465 +			reposition();	// FIXME reposition the view instead...
  31.466 +			selection.update();
  31.467 +			if (lmode==NewMap)
  31.468 +			{
  31.469 +				mapDefault=false;
  31.470 +				mapChanged=false;
  31.471 +				mapUnsaved=false;
  31.472 +				autosaveTimer->stop();
  31.473 +			}
  31.474 +
  31.475 +			// Reset timestamp to check for later updates of file
  31.476 +			fileChangedTime=QFileInfo (destPath).lastModified();
  31.477 +		} else 
  31.478 +		{
  31.479 +			QMessageBox::critical( 0, tr( "Critical Parse Error" ),
  31.480 +					   tr( handler->errorProtocol() ) );
  31.481 +			// returnCode=1;	
  31.482 +			// Still return "success": the map maybe at least
  31.483 +			// partially read by the parser
  31.484 +		}	
  31.485 +	}	
  31.486 +
  31.487 +	// Delete tmpZipDir
  31.488 +	removeDir (QDir(tmpZipDir));
  31.489 +
  31.490 +	updateActions();
  31.491 +
  31.492 +	return err;
  31.493 +}
  31.494 +
  31.495 +ErrorCode VymModel::save (const SaveMode &savemode)
  31.496 +{
  31.497 +	QString tmpZipDir;
  31.498 +	QString mapFileName;
  31.499 +	QString safeFilePath;
  31.500 +
  31.501 +	ErrorCode err=success;
  31.502 +
  31.503 +	if (zipped)
  31.504 +		// save as .xml
  31.505 +		mapFileName=mapName+".xml";
  31.506 +	else
  31.507 +		// use name given by user, even if he chooses .doc
  31.508 +		mapFileName=fileName;
  31.509 +
  31.510 +	// Look, if we should zip the data:
  31.511 +	if (!zipped)
  31.512 +	{
  31.513 +		QMessageBox mb( vymName,
  31.514 +			tr("The map %1\ndid not use the compressed "
  31.515 +			"vym file format.\nWriting it uncompressed will also write images \n"
  31.516 +			"and flags and thus may overwrite files in the "
  31.517 +			"given directory\n\nDo you want to write the map").arg(filePath),
  31.518 +			QMessageBox::Warning,
  31.519 +			QMessageBox::Yes | QMessageBox::Default,
  31.520 +			QMessageBox::No ,
  31.521 +			QMessageBox::Cancel | QMessageBox::Escape);
  31.522 +		mb.setButtonText( QMessageBox::Yes, tr("compressed (vym default)") );
  31.523 +		mb.setButtonText( QMessageBox::No, tr("uncompressed") );
  31.524 +		mb.setButtonText( QMessageBox::Cancel, tr("Cancel"));
  31.525 +		switch( mb.exec() ) 
  31.526 +		{
  31.527 +			case QMessageBox::Yes:
  31.528 +				// save compressed (default file format)
  31.529 +				zipped=true;
  31.530 +				break;
  31.531 +			case QMessageBox::No:
  31.532 +				// save uncompressed
  31.533 +				zipped=false;
  31.534 +				break;
  31.535 +			case QMessageBox::Cancel:
  31.536 +				// do nothing
  31.537 +				return aborted;
  31.538 +				break;
  31.539 +		}
  31.540 +	}
  31.541 +
  31.542 +	// First backup existing file, we 
  31.543 +	// don't want to add to old zip archives
  31.544 +	QFile f(destPath);
  31.545 +	if (f.exists())
  31.546 +	{
  31.547 +		if ( settings.value ("/mapeditor/writeBackupFile").toBool())
  31.548 +		{
  31.549 +			QString backupFileName(destPath + "~");
  31.550 +			QFile backupFile(backupFileName);
  31.551 +			if (backupFile.exists() && !backupFile.remove())
  31.552 +			{
  31.553 +				QMessageBox::warning(0, tr("Save Error"),
  31.554 +									 tr("%1\ncould not be removed before saving").arg(backupFileName));
  31.555 +			}
  31.556 +			else if (!f.rename(backupFileName))
  31.557 +			{
  31.558 +				QMessageBox::warning(0, tr("Save Error"),
  31.559 +									 tr("%1\ncould not be renamed before saving").arg(destPath));
  31.560 +			}
  31.561 +		}
  31.562 +	}
  31.563 +
  31.564 +	if (zipped)
  31.565 +	{
  31.566 +		// Create temporary directory for packing
  31.567 +		bool ok;
  31.568 +		tmpZipDir=makeTmpDir (ok,"vym-zip");
  31.569 +		if (!ok)
  31.570 +		{
  31.571 +			QMessageBox::critical( 0, tr( "Critical Load Error" ),
  31.572 +			   tr("Couldn't create temporary directory before save\n"));
  31.573 +			return aborted; 
  31.574 +		}
  31.575 +
  31.576 +		safeFilePath=filePath;
  31.577 +		setFilePath (tmpZipDir+"/"+ mapName+ ".xml", safeFilePath);
  31.578 +	} // zipped
  31.579 +
  31.580 +	// Create mapName and fileDir
  31.581 +	makeSubDirs (fileDir);
  31.582 +
  31.583 +	QString saveFile;
  31.584 +	if (savemode==CompleteMap || selection.isEmpty())
  31.585 +	{
  31.586 +		// Save complete map
  31.587 +		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),NULL);
  31.588 +		mapChanged=false;
  31.589 +		mapUnsaved=false;
  31.590 +		autosaveTimer->stop();
  31.591 +	}
  31.592 +	else	
  31.593 +	{
  31.594 +		// Save part of map
  31.595 +		if (selection.type()==Selection::FloatImage)
  31.596 +			saveFloatImage();
  31.597 +		else	
  31.598 +			saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),selection.getBranch());	
  31.599 +		// TODO take care of multiselections
  31.600 +	}	
  31.601 +
  31.602 +	if (!saveStringToDisk(fileDir+mapFileName,saveFile))
  31.603 +	{
  31.604 +		err=aborted;
  31.605 +		qWarning ("ME::saveStringToDisk failed!");
  31.606 +	}
  31.607 +
  31.608 +	if (zipped)
  31.609 +	{
  31.610 +		// zip
  31.611 +		if (err==success) err=zipDir (tmpZipDir,destPath);
  31.612 +
  31.613 +		// Delete tmpDir
  31.614 +		removeDir (QDir(tmpZipDir));
  31.615 +
  31.616 +		// Restore original filepath outside of tmp zip dir
  31.617 +		setFilePath (safeFilePath);
  31.618 +	}
  31.619 +
  31.620 +	updateActions();
  31.621 +	fileChangedTime=QFileInfo (destPath).lastModified();
  31.622 +	return err;
  31.623 +}
  31.624 +
  31.625 +void VymModel::addMapReplaceInt(const QString &undoSel, const QString &path)
  31.626 +{
  31.627 +	QString pathDir=path.left(path.findRev("/"));
  31.628 +	QDir d(pathDir);
  31.629 +	QFile file (path);
  31.630 +
  31.631 +	if (d.exists() )
  31.632 +	{
  31.633 +		// We need to parse saved XML data
  31.634 +		parseVYMHandler handler;
  31.635 +		QXmlInputSource source( file);
  31.636 +		QXmlSimpleReader reader;
  31.637 +		reader.setContentHandler( &handler );
  31.638 +		reader.setErrorHandler( &handler );
  31.639 +		handler.setModel ( this);
  31.640 +		handler.setTmpDir ( pathDir );	// needed to load files with rel. path
  31.641 +		if (undoSel.isEmpty())
  31.642 +		{
  31.643 +			unselect();
  31.644 +			clear();
  31.645 +			handler.setLoadMode (NewMap);
  31.646 +		} else	
  31.647 +		{
  31.648 +			select (undoSel);
  31.649 +			handler.setLoadMode (ImportReplace);
  31.650 +		}	
  31.651 +		blockReposition=true;
  31.652 +		bool ok = reader.parse( source );
  31.653 +		blockReposition=false;
  31.654 +		if (! ok ) 
  31.655 +		{	
  31.656 +			// This should never ever happen
  31.657 +			QMessageBox::critical( 0, tr( "Critical Parse Error while reading %1").arg(path),
  31.658 +								    handler.errorProtocol());
  31.659 +		}
  31.660 +	} else	
  31.661 +		QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
  31.662 +}
  31.663 +
  31.664 +void VymModel::addMapInsertInt (const QString &path, int pos)
  31.665 +{
  31.666 +	BranchObj *sel=selection.getBranch();
  31.667 +	if (sel)
  31.668 +	{
  31.669 +		QString pathDir=path.left(path.findRev("/"));
  31.670 +		QDir d(pathDir);
  31.671 +		QFile file (path);
  31.672 +
  31.673 +		if (d.exists() )
  31.674 +		{
  31.675 +			// We need to parse saved XML data
  31.676 +			parseVYMHandler handler;
  31.677 +			QXmlInputSource source( file);
  31.678 +			QXmlSimpleReader reader;
  31.679 +			reader.setContentHandler( &handler );
  31.680 +			reader.setErrorHandler( &handler );
  31.681 +			handler.setModel (this);
  31.682 +			handler.setTmpDir ( pathDir );	// needed to load files with rel. path
  31.683 +			handler.setLoadMode (ImportAdd);
  31.684 +			blockReposition=true;
  31.685 +			bool ok = reader.parse( source );
  31.686 +			blockReposition=false;
  31.687 +			if (! ok ) 
  31.688 +			{	
  31.689 +				// This should never ever happen
  31.690 +				QMessageBox::critical( 0, tr( "Critical Parse Error while reading %1").arg(path),
  31.691 +										handler.errorProtocol());
  31.692 +			}
  31.693 +			if (sel->getDepth()>0)
  31.694 +				sel->getLastBranch()->linkTo (sel,pos);
  31.695 +		} else	
  31.696 +			QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
  31.697 +	}		
  31.698 +}
  31.699 +
  31.700 +FloatImageObj* VymModel::loadFloatImageInt (QString fn)
  31.701 +{
  31.702 +	BranchObj *bo=selection.getBranch();
  31.703 +	if (bo)
  31.704 +	{
  31.705 +		FloatImageObj *fio;
  31.706 +		bo->addFloatImage();
  31.707 +		fio=bo->getLastFloatImage();
  31.708 +		fio->load(fn);
  31.709 +		reposition();
  31.710 +		// FIXME needed? scene()->update();
  31.711 +		return fio;
  31.712 +	}
  31.713 +	return NULL;
  31.714 +}	
  31.715 +
  31.716 +void VymModel::loadFloatImage ()
  31.717 +{
  31.718 +	BranchObj *bo=selection.getBranch();
  31.719 +	if (bo)
  31.720 +	{
  31.721 +
  31.722 +		Q3FileDialog *fd=new Q3FileDialog( NULL);
  31.723 +		fd->setMode (Q3FileDialog::ExistingFiles);
  31.724 +		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
  31.725 +		ImagePreview *p =new ImagePreview (fd);
  31.726 +		fd->setContentsPreviewEnabled( TRUE );
  31.727 +		fd->setContentsPreview( p, p );
  31.728 +		fd->setPreviewMode( Q3FileDialog::Contents );
  31.729 +		fd->setCaption(vymName+" - " +tr("Load image"));
  31.730 +		fd->setDir (lastImageDir);
  31.731 +		fd->show();
  31.732 +
  31.733 +		if ( fd->exec() == QDialog::Accepted )
  31.734 +		{
  31.735 +			// TODO loadFIO in QT4 use:	lastImageDir=fd->directory();
  31.736 +			lastImageDir=QDir (fd->dirPath());
  31.737 +			QString s;
  31.738 +			FloatImageObj *fio;
  31.739 +			for (int j=0; j<fd->selectedFiles().count(); j++)
  31.740 +			{
  31.741 +				s=fd->selectedFiles().at(j);
  31.742 +				fio=loadFloatImageInt (s);
  31.743 +				if (fio)
  31.744 +					saveState(
  31.745 +						(LinkableMapObj*)fio,
  31.746 +						"delete ()",
  31.747 +						bo, 
  31.748 +						QString ("loadImage (%1)").arg(s ),
  31.749 +						QString("Add image %1 to %2").arg(s).arg(getObjectName(bo))
  31.750 +					);
  31.751 +				else
  31.752 +					// TODO loadFIO error handling
  31.753 +					qWarning ("Failed to load "+s);
  31.754 +			}
  31.755 +		}
  31.756 +		delete (p);
  31.757 +		delete (fd);
  31.758 +	}
  31.759 +}
  31.760 +
  31.761 +void VymModel::saveFloatImageInt  (FloatImageObj *fio, const QString &type, const QString &fn)
  31.762 +{
  31.763 +	fio->save (fn,type);
  31.764 +}
  31.765 +
  31.766 +void VymModel::saveFloatImage ()
  31.767 +{
  31.768 +	FloatImageObj *fio=selection.getFloatImage();
  31.769 +	if (fio)
  31.770 +	{
  31.771 +		QFileDialog *fd=new QFileDialog( NULL);
  31.772 +		fd->setFilters (imageIO.getFilters());
  31.773 +		fd->setCaption(vymName+" - " +tr("Save image"));
  31.774 +		fd->setFileMode( QFileDialog::AnyFile );
  31.775 +		fd->setDirectory (lastImageDir);
  31.776 +//		fd->setSelection (fio->getOriginalFilename());
  31.777 +		fd->show();
  31.778 +
  31.779 +		QString fn;
  31.780 +		if ( fd->exec() == QDialog::Accepted && fd->selectedFiles().count()==1)
  31.781 +		{
  31.782 +			fn=fd->selectedFiles().at(0);
  31.783 +			if (QFile (fn).exists() )
  31.784 +			{
  31.785 +				QMessageBox mb( vymName,
  31.786 +					tr("The file %1 exists already.\n"
  31.787 +					"Do you want to overwrite it?").arg(fn),
  31.788 +				QMessageBox::Warning,
  31.789 +				QMessageBox::Yes | QMessageBox::Default,
  31.790 +				QMessageBox::Cancel | QMessageBox::Escape,
  31.791 +				QMessageBox::NoButton );
  31.792 +
  31.793 +				mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
  31.794 +				mb.setButtonText( QMessageBox::No, tr("Cancel"));
  31.795 +				switch( mb.exec() ) 
  31.796 +				{
  31.797 +					case QMessageBox::Yes:
  31.798 +						// save 
  31.799 +						break;
  31.800 +					case QMessageBox::Cancel:
  31.801 +						// do nothing
  31.802 +						delete (fd);
  31.803 +						return;
  31.804 +						break;
  31.805 +				}
  31.806 +			}
  31.807 +			saveFloatImageInt (fio,fd->selectedFilter(),fn );
  31.808 +		}
  31.809 +		delete (fd);
  31.810 +	}
  31.811 +}
  31.812 +
  31.813 +
  31.814 +void VymModel::importDirInt(BranchObj *dst, QDir d)
  31.815 +{
  31.816 +	BranchObj *bo=selection.getBranch();
  31.817 +	if (bo)
  31.818 +	{
  31.819 +		// Traverse directories
  31.820 +		d.setFilter( QDir::Dirs| QDir::Hidden | QDir::NoSymLinks );
  31.821 +		QFileInfoList list = d.entryInfoList();
  31.822 +		QFileInfo fi;
  31.823 +
  31.824 +		for (int i = 0; i < list.size(); ++i) 
  31.825 +		{
  31.826 +			fi=list.at(i);
  31.827 +			if (fi.fileName() != "." && fi.fileName() != ".." )
  31.828 +			{
  31.829 +				dst->addBranch();
  31.830 +				bo=dst->getLastBranch();
  31.831 +				bo->setHeading (fi.fileName() );
  31.832 +				bo->setColor (QColor("blue"));
  31.833 +				bo->toggleScroll();
  31.834 +				if ( !d.cd(fi.fileName()) ) 
  31.835 +					QMessageBox::critical (0,tr("Critical Import Error"),tr("Cannot find the directory %1").arg(fi.fileName()));
  31.836 +				else 
  31.837 +				{
  31.838 +					// Recursively add subdirs
  31.839 +					importDirInt (bo,d);
  31.840 +					d.cdUp();
  31.841 +				}
  31.842 +			}	
  31.843 +		}		
  31.844 +		// Traverse files
  31.845 +		d.setFilter( QDir::Files| QDir::Hidden | QDir::NoSymLinks );
  31.846 +		list = d.entryInfoList();
  31.847 +
  31.848 +		for (int i = 0; i < list.size(); ++i) 
  31.849 +		{
  31.850 +			fi=list.at(i);
  31.851 +			dst->addBranch();
  31.852 +			bo=dst->getLastBranch();
  31.853 +			bo->setHeading (fi.fileName() );
  31.854 +			bo->setColor (QColor("black"));
  31.855 +			if (fi.fileName().right(4) == ".vym" )
  31.856 +				bo->setVymLink (fi.filePath());
  31.857 +		}	
  31.858 +	}		
  31.859 +}
  31.860 +
  31.861 +void VymModel::importDirInt (const QString &s)
  31.862 +{
  31.863 +	BranchObj *bo=selection.getBranch();
  31.864 +	if (bo)
  31.865 +	{
  31.866 +		saveStateChangingPart (bo,bo,QString ("importDir (\"%1\")").arg(s),QString("Import directory structure from %1").arg(s));
  31.867 +
  31.868 +		QDir d(s);
  31.869 +		importDirInt (bo,d);
  31.870 +	}
  31.871 +}	
  31.872 +
  31.873 +void VymModel::importDir()
  31.874 +{
  31.875 +	BranchObj *bo=selection.getBranch();
  31.876 +	if (bo)
  31.877 +	{
  31.878 +		QStringList filters;
  31.879 +		filters <<"VYM map (*.vym)";
  31.880 +		QFileDialog *fd=new QFileDialog( NULL,vymName+ " - " +tr("Choose directory structure to import"));
  31.881 +		fd->setMode (QFileDialog::DirectoryOnly);
  31.882 +		fd->setFilters (filters);
  31.883 +		fd->setCaption(vymName+" - " +tr("Choose directory structure to import"));
  31.884 +		fd->show();
  31.885 +
  31.886 +		QString fn;
  31.887 +		if ( fd->exec() == QDialog::Accepted )
  31.888 +		{
  31.889 +			importDirInt (fd->selectedFile() );
  31.890 +			reposition();
  31.891 +			//FIXME needed? scene()->update();
  31.892 +		}
  31.893 +	}	
  31.894 +}
  31.895 +
  31.896 +
  31.897 +void VymModel::autosave()
  31.898 +{
  31.899 +	QDateTime now=QDateTime().currentDateTime();
  31.900 +
  31.901 +	// Disable autosave, while we have gone back in history
  31.902 +	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
  31.903 +	if (redosAvail>0) return;
  31.904 +
  31.905 +	// Also disable autosave for new map without filename
  31.906 +	if (filePath.isEmpty()) return;
  31.907 +
  31.908 +
  31.909 +	if (mapUnsaved &&mapChanged && settings.value ("/autosave/use",true).toBool() )
  31.910 +	{
  31.911 +		if (QFileInfo(filePath).lastModified()<=fileChangedTime) 
  31.912 +			mainWindow->fileSave (this);
  31.913 +		else
  31.914 +			if (debug)
  31.915 +				cout <<"  ME::autosave  rejected, file on disk is newer than last save.\n"; 
  31.916 +
  31.917 +	}	
  31.918 +}
  31.919 +
  31.920 +void VymModel::fileChanged()
  31.921 +{
  31.922 +	// Check if file on disk has changed meanwhile
  31.923 +	if (!filePath.isEmpty())
  31.924 +	{
  31.925 +		QDateTime tmod=QFileInfo (filePath).lastModified();
  31.926 +		if (tmod>fileChangedTime)
  31.927 +		{
  31.928 +			// FIXME switch to current mapeditor and finish lineedits...
  31.929 +			QMessageBox mb( vymName,
  31.930 +				tr("The file of the map  on disk has changed:\n\n"  
  31.931 +				   "   %1\n\nDo you want to reload that map with the new file?").arg(filePath),
  31.932 +				QMessageBox::Question,
  31.933 +				QMessageBox::Yes ,
  31.934 +				QMessageBox::Cancel | QMessageBox::Default,
  31.935 +				QMessageBox::NoButton );
  31.936 +
  31.937 +			mb.setButtonText( QMessageBox::Yes, tr("Reload"));
  31.938 +			mb.setButtonText( QMessageBox::No, tr("Ignore"));
  31.939 +			switch( mb.exec() ) 
  31.940 +			{
  31.941 +				case QMessageBox::Yes:
  31.942 +					// Reload map
  31.943 +					load (filePath,NewMap,fileType);
  31.944 +		        case QMessageBox::Cancel:
  31.945 +					fileChangedTime=tmod; // allow autosave to overwrite newer file!
  31.946 +			}
  31.947 +		}
  31.948 +	}	
  31.949 +}
  31.950 +
  31.951 +bool VymModel::isDefault()
  31.952 +{
  31.953 +    return mapDefault;
  31.954 +}
  31.955 +
  31.956 +void VymModel::makeDefault()
  31.957 +{
  31.958 +	mapChanged=false;
  31.959 +	mapDefault=true;
  31.960 +}
  31.961 +
  31.962 +bool VymModel::hasChanged()
  31.963 +{
  31.964 +    return mapChanged;
  31.965 +}
  31.966 +
  31.967 +void VymModel::setChanged()
  31.968 +{
  31.969 +	if (!mapChanged)
  31.970 +		autosaveTimer->start(settings.value("/autosave/ms/",300000).toInt());
  31.971 +	mapChanged=true;
  31.972 +	mapDefault=false;
  31.973 +	mapUnsaved=true;
  31.974 +	findReset();
  31.975 +}
  31.976 +
  31.977 +
  31.978 +QString VymModel::getObjectName (const LinkableMapObj *lmo)
  31.979 +{
  31.980 +	QString s;
  31.981 +	if (!lmo) return QString("Error: NULL has no name!");
  31.982 +
  31.983 +	if ((typeid(*lmo) == typeid(BranchObj) ||
  31.984 +				      typeid(*lmo) == typeid(MapCenterObj))) 
  31.985 +	{
  31.986 +		
  31.987 +		s=(((BranchObj*)lmo)->getHeading());
  31.988 +		if (s=="") s="unnamed";
  31.989 +		return QString("branch (%1)").arg(s);
  31.990 +	}	
  31.991 +	if ((typeid(*lmo) == typeid(FloatImageObj) ))
  31.992 +		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
  31.993 +	return QString("Unknown type has no name!");
  31.994 +}
  31.995 +
  31.996 +void VymModel::redo()
  31.997 +{
  31.998 +	// Can we undo at all?
  31.999 +	if (redosAvail<1) return;
 31.1000 +
 31.1001 +	bool blockSaveStateOrg=blockSaveState;
 31.1002 +	blockSaveState=true;
 31.1003 +	
 31.1004 +	redosAvail--;
 31.1005 +
 31.1006 +	if (undosAvail<stepsTotal) undosAvail++;
 31.1007 +	curStep++;
 31.1008 +	if (curStep>stepsTotal) curStep=1;
 31.1009 +	QString undoCommand=  undoSet.readEntry (QString("/history/step-%1/undoCommand").arg(curStep));
 31.1010 +	QString undoSelection=undoSet.readEntry (QString("/history/step-%1/undoSelection").arg(curStep));
 31.1011 +	QString redoCommand=  undoSet.readEntry (QString("/history/step-%1/redoCommand").arg(curStep));
 31.1012 +	QString redoSelection=undoSet.readEntry (QString("/history/step-%1/redoSelection").arg(curStep));
 31.1013 +	QString comment=undoSet.readEntry (QString("/history/step-%1/comment").arg(curStep));
 31.1014 +	QString version=undoSet.readEntry ("/history/version");
 31.1015 +
 31.1016 +	/* TODO Maybe check for version, if we save the history
 31.1017 +	if (!checkVersion(version))
 31.1018 +		QMessageBox::warning(0,tr("Warning"),
 31.1019 +			tr("Version %1 of saved undo/redo data\ndoes not match current vym version %2.").arg(version).arg(vymVersion));
 31.1020 +	*/ 
 31.1021 +
 31.1022 +	// Find out current undo directory
 31.1023 +	QString bakMapDir(QString(tmpMapDir+"/undo-%1").arg(curStep));
 31.1024 +
 31.1025 +	if (debug)
 31.1026 +	{
 31.1027 +		cout << "VymModel::redo() begin\n";
 31.1028 +		cout << "    undosAvail="<<undosAvail<<endl;
 31.1029 +		cout << "    redosAvail="<<redosAvail<<endl;
 31.1030 +		cout << "       curStep="<<curStep<<endl;
 31.1031 +		cout << "    ---------------------------"<<endl;
 31.1032 +		cout << "    comment="<<comment.toStdString()<<endl;
 31.1033 +		cout << "    undoCom="<<undoCommand.toStdString()<<endl;
 31.1034 +		cout << "    undoSel="<<undoSelection.toStdString()<<endl;
 31.1035 +		cout << "    redoCom="<<redoCommand.toStdString()<<endl;
 31.1036 +		cout << "    redoSel="<<redoSelection.toStdString()<<endl;
 31.1037 +		cout << "    ---------------------------"<<endl<<endl;
 31.1038 +	}
 31.1039 +
 31.1040 +	// select  object before redo
 31.1041 +	if (!redoSelection.isEmpty())
 31.1042 +		select (redoSelection);
 31.1043 +
 31.1044 +
 31.1045 +	parseAtom (redoCommand);
 31.1046 +	reposition();
 31.1047 +
 31.1048 +	blockSaveState=blockSaveStateOrg;
 31.1049 +
 31.1050 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
 31.1051 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
 31.1052 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
 31.1053 +	undoSet.writeSettings(histPath);
 31.1054 +
 31.1055 +	mainWindow->updateHistory (undoSet);
 31.1056 +	updateActions();
 31.1057 +
 31.1058 +	/* TODO remove testing
 31.1059 +	cout << "ME::redo() end\n";
 31.1060 +	cout << "    undosAvail="<<undosAvail<<endl;
 31.1061 +	cout << "    redosAvail="<<redosAvail<<endl;
 31.1062 +	cout << "       curStep="<<curStep<<endl;
 31.1063 +	cout << "    ---------------------------"<<endl<<endl;
 31.1064 +	*/
 31.1065 +
 31.1066 +
 31.1067 +}
 31.1068 +
 31.1069 +bool VymModel::isRedoAvailable()
 31.1070 +{
 31.1071 +	if (undoSet.readNumEntry("/history/redosAvail",0)>0)
 31.1072 +		return true;
 31.1073 +	else	
 31.1074 +		return false;
 31.1075 +}
 31.1076 +
 31.1077 +void VymModel::undo()
 31.1078 +{
 31.1079 +	// Can we undo at all?
 31.1080 +	if (undosAvail<1) return;
 31.1081 +
 31.1082 +	mainWindow->statusMessage (tr("Autosave disabled during undo."));
 31.1083 +
 31.1084 +	bool blockSaveStateOrg=blockSaveState;
 31.1085 +	blockSaveState=true;
 31.1086 +	
 31.1087 +	QString undoCommand=  undoSet.readEntry (QString("/history/step-%1/undoCommand").arg(curStep));
 31.1088 +	QString undoSelection=undoSet.readEntry (QString("/history/step-%1/undoSelection").arg(curStep));
 31.1089 +	QString redoCommand=  undoSet.readEntry (QString("/history/step-%1/redoCommand").arg(curStep));
 31.1090 +	QString redoSelection=undoSet.readEntry (QString("/history/step-%1/redoSelection").arg(curStep));
 31.1091 +	QString comment=undoSet.readEntry (QString("/history/step-%1/comment").arg(curStep));
 31.1092 +	QString version=undoSet.readEntry ("/history/version");
 31.1093 +
 31.1094 +	/* TODO Maybe check for version, if we save the history
 31.1095 +	if (!checkVersion(version))
 31.1096 +		QMessageBox::warning(0,tr("Warning"),
 31.1097 +			tr("Version %1 of saved undo/redo data\ndoes not match current vym version %2.").arg(version).arg(vymVersion));
 31.1098 +	*/
 31.1099 +
 31.1100 +	// Find out current undo directory
 31.1101 +	QString bakMapDir(QString(tmpMapDir+"/undo-%1").arg(curStep));
 31.1102 +
 31.1103 +	// select  object before undo
 31.1104 +	if (!undoSelection.isEmpty())
 31.1105 +		select (undoSelection);
 31.1106 +
 31.1107 +	if (debug)
 31.1108 +	{
 31.1109 +		cout << "VymModel::undo() begin\n";
 31.1110 +		cout << "    undosAvail="<<undosAvail<<endl;
 31.1111 +		cout << "    redosAvail="<<redosAvail<<endl;
 31.1112 +		cout << "       curStep="<<curStep<<endl;
 31.1113 +		cout << "    ---------------------------"<<endl;
 31.1114 +		cout << "    comment="<<comment.toStdString()<<endl;
 31.1115 +		cout << "    undoCom="<<undoCommand.toStdString()<<endl;
 31.1116 +		cout << "    undoSel="<<undoSelection.toStdString()<<endl;
 31.1117 +		cout << "    redoCom="<<redoCommand.toStdString()<<endl;
 31.1118 +		cout << "    redoSel="<<redoSelection.toStdString()<<endl;
 31.1119 +		cout << "    ---------------------------"<<endl<<endl;
 31.1120 +	}	
 31.1121 +	parseAtom (undoCommand);
 31.1122 +	reposition();
 31.1123 +
 31.1124 +	undosAvail--;
 31.1125 +	curStep--; 
 31.1126 +	if (curStep<1) curStep=stepsTotal;
 31.1127 +
 31.1128 +	redosAvail++;
 31.1129 +
 31.1130 +	blockSaveState=blockSaveStateOrg;
 31.1131 +/* TODO remove testing
 31.1132 +	cout << "VymModel::undo() end\n";
 31.1133 +	cout << "    undosAvail="<<undosAvail<<endl;
 31.1134 +	cout << "    redosAvail="<<redosAvail<<endl;
 31.1135 +	cout << "       curStep="<<curStep<<endl;
 31.1136 +	cout << "    ---------------------------"<<endl<<endl;
 31.1137 +*/
 31.1138 +
 31.1139 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
 31.1140 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
 31.1141 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
 31.1142 +	undoSet.writeSettings(histPath);
 31.1143 +
 31.1144 +	mainWindow->updateHistory (undoSet);
 31.1145 +	updateActions();
 31.1146 +	selection.update();
 31.1147 +	ensureSelectionVisible();
 31.1148 +}
 31.1149 +
 31.1150 +bool VymModel::isUndoAvailable()
 31.1151 +{
 31.1152 +	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
 31.1153 +		return true;
 31.1154 +	else	
 31.1155 +		return false;
 31.1156 +}
 31.1157 +
 31.1158 +void VymModel::gotoHistoryStep (int i)
 31.1159 +{
 31.1160 +	// Restore variables
 31.1161 +	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
 31.1162 +	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
 31.1163 +
 31.1164 +	if (i<0) i=undosAvail+redosAvail;
 31.1165 +
 31.1166 +	// Clicking above current step makes us undo things
 31.1167 +	if (i<undosAvail) 
 31.1168 +	{	
 31.1169 +		for (int j=0; j<undosAvail-i; j++) undo();
 31.1170 +		return;
 31.1171 +	}	
 31.1172 +	// Clicking below current step makes us redo things
 31.1173 +	if (i>undosAvail) 
 31.1174 +		for (int j=undosAvail; j<i; j++) 
 31.1175 +		{
 31.1176 +			if (debug) cout << "VymModel::gotoHistoryStep redo "<<j<<"/"<<undosAvail<<" i="<<i<<endl;
 31.1177 +			redo();
 31.1178 +		}
 31.1179 +
 31.1180 +	// And ignore clicking the current row ;-)	
 31.1181 +}
 31.1182 +
 31.1183 +
 31.1184 +QString VymModel::getHistoryPath()
 31.1185 +{
 31.1186 +	QString histName(QString("history-%1").arg(curStep));
 31.1187 +	return (tmpMapDir+"/"+histName);
 31.1188 +}
 31.1189 +
 31.1190 +void VymModel::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
 31.1191 +{
 31.1192 +	sendData(redoCom);	//FIXME testing
 31.1193 +
 31.1194 +	// Main saveState
 31.1195 +
 31.1196 +
 31.1197 +	if (blockSaveState) return;
 31.1198 +
 31.1199 +	if (debug) cout << "ME::saveState() for  "<<qPrintable (mapName)<<endl;
 31.1200 +	
 31.1201 +	// Find out current undo directory
 31.1202 +	if (undosAvail<stepsTotal) undosAvail++;
 31.1203 +	curStep++;
 31.1204 +	if (curStep>stepsTotal) curStep=1;
 31.1205 +	
 31.1206 +	QString backupXML="";
 31.1207 +	QString histDir=getHistoryPath();
 31.1208 +	QString bakMapPath=histDir+"/map.xml";
 31.1209 +
 31.1210 +	// Create histDir if not available
 31.1211 +	QDir d(histDir);
 31.1212 +	if (!d.exists()) 
 31.1213 +		makeSubDirs (histDir);
 31.1214 +
 31.1215 +	// Save depending on how much needs to be saved	
 31.1216 +	if (saveSel)
 31.1217 +		backupXML=saveToDir (histDir,mapName+"-",false, QPointF (),saveSel);
 31.1218 +		
 31.1219 +	QString undoCommand="";
 31.1220 +	if (savemode==UndoCommand)
 31.1221 +	{
 31.1222 +		undoCommand=undoCom;
 31.1223 +	}	
 31.1224 +	else if (savemode==PartOfMap )
 31.1225 +	{
 31.1226 +		undoCommand=undoCom;
 31.1227 +		undoCommand.replace ("PATH",bakMapPath);
 31.1228 +	}
 31.1229 +
 31.1230 +	if (!backupXML.isEmpty())
 31.1231 +		// Write XML Data to disk
 31.1232 +		saveStringToDisk (bakMapPath,backupXML);
 31.1233 +
 31.1234 +	// We would have to save all actions in a tree, to keep track of 
 31.1235 +	// possible redos after a action. Possible, but we are too lazy: forget about redos.
 31.1236 +	redosAvail=0;
 31.1237 +
 31.1238 +	// Write the current state to disk
 31.1239 +	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
 31.1240 +	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
 31.1241 +	undoSet.setEntry ("/history/curStep",QString::number(curStep));
 31.1242 +	undoSet.setEntry (QString("/history/step-%1/undoCommand").arg(curStep),undoCommand);
 31.1243 +	undoSet.setEntry (QString("/history/step-%1/undoSelection").arg(curStep),undoSelection);
 31.1244 +	undoSet.setEntry (QString("/history/step-%1/redoCommand").arg(curStep),redoCom);
 31.1245 +	undoSet.setEntry (QString("/history/step-%1/redoSelection").arg(curStep),redoSelection);
 31.1246 +	undoSet.setEntry (QString("/history/step-%1/comment").arg(curStep),comment);
 31.1247 +	undoSet.setEntry (QString("/history/version"),vymVersion);
 31.1248 +	undoSet.writeSettings(histPath);
 31.1249 +
 31.1250 +	if (debug)
 31.1251 +	{
 31.1252 +		// TODO remove after testing
 31.1253 +		//cout << "          into="<< histPath.toStdString()<<endl;
 31.1254 +		cout << "    stepsTotal="<<stepsTotal<<
 31.1255 +		", undosAvail="<<undosAvail<<
 31.1256 +		", redosAvail="<<redosAvail<<
 31.1257 +		", curStep="<<curStep<<endl;
 31.1258 +		cout << "    ---------------------------"<<endl;
 31.1259 +		cout << "    comment="<<comment.toStdString()<<endl;
 31.1260 +		cout << "    undoCom="<<undoCommand.toStdString()<<endl;
 31.1261 +		cout << "    undoSel="<<undoSelection.toStdString()<<endl;
 31.1262 +		cout << "    redoCom="<<redoCom.toStdString()<<endl;
 31.1263 +		cout << "    redoSel="<<redoSelection.toStdString()<<endl;
 31.1264 +		if (saveSel) cout << "    saveSel="<<qPrintable (getSelectString(saveSel))<<endl;
 31.1265 +		cout << "    ---------------------------"<<endl;
 31.1266 +	}
 31.1267 +
 31.1268 +	mainWindow->updateHistory (undoSet);
 31.1269 +	setChanged();
 31.1270 +	updateActions();
 31.1271 +}
 31.1272 +
 31.1273 +
 31.1274 +void VymModel::saveStateChangingPart(LinkableMapObj *undoSel, LinkableMapObj* redoSel, const QString &rc, const QString &comment)
 31.1275 +{
 31.1276 +	// save the selected part of the map, Undo will replace part of map 
 31.1277 +	QString undoSelection="";
 31.1278 +	if (undoSel)
 31.1279 +		undoSelection=getSelectString(undoSel);
 31.1280 +	else
 31.1281 +		qWarning ("VymModel::saveStateChangingPart  no undoSel given!");
 31.1282 +	QString redoSelection="";
 31.1283 +	if (redoSel)
 31.1284 +		redoSelection=getSelectString(undoSel);
 31.1285 +	else
 31.1286 +		qWarning ("VymModel::saveStateChangingPart  no redoSel given!");
 31.1287 +		
 31.1288 +
 31.1289 +	saveState (PartOfMap,
 31.1290 +		undoSelection, "addMapReplace (\"PATH\")",
 31.1291 +		redoSelection, rc, 
 31.1292 +		comment, 
 31.1293 +		undoSel);
 31.1294 +}
 31.1295 +
 31.1296 +void VymModel::saveStateRemovingPart(LinkableMapObj *redoSel, const QString &comment)
 31.1297 +{
 31.1298 +	if (!redoSel)
 31.1299 +	{
 31.1300 +		qWarning ("VymModel::saveStateRemovingPart  no redoSel given!");
 31.1301 +		return;
 31.1302 +	}
 31.1303 +	QString undoSelection=getSelectString (redoSel->getParObj());
 31.1304 +	QString redoSelection=getSelectString(redoSel);
 31.1305 +	if (typeid(*redoSel) == typeid(BranchObj)  ) 
 31.1306 +	{
 31.1307 +		// save the selected branch of the map, Undo will insert part of map 
 31.1308 +		saveState (PartOfMap,
 31.1309 +			undoSelection, QString("addMapInsert (\"PATH\",%1)").arg(((BranchObj*)redoSel)->getNum()),
 31.1310 +			redoSelection, "delete ()", 
 31.1311 +			comment, 
 31.1312 +			redoSel);
 31.1313 +	}
 31.1314 +}
 31.1315 +
 31.1316 +
 31.1317 +void VymModel::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment) 
 31.1318 +{
 31.1319 +	// "Normal" savestate: save commands, selections and comment
 31.1320 +	// so just save commands for undo and redo
 31.1321 +	// and use current selection
 31.1322 +
 31.1323 +	QString redoSelection="";
 31.1324 +	if (redoSel) redoSelection=getSelectString(redoSel);
 31.1325 +	QString undoSelection="";
 31.1326 +	if (undoSel) undoSelection=getSelectString(undoSel);
 31.1327 +
 31.1328 +	saveState (UndoCommand,
 31.1329 +		undoSelection, uc,
 31.1330 +		redoSelection, rc, 
 31.1331 +		comment, 
 31.1332 +		NULL);
 31.1333 +}
 31.1334 +
 31.1335 +void VymModel::saveState(const QString &undoSel, const QString &uc, const QString &redoSel, const QString &rc, const QString &comment) 
 31.1336 +{
 31.1337 +	// "Normal" savestate: save commands, selections and comment
 31.1338 +	// so just save commands for undo and redo
 31.1339 +	// and use current selection
 31.1340 +	saveState (UndoCommand,
 31.1341 +		undoSel, uc,
 31.1342 +		redoSel, rc, 
 31.1343 +		comment, 
 31.1344 +		NULL);
 31.1345 +}
 31.1346 +
 31.1347 +void VymModel::saveState(const QString &uc, const QString &rc, const QString &comment) 
 31.1348 +{
 31.1349 +	// "Normal" savestate applied to model (no selection needed): 
 31.1350 +	// save commands  and comment
 31.1351 +	saveState (UndoCommand,
 31.1352 +		NULL, uc,
 31.1353 +		NULL, rc, 
 31.1354 +		comment, 
 31.1355 +		NULL);
 31.1356 +}
 31.1357 +
 31.1358 +
 31.1359  QGraphicsScene* VymModel::getScene ()
 31.1360  {
 31.1361  	return mapScene;
 31.1362  }
 31.1363  
 31.1364 -MapCenterObj* VymModel::addMapCenter()
 31.1365 -{
 31.1366 -	return addMapCenter (QPointF(0,0));
 31.1367 -}
 31.1368 -
 31.1369 -MapCenterObj* VymModel::addMapCenter(QPointF absPos)
 31.1370 -{
 31.1371 -	MapCenterObj *mapCenter = new MapCenterObj(mapScene);
 31.1372 -	mapCenter->move (absPos);
 31.1373 -    mapCenter->setVisibility (true);
 31.1374 -	mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
 31.1375 -	mapCenter->setMapEditor(mapEditor);		//FIXME needed to get defLinkStyle, mapLinkColorHint ... for later added objects
 31.1376 -	mapCenters.append(mapCenter);
 31.1377 -	return mapCenter;
 31.1378 -}
 31.1379 -
 31.1380 -MapCenterObj *VymModel::removeMapCenter(MapCenterObj* mco)
 31.1381 -{
 31.1382 -	int i=mapCenters.indexOf (mco);
 31.1383 -	if (i>=0)
 31.1384 -	{
 31.1385 -		mapCenters.removeAt (i);
 31.1386 -		delete (mco);
 31.1387 -		if (i>0) return mapCenters.at(i-1);	// Return previous MCO
 31.1388 -	}
 31.1389 -	return NULL;
 31.1390 -}
 31.1391 -
 31.1392  BranchObj* VymModel::first()
 31.1393  {
 31.1394  	if (mapCenters.count()>0) 
 31.1395 @@ -196,6 +1421,10 @@
 31.1396  	return NULL;
 31.1397  }
 31.1398  
 31.1399 +void VymModel::removeSelection()
 31.1400 +{
 31.1401 +}
 31.1402 +
 31.1403  QString VymModel::saveToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset)
 31.1404  {
 31.1405      QString s;
 31.1406 @@ -205,11 +1434,2264 @@
 31.1407      return s;
 31.1408  }
 31.1409  
 31.1410 +//////////////////////////////////////////////
 31.1411 +// Interface 
 31.1412 +//////////////////////////////////////////////
 31.1413 +void VymModel::setVersion (const QString &s)
 31.1414 +{
 31.1415 +	version=s;
 31.1416 +}
 31.1417 +
 31.1418 +void VymModel::setAuthor (const QString &s)
 31.1419 +{
 31.1420 +	saveState (
 31.1421 +		QString ("setMapAuthor (\"%1\")").arg(author),
 31.1422 +		QString ("setMapAuthor (\"%1\")").arg(s),
 31.1423 +		QString ("Set author of map to \"%1\"").arg(s)
 31.1424 +	);
 31.1425 +
 31.1426 +	author=s;
 31.1427 +}
 31.1428 +
 31.1429 +QString VymModel::getAuthor()
 31.1430 +{
 31.1431 +	return author;
 31.1432 +}
 31.1433 +
 31.1434 +void VymModel::setComment (const QString &s)
 31.1435 +{
 31.1436 +	saveState (
 31.1437 +		QString ("setMapComment (\"%1\")").arg(comment),
 31.1438 +		QString ("setMapComment (\"%1\")").arg(s),
 31.1439 +		QString ("Set comment of map")
 31.1440 +	);
 31.1441 +
 31.1442 +	comment=s;
 31.1443 +}
 31.1444 +
 31.1445 +QString VymModel::getComment ()
 31.1446 +{
 31.1447 +	return comment;
 31.1448 +}
 31.1449 +
 31.1450 +QString VymModel::getDate ()
 31.1451 +{
 31.1452 +	return QDate::currentDate().toString ("yyyy-MM-dd");
 31.1453 +}
 31.1454 +
 31.1455 +void VymModel::setHeading(const QString &s)
 31.1456 +{
 31.1457 +	BranchObj *sel=selection.getBranch();
 31.1458 +	if (sel)
 31.1459 +	{
 31.1460 +		saveState(
 31.1461 +			sel,
 31.1462 +			"setHeading (\""+sel->getHeading()+"\")", 
 31.1463 +			sel,
 31.1464 +			"setHeading (\""+s+"\")", 
 31.1465 +			QString("Set heading of %1 to \"%2\"").arg(getObjectName(sel)).arg(s) );
 31.1466 +		sel->setHeading(s );
 31.1467 +		reposition();
 31.1468 +		selection.update();
 31.1469 +		ensureSelectionVisible();
 31.1470 +	}
 31.1471 +}
 31.1472 +
 31.1473 +QString VymModel::getHeading(bool &ok, QPoint &p)
 31.1474 +{
 31.1475 +	BranchObj *bo=selection.getBranch();
 31.1476 +	if (bo)
 31.1477 +	{
 31.1478 +		ok=true;
 31.1479 +		//p=scene->mapFromScene(bo->getAbsPos());	// FIXME this is view-dependant!!!
 31.1480 +		return bo->getHeading();
 31.1481 +	}
 31.1482 +	ok=false;
 31.1483 +	return QString();
 31.1484 +}
 31.1485 +
 31.1486 +
 31.1487 +void VymModel::setHeadingInt(const QString &s)
 31.1488 +{
 31.1489 +	BranchObj *bo=selection.getBranch();
 31.1490 +	if (bo)
 31.1491 +	{
 31.1492 +		bo->setHeading(s);
 31.1493 +		reposition();
 31.1494 +		selection.update();
 31.1495 +		ensureSelectionVisible();
 31.1496 +	}
 31.1497 +}
 31.1498 +
 31.1499 +BranchObj* VymModel::findText (QString s, bool cs)
 31.1500 +{
 31.1501 +	QTextDocument::FindFlags flags=0;
 31.1502 +	if (cs) flags=QTextDocument::FindCaseSensitively;
 31.1503 +
 31.1504 +	if (!itFind) 
 31.1505 +	{	// Nothing found or new find process
 31.1506 +		if (EOFind)
 31.1507 +			// nothing found, start again
 31.1508 +			EOFind=false;
 31.1509 +		itFind=first();
 31.1510 +	}	
 31.1511 +	bool searching=true;
 31.1512 +	bool foundNote=false;
 31.1513 +	while (searching && !EOFind)
 31.1514 +	{
 31.1515 +		if (itFind)
 31.1516 +		{
 31.1517 +			// Searching in Note
 31.1518 +			if (itFind->getNote().contains(s,cs))
 31.1519 +			{
 31.1520 +				if (selection.single()!=itFind) 
 31.1521 +				{
 31.1522 +					selection.select(itFind);
 31.1523 +					ensureSelectionVisible();
 31.1524 +				}
 31.1525 +				if (textEditor->findText(s,flags)) 
 31.1526 +				{
 31.1527 +					searching=false;
 31.1528 +					foundNote=true;
 31.1529 +				}	
 31.1530 +			}
 31.1531 +			// Searching in Heading
 31.1532 +			if (searching && itFind->getHeading().contains (s,cs) ) 
 31.1533 +			{
 31.1534 +				selection.select(itFind);
 31.1535 +				ensureSelectionVisible();
 31.1536 +				searching=false;
 31.1537 +			}
 31.1538 +		}	
 31.1539 +		if (!foundNote)
 31.1540 +		{
 31.1541 +			itFind=next(itFind);
 31.1542 +			if (!itFind) EOFind=true;
 31.1543 +		}
 31.1544 +	//cout <<"still searching...  "<<qPrintable( itFind->getHeading())<<endl;
 31.1545 +	}	
 31.1546 +	if (!searching)
 31.1547 +		return selection.getBranch();
 31.1548 +	else
 31.1549 +		return NULL;
 31.1550 +}
 31.1551 +
 31.1552 +void VymModel::findReset()
 31.1553 +{	// Necessary if text to find changes during a find process
 31.1554 +	itFind=NULL;
 31.1555 +	EOFind=false;
 31.1556 +}
 31.1557 +
 31.1558 +
 31.1559 +
 31.1560 +void VymModel::setScene (QGraphicsScene *s)
 31.1561 +{
 31.1562 +	mapScene=s;
 31.1563 +    init();	// Here we have a mapScene set, 
 31.1564 +			// which is (still) needed to create MapCenters
 31.1565 +}
 31.1566 +
 31.1567 +void VymModel::setURL(const QString &url)
 31.1568 +{
 31.1569 +	BranchObj *bo=selection.getBranch();
 31.1570 +	if (bo)
 31.1571 +	{
 31.1572 +		QString oldurl=bo->getURL();
 31.1573 +		bo->setURL (url);
 31.1574 +		saveState (
 31.1575 +			bo,
 31.1576 +			QString ("setURL (\"%1\")").arg(oldurl),
 31.1577 +			bo,
 31.1578 +			QString ("setURL (\"%1\")").arg(url),
 31.1579 +			QString ("set URL of %1 to %2").arg(getObjectName(bo)).arg(url)
 31.1580 +		);
 31.1581 +		updateActions();
 31.1582 +		reposition();
 31.1583 +		selection.update();
 31.1584 +		ensureSelectionVisible();
 31.1585 +	}
 31.1586 +}	
 31.1587 +
 31.1588 +QString VymModel::getURL()
 31.1589 +{
 31.1590 +	BranchObj *bo=selection.getBranch();
 31.1591 +	if (bo)
 31.1592 +		return bo->getURL();
 31.1593 +	else
 31.1594 +		return "";
 31.1595 +}
 31.1596 +
 31.1597 +QStringList VymModel::getURLs()
 31.1598 +{
 31.1599 +	QStringList urls;
 31.1600 +	BranchObj *bo=selection.getBranch();
 31.1601 +	if (bo)
 31.1602 +	{		
 31.1603 +		bo=bo->first();	
 31.1604 +		while (bo) 
 31.1605 +		{
 31.1606 +			if (!bo->getURL().isEmpty()) urls.append( bo->getURL());
 31.1607 +			bo=bo->next();
 31.1608 +		}	
 31.1609 +	}	
 31.1610 +	return urls;
 31.1611 +}
 31.1612 +
 31.1613 +void VymModel::linkFloatImageTo(const QString &dstString)	
 31.1614 +{
 31.1615 +	FloatImageObj *fio=selection.getFloatImage();
 31.1616 +	if (fio)
 31.1617 +	{
 31.1618 +		BranchObj *dst=(BranchObj*)findObjBySelect(dstString);
 31.1619 +		if (dst && (typeid(*dst)==typeid (BranchObj) || 
 31.1620 +					typeid(*dst)==typeid (MapCenterObj)))
 31.1621 +		{			
 31.1622 +			LinkableMapObj *dstPar=dst->getParObj();
 31.1623 +			QString parString=getSelectString(dstPar);
 31.1624 +			QString fioPreSelectString=getSelectString(fio);
 31.1625 +			QString fioPreParentSelectString=getSelectString (fio->getParObj());
 31.1626 +			((BranchObj*)dst)->addFloatImage (fio);
 31.1627 +			selection.unselect();
 31.1628 +			((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
 31.1629 +			fio=((BranchObj*)dst)->getLastFloatImage();
 31.1630 +			fio->setRelPos();
 31.1631 +			fio->reposition();
 31.1632 +			selection.select(fio);
 31.1633 +			saveState(
 31.1634 +				getSelectString(fio),
 31.1635 +				QString("linkTo (\"%1\")").arg(fioPreParentSelectString), 
 31.1636 +				fioPreSelectString, 
 31.1637 +				QString ("linkTo (\"%1\")").arg(dstString),
 31.1638 +				QString ("Link floatimage to %1").arg(getObjectName(dst)));
 31.1639 +		}
 31.1640 +	}
 31.1641 +}
 31.1642 +
 31.1643 +
 31.1644 +void VymModel::setFrameType(const FrameObj::FrameType &t)
 31.1645 +{
 31.1646 +	BranchObj *bo=selection.getBranch();
 31.1647 +	if (bo)
 31.1648 +	{
 31.1649 +		QString s=bo->getFrameTypeName();
 31.1650 +		bo->setFrameType (t);
 31.1651 +		saveState (bo, QString("setFrameType (\"%1\")").arg(s),
 31.1652 +			bo, QString ("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),QString ("set type of frame to %1").arg(s));
 31.1653 +		reposition();
 31.1654 +		bo->updateLink();
 31.1655 +	}
 31.1656 +}
 31.1657 +
 31.1658 +void VymModel::setFrameType(const QString &s)	
 31.1659 +{
 31.1660 +	BranchObj *bo=selection.getBranch();
 31.1661 +	if (bo)
 31.1662 +	{
 31.1663 +		saveState (bo, QString("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),
 31.1664 +			bo, QString ("setFrameType (\"%1\")").arg(s),QString ("set type of frame to %1").arg(s));
 31.1665 +		bo->setFrameType (s);
 31.1666 +		reposition();
 31.1667 +		bo->updateLink();
 31.1668 +	}
 31.1669 +}
 31.1670 +
 31.1671 +void VymModel::setFramePenColor(const QColor &c)	
 31.1672 +{
 31.1673 +	BranchObj *bo=selection.getBranch();
 31.1674 +	if (bo)
 31.1675 +	{
 31.1676 +		saveState (bo, QString("setFramePenColor (\"%1\")").arg(bo->getFramePenColor().name() ),
 31.1677 +			bo, QString ("setFramePenColor (\"%1\")").arg(c.name() ),QString ("set pen color of frame to %1").arg(c.name() ));
 31.1678 +		bo->setFramePenColor (c);
 31.1679 +	}	
 31.1680 +}
 31.1681 +
 31.1682 +void VymModel::setFrameBrushColor(const QColor &c)	
 31.1683 +{
 31.1684 +	BranchObj *bo=selection.getBranch();
 31.1685 +	if (bo)
 31.1686 +	{
 31.1687 +		saveState (bo, QString("setFrameBrushColor (\"%1\")").arg(bo->getFrameBrushColor().name() ),
 31.1688 +			bo, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
 31.1689 +		bo->setFrameBrushColor (c);
 31.1690 +	}	
 31.1691 +}
 31.1692 +
 31.1693 +void VymModel::setFramePadding (const int &i)
 31.1694 +{
 31.1695 +	BranchObj *bo=selection.getBranch();
 31.1696 +	if (bo)
 31.1697 +	{
 31.1698 +		saveState (bo, QString("setFramePadding (\"%1\")").arg(bo->getFramePadding() ),
 31.1699 +			bo, QString ("setFramePadding (\"%1\")").arg(i),QString ("set brush color of frame to %1").arg(i));
 31.1700 +		bo->setFramePadding (i);
 31.1701 +		reposition();
 31.1702 +		bo->updateLink();
 31.1703 +	}	
 31.1704 +}
 31.1705 +
 31.1706 +void VymModel::setFrameBorderWidth(const int &i)
 31.1707 +{
 31.1708 +	BranchObj *bo=selection.getBranch();
 31.1709 +	if (bo)
 31.1710 +	{
 31.1711 +		saveState (bo, QString("setFrameBorderWidth (\"%1\")").arg(bo->getFrameBorderWidth() ),
 31.1712 +			bo, QString ("setFrameBorderWidth (\"%1\")").arg(i),QString ("set border width of frame to %1").arg(i));
 31.1713 +		bo->setFrameBorderWidth (i);
 31.1714 +		reposition();
 31.1715 +		bo->updateLink();
 31.1716 +	}	
 31.1717 +}
 31.1718 +
 31.1719 +void VymModel::setIncludeImagesVer(bool b)	
 31.1720 +{
 31.1721 +	BranchObj *bo=selection.getBranch();
 31.1722 +	if (bo)
 31.1723 +	{
 31.1724 +		QString u= b ? "false" : "true";
 31.1725 +		QString r=!b ? "false" : "true";
 31.1726 +		
 31.1727 +		saveState(
 31.1728 +			bo,
 31.1729 +			QString("setIncludeImagesVertically (%1)").arg(u),
 31.1730 +			bo, 
 31.1731 +			QString("setIncludeImagesVertically (%1)").arg(r),
 31.1732 +			QString("Include images vertically in %1").arg(getObjectName(bo))
 31.1733 +		);	
 31.1734 +		bo->setIncludeImagesVer(b);
 31.1735 +		reposition();
 31.1736 +	}	
 31.1737 +}
 31.1738 +
 31.1739 +void VymModel::setIncludeImagesHor(bool b)	
 31.1740 +{
 31.1741 +	BranchObj *bo=selection.getBranch();
 31.1742 +	if (bo)
 31.1743 +	{
 31.1744 +		QString u= b ? "false" : "true";
 31.1745 +		QString r=!b ? "false" : "true";
 31.1746 +		
 31.1747 +		saveState(
 31.1748 +			bo,
 31.1749 +			QString("setIncludeImagesHorizontally (%1)").arg(u),
 31.1750 +			bo, 
 31.1751 +			QString("setIncludeImagesHorizontally (%1)").arg(r),
 31.1752 +			QString("Include images horizontally in %1").arg(getObjectName(bo))
 31.1753 +		);	
 31.1754 +		bo->setIncludeImagesHor(b);
 31.1755 +		reposition();
 31.1756 +	}	
 31.1757 +}
 31.1758 +
 31.1759 +void VymModel::setHideLinkUnselected (bool b)
 31.1760 +{
 31.1761 +	LinkableMapObj *sel=selection.single();
 31.1762 +	if (sel &&
 31.1763 +		(selection.type() == Selection::Branch || 
 31.1764 +		selection.type() == Selection::MapCenter  ||
 31.1765 +		selection.type() == Selection::FloatImage ))
 31.1766 +	{
 31.1767 +		QString u= b ? "false" : "true";
 31.1768 +		QString r=!b ? "false" : "true";
 31.1769 +		
 31.1770 +		saveState(
 31.1771 +			sel,
 31.1772 +			QString("setHideLinkUnselected (%1)").arg(u),
 31.1773 +			sel, 
 31.1774 +			QString("setHideLinkUnselected (%1)").arg(r),
 31.1775 +			QString("Hide link of %1 if unselected").arg(getObjectName(sel))
 31.1776 +		);	
 31.1777 +		sel->setHideLinkUnselected(b);
 31.1778 +	}
 31.1779 +}
 31.1780 +
 31.1781 +void VymModel::setHideExport(bool b)
 31.1782 +{
 31.1783 +	BranchObj *bo=selection.getBranch();
 31.1784 +	if (bo)
 31.1785 +	{
 31.1786 +		bo->setHideInExport (b);
 31.1787 +		QString u= b ? "false" : "true";
 31.1788 +		QString r=!b ? "false" : "true";
 31.1789 +		
 31.1790 +		saveState(
 31.1791 +			bo,
 31.1792 +			QString ("setHideExport (%1)").arg(u),
 31.1793 +			bo,
 31.1794 +			QString ("setHideExport (%1)").arg(r),
 31.1795 +			QString ("Set HideExport flag of %1 to %2").arg(getObjectName(bo)).arg (r)
 31.1796 +		);	
 31.1797 +		updateActions();
 31.1798 +		reposition();
 31.1799 +		selection.update();
 31.1800 +		// FIXME needed? scene()->update();
 31.1801 +	}
 31.1802 +}
 31.1803 +
 31.1804 +void VymModel::toggleHideExport()
 31.1805 +{
 31.1806 +	BranchObj *bo=selection.getBranch();
 31.1807 +	if (bo)
 31.1808 +		setHideExport ( !bo->hideInExport() );
 31.1809 +}
 31.1810 +
 31.1811 +
 31.1812 +void VymModel::copy()
 31.1813 +{
 31.1814 +	LinkableMapObj *sel=selection.single();
 31.1815 +	if (sel)
 31.1816 +	{
 31.1817 +		if (redosAvail == 0)
 31.1818 +		{
 31.1819 +			// Copy to history
 31.1820 +			QString s=getSelectString(sel);
 31.1821 +			saveState (PartOfMap, s, "nop ()", s, "copy ()","Copy selection to clipboard",sel  );
 31.1822 +			curClipboard=curStep;
 31.1823 +		}
 31.1824 +
 31.1825 +		// Copy also to global clipboard, because we are at last step in history
 31.1826 +		QString bakMapName(QString("history-%1").arg(curStep));
 31.1827 +		QString bakMapDir(tmpMapDir +"/"+bakMapName);
 31.1828 +		copyDir (bakMapDir,clipboardDir );
 31.1829 +
 31.1830 +		clipboardEmpty=false;
 31.1831 +		updateActions();
 31.1832 +	}	    
 31.1833 +}
 31.1834 +
 31.1835 +
 31.1836 +void VymModel::pasteNoSave(const int &n)
 31.1837 +{
 31.1838 +	bool old=blockSaveState;
 31.1839 +	blockSaveState=true;
 31.1840 +	bool zippedOrg=zipped;
 31.1841 +	if (redosAvail > 0 || n!=0)
 31.1842 +	{
 31.1843 +		// Use the "historical" buffer
 31.1844 +		QString bakMapName(QString("history-%1").arg(n));
 31.1845 +		QString bakMapDir(tmpMapDir +"/"+bakMapName);
 31.1846 +		load (bakMapDir+"/"+clipboardFile,ImportAdd, VymMap);
 31.1847 +	} else
 31.1848 +		// Use the global buffer
 31.1849 +		load (clipboardDir+"/"+clipboardFile,ImportAdd, VymMap);
 31.1850 +	zipped=zippedOrg;
 31.1851 +	blockSaveState=old;
 31.1852 +}
 31.1853 +
 31.1854 +void VymModel::paste()		
 31.1855 +{   
 31.1856 +	BranchObj *sel=selection.getBranch();
 31.1857 +	if (sel)
 31.1858 +	{
 31.1859 +		saveStateChangingPart(
 31.1860 +			sel,
 31.1861 +			sel,
 31.1862 +			QString ("paste (%1)").arg(curClipboard),
 31.1863 +			QString("Paste to %1").arg( getObjectName(sel))
 31.1864 +		);
 31.1865 +		pasteNoSave(0);
 31.1866 +		reposition();
 31.1867 +	}
 31.1868 +}
 31.1869 +
 31.1870 +void VymModel::cut()
 31.1871 +{
 31.1872 +	LinkableMapObj *sel=selection.single();
 31.1873 +	if ( sel && (selection.type() == Selection::Branch ||
 31.1874 +		selection.type()==Selection::MapCenter ||
 31.1875 +		selection.type()==Selection::FloatImage))
 31.1876 +	{
 31.1877 +	/* No savestate! savestate is called in cutNoSave
 31.1878 +		saveStateChangingPart(
 31.1879 +			sel->getParObj(),
 31.1880 +			sel,
 31.1881 +			"cut ()",
 31.1882 +			QString("Cut %1").arg(getObjectName(sel ))
 31.1883 +		);
 31.1884 +	*/	
 31.1885 +		copy();
 31.1886 +		deleteSelection();
 31.1887 +		reposition();
 31.1888 +	}
 31.1889 +}
 31.1890 +
 31.1891 +void VymModel::moveBranchUp()
 31.1892 +{
 31.1893 +	BranchObj* bo=selection.getBranch();
 31.1894 +	BranchObj* par;
 31.1895 +	if (bo)
 31.1896 +	{
 31.1897 +		if (!bo->canMoveBranchUp()) return;
 31.1898 +		par=(BranchObj*)(bo->getParObj());
 31.1899 +		BranchObj *obo=par->moveBranchUp (bo);	// bo will be the one below selection
 31.1900 +		saveState (getSelectString(bo),"moveBranchDown ()",getSelectString(obo),"moveBranchUp ()",QString("Move up %1").arg(getObjectName(bo)));
 31.1901 +		reposition();
 31.1902 +		//FIXME needed? scene()->update();
 31.1903 +		selection.update();
 31.1904 +		ensureSelectionVisible();
 31.1905 +	}
 31.1906 +}
 31.1907 +
 31.1908 +void VymModel::moveBranchDown()
 31.1909 +{
 31.1910 +	BranchObj* bo=selection.getBranch();
 31.1911 +	BranchObj* par;
 31.1912 +	if (bo)
 31.1913 +	{
 31.1914 +		if (!bo->canMoveBranchDown()) return;
 31.1915 +		par=(BranchObj*)(bo->getParObj());
 31.1916 +		BranchObj *obo=par->moveBranchDown(bo);	// bo will be the one above selection
 31.1917 +		saveState(getSelectString(bo),"moveBranchUp ()",getSelectString(obo),"moveBranchDown ()",QString("Move down %1").arg(getObjectName(bo)));
 31.1918 +		reposition();
 31.1919 +		//FIXME needed? scene()->update();
 31.1920 +		selection.update();
 31.1921 +		ensureSelectionVisible();
 31.1922 +	}	
 31.1923 +}
 31.1924 +
 31.1925 +void VymModel::sortChildren()
 31.1926 +{
 31.1927 +	BranchObj* bo=selection.getBranch();
 31.1928 +	if (bo)
 31.1929 +	{
 31.1930 +		if(bo->countBranches()>1)
 31.1931 +		{
 31.1932 +			saveStateChangingPart(bo,bo, "sortChildren ()",QString("Sort children of %1").arg(getObjectName(bo)));
 31.1933 +			bo->sortChildren();
 31.1934 +			reposition();
 31.1935 +			ensureSelectionVisible();
 31.1936 +		}
 31.1937 +	}
 31.1938 +}
 31.1939 +
 31.1940 +MapCenterObj* VymModel::addMapCenter ()
 31.1941 +{
 31.1942 +	MapCenterObj *mco=addMapCenter (QPointF(0,0));
 31.1943 +	selection.select (mco);
 31.1944 +	updateActions();
 31.1945 +	ensureSelectionVisible();
 31.1946 +	saveState (
 31.1947 +		mco,
 31.1948 +		"delete()",
 31.1949 +		NULL,
 31.1950 +		// FIXME  how to position LineEdit without contextMenuPos ?
 31.1951 +		// QString ("addMapCenter (%1,%2)").arg (contextMenuPos.x()).arg(contextMenuPos.y()),
 31.1952 +		// QString ("Adding MapCenter to (%1,%2").arg (contextMenuPos.x()).arg(contextMenuPos.y())
 31.1953 +		QString ("addMapCenter (%1,%2)").arg (0).arg(0),
 31.1954 +		QString ("Adding MapCenter to (%1,%2").arg (0).arg(0)
 31.1955 +	);	
 31.1956 +	return mco;	
 31.1957 +}
 31.1958 +
 31.1959 +MapCenterObj* VymModel::addMapCenter(QPointF absPos)
 31.1960 +{
 31.1961 +	MapCenterObj *mapCenter = new MapCenterObj(mapScene);
 31.1962 +	mapCenter->move (absPos);
 31.1963 +    mapCenter->setVisibility (true);
 31.1964 +	mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
 31.1965 +	mapCenter->setMapEditor(mapEditor);		//FIXME needed to get defLinkStyle, mapLinkColorHint ... for later added objects
 31.1966 +	mapCenters.append(mapCenter);
 31.1967 +	return mapCenter;
 31.1968 +}
 31.1969 +
 31.1970 +MapCenterObj *VymModel::removeMapCenter(MapCenterObj* mco)
 31.1971 +{
 31.1972 +	int i=mapCenters.indexOf (mco);
 31.1973 +	if (i>=0)
 31.1974 +	{
 31.1975 +		mapCenters.removeAt (i);
 31.1976 +		delete (mco);
 31.1977 +		if (i>0) return mapCenters.at(i-1);	// Return previous MCO
 31.1978 +	}
 31.1979 +	return NULL;
 31.1980 +}
 31.1981 +
 31.1982 +
 31.1983 +BranchObj* VymModel::addNewBranchInt(int num)
 31.1984 +{
 31.1985 +	// Depending on pos:
 31.1986 +	// -3		insert in children of parent  above selection 
 31.1987 +	// -2		add branch to selection 
 31.1988 +	// -1		insert in children of parent below selection 
 31.1989 +	// 0..n		insert in children of parent at pos
 31.1990 +	BranchObj *newbo=NULL;
 31.1991 +	BranchObj *bo=selection.getBranch();
 31.1992 +	if (bo)
 31.1993 +	{
 31.1994 +		if (num==-2)
 31.1995 +		{
 31.1996 +			// save scroll state. If scrolled, automatically select
 31.1997 +			// new branch in order to tmp unscroll parent...
 31.1998 +			newbo=bo->addBranch();
 31.1999 +			
 31.2000 +		}else if (num==-1)
 31.2001 +		{
 31.2002 +			num=bo->getNum()+1;
 31.2003 +			bo=(BranchObj*)bo->getParObj();
 31.2004 +			if (bo) newbo=bo->insertBranch(num);
 31.2005 +		}else if (num==-3)
 31.2006 +		{
 31.2007 +			num=bo->getNum();
 31.2008 +			bo=(BranchObj*)bo->getParObj();
 31.2009 +			if (bo) newbo=bo->insertBranch(num);
 31.2010 +		}
 31.2011 +		if (!newbo) return NULL;
 31.2012 +	}	
 31.2013 +	return newbo;
 31.2014 +}	
 31.2015 +
 31.2016 +BranchObj* VymModel::addNewBranch(int pos)
 31.2017 +{
 31.2018 +	// Different meaning than num in addNewBranchInt!
 31.2019 +	// -1	add above
 31.2020 +	//  0	add as child
 31.2021 +	// +1	add below
 31.2022 +	BranchObj *bo = selection.getBranch();
 31.2023 +	BranchObj *newbo=NULL;
 31.2024 +
 31.2025 +	if (bo)
 31.2026 +	{
 31.2027 +		// FIXME  do we still need this in model? setCursor (Qt::ArrowCursor);
 31.2028 +
 31.2029 +		newbo=addNewBranchInt (pos-2);
 31.2030 +
 31.2031 +		if (newbo)
 31.2032 +		{
 31.2033 +			saveState(
 31.2034 +				newbo,		
 31.2035 +				"delete ()",
 31.2036 +				bo,
 31.2037 +				QString ("addBranch (%1)").arg(pos),
 31.2038 +				QString ("Add new branch to %1").arg(getObjectName(bo)));	
 31.2039 +
 31.2040 +			reposition();
 31.2041 +			selection.update();
 31.2042 +			latestSelectionString=getSelectString(newbo);
 31.2043 +			// In Network mode, the client needs to know where the new branch is,
 31.2044 +			// so we have to pass on this information via saveState.
 31.2045 +			// TODO: Get rid of this positioning workaround
 31.2046 +			QString ps=qpointfToString (newbo->getAbsPos());
 31.2047 +			sendData ("selectLatestAdded ()");
 31.2048 +			sendData (QString("move %1").arg(ps));
 31.2049 +			sendSelection();
 31.2050 +		}
 31.2051 +	}	
 31.2052 +	return newbo;
 31.2053 +}
 31.2054 +
 31.2055 +
 31.2056 +BranchObj* VymModel::addNewBranchBefore()
 31.2057 +{
 31.2058 +	BranchObj *newbo=NULL;
 31.2059 +	BranchObj *bo = selection.getBranch();
 31.2060 +	if (bo && selection.type()==Selection::Branch)
 31.2061 +		 // We accept no MapCenterObj here, so we _have_ a parent
 31.2062 +	{
 31.2063 +		QPointF p=bo->getRelPos();
 31.2064 +
 31.2065 +
 31.2066 +		BranchObj *parbo=(BranchObj*)(bo->getParObj());
 31.2067 +
 31.2068 +		// add below selection
 31.2069 +		newbo=parbo->insertBranch(bo->getNum()+1);
 31.2070 +		if (newbo)
 31.2071 +		{
 31.2072 +			newbo->move2RelPos (p);
 31.2073 +
 31.2074 +			// Move selection to new branch
 31.2075 +			bo->linkTo (newbo,-1);
 31.2076 +
 31.2077 +			saveState (newbo, "deleteKeepChildren ()", newbo, "addBranchBefore ()", 
 31.2078 +				QString ("Add branch before %1").arg(getObjectName(bo)));
 31.2079 +
 31.2080 +			reposition();
 31.2081 +			selection.update();
 31.2082 +		}
 31.2083 +	}	
 31.2084 +	latestSelectionString=selection.getSelectString();
 31.2085 +	return newbo;
 31.2086 +}
 31.2087 +
 31.2088 +void VymModel::deleteSelection()
 31.2089 +{
 31.2090 +	BranchObj *bo = selection.getBranch();
 31.2091 +	if (bo && selection.type()==Selection::MapCenter)
 31.2092 +	{
 31.2093 +	//	BranchObj* par=(BranchObj*)(bo->getParObj());
 31.2094 +		selection.unselect();
 31.2095 +	/* FIXME Note:  does saveStateRemovingPart work for MCO? (No parent!)
 31.2096 +		saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
 31.2097 +		*/
 31.2098 +		bo=removeMapCenter ((MapCenterObj*)bo);
 31.2099 +		if (bo) 
 31.2100 +		{
 31.2101 +			selection.select (bo);
 31.2102 +			ensureSelectionVisible();
 31.2103 +			selection.update();
 31.2104 +		}	
 31.2105 +		reposition();
 31.2106 +		return;
 31.2107 +	}
 31.2108 +	if (bo && selection.type()==Selection::Branch)
 31.2109 +	{
 31.2110 +		BranchObj* par=(BranchObj*)bo->getParObj();
 31.2111 +		selection.unselect();
 31.2112 +		saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
 31.2113 +		par->removeBranch(bo);
 31.2114 +		selection.select (par);
 31.2115 +		ensureSelectionVisible();
 31.2116 +		reposition();
 31.2117 +		selection.update();
 31.2118 +		return;
 31.2119 +	}
 31.2120 +	FloatImageObj *fio=selection.getFloatImage();
 31.2121 +	if (fio)
 31.2122 +	{
 31.2123 +		BranchObj* par=(BranchObj*)fio->getParObj();
 31.2124 +		saveStateChangingPart(
 31.2125 +			par, 
 31.2126 +			fio,
 31.2127 +			"delete ()",
 31.2128 +			QString("Delete %1").arg(getObjectName(fio))
 31.2129 +		);
 31.2130 +		selection.unselect();
 31.2131 +		par->removeFloatImage(fio);
 31.2132 +		selection.select (par);
 31.2133 +		reposition();
 31.2134 +		selection.update();
 31.2135 +		ensureSelectionVisible();
 31.2136 +		return;
 31.2137 +	}
 31.2138 +}
 31.2139 +
 31.2140 +void VymModel::deleteKeepChildren()
 31.2141 +{
 31.2142 +	BranchObj *bo=selection.getBranch();
 31.2143 +	BranchObj *par;
 31.2144 +	if (bo)
 31.2145 +	{
 31.2146 +		par=(BranchObj*)(bo->getParObj());
 31.2147 +		QPointF p=bo->getRelPos();
 31.2148 +		saveStateChangingPart(
 31.2149 +			bo->getParObj(),
 31.2150 +			bo,
 31.2151 +			"deleteKeepChildren ()",
 31.2152 +			QString("Remove %1 and keep its children").arg(getObjectName(bo))
 31.2153 +		);
 31.2154 +
 31.2155 +		QString sel=getSelectString(bo);
 31.2156 +		unselect();
 31.2157 +		par->removeBranchHere(bo);
 31.2158 +		reposition();
 31.2159 +		select (sel);
 31.2160 +		selection.getBranch()->move2RelPos (p);
 31.2161 +		reposition();
 31.2162 +	}	
 31.2163 +}
 31.2164 +
 31.2165 +void VymModel::deleteChildren()
 31.2166 +{
 31.2167 +	BranchObj *bo=selection.getBranch();
 31.2168 +	if (bo)
 31.2169 +	{		
 31.2170 +		saveStateChangingPart(
 31.2171 +			bo, 
 31.2172 +			bo,
 31.2173 +			"deleteChildren ()",
 31.2174 +			QString( "Remove children of branch %1").arg(getObjectName(bo))
 31.2175 +		);
 31.2176 +		bo->removeChildren();
 31.2177 +		reposition();
 31.2178 +	}	
 31.2179 +}
 31.2180 +
 31.2181 +
 31.2182 +bool VymModel::scrollBranch(BranchObj *bo)
 31.2183 +{
 31.2184 +	if (bo)
 31.2185 +	{
 31.2186 +		if (bo->isScrolled()) return false;
 31.2187 +		if (bo->countBranches()==0) return false;
 31.2188 +		if (bo->getDepth()==0) return false;
 31.2189 +		QString u,r;
 31.2190 +		r="scroll";
 31.2191 +		u="unscroll";
 31.2192 +		saveState(
 31.2193 +			bo,
 31.2194 +			QString ("%1 ()").arg(u),
 31.2195 +			bo,
 31.2196 +			QString ("%1 ()").arg(r),
 31.2197 +			QString ("%1 %2").arg(r).arg(getObjectName(bo))
 31.2198 +		);
 31.2199 +		bo->toggleScroll();
 31.2200 +		selection.update();
 31.2201 +		// FIXME needed? scene()->update();
 31.2202 +		return true;
 31.2203 +	}	
 31.2204 +	return false;
 31.2205 +}
 31.2206 +
 31.2207 +bool VymModel::unscrollBranch(BranchObj *bo)
 31.2208 +{
 31.2209 +	if (bo)
 31.2210 +	{
 31.2211 +		if (!bo->isScrolled()) return false;
 31.2212 +		if (bo->countBranches()==0) return false;
 31.2213 +		if (bo->getDepth()==0) return false;
 31.2214 +		QString u,r;
 31.2215 +		u="scroll";
 31.2216 +		r="unscroll";
 31.2217 +		saveState(
 31.2218 +			bo,
 31.2219 +			QString ("%1 ()").arg(u),
 31.2220 +			bo,
 31.2221 +			QString ("%1 ()").arg(r),
 31.2222 +			QString ("%1 %2").arg(r).arg(getObjectName(bo))
 31.2223 +		);
 31.2224 +		bo->toggleScroll();
 31.2225 +		selection.update();
 31.2226 +		// FIXME needed? scene()->update();
 31.2227 +		return true;
 31.2228 +	}	
 31.2229 +	return false;
 31.2230 +}
 31.2231 +
 31.2232 +void VymModel::toggleScroll()
 31.2233 +{
 31.2234 +	BranchObj *bo=selection.getBranch();
 31.2235 +	if (selection.type()==Selection::Branch )
 31.2236 +	{
 31.2237 +		if (bo->isScrolled())
 31.2238 +			unscrollBranch (bo);
 31.2239 +		else
 31.2240 +			scrollBranch (bo);
 31.2241 +	}
 31.2242 +}
 31.2243 +
 31.2244 +void VymModel::unscrollChildren() 
 31.2245 +{
 31.2246 +	BranchObj *bo=selection.getBranch();
 31.2247 +	if (bo)
 31.2248 +	{
 31.2249 +		bo->first();
 31.2250 +		while (bo) 
 31.2251 +		{
 31.2252 +			if (bo->isScrolled()) unscrollBranch (bo);
 31.2253 +			bo=bo->next();
 31.2254 +		}
 31.2255 +	}	
 31.2256 +}
 31.2257 +void VymModel::addFloatImage (const QPixmap &img) 
 31.2258 +{
 31.2259 +	BranchObj *bo=selection.getBranch();
 31.2260 +	if (bo)
 31.2261 +  {
 31.2262 +	FloatImageObj *fio=bo->addFloatImage();
 31.2263 +    fio->load(img);
 31.2264 +    fio->setOriginalFilename("No original filename (image added by dropevent)");	
 31.2265 +	QString s=getSelectString(bo);
 31.2266 +	saveState (PartOfMap, s, "nop ()", s, "copy ()","Copy dropped image to clipboard",fio  );
 31.2267 +	saveState (fio,"delete ()", bo,QString("paste(%1)").arg(curStep),"Pasting dropped image");
 31.2268 +    reposition();
 31.2269 +    // FIXME needed? scene()->update();
 31.2270 +  }
 31.2271 +}
 31.2272 +
 31.2273 +
 31.2274 +void VymModel::colorBranch (QColor c)
 31.2275 +{
 31.2276 +	BranchObj *bo=selection.getBranch();
 31.2277 +	if (bo)
 31.2278 +	{
 31.2279 +		saveState(
 31.2280 +			bo, 
 31.2281 +			QString ("colorBranch (\"%1\")").arg(bo->getColor().name()),
 31.2282 +			bo,
 31.2283 +			QString ("colorBranch (\"%1\")").arg(c.name()),
 31.2284 +			QString("Set color of %1 to %2").arg(getObjectName(bo)).arg(c.name())
 31.2285 +		);	
 31.2286 +		bo->setColor(c); // color branch
 31.2287 +	}
 31.2288 +}
 31.2289 +
 31.2290 +void VymModel::colorSubtree (QColor c)
 31.2291 +{
 31.2292 +	BranchObj *bo=selection.getBranch();
 31.2293 +	if (bo) 
 31.2294 +	{
 31.2295 +		saveStateChangingPart(
 31.2296 +			bo, 
 31.2297 +			bo,
 31.2298 +			QString ("colorSubtree (\"%1\")").arg(c.name()),
 31.2299 +			QString ("Set color of %1 and children to %2").arg(getObjectName(bo)).arg(c.name())
 31.2300 +		);	
 31.2301 +		bo->setColorSubtree (c); // color links, color children
 31.2302 +	}
 31.2303 +}
 31.2304 +
 31.2305 +QColor VymModel::getCurrentHeadingColor()
 31.2306 +{
 31.2307 +	BranchObj *bo=selection.getBranch();
 31.2308 +	if (bo) return bo->getColor(); 
 31.2309 +	
 31.2310 +	QMessageBox::warning(0,"Warning","Can't get color of heading,\nthere's no branch selected");
 31.2311 +	return Qt::black;
 31.2312 +}
 31.2313 +
 31.2314 +
 31.2315 +
 31.2316 +void VymModel::editURL()
 31.2317 +{
 31.2318 +	BranchObj *bo=selection.getBranch();
 31.2319 +	if (bo)
 31.2320 +	{		
 31.2321 +		bool ok;
 31.2322 +		QString text = QInputDialog::getText(
 31.2323 +				"VYM", tr("Enter URL:"), QLineEdit::Normal,
 31.2324 +				bo->getURL(), &ok, NULL);
 31.2325 +		if ( ok) 
 31.2326 +			// user entered something and pressed OK
 31.2327 +			setURL(text);
 31.2328 +	}
 31.2329 +}
 31.2330 +
 31.2331 +void VymModel::editLocalURL()
 31.2332 +{
 31.2333 +	BranchObj *bo=selection.getBranch();
 31.2334 +	if (bo)
 31.2335 +	{		
 31.2336 +		QStringList filters;
 31.2337 +		filters <<"All files (*)";
 31.2338 +		filters << tr("Text","Filedialog") + " (*.txt)";
 31.2339 +		filters << tr("Spreadsheet","Filedialog") + " (*.odp,*.sxc)";
 31.2340 +		filters << tr("Textdocument","Filedialog") +" (*.odw,*.sxw)";
 31.2341 +		filters << tr("Images","Filedialog") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)";
 31.2342 +		QFileDialog *fd=new QFileDialog( NULL,vymName+" - " +tr("Set URL to a local file"));
 31.2343 +		fd->setFilters (filters);
 31.2344 +		fd->setCaption(vymName+" - " +tr("Set URL to a local file"));
 31.2345 +		fd->setDirectory (lastFileDir);
 31.2346 +		if (! bo->getVymLink().isEmpty() )
 31.2347 +			fd->selectFile( bo->getURL() );
 31.2348 +		fd->show();
 31.2349 +
 31.2350 +		if ( fd->exec() == QDialog::Accepted )
 31.2351 +		{
 31.2352 +			lastFileDir=QDir (fd->directory().path());
 31.2353 +			setURL (fd->selectedFile() );
 31.2354 +		}
 31.2355 +	}
 31.2356 +}
 31.2357 +
 31.2358 +
 31.2359 +void VymModel::editHeading2URL()
 31.2360 +{
 31.2361 +	BranchObj *bo=selection.getBranch();
 31.2362 +	if (bo)
 31.2363 +		setURL (bo->getHeading());
 31.2364 +}	
 31.2365 +
 31.2366 +void VymModel::editBugzilla2URL()
 31.2367 +{
 31.2368 +	BranchObj *bo=selection.getBranch();
 31.2369 +	if (bo)
 31.2370 +	{		
 31.2371 +		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
 31.2372 +		setURL (url);
 31.2373 +	}
 31.2374 +}	
 31.2375 +
 31.2376 +void VymModel::editFATE2URL()
 31.2377 +{
 31.2378 +	BranchObj *bo=selection.getBranch();
 31.2379 +	if (bo)
 31.2380 +	{		
 31.2381 +		QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
 31.2382 +		saveState(
 31.2383 +			bo,
 31.2384 +			"setURL (\""+bo->getURL()+"\")",
 31.2385 +			bo,
 31.2386 +			"setURL (\""+url+"\")",
 31.2387 +			QString("Use heading of %1 as link to FATE").arg(getObjectName(bo))
 31.2388 +		);	
 31.2389 +		bo->setURL (url);
 31.2390 +		updateActions();
 31.2391 +	}
 31.2392 +}	
 31.2393 +
 31.2394 +void VymModel::editVymLink()
 31.2395 +{
 31.2396 +	BranchObj *bo=selection.getBranch();
 31.2397 +	if (bo)
 31.2398 +	{		
 31.2399 +		QStringList filters;
 31.2400 +		filters <<"VYM map (*.vym)";
 31.2401 +		QFileDialog *fd=new QFileDialog( NULL,vymName+" - " +tr("Link to another map"));
 31.2402 +		fd->setFilters (filters);
 31.2403 +		fd->setCaption(vymName+" - " +tr("Link to another map"));
 31.2404 +		fd->setDirectory (lastFileDir);
 31.2405 +		if (! bo->getVymLink().isEmpty() )
 31.2406 +			fd->selectFile( bo->getVymLink() );
 31.2407 +		fd->show();
 31.2408 +
 31.2409 +		QString fn;
 31.2410 +		if ( fd->exec() == QDialog::Accepted )
 31.2411 +		{
 31.2412 +			lastFileDir=QDir (fd->directory().path());
 31.2413 +			saveState(
 31.2414 +				bo,
 31.2415 +				"setVymLink (\""+bo->getVymLink()+"\")",
 31.2416 +				bo,
 31.2417 +				"setVymLink (\""+fd->selectedFile()+"\")",
 31.2418 +				QString("Set vymlink of %1 to %2").arg(getObjectName(bo)).arg(fd->selectedFile())
 31.2419 +			);	
 31.2420 +			setVymLink (fd->selectedFile() );	// FIXME ok?
 31.2421 +		}
 31.2422 +	}
 31.2423 +}
 31.2424 +
 31.2425 +void VymModel::setVymLink (const QString &s)
 31.2426 +{
 31.2427 +	// Internal function, no saveState needed
 31.2428 +	BranchObj *bo=selection.getBranch();
 31.2429 +	if (bo)
 31.2430 +	{
 31.2431 +		bo->setVymLink(s);
 31.2432 +		reposition();
 31.2433 +		updateActions();
 31.2434 +		selection.update();
 31.2435 +		ensureSelectionVisible();
 31.2436 +	}
 31.2437 +}
 31.2438 +
 31.2439 +void VymModel::deleteVymLink()
 31.2440 +{
 31.2441 +	BranchObj *bo=selection.getBranch();
 31.2442 +	if (bo)
 31.2443 +	{		
 31.2444 +		saveState(
 31.2445 +			bo,
 31.2446 +			"setVymLink (\""+bo->getVymLink()+"\")",
 31.2447 +			bo,
 31.2448 +			"setVymLink (\"\")",
 31.2449 +			QString("Unset vymlink of %1").arg(getObjectName(bo))
 31.2450 +		);	
 31.2451 +		bo->setVymLink ("" );
 31.2452 +		updateActions();
 31.2453 +		reposition();
 31.2454 +		// FIXME needed? scene()->update();
 31.2455 +	}
 31.2456 +}
 31.2457 +
 31.2458 +QString VymModel::getVymLink()
 31.2459 +{
 31.2460 +	BranchObj *bo=selection.getBranch();
 31.2461 +	if (bo)
 31.2462 +		return bo->getVymLink();
 31.2463 +	else	
 31.2464 +		return "";
 31.2465 +	
 31.2466 +}
 31.2467 +
 31.2468 +QStringList VymModel::getVymLinks()
 31.2469 +{
 31.2470 +	QStringList links;
 31.2471 +	BranchObj *bo=selection.getBranch();
 31.2472 +	if (bo)
 31.2473 +	{		
 31.2474 +		bo=bo->first();	
 31.2475 +		while (bo) 
 31.2476 +		{
 31.2477 +			if (!bo->getVymLink().isEmpty()) links.append( bo->getVymLink());
 31.2478 +			bo=bo->next();
 31.2479 +		}	
 31.2480 +	}	
 31.2481 +	return links;
 31.2482 +}
 31.2483 +
 31.2484 +
 31.2485 +void VymModel::followXLink(int i)
 31.2486 +{
 31.2487 +	BranchObj *bo=selection.getBranch();
 31.2488 +	if (bo)
 31.2489 +	{
 31.2490 +		bo=bo->XLinkTargetAt(i);
 31.2491 +		if (bo) 
 31.2492 +		{
 31.2493 +			selection.select(bo);
 31.2494 +			ensureSelectionVisible();
 31.2495 +		}
 31.2496 +	}
 31.2497 +}
 31.2498 +
 31.2499 +void VymModel::editXLink(int i)	// FIXME missing saveState
 31.2500 +{
 31.2501 +	BranchObj *bo=selection.getBranch();
 31.2502 +	if (bo)
 31.2503 +	{
 31.2504 +		XLinkObj *xlo=bo->XLinkAt(i);
 31.2505 +		if (xlo) 
 31.2506 +		{
 31.2507 +			EditXLinkDialog dia;
 31.2508 +			dia.setXLink (xlo);
 31.2509 +			dia.setSelection(bo);
 31.2510 +			if (dia.exec() == QDialog::Accepted)
 31.2511 +			{
 31.2512 +				if (dia.useSettingsGlobal() )
 31.2513 +				{
 31.2514 +					setMapDefXLinkColor (xlo->getColor() );
 31.2515 +					setMapDefXLinkWidth (xlo->getWidth() );
 31.2516 +				}
 31.2517 +				if (dia.deleteXLink())
 31.2518 +					bo->deleteXLinkAt(i);
 31.2519 +			}
 31.2520 +		}	
 31.2521 +	}
 31.2522 +}
 31.2523 +
 31.2524 +
 31.2525 +
 31.2526 +
 31.2527 +
 31.2528 +//////////////////////////////////////////////
 31.2529 +// Scripting
 31.2530 +//////////////////////////////////////////////
 31.2531 +
 31.2532 +void VymModel::parseAtom(const QString &atom)
 31.2533 +{
 31.2534 +	BranchObj *selb=selection.getBranch();
 31.2535 +	QString s,t;
 31.2536 +	double x,y;
 31.2537 +	int n;
 31.2538 +	bool b,ok;
 31.2539 +
 31.2540 +	// Split string s into command and parameters
 31.2541 +	parser.parseAtom (atom);
 31.2542 +	QString com=parser.getCommand();
 31.2543 +	
 31.2544 +	// External commands
 31.2545 +	/////////////////////////////////////////////////////////////////////
 31.2546 +	if (com=="addBranch")
 31.2547 +	{
 31.2548 +		if (selection.isEmpty())
 31.2549 +		{
 31.2550 +			parser.setError (Aborted,"Nothing selected");
 31.2551 +		} else if (! selb )
 31.2552 +		{				  
 31.2553 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2554 +		} else 
 31.2555 +		{	
 31.2556 +			QList <int> pl;
 31.2557 +			pl << 0 <<1;
 31.2558 +			if (parser.checkParCount(pl))
 31.2559 +			{
 31.2560 +				if (parser.parCount()==0)
 31.2561 +					addNewBranch (0);
 31.2562 +				else
 31.2563 +				{
 31.2564 +					n=parser.parInt (ok,0);
 31.2565 +					if (ok ) addNewBranch (n);
 31.2566 +				}
 31.2567 +			}
 31.2568 +		}
 31.2569 +	/////////////////////////////////////////////////////////////////////
 31.2570 +	} else if (com=="addBranchBefore")
 31.2571 +	{
 31.2572 +		if (selection.isEmpty())
 31.2573 +		{
 31.2574 +			parser.setError (Aborted,"Nothing selected");
 31.2575 +		} else if (! selb )
 31.2576 +		{				  
 31.2577 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2578 +		} else 
 31.2579 +		{	
 31.2580 +			if (parser.parCount()==0)
 31.2581 +			{
 31.2582 +				addNewBranchBefore ();
 31.2583 +			}	
 31.2584 +		}
 31.2585 +	/////////////////////////////////////////////////////////////////////
 31.2586 +	} else if (com==QString("addMapCenter"))
 31.2587 +	{
 31.2588 +		if (parser.checkParCount(2))
 31.2589 +		{
 31.2590 +			x=parser.parDouble (ok,0);
 31.2591 +			if (ok)
 31.2592 +			{
 31.2593 +				y=parser.parDouble (ok,1);
 31.2594 +				if (ok) addMapCenter (QPointF(x,y));
 31.2595 +			}
 31.2596 +		}	
 31.2597 +	/////////////////////////////////////////////////////////////////////
 31.2598 +	} else if (com==QString("addMapReplace"))
 31.2599 +	{
 31.2600 +		if (selection.isEmpty())
 31.2601 +		{
 31.2602 +			parser.setError (Aborted,"Nothing selected");
 31.2603 +		} else if (! selb )
 31.2604 +		{				  
 31.2605 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2606 +		} else if (parser.checkParCount(1))
 31.2607 +		{
 31.2608 +			//s=parser.parString (ok,0);	// selection
 31.2609 +			t=parser.parString (ok,0);	// path to map
 31.2610 +			if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
 31.2611 +			addMapReplaceInt(getSelectString(selb),t);	
 31.2612 +		}
 31.2613 +	/////////////////////////////////////////////////////////////////////
 31.2614 +	} else if (com==QString("addMapInsert"))
 31.2615 +	{
 31.2616 +		if (selection.isEmpty())
 31.2617 +		{
 31.2618 +			parser.setError (Aborted,"Nothing selected");
 31.2619 +		} else if (! selb )
 31.2620 +		{				  
 31.2621 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2622 +		} else 
 31.2623 +		{	
 31.2624 +			if (parser.checkParCount(2))
 31.2625 +			{
 31.2626 +				t=parser.parString (ok,0);	// path to map
 31.2627 +				n=parser.parInt(ok,1);		// position
 31.2628 +				if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
 31.2629 +				addMapInsertInt(t,n);	
 31.2630 +			}
 31.2631 +		}
 31.2632 +	/////////////////////////////////////////////////////////////////////
 31.2633 +	} else if (com=="clearFlags")
 31.2634 +	{
 31.2635 +		if (selection.isEmpty() )
 31.2636 +		{
 31.2637 +			parser.setError (Aborted,"Nothing selected");
 31.2638 +		} else if (! selb )
 31.2639 +		{				  
 31.2640 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2641 +		} else if (parser.checkParCount(0))
 31.2642 +		{
 31.2643 +			selb->clearStandardFlags();	
 31.2644 +			selb->updateFlagsToolbar();
 31.2645 +		}
 31.2646 +	/////////////////////////////////////////////////////////////////////
 31.2647 +	} else if (com=="colorBranch")
 31.2648 +	{
 31.2649 +		if (selection.isEmpty())
 31.2650 +		{
 31.2651 +			parser.setError (Aborted,"Nothing selected");
 31.2652 +		} else if (! selb )
 31.2653 +		{				  
 31.2654 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2655 +		} else if (parser.checkParCount(1))
 31.2656 +		{	
 31.2657 +			QColor c=parser.parColor (ok,0);
 31.2658 +			if (ok) colorBranch (c);
 31.2659 +		}	
 31.2660 +	/////////////////////////////////////////////////////////////////////
 31.2661 +	} else if (com=="colorSubtree")
 31.2662 +	{
 31.2663 +		if (selection.isEmpty())
 31.2664 +		{
 31.2665 +			parser.setError (Aborted,"Nothing selected");
 31.2666 +		} else if (! selb )
 31.2667 +		{				  
 31.2668 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2669 +		} else if (parser.checkParCount(1))
 31.2670 +		{	
 31.2671 +			QColor c=parser.parColor (ok,0);
 31.2672 +			if (ok) colorSubtree (c);
 31.2673 +		}	
 31.2674 +	/////////////////////////////////////////////////////////////////////
 31.2675 +	} else if (com=="copy")
 31.2676 +	{
 31.2677 +		if (selection.isEmpty())
 31.2678 +		{
 31.2679 +			parser.setError (Aborted,"Nothing selected");
 31.2680 +		} else if (! selb )
 31.2681 +		{				  
 31.2682 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2683 +		} else if (parser.checkParCount(0))
 31.2684 +		{	
 31.2685 +			//FIXME missing action for copy
 31.2686 +		}	
 31.2687 +	/////////////////////////////////////////////////////////////////////
 31.2688 +	} else if (com=="cut")
 31.2689 +	{
 31.2690 +		if (selection.isEmpty())
 31.2691 +		{
 31.2692 +			parser.setError (Aborted,"Nothing selected");
 31.2693 +		} else if ( selection.type()!=Selection::Branch  && 
 31.2694 +					selection.type()!=Selection::MapCenter  &&
 31.2695 +					selection.type()!=Selection::FloatImage )
 31.2696 +		{				  
 31.2697 +			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
 31.2698 +		} else if (parser.checkParCount(0))
 31.2699 +		{	
 31.2700 +			cut();
 31.2701 +		}	
 31.2702 +	/////////////////////////////////////////////////////////////////////
 31.2703 +	} else if (com=="delete")
 31.2704 +	{
 31.2705 +		if (selection.isEmpty())
 31.2706 +		{
 31.2707 +			parser.setError (Aborted,"Nothing selected");
 31.2708 +		} 
 31.2709 +		/*else if (selection.type() != Selection::Branch && selection.type() != Selection::FloatImage )
 31.2710 +		{
 31.2711 +			parser.setError (Aborted,"Type of selection is wrong.");
 31.2712 +		} 
 31.2713 +		*/
 31.2714 +		else if (parser.checkParCount(0))
 31.2715 +		{	
 31.2716 +			deleteSelection();
 31.2717 +		}	
 31.2718 +	/////////////////////////////////////////////////////////////////////
 31.2719 +	} else if (com=="deleteKeepChildren")
 31.2720 +	{
 31.2721 +		if (selection.isEmpty())
 31.2722 +		{
 31.2723 +			parser.setError (Aborted,"Nothing selected");
 31.2724 +		} else if (! selb )
 31.2725 +		{
 31.2726 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2727 +		} else if (parser.checkParCount(0))
 31.2728 +		{	
 31.2729 +			deleteKeepChildren();
 31.2730 +		}	
 31.2731 +	/////////////////////////////////////////////////////////////////////
 31.2732 +	} else if (com=="deleteChildren")
 31.2733 +	{
 31.2734 +		if (selection.isEmpty())
 31.2735 +		{
 31.2736 +			parser.setError (Aborted,"Nothing selected");
 31.2737 +		} else if (! selb)
 31.2738 +		{
 31.2739 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2740 +		} else if (parser.checkParCount(0))
 31.2741 +		{	
 31.2742 +			deleteChildren();
 31.2743 +		}	
 31.2744 +	/////////////////////////////////////////////////////////////////////
 31.2745 +	} else if (com=="exportASCII")
 31.2746 +	{
 31.2747 +		QString fname="";
 31.2748 +		ok=true;
 31.2749 +		if (parser.parCount()>=1)
 31.2750 +			// Hey, we even have a filename
 31.2751 +			fname=parser.parString(ok,0); 
 31.2752 +		if (!ok)
 31.2753 +		{
 31.2754 +			parser.setError (Aborted,"Could not read filename");
 31.2755 +		} else
 31.2756 +		{
 31.2757 +				exportASCII (fname,false);
 31.2758 +		}
 31.2759 +	/////////////////////////////////////////////////////////////////////
 31.2760 +	} else if (com=="exportImage")
 31.2761 +	{
 31.2762 +		QString fname="";
 31.2763 +		ok=true;
 31.2764 +		if (parser.parCount()>=2)
 31.2765 +			// Hey, we even have a filename
 31.2766 +			fname=parser.parString(ok,0); 
 31.2767 +		if (!ok)
 31.2768 +		{
 31.2769 +			parser.setError (Aborted,"Could not read filename");
 31.2770 +		} else
 31.2771 +		{
 31.2772 +			QString format="PNG";
 31.2773 +			if (parser.parCount()>=2)
 31.2774 +			{
 31.2775 +				format=parser.parString(ok,1);
 31.2776 +			}
 31.2777 +			exportImage (fname,false,format);
 31.2778 +		}
 31.2779 +	/////////////////////////////////////////////////////////////////////
 31.2780 +	} else if (com=="exportXHTML")
 31.2781 +	{
 31.2782 +		QString fname="";
 31.2783 +		ok=true;
 31.2784 +		if (parser.parCount()>=2)
 31.2785 +			// Hey, we even have a filename
 31.2786 +			fname=parser.parString(ok,1); 
 31.2787 +		if (!ok)
 31.2788 +		{
 31.2789 +			parser.setError (Aborted,"Could not read filename");
 31.2790 +		} else
 31.2791 +		{
 31.2792 +			exportXHTML (fname,false);
 31.2793 +		}
 31.2794 +	/////////////////////////////////////////////////////////////////////
 31.2795 +	} else if (com=="exportXML")
 31.2796 +	{
 31.2797 +		QString fname="";
 31.2798 +		ok=true;
 31.2799 +		if (parser.parCount()>=2)
 31.2800 +			// Hey, we even have a filename
 31.2801 +			fname=parser.parString(ok,1); 
 31.2802 +		if (!ok)
 31.2803 +		{
 31.2804 +			parser.setError (Aborted,"Could not read filename");
 31.2805 +		} else
 31.2806 +		{
 31.2807 +			exportXML (fname,false);
 31.2808 +		}
 31.2809 +	/////////////////////////////////////////////////////////////////////
 31.2810 +	} else if (com=="importDir")
 31.2811 +	{
 31.2812 +		if (selection.isEmpty())
 31.2813 +		{
 31.2814 +			parser.setError (Aborted,"Nothing selected");
 31.2815 +		} else if (! selb )
 31.2816 +		{				  
 31.2817 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2818 +		} else if (parser.checkParCount(1))
 31.2819 +		{
 31.2820 +			s=parser.parString(ok,0);
 31.2821 +			if (ok) importDirInt(s);
 31.2822 +		}	
 31.2823 +	/////////////////////////////////////////////////////////////////////
 31.2824 +	} else if (com=="linkTo")
 31.2825 +	{
 31.2826 +		if (selection.isEmpty())
 31.2827 +		{
 31.2828 +			parser.setError (Aborted,"Nothing selected");
 31.2829 +		} else if ( selb)
 31.2830 +		{
 31.2831 +			if (parser.checkParCount(4))
 31.2832 +			{
 31.2833 +				// 0	selectstring of parent
 31.2834 +				// 1	num in parent (for branches)
 31.2835 +				// 2,3	x,y of mainbranch or mapcenter
 31.2836 +				s=parser.parString(ok,0);
 31.2837 +				LinkableMapObj *dst=findObjBySelect (s);
 31.2838 +				if (dst)
 31.2839 +				{	
 31.2840 +					if (typeid(*dst) == typeid(BranchObj) ) 
 31.2841 +					{
 31.2842 +						// Get number in parent
 31.2843 +						n=parser.parInt (ok,1);
 31.2844 +						if (ok)
 31.2845 +						{
 31.2846 +							selb->linkTo ((BranchObj*)(dst),n);
 31.2847 +							selection.update();
 31.2848 +						}	
 31.2849 +					} else if (typeid(*dst) == typeid(MapCenterObj) ) 
 31.2850 +					{
 31.2851 +						selb->linkTo ((BranchObj*)(dst),-1);
 31.2852 +						// Get coordinates of mainbranch
 31.2853 +						x=parser.parDouble(ok,2);
 31.2854 +						if (ok)
 31.2855 +						{
 31.2856 +							y=parser.parDouble(ok,3);
 31.2857 +							if (ok) 
 31.2858 +							{
 31.2859 +								selb->move (x,y);
 31.2860 +								selection.update();
 31.2861 +							}
 31.2862 +						}
 31.2863 +					}	
 31.2864 +				}	
 31.2865 +			}	
 31.2866 +		} else if ( selection.type() == Selection::FloatImage) 
 31.2867 +		{
 31.2868 +			if (parser.checkParCount(1))
 31.2869 +			{
 31.2870 +				// 0	selectstring of parent
 31.2871 +				s=parser.parString(ok,0);
 31.2872 +				LinkableMapObj *dst=findObjBySelect (s);
 31.2873 +				if (dst)
 31.2874 +				{	
 31.2875 +					if (typeid(*dst) == typeid(BranchObj) ||
 31.2876 +						typeid(*dst) == typeid(MapCenterObj)) 
 31.2877 +						linkFloatImageTo (getSelectString(dst));
 31.2878 +				} else	
 31.2879 +					parser.setError (Aborted,"Destination is not a branch");
 31.2880 +			}		
 31.2881 +		} else
 31.2882 +			parser.setError (Aborted,"Type of selection is not a floatimage or branch");
 31.2883 +	/////////////////////////////////////////////////////////////////////
 31.2884 +	} else if (com=="loadImage")
 31.2885 +	{
 31.2886 +		if (selection.isEmpty())
 31.2887 +		{
 31.2888 +			parser.setError (Aborted,"Nothing selected");
 31.2889 +		} else if (! selb )
 31.2890 +		{				  
 31.2891 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2892 +		} else if (parser.checkParCount(1))
 31.2893 +		{
 31.2894 +			s=parser.parString(ok,0);
 31.2895 +			if (ok) loadFloatImageInt (s);
 31.2896 +		}	
 31.2897 +	/////////////////////////////////////////////////////////////////////
 31.2898 +	} else if (com=="moveBranchUp")
 31.2899 +	{
 31.2900 +		if (selection.isEmpty() )
 31.2901 +		{
 31.2902 +			parser.setError (Aborted,"Nothing selected");
 31.2903 +		} else if (! selb )
 31.2904 +		{				  
 31.2905 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2906 +		} else if (parser.checkParCount(0))
 31.2907 +		{
 31.2908 +			moveBranchUp();
 31.2909 +		}	
 31.2910 +	/////////////////////////////////////////////////////////////////////
 31.2911 +	} else if (com=="moveBranchDown")
 31.2912 +	{
 31.2913 +		if (selection.isEmpty() )
 31.2914 +		{
 31.2915 +			parser.setError (Aborted,"Nothing selected");
 31.2916 +		} else if (! selb )
 31.2917 +		{				  
 31.2918 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2919 +		} else if (parser.checkParCount(0))
 31.2920 +		{
 31.2921 +			moveBranchDown();
 31.2922 +		}	
 31.2923 +	/////////////////////////////////////////////////////////////////////
 31.2924 +	} else if (com=="move")
 31.2925 +	{
 31.2926 +		if (selection.isEmpty() )
 31.2927 +		{
 31.2928 +			parser.setError (Aborted,"Nothing selected");
 31.2929 +		} else if ( selection.type()!=Selection::Branch  && 
 31.2930 +					selection.type()!=Selection::MapCenter  &&
 31.2931 +					selection.type()!=Selection::FloatImage )
 31.2932 +		{				  
 31.2933 +			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
 31.2934 +		} else if (parser.checkParCount(2))
 31.2935 +		{	
 31.2936 +			x=parser.parDouble (ok,0);
 31.2937 +			if (ok)
 31.2938 +			{
 31.2939 +				y=parser.parDouble (ok,1);
 31.2940 +				if (ok) move (x,y);
 31.2941 +			}
 31.2942 +		}	
 31.2943 +	/////////////////////////////////////////////////////////////////////
 31.2944 +	} else if (com=="moveRel")
 31.2945 +	{
 31.2946 +		if (selection.isEmpty() )
 31.2947 +		{
 31.2948 +			parser.setError (Aborted,"Nothing selected");
 31.2949 +		} else if ( selection.type()!=Selection::Branch  && 
 31.2950 +					selection.type()!=Selection::MapCenter  &&
 31.2951 +					selection.type()!=Selection::FloatImage )
 31.2952 +		{				  
 31.2953 +			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
 31.2954 +		} else if (parser.checkParCount(2))
 31.2955 +		{	
 31.2956 +			x=parser.parDouble (ok,0);
 31.2957 +			if (ok)
 31.2958 +			{
 31.2959 +				y=parser.parDouble (ok,1);
 31.2960 +				if (ok) moveRel (x,y);
 31.2961 +			}
 31.2962 +		}	
 31.2963 +	/////////////////////////////////////////////////////////////////////
 31.2964 +	} else if (com=="nop")
 31.2965 +	{
 31.2966 +	/////////////////////////////////////////////////////////////////////
 31.2967 +	} else if (com=="paste")
 31.2968 +	{
 31.2969 +		if (selection.isEmpty() )
 31.2970 +		{
 31.2971 +			parser.setError (Aborted,"Nothing selected");
 31.2972 +		} else if (! selb )
 31.2973 +		{				  
 31.2974 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2975 +		} else if (parser.checkParCount(1))
 31.2976 +		{	
 31.2977 +			n=parser.parInt (ok,0);
 31.2978 +			if (ok) pasteNoSave(n);
 31.2979 +		}	
 31.2980 +	/////////////////////////////////////////////////////////////////////
 31.2981 +	} else if (com=="qa")
 31.2982 +	{
 31.2983 +		if (selection.isEmpty() )
 31.2984 +		{
 31.2985 +			parser.setError (Aborted,"Nothing selected");
 31.2986 +		} else if (! selb )
 31.2987 +		{				  
 31.2988 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.2989 +		} else if (parser.checkParCount(4))
 31.2990 +		{	
 31.2991 +			QString c,u;
 31.2992 +			c=parser.parString (ok,0);
 31.2993 +			if (!ok)
 31.2994 +			{
 31.2995 +				parser.setError (Aborted,"No comment given");
 31.2996 +			} else
 31.2997 +			{
 31.2998 +				s=parser.parString (ok,1);
 31.2999 +				if (!ok)
 31.3000 +				{
 31.3001 +					parser.setError (Aborted,"First parameter is not a string");
 31.3002 +				} else
 31.3003 +				{
 31.3004 +					t=parser.parString (ok,2);
 31.3005 +					if (!ok)
 31.3006 +					{
 31.3007 +						parser.setError (Aborted,"Condition is not a string");
 31.3008 +					} else
 31.3009 +					{
 31.3010 +						u=parser.parString (ok,3);
 31.3011 +						if (!ok)
 31.3012 +						{
 31.3013 +							parser.setError (Aborted,"Third parameter is not a string");
 31.3014 +						} else
 31.3015 +						{
 31.3016 +							if (s!="heading")
 31.3017 +							{
 31.3018 +								parser.setError (Aborted,"Unknown type: "+s);
 31.3019 +							} else
 31.3020 +							{
 31.3021 +								if (! (t=="eq") ) 
 31.3022 +								{
 31.3023 +									parser.setError (Aborted,"Unknown operator: "+t);
 31.3024 +								} else
 31.3025 +								{
 31.3026 +									if (! selb    )
 31.3027 +									{
 31.3028 +										parser.setError (Aborted,"Type of selection is not a branch");
 31.3029 +									} else
 31.3030 +									{
 31.3031 +										if (selb->getHeading() == u)
 31.3032 +										{
 31.3033 +											cout << "PASSED: " << qPrintable (c)  << endl;
 31.3034 +										} else
 31.3035 +										{
 31.3036 +											cout << "FAILED: " << qPrintable (c)  << endl;
 31.3037 +										}
 31.3038 +									}
 31.3039 +								}
 31.3040 +							}
 31.3041 +						} 
 31.3042 +					} 
 31.3043 +				} 
 31.3044 +			}
 31.3045 +		}	
 31.3046 +	/////////////////////////////////////////////////////////////////////
 31.3047 +	} else if (com=="saveImage")
 31.3048 +	{
 31.3049 +		FloatImageObj *fio=selection.getFloatImage();
 31.3050 +		if (!fio)
 31.3051 +		{
 31.3052 +			parser.setError (Aborted,"Type of selection is not an image");
 31.3053 +		} else if (parser.checkParCount(2))
 31.3054 +		{
 31.3055 +			s=parser.parString(ok,0);
 31.3056 +			if (ok)
 31.3057 +			{
 31.3058 +				t=parser.parString(ok,1);
 31.3059 +				if (ok) saveFloatImageInt (fio,t,s);
 31.3060 +			}
 31.3061 +		}	
 31.3062 +	/////////////////////////////////////////////////////////////////////
 31.3063 +	} else if (com=="scroll")
 31.3064 +	{
 31.3065 +		if (selection.isEmpty() )
 31.3066 +		{
 31.3067 +			parser.setError (Aborted,"Nothing selected");
 31.3068 +		} else if (! selb )
 31.3069 +		{				  
 31.3070 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3071 +		} else if (parser.checkParCount(0))
 31.3072 +		{	
 31.3073 +			if (!scrollBranch (selb))	
 31.3074 +				parser.setError (Aborted,"Could not scroll branch");
 31.3075 +		}	
 31.3076 +	/////////////////////////////////////////////////////////////////////
 31.3077 +	} else if (com=="select")
 31.3078 +	{
 31.3079 +		if (parser.checkParCount(1))
 31.3080 +		{
 31.3081 +			s=parser.parString(ok,0);
 31.3082 +			if (ok) select (s);
 31.3083 +		}	
 31.3084 +	/////////////////////////////////////////////////////////////////////
 31.3085 +	} else if (com=="selectLastBranch")
 31.3086 +	{
 31.3087 +		if (selection.isEmpty() )
 31.3088 +		{
 31.3089 +			parser.setError (Aborted,"Nothing selected");
 31.3090 +		} else if (! selb )
 31.3091 +		{				  
 31.3092 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3093 +		} else if (parser.checkParCount(0))
 31.3094 +		{	
 31.3095 +			BranchObj *bo=selb->getLastBranch();
 31.3096 +			if (!bo)
 31.3097 +				parser.setError (Aborted,"Could not select last branch");
 31.3098 +			selectInt (bo);	
 31.3099 +				
 31.3100 +		}	
 31.3101 +	/////////////////////////////////////////////////////////////////////
 31.3102 +	} else if (com=="selectLastImage")
 31.3103 +	{
 31.3104 +		if (selection.isEmpty() )
 31.3105 +		{
 31.3106 +			parser.setError (Aborted,"Nothing selected");
 31.3107 +		} else if (! selb )
 31.3108 +		{				  
 31.3109 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3110 +		} else if (parser.checkParCount(0))
 31.3111 +		{	
 31.3112 +			FloatImageObj *fio=selb->getLastFloatImage();
 31.3113 +			if (!fio)
 31.3114 +				parser.setError (Aborted,"Could not select last image");
 31.3115 +			selectInt (fio);	
 31.3116 +				
 31.3117 +		}	
 31.3118 +	/////////////////////////////////////////////////////////////////////
 31.3119 +	} else if (com=="selectLatestAdded")
 31.3120 +	{
 31.3121 +		if (latestSelectionString.isEmpty() )
 31.3122 +		{
 31.3123 +			parser.setError (Aborted,"No latest added object");
 31.3124 +		} else
 31.3125 +		{	
 31.3126 +			if (!select (latestSelectionString))
 31.3127 +				parser.setError (Aborted,"Could not select latest added object "+latestSelectionString);
 31.3128 +		}	
 31.3129 +	/////////////////////////////////////////////////////////////////////
 31.3130 +	} else if (com=="setFrameType")
 31.3131 +	{
 31.3132 +		if ( selection.type()!=Selection::Branch && selection.type()!= Selection::MapCenter && selection.type()!=Selection::FloatImage)
 31.3133 +		{
 31.3134 +			parser.setError (Aborted,"Type of selection does not allow setting frame type");
 31.3135 +		}
 31.3136 +		else if (parser.checkParCount(1))
 31.3137 +		{
 31.3138 +			s=parser.parString(ok,0);
 31.3139 +			if (ok) setFrameType (s);
 31.3140 +		}	
 31.3141 +	/////////////////////////////////////////////////////////////////////
 31.3142 +	} else if (com=="setFramePenColor")
 31.3143 +	{
 31.3144 +		if ( selection.type()!=Selection::Branch && selection.type()!= Selection::MapCenter && selection.type()!=Selection::FloatImage)
 31.3145 +		{
 31.3146 +			parser.setError (Aborted,"Type of selection does not allow setting of pen color");
 31.3147 +		}
 31.3148 +		else if (parser.checkParCount(1))
 31.3149 +		{
 31.3150 +			QColor c=parser.parColor(ok,0);
 31.3151 +			if (ok) setFramePenColor (c);
 31.3152 +		}	
 31.3153 +	/////////////////////////////////////////////////////////////////////
 31.3154 +	} else if (com=="setFrameBrushColor")
 31.3155 +	{
 31.3156 +		if ( selection.type()!=Selection::Branch && selection.type()!= Selection::MapCenter && selection.type()!=Selection::FloatImage)
 31.3157 +		{
 31.3158 +			parser.setError (Aborted,"Type of selection does not allow setting brush color");
 31.3159 +		}
 31.3160 +		else if (parser.checkParCount(1))
 31.3161 +		{
 31.3162 +			QColor c=parser.parColor(ok,0);
 31.3163 +			if (ok) setFrameBrushColor (c);
 31.3164 +		}	
 31.3165 +	/////////////////////////////////////////////////////////////////////
 31.3166 +	} else if (com=="setFramePadding")
 31.3167 +	{
 31.3168 +		if ( selection.type()!=Selection::Branch && selection.type()!= Selection::MapCenter && selection.type()!=Selection::FloatImage)
 31.3169 +		{
 31.3170 +			parser.setError (Aborted,"Type of selection does not allow setting frame padding");
 31.3171 +		}
 31.3172 +		else if (parser.checkParCount(1))
 31.3173 +		{
 31.3174 +			n=parser.parInt(ok,0);
 31.3175 +			if (ok) setFramePadding(n);
 31.3176 +		}	
 31.3177 +	/////////////////////////////////////////////////////////////////////
 31.3178 +	} else if (com=="setFrameBorderWidth")
 31.3179 +	{
 31.3180 +		if ( selection.type()!=Selection::Branch && selection.type()!= Selection::MapCenter && selection.type()!=Selection::FloatImage)
 31.3181 +		{
 31.3182 +			parser.setError (Aborted,"Type of selection does not allow setting frame border width");
 31.3183 +		}
 31.3184 +		else if (parser.checkParCount(1))
 31.3185 +		{
 31.3186 +			n=parser.parInt(ok,0);
 31.3187 +			if (ok) setFrameBorderWidth (n);
 31.3188 +		}	
 31.3189 +	/////////////////////////////////////////////////////////////////////
 31.3190 +	} else if (com=="setMapAuthor")
 31.3191 +	{
 31.3192 +		if (parser.checkParCount(1))
 31.3193 +		{
 31.3194 +			s=parser.parString(ok,0);
 31.3195 +			if (ok) setAuthor (s);
 31.3196 +		}	
 31.3197 +	/////////////////////////////////////////////////////////////////////
 31.3198 +	} else if (com=="setMapComment")
 31.3199 +	{
 31.3200 +		if (parser.checkParCount(1))
 31.3201 +		{
 31.3202 +			s=parser.parString(ok,0);
 31.3203 +			if (ok) setComment(s);
 31.3204 +		}	
 31.3205 +	/////////////////////////////////////////////////////////////////////
 31.3206 +	} else if (com=="setMapBackgroundColor")
 31.3207 +	{
 31.3208 +		if (selection.isEmpty() )
 31.3209 +		{
 31.3210 +			parser.setError (Aborted,"Nothing selected");
 31.3211 +		} else if (! selection.getBranch() )
 31.3212 +		{				  
 31.3213 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3214 +		} else if (parser.checkParCount(1))
 31.3215 +		{
 31.3216 +			QColor c=parser.parColor (ok,0);
 31.3217 +			if (ok) setMapBackgroundColor (c);
 31.3218 +		}	
 31.3219 +	/////////////////////////////////////////////////////////////////////
 31.3220 +	} else if (com=="setMapDefLinkColor")
 31.3221 +	{
 31.3222 +		if (selection.isEmpty() )
 31.3223 +		{
 31.3224 +			parser.setError (Aborted,"Nothing selected");
 31.3225 +		} else if (! selb )
 31.3226 +		{				  
 31.3227 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3228 +		} else if (parser.checkParCount(1))
 31.3229 +		{
 31.3230 +			QColor c=parser.parColor (ok,0);
 31.3231 +			if (ok) setMapDefLinkColor (c);
 31.3232 +		}	
 31.3233 +	/////////////////////////////////////////////////////////////////////
 31.3234 +	} else if (com=="setMapLinkStyle")
 31.3235 +	{
 31.3236 +		if (parser.checkParCount(1))
 31.3237 +		{
 31.3238 +			s=parser.parString (ok,0);
 31.3239 +			if (ok) setMapLinkStyle(s);
 31.3240 +		}	
 31.3241 +	/////////////////////////////////////////////////////////////////////
 31.3242 +	} else if (com=="setHeading")
 31.3243 +	{
 31.3244 +		if (selection.isEmpty() )
 31.3245 +		{
 31.3246 +			parser.setError (Aborted,"Nothing selected");
 31.3247 +		} else if (! selb )
 31.3248 +		{				  
 31.3249 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3250 +		} else if (parser.checkParCount(1))
 31.3251 +		{
 31.3252 +			s=parser.parString (ok,0);
 31.3253 +			if (ok) 
 31.3254 +				setHeading (s);
 31.3255 +		}	
 31.3256 +	/////////////////////////////////////////////////////////////////////
 31.3257 +	} else if (com=="setHideExport")
 31.3258 +	{
 31.3259 +		if (selection.isEmpty() )
 31.3260 +		{
 31.3261 +			parser.setError (Aborted,"Nothing selected");
 31.3262 +		} else if (selection.type()!=Selection::Branch && selection.type() != Selection::MapCenter &&selection.type()!=Selection::FloatImage)
 31.3263 +		{				  
 31.3264 +			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
 31.3265 +		} else if (parser.checkParCount(1))
 31.3266 +		{
 31.3267 +			b=parser.parBool(ok,0);
 31.3268 +			if (ok) setHideExport (b);
 31.3269 +		}
 31.3270 +	/////////////////////////////////////////////////////////////////////
 31.3271 +	} else if (com=="setIncludeImagesHorizontally")
 31.3272 +	{ 
 31.3273 +		if (selection.isEmpty() )
 31.3274 +		{
 31.3275 +			parser.setError (Aborted,"Nothing selected");
 31.3276 +		} else if (! selb)
 31.3277 +		{				  
 31.3278 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3279 +		} else if (parser.checkParCount(1))
 31.3280 +		{
 31.3281 +			b=parser.parBool(ok,0);
 31.3282 +			if (ok) setIncludeImagesHor(b);
 31.3283 +		}
 31.3284 +	/////////////////////////////////////////////////////////////////////
 31.3285 +	} else if (com=="setIncludeImagesVertically")
 31.3286 +	{
 31.3287 +		if (selection.isEmpty() )
 31.3288 +		{
 31.3289 +			parser.setError (Aborted,"Nothing selected");
 31.3290 +		} else if (! selb)
 31.3291 +		{				  
 31.3292 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3293 +		} else if (parser.checkParCount(1))
 31.3294 +		{
 31.3295 +			b=parser.parBool(ok,0);
 31.3296 +			if (ok) setIncludeImagesVer(b);
 31.3297 +		}
 31.3298 +	/////////////////////////////////////////////////////////////////////
 31.3299 +	} else if (com=="setHideLinkUnselected")
 31.3300 +	{
 31.3301 +		if (selection.isEmpty() )
 31.3302 +		{
 31.3303 +			parser.setError (Aborted,"Nothing selected");
 31.3304 +		} else if ( selection.type()!=Selection::Branch && selection.type()!= Selection::MapCenter && selection.type()!=Selection::FloatImage)
 31.3305 +		{				  
 31.3306 +			parser.setError (Aborted,"Type of selection does not allow hiding the link");
 31.3307 +		} else if (parser.checkParCount(1))
 31.3308 +		{
 31.3309 +			b=parser.parBool(ok,0);
 31.3310 +			if (ok) setHideLinkUnselected(b);
 31.3311 +		}
 31.3312 +	/////////////////////////////////////////////////////////////////////
 31.3313 +	} else if (com=="setSelectionColor")
 31.3314 +	{
 31.3315 +		if (parser.checkParCount(1))
 31.3316 +		{
 31.3317 +			QColor c=parser.parColor (ok,0);
 31.3318 +			if (ok) setSelectionColorInt (c);
 31.3319 +		}	
 31.3320 +	/////////////////////////////////////////////////////////////////////
 31.3321 +	} else if (com=="setURL")
 31.3322 +	{
 31.3323 +		if (selection.isEmpty() )
 31.3324 +		{
 31.3325 +			parser.setError (Aborted,"Nothing selected");
 31.3326 +		} else if (! selb )
 31.3327 +		{				  
 31.3328 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3329 +		} else if (parser.checkParCount(1))
 31.3330 +		{
 31.3331 +			s=parser.parString (ok,0);
 31.3332 +			if (ok) setURL(s);
 31.3333 +		}	
 31.3334 +	/////////////////////////////////////////////////////////////////////
 31.3335 +	} else if (com=="setVymLink")
 31.3336 +	{
 31.3337 +		if (selection.isEmpty() )
 31.3338 +		{
 31.3339 +			parser.setError (Aborted,"Nothing selected");
 31.3340 +		} else if (! selb )
 31.3341 +		{				  
 31.3342 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3343 +		} else if (parser.checkParCount(1))
 31.3344 +		{
 31.3345 +			s=parser.parString (ok,0);
 31.3346 +			if (ok) setVymLink(s);
 31.3347 +		}	
 31.3348 +	}
 31.3349 +	/////////////////////////////////////////////////////////////////////
 31.3350 +	else if (com=="setFlag")
 31.3351 +	{
 31.3352 +		if (selection.isEmpty() )
 31.3353 +		{
 31.3354 +			parser.setError (Aborted,"Nothing selected");
 31.3355 +		} else if (! selb )
 31.3356 +		{				  
 31.3357 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3358 +		} else if (parser.checkParCount(1))
 31.3359 +		{
 31.3360 +			s=parser.parString(ok,0);
 31.3361 +			if (ok) 
 31.3362 +			{
 31.3363 +				selb->activateStandardFlag(s);
 31.3364 +				selb->updateFlagsToolbar();
 31.3365 +			}	
 31.3366 +		}
 31.3367 +	/////////////////////////////////////////////////////////////////////
 31.3368 +	} else if (com=="setFrameType")
 31.3369 +	{
 31.3370 +		if (selection.isEmpty() )
 31.3371 +		{
 31.3372 +			parser.setError (Aborted,"Nothing selected");
 31.3373 +		} else if (! selb )
 31.3374 +		{				  
 31.3375 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3376 +		} else if (parser.checkParCount(1))
 31.3377 +		{
 31.3378 +			s=parser.parString(ok,0);
 31.3379 +			if (ok) 
 31.3380 +				setFrameType (s);
 31.3381 +		}
 31.3382 +	/////////////////////////////////////////////////////////////////////
 31.3383 +	} else if (com=="sortChildren")
 31.3384 +	{
 31.3385 +		if (selection.isEmpty() )
 31.3386 +		{
 31.3387 +			parser.setError (Aborted,"Nothing selected");
 31.3388 +		} else if (! selb )
 31.3389 +		{				  
 31.3390 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3391 +		} else if (parser.checkParCount(0))
 31.3392 +		{
 31.3393 +			sortChildren();
 31.3394 +		}
 31.3395 +	/////////////////////////////////////////////////////////////////////
 31.3396 +	} else if (com=="toggleFlag")
 31.3397 +	{
 31.3398 +		if (selection.isEmpty() )
 31.3399 +		{
 31.3400 +			parser.setError (Aborted,"Nothing selected");
 31.3401 +		} else if (! selb )
 31.3402 +		{				  
 31.3403 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3404 +		} else if (parser.checkParCount(1))
 31.3405 +		{
 31.3406 +			s=parser.parString(ok,0);
 31.3407 +			if (ok) 
 31.3408 +			{
 31.3409 +				selb->toggleStandardFlag(s);	
 31.3410 +				selb->updateFlagsToolbar();
 31.3411 +			}	
 31.3412 +		}
 31.3413 +	/////////////////////////////////////////////////////////////////////
 31.3414 +	} else if (com=="unscroll")
 31.3415 +	{
 31.3416 +		if (selection.isEmpty() )
 31.3417 +		{
 31.3418 +			parser.setError (Aborted,"Nothing selected");
 31.3419 +		} else if (! selb )
 31.3420 +		{				  
 31.3421 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3422 +		} else if (parser.checkParCount(0))
 31.3423 +		{	
 31.3424 +			if (!unscrollBranch (selb))	
 31.3425 +				parser.setError (Aborted,"Could not unscroll branch");
 31.3426 +		}	
 31.3427 +	/////////////////////////////////////////////////////////////////////
 31.3428 +	} else if (com=="unscrollChildren")
 31.3429 +	{
 31.3430 +		if (selection.isEmpty() )
 31.3431 +		{
 31.3432 +			parser.setError (Aborted,"Nothing selected");
 31.3433 +		} else if (! selb )
 31.3434 +		{				  
 31.3435 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3436 +		} else if (parser.checkParCount(0))
 31.3437 +		{	
 31.3438 +			unscrollChildren ();
 31.3439 +		}	
 31.3440 +	/////////////////////////////////////////////////////////////////////
 31.3441 +	} else if (com=="unsetFlag")
 31.3442 +	{
 31.3443 +		if (selection.isEmpty() )
 31.3444 +		{
 31.3445 +			parser.setError (Aborted,"Nothing selected");
 31.3446 +		} else if (! selb )
 31.3447 +		{				  
 31.3448 +			parser.setError (Aborted,"Type of selection is not a branch");
 31.3449 +		} else if (parser.checkParCount(1))
 31.3450 +		{
 31.3451 +			s=parser.parString(ok,0);
 31.3452 +			if (ok) 
 31.3453 +			{
 31.3454 +				selb->deactivateStandardFlag(s);
 31.3455 +				selb->updateFlagsToolbar();
 31.3456 +			}	
 31.3457 +		}
 31.3458 +	} else
 31.3459 +		parser.setError (Aborted,"Unknown command");
 31.3460 +
 31.3461 +	// Any errors?
 31.3462 +	if (parser.errorLevel()==NoError)
 31.3463 +	{
 31.3464 +		// setChanged();  FIXME should not be called e.g. for export?!
 31.3465 +		reposition();
 31.3466 +	}	
 31.3467 +	else	
 31.3468 +	{
 31.3469 +		// TODO Error handling
 31.3470 +		qWarning("VymModel::parseAtom: Error!");
 31.3471 +		qWarning(parser.errorMessage());
 31.3472 +	} 
 31.3473 +}
 31.3474 +
 31.3475 +void VymModel::runScript (QString script)
 31.3476 +{
 31.3477 +	parser.setScript (script);
 31.3478 +	parser.runScript();
 31.3479 +	while (parser.next() ) 
 31.3480 +		parseAtom(parser.getAtom());
 31.3481 +}
 31.3482 +
 31.3483 +void VymModel::setExportMode (bool b)
 31.3484 +{
 31.3485 +	// should be called before and after exports
 31.3486 +	// depending on the settings
 31.3487 +	if (b && settings.value("/export/useHideExport","true")=="true")
 31.3488 +		setHideTmpMode (HideExport);
 31.3489 +	else	
 31.3490 +		setHideTmpMode (HideNone);
 31.3491 +}
 31.3492 +
 31.3493 +void VymModel::exportImage(QString fname, bool askName, QString format)
 31.3494 +{
 31.3495 +	if (fname=="")
 31.3496 +	{
 31.3497 +		fname=getMapName()+".png";
 31.3498 +		format="PNG";
 31.3499 +	} 	
 31.3500 +
 31.3501 +	if (askName)
 31.3502 +	{
 31.3503 +		QStringList fl;
 31.3504 +		QFileDialog *fd=new QFileDialog (NULL);
 31.3505 +		fd->setCaption (tr("Export map as image"));
 31.3506 +		fd->setDirectory (lastImageDir);
 31.3507 +		fd->setFileMode(QFileDialog::AnyFile);
 31.3508 +		fd->setFilters  (imageIO.getFilters() );
 31.3509 +		if (fd->exec())
 31.3510 +		{
 31.3511 +			fl=fd->selectedFiles();
 31.3512 +			fname=fl.first();
 31.3513 +			format=imageIO.getType(fd->selectedFilter());
 31.3514 +		} 
 31.3515 +	}
 31.3516 +
 31.3517 +	setExportMode (true);
 31.3518 +	QPixmap pix (getPixmap());
 31.3519 +	pix.save(fname, format);
 31.3520 +	setExportMode (false);
 31.3521 +}
 31.3522 +
 31.3523 +
 31.3524 +void VymModel::exportXML(QString dir, bool askForName)
 31.3525 +{
 31.3526 +	if (askForName)
 31.3527 +	{
 31.3528 +		dir=browseDirectory(NULL,tr("Export XML to directory"));
 31.3529 +		if (dir =="" && !reallyWriteDirectory(dir) )
 31.3530 +		return;
 31.3531 +	}
 31.3532 +
 31.3533 +	// Hide stuff during export, if settings want this
 31.3534 +	setExportMode (true);
 31.3535 +
 31.3536 +	// Create subdirectories
 31.3537 +	makeSubDirs (dir);
 31.3538 +
 31.3539 +	// write to directory
 31.3540 +	QString saveFile=saveToDir (dir,mapName+"-",true,getTotalBBox().topLeft() ,NULL);
 31.3541 +	QFile file;
 31.3542 +
 31.3543 +	file.setName ( dir + "/"+mapName+".xml");
 31.3544 +	if ( !file.open( QIODevice::WriteOnly ) )
 31.3545 +	{
 31.3546 +		// This should neverever happen
 31.3547 +		QMessageBox::critical (0,tr("Critical Export Error"),tr("VymModel::exportXML couldn't open %1").arg(file.name()));
 31.3548 +		return;
 31.3549 +	}	
 31.3550 +
 31.3551 +	// Write it finally, and write in UTF8, no matter what 
 31.3552 +	QTextStream ts( &file );
 31.3553 +	ts.setEncoding (QTextStream::UnicodeUTF8);
 31.3554 +	ts << saveFile;
 31.3555 +	file.close();
 31.3556 +
 31.3557 +	// Now write image, too
 31.3558 +	exportImage (dir+"/images/"+mapName+".png",false,"PNG");
 31.3559 +
 31.3560 +	setExportMode (false);
 31.3561 +}
 31.3562 +
 31.3563 +void VymModel::exportASCII(QString fname,bool askName)
 31.3564 +{
 31.3565 +	ExportASCII ex;
 31.3566 +	ex.setModel (this);
 31.3567 +	if (fname=="") 
 31.3568 +		ex.setFile (mapName+".txt");	
 31.3569 +	else
 31.3570 +		ex.setFile (fname);
 31.3571 +
 31.3572 +	if (askName)
 31.3573 +	{
 31.3574 +		//ex.addFilter ("TXT (*.txt)");
 31.3575 +		ex.setDir(lastImageDir);
 31.3576 +		//ex.setCaption(vymName+ " -" +tr("Export as ASCII")+" "+tr("(still experimental)"));
 31.3577 +		ex.execDialog() ; 
 31.3578 +	} 
 31.3579 +	if (!ex.canceled())
 31.3580 +	{
 31.3581 +		setExportMode(true);
 31.3582 +		ex.doExport();
 31.3583 +		setExportMode(false);
 31.3584 +	}
 31.3585 +}
 31.3586 +
 31.3587 +void VymModel::exportXHTML (const QString &dir, bool askForName)
 31.3588 +{
 31.3589 +			ExportXHTMLDialog dia(NULL);
 31.3590 +			dia.setFilePath (filePath );
 31.3591 +			dia.setMapName (mapName );
 31.3592 +			dia.readSettings();
 31.3593 +			if (dir!="") dia.setDir (dir);
 31.3594 +
 31.3595 +			bool ok=true;
 31.3596 +			
 31.3597 +			if (askForName)
 31.3598 +			{
 31.3599 +				if (dia.exec()!=QDialog::Accepted) 
 31.3600 +					ok=false;
 31.3601 +				else	
 31.3602 +				{
 31.3603 +					QDir d (dia.getDir());
 31.3604 +					// Check, if warnings should be used before overwriting
 31.3605 +					// the output directory
 31.3606 +					if (d.exists() && d.count()>0)
 31.3607 +					{
 31.3608 +						WarningDialog warn;
 31.3609 +						warn.showCancelButton (true);
 31.3610 +						warn.setText(QString(
 31.3611 +							"The directory %1 is not empty.\n"
 31.3612 +							"Do you risk to overwrite some of its contents?").arg(d.path() ));
 31.3613 +						warn.setCaption("Warning: Directory not empty");
 31.3614 +						warn.setShowAgainName("mainwindow/overwrite-dir-xhtml");
 31.3615 +
 31.3616 +						if (warn.exec()!=QDialog::Accepted) ok=false;
 31.3617 +					}
 31.3618 +				}	
 31.3619 +			}
 31.3620 +
 31.3621 +			if (ok)
 31.3622 +			{
 31.3623 +				exportXML (dia.getDir(),false );
 31.3624 +				dia.doExport(mapName );
 31.3625 +				//if (dia.hasChanged()) setChanged();
 31.3626 +			}
 31.3627 +}
 31.3628 +
 31.3629 +void VymModel::exportOOPresentation(const QString &fn, const QString &cf)
 31.3630 +{
 31.3631 +	ExportOO ex;
 31.3632 +	ex.setFile (fn);
 31.3633 +	ex.setModel (this);
 31.3634 +	if (ex.setConfigFile(cf)) 
 31.3635 +	{
 31.3636 +		setExportMode (true);
 31.3637 +		ex.exportPresentation();
 31.3638 +		setExportMode (false);
 31.3639 +	}
 31.3640 +}
 31.3641 +
 31.3642 +
 31.3643 +
 31.3644  
 31.3645  //////////////////////////////////////////////
 31.3646  // View related
 31.3647  //////////////////////////////////////////////
 31.3648  
 31.3649 +void VymModel::registerEditor(QWidget *)
 31.3650 +{
 31.3651 +}
 31.3652 +
 31.3653 +void VymModel::unregisterEditor(QWidget *)
 31.3654 +{
 31.3655 +}
 31.3656 +
 31.3657 +void VymModel::updateNoteFlag()
 31.3658 +{
 31.3659 +	setChanged();
 31.3660 +	BranchObj *bo=selection.getBranch();
 31.3661 +	if (bo) 
 31.3662 +	{
 31.3663 +		bo->updateNoteFlag();
 31.3664 +		mainWindow->updateActions();
 31.3665 +	}	
 31.3666 +}
 31.3667 +
 31.3668  void VymModel::updateRelPositions()
 31.3669  {
 31.3670  	for (int i=0; i<mapCenters.count(); i++)
 31.3671 @@ -284,6 +3766,261 @@
 31.3672  	}
 31.3673  }
 31.3674  
 31.3675 +QPixmap VymModel::getPixmap()
 31.3676 +{
 31.3677 +	QRectF mapRect=getTotalBBox();
 31.3678 +	QPixmap pix((int)mapRect.width()+2,(int)mapRect.height()+1);
 31.3679 +	QPainter pp (&pix);
 31.3680 +	
 31.3681 +	pp.setRenderHints(mapEditor->renderHints());
 31.3682 +
 31.3683 +	// Don't print the visualisation of selection
 31.3684 +	selection.unselect();
 31.3685 +
 31.3686 +	mapScene->render (	&pp, 
 31.3687 +		QRectF(0,0,mapRect.width()+2,mapRect.height()+2),
 31.3688 +		QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height() ));
 31.3689 +
 31.3690 +	// Restore selection
 31.3691 +	selection.reselect();
 31.3692 +	
 31.3693 +	return pix;
 31.3694 +}
 31.3695 +
 31.3696 +
 31.3697 +void VymModel::setMapLinkStyle (const QString & s)
 31.3698 +{
 31.3699 +	QString snow;
 31.3700 +	if (linkstyle==LinkableMapObj::Line)
 31.3701 +		snow="StyleLine";
 31.3702 +	else if (linkstyle==LinkableMapObj::Parabel)
 31.3703 +		snow="StyleParabel";
 31.3704 +	else if (linkstyle==LinkableMapObj::PolyLine)
 31.3705 +		snow="StylePolyLine";
 31.3706 +	else if (linkstyle==LinkableMapObj::PolyParabel)
 31.3707 +		snow="StyleParabel";
 31.3708 +
 31.3709 +	saveState (
 31.3710 +		QString("setMapLinkStyle (\"%1\")").arg(s),
 31.3711 +		QString("setMapLinkStyle (\"%1\")").arg(snow),
 31.3712 +		QString("Set map link style (\"%1\")").arg(s)
 31.3713 +	);	
 31.3714 +
 31.3715 +	if (s=="StyleLine")
 31.3716 +		linkstyle=LinkableMapObj::Line;
 31.3717 +	else if (s=="StyleParabel")
 31.3718 +		linkstyle=LinkableMapObj::Parabel;
 31.3719 +	else if (s=="StylePolyLine")
 31.3720 +		linkstyle=LinkableMapObj::PolyLine;
 31.3721 +	else	
 31.3722 +		linkstyle=LinkableMapObj::PolyParabel;
 31.3723 +
 31.3724 +	BranchObj *bo;
 31.3725 +	bo=first();
 31.3726 +	bo=next(bo);
 31.3727 +	while (bo) 
 31.3728 +	{
 31.3729 +		bo->setLinkStyle(bo->getDefLinkStyle());
 31.3730 +		bo=next(bo);
 31.3731 +	}
 31.3732 +	reposition();
 31.3733 +}
 31.3734 +
 31.3735 +LinkableMapObj::Style VymModel::getMapLinkStyle ()
 31.3736 +{
 31.3737 +	return linkstyle;
 31.3738 +}	
 31.3739 +
 31.3740 +void VymModel::setMapDefLinkColor(QColor col)
 31.3741 +{
 31.3742 +	if ( !col.isValid() ) return;
 31.3743 +	saveState (
 31.3744 +		QString("setMapDefLinkColor (\"%1\")").arg(getMapDefLinkColor().name()),
 31.3745 +		QString("setMapDefLinkColor (\"%1\")").arg(col.name()),
 31.3746 +		QString("Set map link color to %1").arg(col.name())
 31.3747 +	);
 31.3748 +
 31.3749 +	defLinkColor=col;
 31.3750 +	BranchObj *bo;
 31.3751 +	bo=first();
 31.3752 +	while (bo) 
 31.3753 +	{
 31.3754 +		bo->setLinkColor();
 31.3755 +		bo=next(bo);
 31.3756 +	}
 31.3757 +	updateActions();
 31.3758 +}
 31.3759 +
 31.3760 +void VymModel::setMapLinkColorHintInt()
 31.3761 +{
 31.3762 +	// called from setMapLinkColorHint(lch) or at end of parse
 31.3763 +	BranchObj *bo;
 31.3764 +	bo=first();
 31.3765 +	while (bo) 
 31.3766 +	{
 31.3767 +		bo->setLinkColor();
 31.3768 +		bo=next(bo);
 31.3769 +	}
 31.3770 +}
 31.3771 +
 31.3772 +void VymModel::setMapLinkColorHint(LinkableMapObj::ColorHint lch)
 31.3773 +{
 31.3774 +	linkcolorhint=lch;
 31.3775 +	setMapLinkColorHintInt();
 31.3776 +}
 31.3777 +
 31.3778 +void VymModel::toggleMapLinkColorHint()
 31.3779 +{
 31.3780 +	if (linkcolorhint==LinkableMapObj::HeadingColor)
 31.3781 +		linkcolorhint=LinkableMapObj::DefaultColor;
 31.3782 +	else	
 31.3783 +		linkcolorhint=LinkableMapObj::HeadingColor;
 31.3784 +	BranchObj *bo;
 31.3785 +	bo=first();
 31.3786 +	while (bo) 
 31.3787 +	{
 31.3788 +		bo->setLinkColor();
 31.3789 +		bo=next(bo);
 31.3790 +	}
 31.3791 +}
 31.3792 +
 31.3793 +void VymModel::selectMapBackgroundImage ()
 31.3794 +{
 31.3795 +	Q3FileDialog *fd=new Q3FileDialog( NULL);
 31.3796 +	fd->setMode (Q3FileDialog::ExistingFile);
 31.3797 +	fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
 31.3798 +	ImagePreview *p =new ImagePreview (fd);
 31.3799 +	fd->setContentsPreviewEnabled( TRUE );
 31.3800 +	fd->setContentsPreview( p, p );
 31.3801 +	fd->setPreviewMode( Q3FileDialog::Contents );
 31.3802 +	fd->setCaption(vymName+" - " +tr("Load background image"));
 31.3803 +	fd->setDir (lastImageDir);
 31.3804 +	fd->show();
 31.3805 +
 31.3806 +	if ( fd->exec() == QDialog::Accepted )
 31.3807 +	{
 31.3808 +		// TODO selectMapBackgroundImg in QT4 use:	lastImageDir=fd->directory();
 31.3809 +		lastImageDir=QDir (fd->dirPath());
 31.3810 +		setMapBackgroundImage (fd->selectedFile());
 31.3811 +	}
 31.3812 +}	
 31.3813 +
 31.3814 +void VymModel::setMapBackgroundImage (const QString &fn)	//FIXME missing savestate
 31.3815 +{
 31.3816 +	QColor oldcol=mapScene->backgroundBrush().color();
 31.3817 +	/*
 31.3818 +	saveState(
 31.3819 +		selection,
 31.3820 +		QString ("setMapBackgroundImage (%1)").arg(oldcol.name()),
 31.3821 +		selection,
 31.3822 +		QString ("setMapBackgroundImage (%1)").arg(col.name()),
 31.3823 +		QString("Set background color of map to %1").arg(col.name()));
 31.3824 +	*/	
 31.3825 +	QBrush brush;
 31.3826 +	brush.setTextureImage (QPixmap (fn));
 31.3827 +	mapScene->setBackgroundBrush(brush);
 31.3828 +}
 31.3829 +
 31.3830 +void VymModel::selectMapBackgroundColor()
 31.3831 +{
 31.3832 +	QColor col = QColorDialog::getColor( mapScene->backgroundBrush().color(), NULL);
 31.3833 +	if ( !col.isValid() ) return;
 31.3834 +	setMapBackgroundColor( col );
 31.3835 +}
 31.3836 +
 31.3837 +
 31.3838 +void VymModel::setMapBackgroundColor(QColor col)
 31.3839 +{
 31.3840 +	QColor oldcol=mapScene->backgroundBrush().color();
 31.3841 +	saveState(
 31.3842 +		QString ("setMapBackgroundColor (\"%1\")").arg(oldcol.name()),
 31.3843 +		QString ("setMapBackgroundColor (\"%1\")").arg(col.name()),
 31.3844 +		QString("Set background color of map to %1").arg(col.name()));
 31.3845 +	mapScene->setBackgroundBrush(col);
 31.3846 +}
 31.3847 +
 31.3848 +QColor VymModel::getMapBackgroundColor()
 31.3849 +{
 31.3850 +    return mapScene->backgroundBrush().color();
 31.3851 +}
 31.3852 +
 31.3853 +
 31.3854 +LinkableMapObj::ColorHint VymModel::getMapLinkColorHint()
 31.3855 +{
 31.3856 +	return linkcolorhint;
 31.3857 +}
 31.3858 +
 31.3859 +QColor VymModel::getMapDefLinkColor()
 31.3860 +{
 31.3861 +	return defLinkColor;
 31.3862 +}
 31.3863 +
 31.3864 +void VymModel::setMapDefXLinkColor(QColor col)
 31.3865 +{
 31.3866 +	defXLinkColor=col;
 31.3867 +}
 31.3868 +
 31.3869 +QColor VymModel::getMapDefXLinkColor()
 31.3870 +{
 31.3871 +	return defXLinkColor;
 31.3872 +}
 31.3873 +
 31.3874 +void VymModel::setMapDefXLinkWidth (int w)
 31.3875 +{
 31.3876 +	defXLinkWidth=w;
 31.3877 +}
 31.3878 +
 31.3879 +int VymModel::getMapDefXLinkWidth()
 31.3880 +{
 31.3881 +	return defXLinkWidth;
 31.3882 +}
 31.3883 +
 31.3884 +void VymModel::move(const double &x, const double &y)
 31.3885 +{
 31.3886 +	LinkableMapObj *sel=selection.single();
 31.3887 +	if (sel)
 31.3888 +	{
 31.3889 +        QPointF ap(sel->getAbsPos());
 31.3890 +        QPointF to(x, y);
 31.3891 +        if (ap != to)
 31.3892 +        {
 31.3893 +            QString ps=qpointfToString(ap);
 31.3894 +            QString s=selection.getSelectString();
 31.3895 +            saveState(
 31.3896 +                s, "move "+ps, 
 31.3897 +                s, "move "+qpointfToString(to), 
 31.3898 +                QString("Move %1 to %2").arg(getObjectName(sel)).arg(ps));
 31.3899 +            sel->move(x,y);
 31.3900 +            reposition();
 31.3901 +            selection.update();
 31.3902 +        }
 31.3903 +	}
 31.3904 +}
 31.3905 +
 31.3906 +void VymModel::moveRel (const double &x, const double &y)
 31.3907 +{
 31.3908 +	LinkableMapObj *sel=selection.single();
 31.3909 +	if (sel)
 31.3910 +	{
 31.3911 +        QPointF rp(sel->getRelPos());
 31.3912 +        QPointF to(x, y);
 31.3913 +        if (rp != to)
 31.3914 +        {
 31.3915 +            QString ps=qpointfToString (sel->getRelPos());
 31.3916 +            QString s=getSelectString(sel);
 31.3917 +            saveState(
 31.3918 +                s, "moveRel "+ps, 
 31.3919 +                s, "moveRel "+qpointfToString(to), 
 31.3920 +                QString("Move %1 to relative position %2").arg(getObjectName(sel)).arg(ps));
 31.3921 +            ((OrnamentedObj*)sel)->move2RelPos (x,y);
 31.3922 +            reposition();
 31.3923 +            sel->updateLink();
 31.3924 +            selection.update();
 31.3925 +        }
 31.3926 +	}
 31.3927 +}
 31.3928 +
 31.3929 +
 31.3930  void VymModel::animate()
 31.3931  {
 31.3932  	animationTimer->stop();
 31.3933 @@ -294,7 +4031,11 @@
 31.3934  		bo=(BranchObj*)animObjList.at(i);
 31.3935  		if (!bo->animate())
 31.3936  		{
 31.3937 -			if (i>=0) animObjList.removeAt(i);
 31.3938 +			if (i>=0) 
 31.3939 +			{	
 31.3940 +				animObjList.removeAt(i);
 31.3941 +				i--;
 31.3942 +			}
 31.3943  		}
 31.3944  		bo->reposition();
 31.3945  		i++;
 31.3946 @@ -322,26 +4063,640 @@
 31.3947  	}
 31.3948  }
 31.3949  
 31.3950 +void VymModel::sendSelection()
 31.3951 +{
 31.3952 +	if (netstate!=Server) return;
 31.3953 +	sendData (QString("select (\"%1\")").arg(selection.getSelectString()) );
 31.3954 +}
 31.3955 +
 31.3956 +void VymModel::newServer()
 31.3957 +{
 31.3958 +	port=54321;
 31.3959 +	sendCounter=0;
 31.3960 +    tcpServer = new QTcpServer(this);
 31.3961 +    if (!tcpServer->listen(QHostAddress::Any,port)) {
 31.3962 +        QMessageBox::critical(NULL, "vym server",
 31.3963 +                              QString("Unable to start the server: %1.").arg(tcpServer->errorString()));
 31.3964 +        //FIXME needed? we are no widget any longer... close();
 31.3965 +        return;
 31.3966 +    }
 31.3967 +	connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient()));
 31.3968 +	netstate=Server;
 31.3969 +	cout<<"Server is running on port "<<tcpServer->serverPort()<<endl;
 31.3970 +}
 31.3971 +
 31.3972 +void VymModel::connectToServer()
 31.3973 +{
 31.3974 +	port=54321;
 31.3975 +	server="salam.suse.de";
 31.3976 +	server="localhost";
 31.3977 +	clientSocket = new QTcpSocket (this);
 31.3978 +	clientSocket->abort();
 31.3979 +    clientSocket->connectToHost(server ,port);
 31.3980 +	connect(clientSocket, SIGNAL(readyRead()), this, SLOT(readData()));
 31.3981 +    connect(clientSocket, SIGNAL(error(QAbstractSocket::SocketError)),
 31.3982 +            this, SLOT(displayNetworkError(QAbstractSocket::SocketError)));
 31.3983 +	netstate=Client;		
 31.3984 +	cout<<"connected to "<<qPrintable (server)<<" port "<<port<<endl;
 31.3985 +
 31.3986 +	
 31.3987 +}
 31.3988 +
 31.3989 +void VymModel::newClient()
 31.3990 +{
 31.3991 +    QTcpSocket *newClient = tcpServer->nextPendingConnection();
 31.3992 +    connect(newClient, SIGNAL(disconnected()),
 31.3993 +            newClient, SLOT(deleteLater()));
 31.3994 +
 31.3995 +	cout <<"ME::newClient  at "<<qPrintable( newClient->peerAddress().toString() )<<endl;
 31.3996 +
 31.3997 +	clientList.append (newClient);
 31.3998 +}
 31.3999 +
 31.4000 +
 31.4001 +void VymModel::sendData(const QString &s)
 31.4002 +{
 31.4003 +	if (clientList.size()==0) return;
 31.4004 +
 31.4005 +	// Create bytearray to send
 31.4006 +	QByteArray block;
 31.4007 +    QDataStream out(&block, QIODevice::WriteOnly);
 31.4008 +    out.setVersion(QDataStream::Qt_4_0);
 31.4009 +
 31.4010 +	// Reserve some space for blocksize
 31.4011 +    out << (quint16)0;
 31.4012 +
 31.4013 +	// Write sendCounter
 31.4014 +    out << sendCounter++;
 31.4015 +
 31.4016 +	// Write data
 31.4017 +    out << s;
 31.4018 +
 31.4019 +	// Go back and write blocksize so far
 31.4020 +    out.device()->seek(0);
 31.4021 +    quint16 bs=(quint16)(block.size() - 2*sizeof(quint16));
 31.4022 +	out << bs;
 31.4023 +
 31.4024 +	if (debug)
 31.4025 +		cout << "ME::sendData  bs="<<bs<<"  counter="<<sendCounter<<"  s="<<qPrintable(s)<<endl;
 31.4026 +
 31.4027 +	for (int i=0; i<clientList.size(); ++i)
 31.4028 +	{
 31.4029 +		//cout << "Sending \""<<qPrintable (s)<<"\" to "<<qPrintable (clientList.at(i)->peerAddress().toString())<<endl;
 31.4030 +		clientList.at(i)->write (block);
 31.4031 +	}
 31.4032 +}
 31.4033 +
 31.4034 +void VymModel::readData ()
 31.4035 +{
 31.4036 +	while (clientSocket->bytesAvailable() >=(int)sizeof(quint16) )
 31.4037 +	{
 31.4038 +		if (debug)
 31.4039 +			cout <<"readData  bytesAvail="<<clientSocket->bytesAvailable();
 31.4040 +		quint16 recCounter;
 31.4041 +		quint16 blockSize;
 31.4042 +
 31.4043 +		QDataStream in(clientSocket);
 31.4044 +		in.setVersion(QDataStream::Qt_4_0);
 31.4045 +
 31.4046 +		in >> blockSize;
 31.4047 +		in >> recCounter;
 31.4048 +		
 31.4049 +		QString t;
 31.4050 +		in >>t;
 31.4051 +		if (debug)
 31.4052 +			cout << "  t="<<qPrintable (t)<<endl;
 31.4053 +		parseAtom (t);
 31.4054 +	}
 31.4055 +	return;
 31.4056 +}
 31.4057 +
 31.4058 +void VymModel::displayNetworkError(QAbstractSocket::SocketError socketError)
 31.4059 +{
 31.4060 +    switch (socketError) {
 31.4061 +    case QAbstractSocket::RemoteHostClosedError:
 31.4062 +        break;
 31.4063 +    case QAbstractSocket::HostNotFoundError:
 31.4064 +        QMessageBox::information(NULL, vymName +" Network client",
 31.4065 +                                 "The host was not found. Please check the "
 31.4066 +                                    "host name and port settings.");
 31.4067 +        break;
 31.4068 +    case QAbstractSocket::ConnectionRefusedError:
 31.4069 +        QMessageBox::information(NULL, vymName + " Network client",
 31.4070 +                                 "The connection was refused by the peer. "
 31.4071 +                                    "Make sure the fortune server is running, "
 31.4072 +                                    "and check that the host name and port "
 31.4073 +                                    "settings are correct.");
 31.4074 +        break;
 31.4075 +    default:
 31.4076 +        QMessageBox::information(NULL, vymName + " Network client",
 31.4077 +                                 QString("The following error occurred: %1.")
 31.4078 +                                 .arg(clientSocket->errorString()));
 31.4079 +    }
 31.4080 +}
 31.4081 +
 31.4082 +
 31.4083 +
 31.4084 +
 31.4085 +void VymModel::selectMapSelectionColor()
 31.4086 +{
 31.4087 +	QColor col = QColorDialog::getColor( defLinkColor, NULL);
 31.4088 +	setSelectionColor (col);
 31.4089 +}
 31.4090 +
 31.4091 +void VymModel::setSelectionColorInt (QColor col)
 31.4092 +{
 31.4093 +	if ( !col.isValid() ) return;
 31.4094 +	saveState (
 31.4095 +		QString("setSelectionColor (%1)").arg(selection.getColor().name()),
 31.4096 +		QString("setSelectionColor (%1)").arg(col.name()),
 31.4097 +		QString("Set color of selection box to %1").arg(col.name())
 31.4098 +	);
 31.4099 +
 31.4100 +	selection.setColor (col);
 31.4101 +}
 31.4102 +
 31.4103 +void VymModel::updateSelection()
 31.4104 +{
 31.4105 +	selection.update();
 31.4106 +}
 31.4107 +
 31.4108 +void VymModel::setSelectionColor(QColor col)
 31.4109 +{
 31.4110 +	if ( !col.isValid() ) return;
 31.4111 +	saveState (
 31.4112 +		QString("setSelectionColor (%1)").arg(selection.getColor().name()),
 31.4113 +		QString("setSelectionColor (%1)").arg(col.name()),
 31.4114 +		QString("Set color of selection box to %1").arg(col.name())
 31.4115 +	);
 31.4116 +	setSelectionColorInt (col);
 31.4117 +}
 31.4118 +
 31.4119 +QColor VymModel::getSelectionColor()
 31.4120 +{
 31.4121 +	return selection.getColor();
 31.4122 +}
 31.4123 +
 31.4124 +void VymModel::setHideTmpMode (HideTmpMode mode)
 31.4125 +{
 31.4126 +	hidemode=mode;
 31.4127 +	for (int i=0;i<mapCenters.count(); i++)
 31.4128 +		mapCenters.at(i)->setHideTmp (mode);	
 31.4129 +	reposition();
 31.4130 +	// FIXME needed? scene()->update();
 31.4131 +}
 31.4132 +
 31.4133 +
 31.4134 +QRectF VymModel::getTotalBBox()
 31.4135 +{
 31.4136 +	QRectF r;
 31.4137 +	for (int i=0;i<mapCenters.count(); i++)
 31.4138 +		r=addBBox (mapCenters.at(i)->getTotalBBox(), r);
 31.4139 +	return r;	
 31.4140 +}
 31.4141  
 31.4142  //////////////////////////////////////////////
 31.4143  // Selection related
 31.4144  //////////////////////////////////////////////
 31.4145  
 31.4146 -
 31.4147 -// Only as long as we dont have Model/View yet
 31.4148 +void VymModel::setSelectionBlocked (bool b)
 31.4149 +{
 31.4150 +	if (b)
 31.4151 +		selection.block();
 31.4152 +	else	
 31.4153 +		selection.unblock();
 31.4154 +}
 31.4155 +
 31.4156 +bool VymModel::isSelectionBlocked()
 31.4157 +{
 31.4158 +	return selection.isBlocked();
 31.4159 +}
 31.4160 +
 31.4161 +bool VymModel::select (const QString &s)
 31.4162 +{
 31.4163 +	if (selection.select(s))
 31.4164 +	{
 31.4165 +		selection.update();
 31.4166 +		ensureSelectionVisible();
 31.4167 +		sendSelection ();
 31.4168 +		return true;
 31.4169 +	}
 31.4170 +	return false;
 31.4171 +
 31.4172 +}
 31.4173 +
 31.4174 +bool VymModel::select (LinkableMapObj *lmo)
 31.4175 +{
 31.4176 +	if (selection.select(lmo))
 31.4177 +	{
 31.4178 +		selection.update();
 31.4179 +		ensureSelectionVisible();
 31.4180 +		sendSelection ();
 31.4181 +		return true;
 31.4182 +	}
 31.4183 +	return false;
 31.4184 +}
 31.4185 +
 31.4186 +void VymModel::unselect()
 31.4187 +{
 31.4188 +	selection.unselect();
 31.4189 +}	
 31.4190 +
 31.4191 +void VymModel::reselect()
 31.4192 +{
 31.4193 +	selection.reselect();
 31.4194 +}	
 31.4195 +
 31.4196 +void VymModel::ensureSelectionVisible()
 31.4197 +{
 31.4198 +	LinkableMapObj *lmo=selection.single();
 31.4199 +	if (lmo &&mapEditor) mapEditor->ensureVisible (lmo->getBBox() );
 31.4200 +	
 31.4201 +}
 31.4202 +
 31.4203 +void VymModel::selectInt (LinkableMapObj *lmo)
 31.4204 +{
 31.4205 +	if (selection.select(lmo))
 31.4206 +	{
 31.4207 +		selection.update();
 31.4208 +		sendSelection ();
 31.4209 +	}
 31.4210 +}
 31.4211 +
 31.4212 +
 31.4213 +void VymModel::selectNextBranchInt()
 31.4214 +{
 31.4215 +	// Increase number of branch
 31.4216 +	LinkableMapObj *sel=selection.single();
 31.4217 +	if (sel)
 31.4218 +	{
 31.4219 +		QString s=selection.getSelectString();
 31.4220 +		QString part;
 31.4221 +		QString typ;
 31.4222 +		QString num;
 31.4223 +
 31.4224 +		// Where am I? 
 31.4225 +		part=s.section(",",-1);
 31.4226 +		typ=part.left (3);
 31.4227 +		num=part.right(part.length() - 3);
 31.4228 +
 31.4229 +		s=s.left (s.length() -num.length());
 31.4230 +
 31.4231 +		// Go to next lmo
 31.4232 +		num=QString ("%1").arg(num.toUInt()+1);
 31.4233 +
 31.4234 +		s=s+num;
 31.4235 +		
 31.4236 +		// Try to select this one
 31.4237 +		if (select (s)) return;
 31.4238 +
 31.4239 +		// We have no direct successor, 
 31.4240 +		// try to increase the parental number in order to
 31.4241 +		// find a successor with same depth
 31.4242 +
 31.4243 +		int d=selection.single()->getDepth();
 31.4244 +		int oldDepth=d;
 31.4245 +		int i;
 31.4246 +		bool found=false;
 31.4247 +		bool b;
 31.4248 +		while (!found && d>0)
 31.4249 +		{
 31.4250 +			s=s.section (",",0,d-1);
 31.4251 +			// replace substring of current depth in s with "1"
 31.4252 +			part=s.section(",",-1);
 31.4253 +			typ=part.left (3);
 31.4254 +			num=part.right(part.length() - 3);
 31.4255 +
 31.4256 +			if (d>1)
 31.4257 +			{	
 31.4258 +				// increase number of parent
 31.4259 +				num=QString ("%1").arg(num.toUInt()+1);
 31.4260 +				s=s.section (",",0,d-2) + ","+ typ+num;
 31.4261 +			} else
 31.4262 +			{
 31.4263 +				// Special case, look at orientation
 31.4264 +				if (selection.single()->getOrientation()==LinkableMapObj::RightOfCenter)
 31.4265 +					num=QString ("%1").arg(num.toUInt()+1);
 31.4266 +				else	
 31.4267 +					num=QString ("%1").arg(num.toUInt()-1);
 31.4268 +				s=typ+num;
 31.4269 +			}	
 31.4270 +
 31.4271 +			if (select (s))
 31.4272 +				// pad to oldDepth, select the first branch for each depth
 31.4273 +				for (i=d;i<oldDepth;i++)
 31.4274 +				{
 31.4275 +					b=select (s);
 31.4276 +					if (b)
 31.4277 +					{	
 31.4278 +						if ( selection.getBranch()->countBranches()>0)
 31.4279 +							s+=",bo:0";
 31.4280 +						else	
 31.4281 +							break;
 31.4282 +					} else
 31.4283 +						break;
 31.4284 +				}	
 31.4285 +
 31.4286 +			// try to select the freshly built string
 31.4287 +			found=select(s);
 31.4288 +			d--;
 31.4289 +		}
 31.4290 +		return;
 31.4291 +	}	
 31.4292 +}
 31.4293 +
 31.4294 +void VymModel::selectPrevBranchInt()
 31.4295 +{
 31.4296 +	// Decrease number of branch
 31.4297 +	BranchObj *bo=selection.getBranch();
 31.4298 +	if (bo)
 31.4299 +	{
 31.4300 +		QString s=selection.getSelectString();
 31.4301 +		QString part;
 31.4302 +		QString typ;
 31.4303 +		QString num;
 31.4304 +
 31.4305 +		// Where am I? 
 31.4306 +		part=s.section(",",-1);
 31.4307 +		typ=part.left (3);
 31.4308 +		num=part.right(part.length() - 3);
 31.4309 +
 31.4310 +		s=s.left (s.length() -num.length());
 31.4311 +
 31.4312 +		int n=num.toInt()-1;
 31.4313 +		
 31.4314 +		// Go to next lmo
 31.4315 +		num=QString ("%1").arg(n);
 31.4316 +		s=s+num;
 31.4317 +		
 31.4318 +		// Try to select this one
 31.4319 +		if (n>=0 && select (s)) return;
 31.4320 +
 31.4321 +		// We have no direct precessor, 
 31.4322 +		// try to decrease the parental number in order to
 31.4323 +		// find a precessor with same depth
 31.4324 +
 31.4325 +		int d=selection.single()->getDepth();
 31.4326 +		int oldDepth=d;
 31.4327 +		int i;
 31.4328 +		bool found=false;
 31.4329 +		bool b;
 31.4330 +		while (!found && d>0)
 31.4331 +		{
 31.4332 +			s=s.section (",",0,d-1);
 31.4333 +			// replace substring of current depth in s with "1"
 31.4334 +			part=s.section(",",-1);
 31.4335 +			typ=part.left (3);
 31.4336 +			num=part.right(part.length() - 3);
 31.4337 +
 31.4338 +			if (d>1)
 31.4339 +			{
 31.4340 +				// decrease number of parent
 31.4341 +				num=QString ("%1").arg(num.toInt()-1);
 31.4342 +				s=s.section (",",0,d-2) + ","+ typ+num;
 31.4343 +			} else
 31.4344 +			{
 31.4345 +				// Special case, look at orientation
 31.4346 +				if (selection.single()->getOrientation()==LinkableMapObj::RightOfCenter)
 31.4347 +					num=QString ("%1").arg(num.toInt()-1);
 31.4348 +				else	
 31.4349 +					num=QString ("%1").arg(num.toInt()+1);
 31.4350 +				s=typ+num;
 31.4351 +			}	
 31.4352 +
 31.4353 +			if (select(s))
 31.4354 +				// pad to oldDepth, select the last branch for each depth
 31.4355 +				for (i=d;i<oldDepth;i++)
 31.4356 +				{
 31.4357 +					b=select (s);
 31.4358 +					if (b)
 31.4359 +						if ( selection.getBranch()->countBranches()>0)
 31.4360 +							s+=",bo:"+ QString ("%1").arg( selection.getBranch()->countBranches()-1 );
 31.4361 +						else	
 31.4362 +							break;
 31.4363 +					else
 31.4364 +						break;
 31.4365 +				}	
 31.4366 +			
 31.4367 +			// try to select the freshly built string
 31.4368 +			found=select(s);
 31.4369 +			d--;
 31.4370 +		}
 31.4371 +		return;
 31.4372 +	}	
 31.4373 +}
 31.4374 +
 31.4375 +void VymModel::selectUpperBranch()
 31.4376 +{
 31.4377 +	if (selection.isBlocked() ) return;
 31.4378 +
 31.4379 +	BranchObj *bo=selection.getBranch();
 31.4380 +	if (bo && selection.type()==Selection::Branch)
 31.4381 +	{
 31.4382 +		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
 31.4383 +			selectPrevBranchInt();
 31.4384 +		else
 31.4385 +			if (bo->getDepth()==1)
 31.4386 +				selectNextBranchInt();
 31.4387 +			else
 31.4388 +				selectPrevBranchInt();
 31.4389 +	}
 31.4390 +}
 31.4391 +
 31.4392 +void VymModel::selectLowerBranch()
 31.4393 +{
 31.4394 +	if (selection.isBlocked() ) return;
 31.4395 +
 31.4396 +	BranchObj *bo=selection.getBranch();
 31.4397 +	if (bo && selection.type()==Selection::Branch)
 31.4398 +	{
 31.4399 +		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
 31.4400 +			selectNextBranchInt();
 31.4401 +		else
 31.4402 +			if (bo->getDepth()==1)
 31.4403 +				selectPrevBranchInt();
 31.4404 +			else
 31.4405 +				selectNextBranchInt();
 31.4406 +	}			
 31.4407 +}
 31.4408 +
 31.4409 +
 31.4410 +void VymModel::selectLeftBranch()
 31.4411 +{
 31.4412 +	if (selection.isBlocked() ) return;
 31.4413 +
 31.4414 +	BranchObj* bo;
 31.4415 +	BranchObj* par;
 31.4416 +	LinkableMapObj *sel=selection.single();
 31.4417 +	if (sel)
 31.4418 +	{
 31.4419 +		if (selection.type()== Selection::MapCenter)
 31.4420 +		{
 31.4421 +			par=selection.getBranch();
 31.4422 +			bo=par->getLastSelectedBranch();
 31.4423 +			if (bo)
 31.4424 +			{
 31.4425 +				// Workaround for reselecting on left and right side
 31.4426 +				if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
 31.4427 +					bo=par->getLastBranch();
 31.4428 +				if (bo)
 31.4429 +				{
 31.4430 +					bo=par->getLastBranch();
 31.4431 +					selection.select(bo);
 31.4432 +					selection.update();
 31.4433 +					ensureSelectionVisible();
 31.4434 +					sendSelection();
 31.4435 +				}
 31.4436 +			}	
 31.4437 +		} else
 31.4438 +		{
 31.4439 +			par=(BranchObj*)(sel->getParObj());
 31.4440 +			if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
 31.4441 +			{
 31.4442 +				if (selection.type() == Selection::Branch ||
 31.4443 +					selection.type() == Selection::FloatImage)
 31.4444 +				{
 31.4445 +					selection.select(par);
 31.4446 +					selection.update();
 31.4447 +					ensureSelectionVisible();
 31.4448 +					sendSelection();
 31.4449 +				}
 31.4450 +			} else
 31.4451 +			{
 31.4452 +				if (selection.type() == Selection::Branch )
 31.4453 +				{
 31.4454 +					bo=selection.getBranch()->getLastSelectedBranch();
 31.4455 +					if (bo) 
 31.4456 +					{
 31.4457 +						selection.select(bo);
 31.4458 +						selection.update();
 31.4459 +						ensureSelectionVisible();
 31.4460 +					sendSelection();
 31.4461 +					}
 31.4462 +				}
 31.4463 +			}
 31.4464 +		}	
 31.4465 +	}
 31.4466 +}
 31.4467 +
 31.4468 +void VymModel::selectRightBranch()
 31.4469 +{
 31.4470 +	if (selection.isBlocked() ) return;
 31.4471 +
 31.4472 +	BranchObj* bo;
 31.4473 +	BranchObj* par;
 31.4474 +	LinkableMapObj *sel=selection.single();
 31.4475 +	if (sel)
 31.4476 +	{
 31.4477 +		if (selection.type()==Selection::MapCenter) 
 31.4478 +		{
 31.4479 +			par=selection.getBranch();
 31.4480 +			bo=par->getLastSelectedBranch();
 31.4481 +			if (bo)
 31.4482 +			{
 31.4483 +				// Workaround for reselecting on left and right side
 31.4484 +				if (bo->getOrientation()==LinkableMapObj::LeftOfCenter)
 31.4485 +					bo=par->getFirstBranch();
 31.4486 +				if (bo)
 31.4487 +				{
 31.4488 +					selection.select(bo);
 31.4489 +					selection.update();
 31.4490 +					ensureSelectionVisible();
 31.4491 +					sendSelection();
 31.4492 +				}
 31.4493 +			}
 31.4494 +		} else
 31.4495 +		{
 31.4496 +			par=(BranchObj*)(selection.single()->getParObj());
 31.4497 +			if (selection.single()->getOrientation()==LinkableMapObj::LeftOfCenter)
 31.4498 +			{
 31.4499 +				if (selection.type() == Selection::Branch ||
 31.4500 +					selection.type() == Selection::FloatImage)
 31.4501 +				{
 31.4502 +					selection.select(par);
 31.4503 +					selection.update();
 31.4504 +					ensureSelectionVisible();
 31.4505 +					sendSelection();
 31.4506 +				}
 31.4507 +			} else
 31.4508 +			{
 31.4509 +				if (selection.type()  == Selection::Branch) 
 31.4510 +				{
 31.4511 +					bo=selection.getBranch()->getLastSelectedBranch();
 31.4512 +					if (bo) 
 31.4513 +					{
 31.4514 +						selection.select(bo);
 31.4515 +						selection.update();
 31.4516 +						ensureSelectionVisible();
 31.4517 +					sendSelection();
 31.4518 +					}
 31.4519 +				}
 31.4520 +			}
 31.4521 +		}
 31.4522 +	}
 31.4523 +}
 31.4524 +
 31.4525 +void VymModel::selectFirstBranch()
 31.4526 +{
 31.4527 +	BranchObj *bo1=selection.getBranch();
 31.4528 +	BranchObj *bo2;
 31.4529 +	BranchObj* par;
 31.4530 +	if (bo1)
 31.4531 +	{
 31.4532 +		par=(BranchObj*)(bo1->getParObj());
 31.4533 +		if (!par) return;
 31.4534 +		bo2=par->getFirstBranch();
 31.4535 +		if (bo2) {
 31.4536 +			selection.select(bo2);
 31.4537 +			selection.update();
 31.4538 +			ensureSelectionVisible();
 31.4539 +			sendSelection();
 31.4540 +		}
 31.4541 +	}		
 31.4542 +}
 31.4543 +
 31.4544 +void VymModel::selectLastBranch()
 31.4545 +{
 31.4546 +	BranchObj *bo1=selection.getBranch();
 31.4547 +	BranchObj *bo2;
 31.4548 +	BranchObj* par;
 31.4549 +	if (bo1)
 31.4550 +	{
 31.4551 +		par=(BranchObj*)(bo1->getParObj());
 31.4552 +		if (!par) return;
 31.4553 +		bo2=par->getLastBranch();
 31.4554 +		if (bo2) 
 31.4555 +		{
 31.4556 +			selection.select(bo2);
 31.4557 +			selection.update();
 31.4558 +			ensureSelectionVisible();
 31.4559 +			sendSelection();
 31.4560 +		}
 31.4561 +	}		
 31.4562 +}
 31.4563 +
 31.4564 +Selection::Type VymModel::selectionType()
 31.4565 +{
 31.4566 +	return selection.type();
 31.4567 +}
 31.4568 +
 31.4569  LinkableMapObj* VymModel::getSelection()
 31.4570  {
 31.4571 -	return mapEditor->getSelection();
 31.4572 +	return selection.single();	
 31.4573  }
 31.4574  BranchObj* VymModel::getSelectedBranch()
 31.4575  {
 31.4576 -	return mapEditor->getSelectedBranch();
 31.4577 +	return selection.getBranch();	
 31.4578  }
 31.4579  
 31.4580 -
 31.4581 -bool VymModel::select (const QString &s)
 31.4582 +FloatImageObj* VymModel::getSelectedFloatImage()
 31.4583  {
 31.4584 -	return mapEditor->select (s);
 31.4585 +	return selection.getFloatImage();	
 31.4586 +}
 31.4587 +
 31.4588 +QString VymModel::getSelectString ()
 31.4589 +{
 31.4590 +	return selection.getSelectString();
 31.4591  }
 31.4592  
 31.4593  QString VymModel::getSelectString (LinkableMapObj *lmo)
 31.4594 @@ -368,21 +4723,5 @@
 31.4595  		}	
 31.4596  	}	
 31.4597  	return s;
 31.4598 -
 31.4599  }
 31.4600  
 31.4601 -	
 31.4602 -void VymModel::setHideTmp (HideTmpMode mode)
 31.4603 -{
 31.4604 -	for (int i=0;i<mapCenters.count(); i++)
 31.4605 -		mapCenters.at(i)->setHideTmp (mode);	
 31.4606 -}
 31.4607 -
 31.4608 -QRectF VymModel::getTotalBBox()
 31.4609 -{
 31.4610 -	QRectF r;
 31.4611 -	for (int i=0;i<mapCenters.count(); i++)
 31.4612 -		r=addBBox (mapCenters.at(i)->getTotalBBox(), r);
 31.4613 -	return r;	
 31.4614 -}
 31.4615 -
    32.1 --- a/vymmodel.h	Wed Jul 16 10:44:44 2008 +0000
    32.2 +++ b/vymmodel.h	Wed Jul 16 10:46:14 2008 +0000
    32.3 @@ -2,60 +2,456 @@
    32.4  #define VYMMODEL_H
    32.5  
    32.6  #include <QGraphicsScene>
    32.7 +#include <QtNetwork>
    32.8  
    32.9 +#include "file.h"
   32.10  #include "mapcenterobj.h"
   32.11  #include "mapeditor.h"
   32.12 +#include "parser.h"
   32.13 +#include "selection.h"
   32.14 +#include "xmlobj.h"
   32.15  
   32.16  
   32.17  /*! \brief This will later be divided into Model/View
   32.18  */
   32.19  
   32.20 -class VymModel : public QObject{
   32.21 +class VymModel : public QObject,  public XMLObj {		
   32.22  	Q_OBJECT
   32.23  
   32.24 +////////////////////////////////////////////
   32.25 +// General housekeeping
   32.26 +////////////////////////////////////////////
   32.27 +private:
   32.28 +	QGraphicsScene *mapScene;
   32.29 +	QList <MapCenterObj*> mapCenters;
   32.30 +	QString version;	//!< version string saved in vym file
   32.31 +	QString author;
   32.32 +	QString comment;
   32.33 +	QDate date;
   32.34 +
   32.35  public:
   32.36  	VymModel();
   32.37  	~VymModel ();
   32.38      void clear();
   32.39      void init();
   32.40 +	void makeTmpDirectories();		//!< create temporary directories e.g. for history
   32.41 +
   32.42  	void setMapEditor(MapEditor *me);	// FIXME should not be necessary in Model/View
   32.43 -	MapEditor* getMapEditor();
   32.44 +	MapEditor* getMapEditor();			// FIXME not necessary
   32.45 +
   32.46 +	bool isRepositionBlocked();		//!< While load or undo there is no need to update graphicsview
   32.47 +
   32.48 +	void updateActions();			//!< Update buttons in mainwindow
   32.49 +
   32.50 +
   32.51 +////////////////////////////////////////////
   32.52 +// Load/save 
   32.53 +////////////////////////////////////////////
   32.54 +private:
   32.55 +
   32.56 +	bool zipped;				// should map be zipped
   32.57 +	static	int mapNum;			// unique number for model used in save/undo
   32.58 +	FileType fileType;			// type of file, e.g. vym, freemind...
   32.59 +	QString fileName;			// short name of file (for tab)
   32.60 +	QString filePath;			// path to file which will be saved
   32.61 +	QString fileDir;			// dir where file is saved
   32.62 +	QString destPath;			// path to .vym file (needed for vymlinks)
   32.63 +	QString mapName;			// fileName without ".vym"
   32.64 +
   32.65 +	QString tmpMapDir;			// tmp directory with undo history
   32.66 +
   32.67 +	QTimer *autosaveTimer;
   32.68 +	QTimer *fileChangedTimer;
   32.69 +	QDateTime fileChangedTime;
   32.70 +
   32.71 +public:
   32.72 +	/*! This function saves all information of the map to disc.
   32.73 +	    saveToDir also calls the functions for all BranchObj and other objects in the map.
   32.74 +		The structure of the map itself is returned as QString and passed back to Main, 
   32.75 +		where saveToDir is called initially
   32.76 +	*/	
   32.77 +    QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel);
   32.78 +
   32.79 +	/*! \brief Sets filepath, filename and mapname
   32.80 +
   32.81 +	     If the filepath is "/home/tux/map.xml", then the filename will be set
   32.82 +		 to map.xml. The destname is needed for vymLinks, pointing to another map. 
   32.83 +		 The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
   32.84 +	*/	 
   32.85 +
   32.86 +
   32.87 +	/*! \brief Set File path
   32.88 +
   32.89 +	     The destname is needed to construct the references between maps
   32.90 +	*/	 
   32.91 +	void setFilePath (QString filepath,QString destname);	
   32.92 +	void setFilePath (QString);	//!< Overloaded for convenience
   32.93 +	QString getFilePath ();	//!< Full path e.g. "/home/tux/map.xml"
   32.94 +	QString getFileName ();	//!< e.g. "map.xml"
   32.95 +	QString getMapName ();	//!< e.g. "map"
   32.96 +	QString getDestPath (); //!< e.g. "/home/tux/map.vym"
   32.97 +
   32.98 +	/*! \brief Load map
   32.99 +
  32.100 +		The data is read from file. Depending on LoadMode the current
  32.101 +		selection gets replaced by data or the data is appended.
  32.102 +	*/	
  32.103 +    ErrorCode load (QString, const LoadMode &, const FileType& );	// newmap, import/replace selection
  32.104 +
  32.105 +public:
  32.106 +	/*! \brief Save the map to file */
  32.107 +    ErrorCode save(const SaveMode &);	
  32.108 +
  32.109 +private:
  32.110 +    void addMapReplaceInt(const QString & undoSel, const QString & path);
  32.111 +    void addMapInsertInt (const QString & path, int pos);
  32.112 +
  32.113 +	FloatImageObj* loadFloatImageInt (QString);
  32.114 +	void saveFloatImageInt (FloatImageObj*, const QString &, const QString &);
  32.115 +public:	
  32.116 +	void loadFloatImage ();
  32.117 +	void saveFloatImage ();
  32.118 +
  32.119 +private:	
  32.120 +    void importDirInt(BranchObj *,QDir);
  32.121 +    void importDirInt(const QString&);
  32.122 +public:	
  32.123 +    void importDir();
  32.124 +
  32.125 +private slots:
  32.126 +	void autosave ();
  32.127 +	void fileChanged();
  32.128 +
  32.129 +////////////////////////////////////////////
  32.130 +// history (undo/redo)
  32.131 +////////////////////////////////////////////
  32.132 +private:
  32.133 +    bool mapDefault;			//!< Flag if map is untouched
  32.134 +    bool mapChanged;			//!< Flag if undo is possible
  32.135 +	bool mapUnsaved;			//!< Flag if map should be saved
  32.136 +
  32.137 +	QString histPath;			//!< Path to history file
  32.138 +	SimpleSettings undoSet;		//!< undo/redo commands, saved in histPath
  32.139 +	int stepsTotal;				//!< total number of steps (undos+redos) 
  32.140 +	int curStep;				//!< Current step in history (ring buffer)
  32.141 +	int curClipboard;			//!< number of history step, which is the current clipboard
  32.142 +	int redosAvail;				//!< Available number of redo steps
  32.143 +	int undosAvail;				//!< Available number of undo steps
  32.144 +	bool blockReposition;		//!< block while load or undo
  32.145 +	bool blockSaveState;		//!< block while load or undo
  32.146 +public:
  32.147 +	bool isDefault();			//!< true, if map is still the empty default map
  32.148 +	void makeDefault();			//!< Reset changelog, declare this as default map
  32.149 +    bool hasChanged()	;		//!< true, if something has changed and is not saved yet
  32.150 +	void setChanged();			//!< called from TextEditor via LinkableMapObj
  32.151 +
  32.152 +	/*! \brief Get name of object
  32.153 +	  
  32.154 +	  Returns heading of a branch or name of an object for use in comment
  32.155 +	  of undo/redo history
  32.156 +	*/ 
  32.157 +	QString getObjectName(const LinkableMapObj*);	
  32.158 +
  32.159 +    void redo();						//!< Redo last action
  32.160 +	bool isRedoAvailable();				//!< True, if redo is available
  32.161 +    void undo();						//!< Undo last action
  32.162 +	bool isUndoAvailable();				//!< True, if undo is available
  32.163 +	void gotoHistoryStep (int);			//!< Goto a specifig step in history
  32.164 +
  32.165 +
  32.166 +	QString getHistoryPath();			//!< Path to directory containing the history
  32.167 +
  32.168 +	/*! \brief Save the current changes in map 
  32.169 +
  32.170 +		Two commands and selections are saved:
  32.171 +
  32.172 +			- undocommand and undoselection to undo the change
  32.173 +			- redocommand and redoselection to redo the action after an undo
  32.174 +
  32.175 +		Additionally a comment is logged. 
  32.176 +
  32.177 +	*/	
  32.178 +    void saveState(
  32.179 +		const SaveMode& savemode, 
  32.180 +		const QString &undoSelection, 
  32.181 +		const QString &undoCommand, 
  32.182 +		const QString &redoSelection, 
  32.183 +		const QString &redoCommand, 
  32.184 +		const QString &comment, 
  32.185 +		LinkableMapObj *saveSelection);
  32.186 +	/*! Overloaded for convenience */
  32.187 +    void saveStateChangingPart(
  32.188 +		LinkableMapObj *undoSelection, 
  32.189 +		LinkableMapObj* redoSelection, 
  32.190 +		const QString &redoCommand, 
  32.191 +		const QString &comment);
  32.192 +	/*! Overloaded for convenience */
  32.193 +    void saveStateRemovingPart(
  32.194 +		LinkableMapObj *redoSelection, 
  32.195 +		const QString &comment);
  32.196 +	/*! Overloaded for convenience */
  32.197 +    void saveState(
  32.198 +		LinkableMapObj *undoSelection, 
  32.199 +		const QString &undoCommand, 
  32.200 +		LinkableMapObj *redoSelection, 
  32.201 +		const QString &redoCommand, 
  32.202 +		const QString &comment); 
  32.203 +	/*! Overloaded for convenience */
  32.204 +    void saveState(
  32.205 +		const QString &undoSelection, 
  32.206 +		const QString &undoCommand, 
  32.207 +		const QString &redoSelection, 
  32.208 +		const QString &redoCommand, 
  32.209 +		const QString &comment) ;
  32.210 +    void saveState(
  32.211 +		const QString &undoCommand, 
  32.212 +		const QString &redoCommand, 
  32.213 +		const QString &comment) ;
  32.214 +
  32.215 +
  32.216 +////////////////////////////////////////////
  32.217 +// unsorted so far
  32.218 +////////////////////////////////////////////
  32.219 +public:
  32.220 +	void setScene(QGraphicsScene *s);
  32.221 +	QGraphicsScene *getScene();
  32.222 +
  32.223 +	BranchObj* first();					
  32.224 +	BranchObj* next(BranchObj *bo);		
  32.225 +
  32.226 +    LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
  32.227 +    LinkableMapObj* findObjBySelect (const QString &s);		// find MapObj by select string
  32.228 +    LinkableMapObj* findID (const QString &s);				// find MapObj by previously set ID
  32.229 +
  32.230 +	void removeSelection ();								// remove selected object
  32.231 +
  32.232 +	QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
  32.233 +
  32.234 +
  32.235 +////////////////////////////////////////////
  32.236 +// Interface 
  32.237 +////////////////////////////////////////////
  32.238 +public:
  32.239  	void setVersion(const  QString &);
  32.240  	void setAuthor  (const QString &);
  32.241  	QString getAuthor ();
  32.242  	void setComment (const QString &);
  32.243  	QString getComment ();
  32.244  	QString getDate();
  32.245 -	void setScene(QGraphicsScene *s);
  32.246 -	QGraphicsScene *getScene();
  32.247 +
  32.248 +public:	
  32.249 +	void setHeading(const QString &);		//!< Set heading of branch	
  32.250 +	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
  32.251 +private:
  32.252 +	void setHeadingInt(const QString &);
  32.253 +
  32.254 +private:
  32.255 +	BranchObj* itFind;			// next object in find process
  32.256 +	bool EOFind;				// true, if search failed
  32.257 +public:
  32.258 +    BranchObj* findText(QString,bool);		// Find object
  32.259 +    void findReset();						// Reset Search
  32.260 +
  32.261 +	void setURL(const QString &url);
  32.262 +	QString getURL();						// returns URL of selection or ""
  32.263 +	QStringList getURLs();					// returns URLs of subtree
  32.264 +
  32.265 +	void linkFloatImageTo(const QString &);
  32.266 +
  32.267 +	void setFrameType(const FrameObj::FrameType &);
  32.268 +	void setFrameType(const QString &);
  32.269 +	void setFramePenColor (const QColor &);
  32.270 +	void setFrameBrushColor (const QColor &);
  32.271 +	void setFramePadding (const int &);
  32.272 +	void setFrameBorderWidth (const int &);
  32.273 +	void setIncludeImagesVer(bool);
  32.274 +	void setIncludeImagesHor(bool);
  32.275 +	void setHideLinkUnselected (bool);
  32.276 +
  32.277 +	/*! Should object be hidden in exports (clouded)? */
  32.278 +	void setHideExport(bool);			
  32.279 +
  32.280 +	/*! Should object be hidden in exports (clouded)? */
  32.281 +	void toggleHideExport();		
  32.282 +
  32.283 +    void copy();						//!< Copy to clipboard
  32.284 +private:	
  32.285 +    void pasteNoSave(const int &n);		//!< paste clipboard to branch
  32.286 +public:	
  32.287 +    void paste();		//!< Paste clipboard to branch and backup
  32.288 +    void cut();			//!< Cut to clipboard (and copy)
  32.289 +
  32.290 +    void moveBranchUp();	//!< Move branch up
  32.291 +    void moveBranchDown();	//!< Move branch down
  32.292 +	void sortChildren();	//!< Sort children lexically
  32.293 +
  32.294 +	/*! \brief Add new mapcenter
  32.295 +
  32.296 +	    Disclaimer: Still experimental, not fully supported yet.
  32.297 +	*/	
  32.298  	MapCenterObj* addMapCenter();
  32.299 +private:	
  32.300  	MapCenterObj* addMapCenter(QPointF absPos);
  32.301 +public:	
  32.302  	MapCenterObj* removeMapCenter(MapCenterObj *mco);
  32.303  
  32.304 -	BranchObj* first();					// FIXME replaced by ModelIndex later
  32.305 -	BranchObj* next(BranchObj *bo);		// FIXME replaced by ModelIndex later
  32.306 +	/*! \brief Add new branch
  32.307  
  32.308 -    LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
  32.309 -    LinkableMapObj* findObjBySelect (const QString &s);		// find MapObj by select string
  32.310 -    LinkableMapObj* findID (const QString &s);				// find MapObj by previously set ID
  32.311 -	QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
  32.312 +		Depending on num the new branch is created
  32.313  
  32.314 +		-3 above selection as child of selections parent
  32.315 +		-2 as child of selection
  32.316 +		-1 below selection as child of selections parent
  32.317 +		0..n	insert at a specific position in selections parent
  32.318 +		(needed for free relinking)
  32.319 +	*/	
  32.320 +private:	
  32.321 +    BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
  32.322 +public:	
  32.323 +	/*! \Add new branch
  32.324 +		
  32.325 +		Depending on num the new branch is created
  32.326 +		-1 above selection
  32.327 +		 0 as child of selection
  32.328 +		 1 below selection
  32.329 +	*/
  32.330 +    BranchObj* addNewBranch(int pos);		
  32.331 +    BranchObj* addNewBranchBefore();		//!< Insert branch between selection and its parent
  32.332 +    void deleteSelection();					//!< Delete selection
  32.333 +	void deleteKeepChildren();				//!< remove branch, but keep children
  32.334 +	void deleteChildren();					//!< keep branch, but remove children
  32.335  
  32.336 -////////////////////////////////////////// View related
  32.337 -    // void updateLink();  FIXME needed?
  32.338 +private:	
  32.339 +	bool scrollBranch(BranchObj*);
  32.340 +	bool unscrollBranch(BranchObj*);
  32.341 +public:	
  32.342 +    void toggleScroll();
  32.343 +    void unscrollChildren();
  32.344 +
  32.345 +    void addFloatImage(const QPixmap &img);
  32.346 +
  32.347 +    void colorBranch(QColor);
  32.348 +    void colorSubtree(QColor);
  32.349 +	QColor getCurrentHeadingColor();
  32.350 +
  32.351 +
  32.352 +	void editURL();							// edit URL
  32.353 +	void editLocalURL();					// edit URL to local file
  32.354 +	void editHeading2URL();					// copy heading to URL
  32.355 +	void editBugzilla2URL();				// create URL to Bugzilla
  32.356 +	void editFATE2URL();					// create URL to FATE
  32.357 +	void editVymLink();						// edit link to another map
  32.358 +	void setVymLink (const QString &);	// Set vymLink for selection
  32.359 +	void deleteVymLink();					// delete link to another map
  32.360 +	QString getVymLink();					// return path to map
  32.361 +	QStringList getVymLinks();				// return paths in subtree
  32.362 +	void followXLink (int);
  32.363 +	void editXLink (int);
  32.364 +
  32.365 +
  32.366 +
  32.367 +
  32.368 +////////////////////////////////////////////
  32.369 +// Scripting
  32.370 +////////////////////////////////////////////
  32.371 +public:	
  32.372 +
  32.373 +	/* \brief Process one command and its parameters */
  32.374 +    void parseAtom (const QString &atom);	
  32.375 +
  32.376 +	/* \brief Runs the script */
  32.377 +	void runScript (QString script);
  32.378 +
  32.379 +private:
  32.380 +	Parser parser;
  32.381 +
  32.382 +////////////////////////////////////////////
  32.383 +// Exports
  32.384 +////////////////////////////////////////////
  32.385 +private:
  32.386 +	HideTmpMode hidemode;	// true while exporting to hide some stuff
  32.387 +
  32.388 +public:
  32.389 +	/*! Set or unset temporary hiding of objects during export  */
  32.390 +	void setExportMode (bool);
  32.391 +
  32.392 +	/*! Save as image */
  32.393 +    void exportImage (QString fname="",bool askForName=true,QString format="PNG");
  32.394 +
  32.395 +
  32.396 +	/*! Export as XTML to directory */
  32.397 +    void exportXML(QString dir="", bool askForName=true);
  32.398 +
  32.399 +	/*! Export as ASCII text to file */
  32.400 +	void exportASCII (QString fname="",bool askForName=true);  
  32.401 +
  32.402 +	/*! Export as XHTML to directory */
  32.403 +    void exportXHTML(const QString& dir="", bool askForName=true);	
  32.404 +
  32.405 +    /*! Export as OpenOfficeOrg presentation */
  32.406 +    void exportOOPresentation(const QString &,const QString &);	
  32.407 +
  32.408 +
  32.409 +////////////////////////////////////////////
  32.410 +// View related
  32.411 +////////////////////////////////////////////
  32.412 +public:
  32.413 +	void registerEditor (QWidget *);
  32.414 +	void unregisterEditor (QWidget *);
  32.415 +	void updateNoteFlag();				//!< Signal origination in TextEditor
  32.416      void updateRelPositions();
  32.417  
  32.418  	QRectF getTotalBBox();
  32.419  	void reposition();					//!< Call reposition for all MCOs
  32.420 -	void setHideTmp (HideTmpMode mode);	
  32.421 +	void setHideTmpMode (HideTmpMode mode);	
  32.422 +
  32.423  	QPolygonF shape(BranchObj *bo);		//!< Returns arbitrary shape of subtree
  32.424  	void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
  32.425  
  32.426 -	// Animation  **experimental**
  32.427 -private slots:
  32.428 -	void animate();						//!< Called by timer to animate stuff
  32.429 +	//void ensureSelectionVisible();		//!< Show selection in all views
  32.430 +
  32.431 +private:
  32.432 +	MapEditor *mapEditor;
  32.433 +
  32.434 +	QColor defLinkColor;		// default color for links
  32.435 +	QColor defXLinkColor;		// default color for xlinks
  32.436 +	int defXLinkWidth;			// default width for xlinks
  32.437 +	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
  32.438 +	LinkableMapObj::Style linkstyle;		// default style for links
  32.439 +
  32.440 +private:
  32.441 +    QPixmap getPixmap();
  32.442 +
  32.443  public:
  32.444 -	void startAnimation(const QPointF &start, const QPointF &dest);
  32.445 +	void setMapLinkStyle (const QString &);	// Set style of link
  32.446 +	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
  32.447 +	void setMapDefLinkColor(QColor);		// default color of links
  32.448 +	void setMapLinkColorHintInt();			// color of links
  32.449 +	void setMapLinkColorHint(LinkableMapObj::ColorHint);// color of links
  32.450 +	void toggleMapLinkColorHint();			// after changing linkStyles
  32.451 +    void selectMapBackgroundImage();
  32.452 +    void setMapBackgroundImage(const QString &);
  32.453 +    void selectMapBackgroundColor();
  32.454 +    void setMapBackgroundColor(QColor);
  32.455 +    QColor getMapBackgroundColor();
  32.456 +
  32.457 +
  32.458 +	LinkableMapObj::ColorHint getMapLinkColorHint();
  32.459 +	QColor getMapDefLinkColor();
  32.460 +	void setMapDefXLinkColor(QColor);
  32.461 +	QColor getMapDefXLinkColor();
  32.462 +	void setMapDefXLinkWidth (int);
  32.463 +	int getMapDefXLinkWidth();
  32.464 +
  32.465 +	/*!  Move absolutly to (x,y).  */	
  32.466 +    void move    (const double &x, const double &y);
  32.467 +
  32.468 +	/*!  Move relativly to (x,y).  */	
  32.469 +    void moveRel (const double &x, const double &y);
  32.470 +
  32.471 +////////////////////////////////////////////
  32.472 +// Animation  **experimental**
  32.473 +////////////////////////////////////////////
  32.474  private:	
  32.475  	QTimer *animationTimer;
  32.476  	bool animationUse;
  32.477 @@ -64,22 +460,102 @@
  32.478  	int timerId;				// animation timer
  32.479  	QList <MapObj*> animObjList;// list with animated objects
  32.480  
  32.481 -////////////////////////////////////////// Selection related 
  32.482 +private slots:
  32.483 +	void animate();						//!< Called by timer to animate stuff
  32.484  public:
  32.485 +	void startAnimation(const QPointF &start, const QPointF &dest);
  32.486 +////////////////////////////////////////////
  32.487 +// Network related 
  32.488 +////////////////////////////////////////////
  32.489 +public:
  32.490 +    /*! \brief Networking states
  32.491 +		
  32.492 +		In Network modus we want to switch of saveState, autosave, ...
  32.493 +	*/
  32.494 +	enum NetState {
  32.495 +		Offline,			//!< Offline
  32.496 +		Client,				//!< I am the client and connected to server
  32.497 +		Server				//!< I am the server
  32.498 +	};
  32.499 +
  32.500 +private:
  32.501 +	// Network connections **Experimental**
  32.502 +	NetState netstate;			// offline, client, server
  32.503 +	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
  32.504 +	QList <QTcpSocket*> clientList;		// List of connected clients
  32.505 +	quint16 sendCounter;		// Increased with every sent command
  32.506 +
  32.507 +	QTcpSocket	*clientSocket;	// socket of this client
  32.508 +	QString server;				// server address of this client
  32.509 +	int port;					// server port of this client
  32.510 +
  32.511 +
  32.512 +
  32.513 +protected:
  32.514 +	void sendSelection();
  32.515 +
  32.516 +public:
  32.517 +	void newServer();
  32.518 +	void connectToServer();
  32.519 +
  32.520 +private slots:	
  32.521 +	void newClient();
  32.522 +	void sendData(const QString &s);
  32.523 +	void readData();
  32.524 +	void displayNetworkError (QAbstractSocket::SocketError);
  32.525 +
  32.526 +private:	
  32.527 +	void displayClientError(QAbstractSocket::SocketError socketError);
  32.528 +
  32.529 +
  32.530 +////////////////////////////////////////////
  32.531 +// Selection related 
  32.532 +////////////////////////////////////////////
  32.533 +private:
  32.534 +	Selection selection;
  32.535 +	QString latestSelectionString;	// select string of latest added object
  32.536 +
  32.537 +public:
  32.538 +	void setSelectionBlocked(bool);
  32.539 +	bool isSelectionBlocked();
  32.540 +
  32.541 +	bool select(const QString &);			// Select by string
  32.542 +	bool select(LinkableMapObj *lmo);		// Select by pointer
  32.543 +	void unselect();
  32.544 +	void reselect();
  32.545 +
  32.546 +	void ensureSelectionVisible();			//!< Show selection in all views
  32.547 +
  32.548 +	void selectInt(LinkableMapObj*);	
  32.549 +
  32.550 +private:	
  32.551 +	void selectNextBranchInt();		// Increment number of branch
  32.552 +	void selectPrevBranchInt();		// Decrement number of branch
  32.553 +public:	
  32.554 +    void selectUpperBranch();
  32.555 +    void selectLowerBranch();
  32.556 +    void selectLeftBranch();
  32.557 +    void selectRightBranch();
  32.558 +    void selectFirstBranch();
  32.559 +    void selectLastBranch();
  32.560 +
  32.561 +public:
  32.562 +	Selection::Type selectionType();
  32.563  	LinkableMapObj* getSelection();
  32.564  	BranchObj* getSelectedBranch();
  32.565 -	bool select (const QString &s);
  32.566 +	FloatImageObj* getSelectedFloatImage();
  32.567 +	QString getSelectString ();
  32.568  	QString getSelectString (LinkableMapObj *lmo);
  32.569 +	
  32.570 +	void updateSelection();
  32.571 +	void selectMapLinkColor();
  32.572 +    void selectMapSelectionColor();
  32.573 +private:	
  32.574 +    void setSelectionColorInt(QColor);
  32.575 +public:	
  32.576 +    void setSelectionColor(QColor);
  32.577 +    QColor getSelectionColor();
  32.578  
  32.579 -private:
  32.580 -	QGraphicsScene *mapScene;
  32.581 -	MapEditor *mapEditor;
  32.582 -	QList <MapCenterObj*> mapCenters;
  32.583 -	QString version;	//!< version string saved in vym file
  32.584 -	QString author;
  32.585 -	QString comment;
  32.586 -	QDate date;
  32.587  };
  32.588  
  32.589 -
  32.590  #endif
    33.1 --- a/xml-vym.cpp	Wed Jul 16 10:44:44 2008 +0000
    33.2 +++ b/xml-vym.cpp	Wed Jul 16 10:46:14 2008 +0000
    33.3 @@ -105,29 +105,29 @@
    33.4  			if (!atts.value( "selectionColor").isEmpty() )
    33.5  			{
    33.6  				col.setNamedColor(atts.value("selectionColor"));
    33.7 -				model->getMapEditor()->setSelectionColor(col);
    33.8 +				model->setSelectionColor(col);
    33.9  			}	    
   33.10  			if (!atts.value( "linkColorHint").isEmpty() ) 
   33.11  			{
   33.12  				if (atts.value("linkColorHint")=="HeadingColor")
   33.13 -					model->getMapEditor()->setMapLinkColorHint(LinkableMapObj::HeadingColor);
   33.14 +					model->setMapLinkColorHint(LinkableMapObj::HeadingColor);
   33.15  				else
   33.16 -					model->getMapEditor()->setMapLinkColorHint(LinkableMapObj::DefaultColor);
   33.17 +					model->setMapLinkColorHint(LinkableMapObj::DefaultColor);
   33.18  			}
   33.19  			if (!atts.value( "linkStyle").isEmpty() ) 
   33.20 -				model->getMapEditor()->setMapLinkStyle(atts.value("linkStyle"));
   33.21 +				model->setMapLinkStyle(atts.value("linkStyle"));
   33.22  			if (!atts.value( "linkColor").isEmpty() ) 
   33.23  			{
   33.24  				col.setNamedColor(atts.value("linkColor"));
   33.25 -				model->getMapEditor()->setMapDefLinkColor(col);
   33.26 +				model->setMapDefLinkColor(col);
   33.27  			}	
   33.28  			if (!atts.value( "defXLinkColor").isEmpty() ) 
   33.29  			{
   33.30  				col.setNamedColor(atts.value("defXLinkColor"));
   33.31 -				model->getMapEditor()->setMapDefXLinkColor(col);
   33.32 +				model->setMapDefXLinkColor(col);
   33.33  			}	
   33.34  			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   33.35 -				model->getMapEditor()->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   33.36 +				model->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   33.37  		}	
   33.38  	} else if ( eName == "select" && state == StateMap ) 
   33.39  	{
   33.40 @@ -150,8 +150,8 @@
   33.41  			// Treat the found mapcenter as a branch 
   33.42  			// in an existing map
   33.43  			LinkableMapObj* lmo=model->getSelection();
   33.44 -			if (lmo && ((typeid(*lmo) == typeid(BranchObj) ) 
   33.45 -			        ||  typeid(*lmo) == typeid(MapCenterObj) ) )
   33.46 +			if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   33.47 +			        || (typeid(*lmo) == typeid(MapCenterObj) ) )
   33.48  			{
   33.49  				lastBranch=(BranchObj*)lmo;
   33.50  				if (loadMode==ImportAdd)
   33.51 @@ -205,10 +205,10 @@
   33.52  			// selection==lmo==NULL
   33.53  			// Treat it like ImportAdd then...
   33.54  			loadMode=ImportAdd;
   33.55 -			lmo=model->first();		// FIXME this used to be lmo=mc before
   33.56 +			lmo=model->first();		
   33.57  		}	
   33.58 -		if (lmo && ((typeid(*lmo) == typeid(BranchObj) ) 
   33.59 -				||  typeid(*lmo) == typeid(MapCenterObj) ) )
   33.60 +		if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   33.61 +				|| (typeid(*lmo) == typeid(MapCenterObj) ) )
   33.62  		{
   33.63  			lastBranch=(BranchObj*)(lmo);
   33.64  			if (eName=="branch")
   33.65 @@ -626,7 +626,7 @@
   33.66  	if (!a.value( "key").isEmpty() ) 
   33.67  	{
   33.68  		if (!a.value( "value").isEmpty() ) 
   33.69 -			settings.setLocalEntry (model->getMapEditor()->getDestPath(), a.value ("key"), a.value ("value"));
   33.70 +			settings.setLocalEntry (model->getDestPath(), a.value ("key"), a.value ("value"));
   33.71  		else
   33.72  			return false;
   33.73  		
    34.1 --- a/xmlobj.cpp	Wed Jul 16 10:44:44 2008 +0000
    34.2 +++ b/xmlobj.cpp	Wed Jul 16 10:46:14 2008 +0000
    34.3 @@ -1,6 +1,7 @@
    34.4  #include "xmlobj.h"
    34.5  
    34.6  #include <QRegExp>
    34.7 +#include <QString>
    34.8  
    34.9  
   34.10  // returns masked "<" ">" "&"
    35.1 --- a/xmlobj.h	Wed Jul 16 10:44:44 2008 +0000
    35.2 +++ b/xmlobj.h	Wed Jul 16 10:46:14 2008 +0000
    35.3 @@ -1,7 +1,7 @@
    35.4  #ifndef XMLOBJ_H
    35.5  #define XMLOBJ_H
    35.6  
    35.7 -#include <QString>
    35.8 +class QString;
    35.9  
   35.10  QString quotemeta(const QString&);	
   35.11