Various fixes for relinking and selecting
authorinsilmaril
Thu Oct 01 11:28:50 2009 +0000 (2009-10-01)
changeset 798d251c7b2de54
parent 797 2876353ea150
child 799 2c42ad499ac3
Various fixes for relinking and selecting
branchitem.cpp
branchobj.cpp
floatobj.cpp
geometry.cpp
geometry.h
imageitem.cpp
linkablemapobj.cpp
linkablemapobj.h
mapeditor.cpp
mapeditor.h
ornamentedobj.cpp
version.h
vymmodel.cpp
vymview.cpp
     1.1 --- a/branchitem.cpp	Wed Sep 23 12:14:08 2009 +0000
     1.2 +++ b/branchitem.cpp	Thu Oct 01 11:28:50 2009 +0000
     1.3 @@ -438,9 +438,13 @@
     1.4  {
     1.5  	// FIXME-5 compare also MapItem::initLMO...
     1.6  
     1.7 -	if (lmo && parentItem != rootItem)
     1.8 -	{
     1.9 -		lmo->setParObj ( ((MapItem*)parentItem)->getLMO() );
    1.10 +	if (lmo)
    1.11 +	{ 
    1.12 +		if ( parentItem != rootItem)
    1.13 +			lmo->setParObj ( ((MapItem*)parentItem)->getLMO() );
    1.14 +		else
    1.15 +			lmo->setParObj (NULL);
    1.16 +		((BranchObj*)lmo)->setDefAttr(BranchObj::MovedBranch);
    1.17  	}
    1.18  }
    1.19  
    1.20 @@ -458,7 +462,7 @@
    1.21  	if (parentItem==rootItem)
    1.22  	{
    1.23  		newbo->setParObj(NULL);
    1.24 -		newbo->setFrameType (FrameObj::Rectangle);
    1.25 +		//newbo->setFrameType (FrameObj::Rectangle);	//FIXME-4 maybe call updateStyles?
    1.26  	} else
    1.27  	{
    1.28  		newbo->setParObj( ((MapItem*)parentItem)->getLMO() );
     2.1 --- a/branchobj.cpp	Wed Sep 23 12:14:08 2009 +0000
     2.2 +++ b/branchobj.cpp	Thu Oct 01 11:28:50 2009 +0000
     2.3 @@ -115,7 +115,7 @@
     2.4  		return false;
     2.5  }
     2.6  
     2.7 -void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off)
     2.8 +void BranchObj::setParObjTmp(LinkableMapObj* dst, QPointF m, int off)	//FIXME-1 after moving a mainbranch to a branch and away again mainbranch is no longer connected to mapcenter...
     2.9  {
    2.10  	// Temporary link to dst
    2.11  	// m is position of mouse pointer 
    2.12 @@ -127,9 +127,12 @@
    2.13  	int pi_depth=pi->depth();
    2.14  	BranchObj* bo=(BranchObj*)(dst);
    2.15  
    2.16 -	if (!parObjTmpBuf) parObjTmpBuf=parObj;
    2.17 +	if (!tmpParent) 
    2.18 +	{
    2.19 +		tmpParent=true;
    2.20 +		parObjTmpBuf=parObj;
    2.21 +	}
    2.22  
    2.23 -	// ignore mapcenter and mainbranch	//FIXME-1 MCO meanwhile also could be relinked
    2.24  	if (pi_depth<2) off=0;
    2.25  	if (off==0)
    2.26  		link2ParPos=false;
    2.27 @@ -137,9 +140,6 @@
    2.28  		link2ParPos=true;
    2.29  	parObj=bo;
    2.30  
    2.31 -	// setLinkStyle calls updateLinkGeometry, only set it once
    2.32 -	//LinkableMapObj::Style ls=getDefLinkStyle (dst->getTreeItem() );
    2.33 -	//if (style!=ls ) setLinkStyle (ls);
    2.34  	setLinkStyle (dst->getDefLinkStyle (dsti));
    2.35  
    2.36  	// Move temporary to new position at destination
    2.37 @@ -148,12 +148,11 @@
    2.38  	// Better just do it approximately
    2.39  	if (parObj->getTreeItem()->depth()==0)	
    2.40  	{	// new parent is a mapcenter
    2.41 -
    2.42 -		//FIXME-2 rewrite to us new normalize QPointF p= normalize ( QPointF (m.x() - o->getChildPos().x(),
    2.43 -		//								  m.y() - o->getChildPos().y() ));
    2.44 -		QPointF p= ( m - bo->getChildPos());
    2.45 -		if (p.x()<0) p.setX( p.x()-bbox.width() );
    2.46 -		move2RelPos (p);
    2.47 +		Vector v= ( m - bo->getChildPos());
    2.48 +		if (v.x()<0) v.setX( v.x()-bbox.width() );
    2.49 +		v.normalize();
    2.50 +		v.scale (100);
    2.51 +		move2RelPos (v.toQPointF());
    2.52  	} else
    2.53  	{	
    2.54  		qreal y;
    2.55 @@ -190,8 +189,9 @@
    2.56  
    2.57  void BranchObj::unsetParObjTmp()
    2.58  {
    2.59 -	if (parObjTmpBuf) 
    2.60 +	if (tmpParent) 
    2.61  	{
    2.62 +		tmpParent=false;
    2.63  		link2ParPos=false;
    2.64  		parObj=parObjTmpBuf;
    2.65  		parObjTmpBuf=NULL;
    2.66 @@ -485,9 +485,18 @@
    2.67  	int fontsize;
    2.68  	switch (treeItem->depth())
    2.69  	{
    2.70 -		case 0: fontsize=16; break;
    2.71 -		case 1: fontsize=12; break;
    2.72 -		default: fontsize=10; break;
    2.73 +		case 0: 
    2.74 +			fontsize=16; 
    2.75 +			setFrameType (FrameObj::Rectangle);
    2.76 +			break;
    2.77 +		case 1: 
    2.78 +			fontsize=12; 
    2.79 +			setFrameType (FrameObj::NoFrame);
    2.80 +			break;
    2.81 +		default: 
    2.82 +			fontsize=10; 
    2.83 +			setFrameType (FrameObj::NoFrame);
    2.84 +			break;
    2.85  	}	
    2.86  	setLinkStyle(getDefLinkStyle(treeItem->parent() ));
    2.87  	setLinkColor ();
    2.88 @@ -497,6 +506,10 @@
    2.89  
    2.90  	if (mod==NewBranch)
    2.91  		setColor (treeItem->getHeadingColor() );
    2.92 +	else
    2.93 +		// Also set styles for children
    2.94 +		for (int i=0; i<treeItem->branchCount(); ++i)
    2.95 +			treeItem->getBranchObjNum(i)->setDefAttr(MovedBranch);
    2.96  	calcBBoxSize();
    2.97  }
    2.98  
    2.99 @@ -672,7 +685,7 @@
   2.100  	return bboxTotal;
   2.101  }
   2.102  
   2.103 -ConvexPolygon BranchObj::getBoundingPolygon()
   2.104 +ConvexPolygon BranchObj::getBoundingPolygon()	
   2.105  {
   2.106  /*
   2.107  	if (!pi)	//FIXME-3 Testing only
   2.108 @@ -683,6 +696,7 @@
   2.109  		pi->setZValue(Z_BBOX);
   2.110  	}
   2.111  	*/
   2.112 +
   2.113  	if (treeItem->branchCount()==0 || treeItem->depth()==0)
   2.114  	{
   2.115  		if (pi) pi->setPolygon (MapObj::getBoundingPolygon() );
   2.116 @@ -695,7 +709,9 @@
   2.117  	p<<bboxTotal.topRight();
   2.118  	p<<bboxTotal.bottomRight();
   2.119  	p<<bboxTotal.bottomLeft();
   2.120 -		if (pi) pi->setPolygon (p );
   2.121 +	//cout << "BO::getBP (total)  "<<treeItem->getHeadingStd()<<"  tL="<<bboxTotal.topLeft()<<"  bR="<<bboxTotal.bottomRight()<<endl;
   2.122 +	//cout << "                   "<<"  tL="<<bbox.topLeft()<<"  bR="<<bbox.bottomRight()<<endl;
   2.123 +	if (pi) pi->setPolygon (p );
   2.124  	return p;
   2.125  }
   2.126  
   2.127 @@ -751,6 +767,7 @@
   2.128  			r.setWidth( max (br.width(), r.width() ));
   2.129  			r.setHeight(br.height() + r.height() );
   2.130  			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
   2.131 +			if (br.x()<bboxTotal.x()) bboxTotal.setX(br.x());
   2.132  		}
   2.133  	}
   2.134  	// Add myself and also
     3.1 --- a/floatobj.cpp	Wed Sep 23 12:14:08 2009 +0000
     3.2 +++ b/floatobj.cpp	Thu Oct 01 11:28:50 2009 +0000
     3.3 @@ -9,7 +9,7 @@
     3.4  
     3.5  FloatObj::FloatObj (QGraphicsScene* s, TreeItem *ti):OrnamentedObj(s,ti)
     3.6  {
     3.7 -	cout << "Const FloatObj s="<<s<<"  ti="<<ti<<"  treeItem="<<treeItem<<endl;
     3.8 +	//cout << "Const FloatObj s="<<s<<"  ti="<<ti<<"  treeItem="<<treeItem<<endl;
     3.9      setParObj (this);	
    3.10      init();
    3.11  }
     4.1 --- a/geometry.cpp	Wed Sep 23 12:14:08 2009 +0000
     4.2 +++ b/geometry.cpp	Thu Oct 01 11:28:50 2009 +0000
     4.3 @@ -88,6 +88,11 @@
     4.4  	setY (-y());
     4.5  }
     4.6  
     4.7 +QPointF Vector::toQPointF ()
     4.8 +{
     4.9 +	return QPointF (x(),y());
    4.10 +}
    4.11 +
    4.12  /*! Calculate the projection of a polygon on an axis
    4.13      and returns it as a [min, max] interval  */
    4.14  ConvexPolygon::ConvexPolygon ()
     5.1 --- a/geometry.h	Wed Sep 23 12:14:08 2009 +0000
     5.2 +++ b/geometry.h	Thu Oct 01 11:28:50 2009 +0000
     5.3 @@ -21,6 +21,7 @@
     5.4  	virtual qreal dotProduct (const QPointF &b);
     5.5  	virtual void scale  (const qreal &f);
     5.6  	virtual void invert ();
     5.7 +	virtual QPointF toQPointF();
     5.8  };
     5.9  
    5.10  class ConvexPolygon:public QPolygonF
     6.1 --- a/imageitem.cpp	Wed Sep 23 12:14:08 2009 +0000
     6.2 +++ b/imageitem.cpp	Thu Oct 01 11:28:50 2009 +0000
     6.3 @@ -66,7 +66,7 @@
     6.4  	initLMO();
     6.5  	fio->setZValue(zValue);
     6.6  	fio->setRelPos (pos);
     6.7 -	cout << "II::createMO   fio="<<fio<<"   tI="<<fio->getTreeItem()<<endl;
     6.8 +	//cout << "II::createMO   fio="<<fio<<"   tI="<<fio->getTreeItem()<<endl;
     6.9  	return fio;
    6.10  }
    6.11  
     7.1 --- a/linkablemapobj.cpp	Wed Sep 23 12:14:08 2009 +0000
     7.2 +++ b/linkablemapobj.cpp	Thu Oct 01 11:28:50 2009 +0000
     7.3 @@ -39,6 +39,7 @@
     7.4  
     7.5  void LinkableMapObj::delLink()
     7.6  {
     7.7 +	//bottomline->hide();
     7.8  	switch (style)
     7.9  	{
    7.10  		case Line:
    7.11 @@ -62,6 +63,7 @@
    7.12  {
    7.13      parObj=NULL;
    7.14      parObjTmpBuf=NULL;
    7.15 +	tmpParent=false;
    7.16      parPos=QPointF(0,0);
    7.17      childPos=QPointF(0,0);
    7.18  	link2ParPos=false;
    7.19 @@ -78,6 +80,8 @@
    7.20  	pen.setWidth (1);
    7.21  	pen.setColor (linkcolor);
    7.22  	pen.setCapStyle ( Qt::RoundCap );
    7.23 +
    7.24 +	useBottomline=true;
    7.25  	bottomline=scene->addLine(QLineF(1,1,1,1),pen);
    7.26      bottomline->setZValue(Z_LINK);
    7.27      bottomline->show();
    7.28 @@ -116,8 +120,7 @@
    7.29  
    7.30  bool LinkableMapObj::hasParObjTmp()
    7.31  {
    7.32 -	if (parObjTmpBuf) return true;
    7.33 -	return false;
    7.34 +	return tmpParent;
    7.35  }
    7.36  
    7.37  void LinkableMapObj::setUseRelPos (const bool &b)
    7.38 @@ -205,7 +208,6 @@
    7.39  
    7.40  void LinkableMapObj::setLinkStyle(Style newstyle)
    7.41  {
    7.42 -	//if (newstyle==style) return; FIXME-3
    7.43  	delLink();
    7.44  		
    7.45  	style=newstyle;
    7.46 @@ -368,7 +370,11 @@
    7.47  
    7.48  	if (visnow) 
    7.49  	{
    7.50 -		bottomline->show();
    7.51 +		if (useBottomline)
    7.52 +			bottomline->show();
    7.53 +		else	
    7.54 +			bottomline->hide();
    7.55 +
    7.56  		switch (style)
    7.57  		{
    7.58  			case Line:
    7.59 @@ -477,7 +483,6 @@
    7.60  	double vy=p2y - p1y;
    7.61  
    7.62  	// Draw the horizontal line below heading (from ChildPos to ParPos)
    7.63 -	//bottomline->prepareGeometryChange();
    7.64  	bottomline->setLine (QLine (qRound(childPos.x()),
    7.65  		qRound(childPos.y()),
    7.66  		qRound(p1x),
     8.1 --- a/linkablemapobj.h	Wed Sep 23 12:14:08 2009 +0000
     8.2 +++ b/linkablemapobj.h	Thu Oct 01 11:28:50 2009 +0000
     8.3 @@ -40,6 +40,7 @@
     8.4  		Bottom  //!< Link is drawn at bottom of object
     8.5  	};
     8.6  
     8.7 +
     8.8  	/*! Hint if link should use the default link color or the color of heading */
     8.9  	enum ColorHint {
    8.10  		DefaultColor,	//!< Link uses the default color
    8.11 @@ -117,7 +118,7 @@
    8.12  
    8.13      LinkableMapObj* parObj;		
    8.14      LinkableMapObj* parObjTmpBuf;	// temporary buffer the original parent
    8.15 -    qreal bottomlineY;              // vertical offset of dockpos to pos
    8.16 +	bool tmpParent;
    8.17  
    8.18  	int thickness_start;			// for StylePoly*	
    8.19      Style style;					// Current style
    8.20 @@ -131,7 +132,11 @@
    8.21  	QPolygonF pa0;					// For drawing of PolyParabel and PolyLine
    8.22  	QPolygonF pa1;					// For drawing of PolyParabel 
    8.23  	QPolygonF pa2;					// For drawing of PolyParabel	
    8.24 +
    8.25      QGraphicsLineItem* bottomline;  // on bottom of BBox
    8.26 +	bool useBottomline;				//! Hint if bottomline should be used
    8.27 +    qreal bottomlineY;              // vertical offset of dockpos to pos
    8.28 +
    8.29  	bool repositionRequest;			// 
    8.30  
    8.31  	qreal topPad, botPad,
     9.1 --- a/mapeditor.cpp	Wed Sep 23 12:14:08 2009 +0000
     9.2 +++ b/mapeditor.cpp	Thu Oct 01 11:28:50 2009 +0000
     9.3 @@ -64,6 +64,7 @@
     9.4  	pickingColor=false;
     9.5  	drawingLink=false;
     9.6  	copyingObj=false;
     9.7 +	objectMoved=false;
     9.8  
     9.9      editingBO=NULL;
    9.10      movingObj=NULL;
    9.11 @@ -184,17 +185,20 @@
    9.12      return mapScene;
    9.13  }
    9.14  
    9.15 -void MapEditor::scrollTo (const QModelIndex &index)
    9.16 +void MapEditor::scrollTo (const QModelIndex &index)	//FIXME-1 problems with locating stuff in big maps
    9.17  {
    9.18 -	//cout <<"ME::scrollTo aborted\n";
    9.19 -	//return;
    9.20  	if (index.isValid())
    9.21  	{
    9.22  		LinkableMapObj* lmo=NULL;
    9.23  		TreeItem *ti= static_cast<TreeItem*>(index.internalPointer());
    9.24  		if (ti->getType()==TreeItem::Image ||ti->isBranchLikeType() )
    9.25  			lmo=((MapItem*)ti)->getLMO();
    9.26 -		if (lmo) setScrollBarPosTarget (lmo->getBBox() );
    9.27 +		if (lmo) 
    9.28 +		{
    9.29 +			QRectF r=lmo->getBBox();
    9.30 +			cout << "ME::scrollTo "<<ti->getHeadingStd()<<"  tL="<<r.topLeft()<<"  bR="<<r.bottomRight()<<endl;
    9.31 +			setScrollBarPosTarget (lmo->getBBox() );
    9.32 +		}	
    9.33  	}
    9.34  }
    9.35  
    9.36 @@ -457,6 +461,14 @@
    9.37  void MapEditor::testFunction1()
    9.38  {
    9.39  	cout << "ME::test1  selected TI="<<model->getSelectedItem()<<endl;
    9.40 +
    9.41 +	BranchObj *bo=model->getSelectedBranchObj();
    9.42 +	if (bo)
    9.43 +	{
    9.44 +		bo->moveBy (100,100);
    9.45 +		model->reposition();
    9.46 +	}
    9.47 +
    9.48  	/*
    9.49  	// Code copied from Qt sources
    9.50  	QRectF rect=model->getSelectedBranchObj()->getBBox();
    9.51 @@ -657,6 +669,7 @@
    9.52  			Vector v=polys[i].at(0)-orgpos[i];
    9.53  			orients.append (mapobjects[i]->getOrientation());
    9.54  			mapobjects[i]->moveBy(v.x(),v.y() );
    9.55 +			mapobjects[i]->setRelPos();
    9.56  		}	
    9.57  		model->reposition();	
    9.58  		orientationChanged=false;
    9.59 @@ -670,6 +683,8 @@
    9.60  		break;
    9.61  		//orientationChanged=false;
    9.62  	} // loop if orientation has changed
    9.63 +
    9.64 +	model->emitSelectionChanged();
    9.65  }
    9.66  
    9.67  BranchItem* MapEditor::getBranchDirectAbove (BranchItem *bi)
    9.68 @@ -1003,8 +1018,8 @@
    9.69  		if (!foname.isEmpty())
    9.70  		{
    9.71  			// systemFlag clicked
    9.72 -			model->select (lmo);	// FIXME-3 was selectInt
    9.73 -			if (foname=="url") 
    9.74 +			model->select (lmo);	
    9.75 +			if (foname=="system-url") 
    9.76  			{
    9.77  				if (e->state() & Qt::ControlModifier)
    9.78  					mainWindow->editOpenURLTab();
    9.79 @@ -1124,14 +1139,16 @@
    9.80      // Move the selected MapObj
    9.81      if ( lmosel && movingObj) 
    9.82      {	
    9.83 +		objectMoved=true;
    9.84  		// reset cursor if we are moving and don't copy
    9.85  		if (mainWindow->getModMode()!=Main::ModModeCopy)
    9.86  			setCursor (Qt::ArrowCursor);
    9.87  
    9.88  		// To avoid jumping of the sceneView, only 
    9.89  		// show selection, if not tmp linked
    9.90 -		if (!lmosel->hasParObjTmp())
    9.91 +		/* FIXME-2 if (!lmosel->hasParObjTmp())
    9.92  			model->emitShowSelection();
    9.93 +			*/
    9.94  		
    9.95  		// Now move the selection, but add relative position 
    9.96  		// (movingObj_start) where selection was chosen with 
    9.97 @@ -1183,9 +1200,8 @@
    9.98  			}
    9.99  		} else	
   9.100  		{	// selection != a FloatObj
   9.101 -			if (seli->depth()==0)		//FIXME-1 also moved mapcenters could be linked, but not working so far
   9.102 +			if (seli->depth()==0)		
   9.103  			{
   9.104 -				// Move MapCenter // FIXME-1 scrolls way too much with shift pressed
   9.105  				lmosel->move   (p-movingObj_start);		
   9.106  				if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier) 
   9.107  				{
   9.108 @@ -1373,7 +1389,7 @@
   9.109  			QString preSelStr=model->getSelectString(seli);
   9.110  
   9.111  			copyingObj=false;	
   9.112 -			if (dsti)
   9.113 +			if (dsti && objectMoved)
   9.114  			{
   9.115  				// We have a destination, relink to that
   9.116  
   9.117 @@ -1444,14 +1460,11 @@
   9.118  				if (settings.value("/animation/use",false).toBool() && seli->depth()>1) 
   9.119  				{
   9.120  					lmosel->setRelPos();	// calc relPos first for starting point
   9.121 -					QPointF dst=bi->getBranchObj()->getParObj()->getChildPos();		// FIXME-3 check getBO here...
   9.122 -			//		if (lmosel->getOrientation()==LinkableMapObj::LeftOfCenter) dst.setX (dst.x()+lmosel->width() );
   9.123  					
   9.124  					model->startAnimation(
   9.125  						(BranchObj*)lmosel,
   9.126  						lmosel->getRelPos(),
   9.127  						movingObj_orgRelPos
   9.128 -//						QPointF (movingObj_orgPos.x() - dst.x(), movingObj_orgPos.y() - dst.y() )
   9.129  					);	
   9.130  				} else	
   9.131  					model->reposition();
   9.132 @@ -1461,9 +1474,8 @@
   9.133  		// Finally resize scene, if needed
   9.134  		scene()->update();
   9.135  		movingObj=NULL;		
   9.136 +		objectMoved=false;
   9.137  
   9.138 -		// Just make sure, that actions are still ok,e.g. the move branch up/down buttons...
   9.139 -		// model->updateActions(); FIXME-3 neeeded? 
   9.140  	} else 
   9.141  		// maybe we moved View: set old cursor
   9.142  		setCursor (Qt::ArrowCursor);
   9.143 @@ -1472,6 +1484,9 @@
   9.144  
   9.145  void MapEditor::mouseDoubleClickEvent(QMouseEvent* e)
   9.146  {
   9.147 +	if (debug) cout << "ME p="<<mapToScene (e->pos())<<endl;
   9.148 +
   9.149 +
   9.150  	if (model->isSelectionBlocked() ) 
   9.151  	{
   9.152  		e->ignore();
   9.153 @@ -1648,12 +1663,12 @@
   9.154  						do_reposition=true;
   9.155  				}	
   9.156  			}
   9.157 -			scrollTo (ix);
   9.158  			if (ti->isBranchLikeType() || ti->getType()==TreeItem::Image)
   9.159  				// Show link if needed
   9.160  				((MapItem*)ti)->getLMO()->updateVisibility();
   9.161  		}
   9.162  	}
   9.163 +	// FIXME-3 cout << "ME::updateSel  doRepos="<<do_reposition<<endl;
   9.164  	if (do_reposition) model->reposition();
   9.165  
   9.166  	// Reduce rectangles
    10.1 --- a/mapeditor.h	Wed Sep 23 12:14:08 2009 +0000
    10.2 +++ b/mapeditor.h	Thu Oct 01 11:28:50 2009 +0000
    10.3 @@ -112,7 +112,8 @@
    10.4  	QCursor XLinkCursor;		// cursor while picking color 
    10.5  	bool pickingColor;
    10.6  	bool drawingLink;			// true while creating a link
    10.7 -	bool copyingObj;			// true while creating a link
    10.8 +	bool copyingObj;			// true while modModeCopy
    10.9 +	bool objectMoved;			// true if object was not clicked, but moved with mouse
   10.10  	XLinkItem* tmpXLink;
   10.11  
   10.12  	MapObj* movingObj;				// moving a MapObj
    11.1 --- a/ornamentedobj.cpp	Wed Sep 23 12:14:08 2009 +0000
    11.2 +++ b/ornamentedobj.cpp	Thu Oct 01 11:28:50 2009 +0000
    11.3 @@ -90,9 +90,14 @@
    11.4  {
    11.5  	frame->setFrameType(t);
    11.6  	if (t == FrameObj::NoFrame)
    11.7 +	{
    11.8  		linkpos=LinkableMapObj::Bottom;
    11.9 -	else	
   11.10 +		useBottomline=true;
   11.11 +	} else	
   11.12 +	{
   11.13  		linkpos=LinkableMapObj::Middle;
   11.14 +		useBottomline=false;
   11.15 +	}
   11.16  
   11.17  	calcBBoxSize();
   11.18  	positionBBox();
    12.1 --- a/version.h	Wed Sep 23 12:14:08 2009 +0000
    12.2 +++ b/version.h	Thu Oct 01 11:28:50 2009 +0000
    12.3 @@ -7,7 +7,7 @@
    12.4  #define __VYM_VERSION "1.13.0"
    12.5  //#define __VYM_CODENAME "Codename: RC-1"
    12.6  #define __VYM_CODENAME "Codename: development version, not for production!"
    12.7 -#define __VYM_BUILD_DATE "2009-09-23"
    12.8 +#define __VYM_BUILD_DATE "2009-10-01"
    12.9  
   12.10  
   12.11  bool checkVersion(const QString &);
    13.1 --- a/vymmodel.cpp	Wed Sep 23 12:14:08 2009 +0000
    13.2 +++ b/vymmodel.cpp	Thu Oct 01 11:28:50 2009 +0000
    13.3 @@ -1963,10 +1963,15 @@
    13.4  	BranchItem *selbi=getSelectedBranch();
    13.5  	if (selbi && selbi->depth()>0)
    13.6  	{
    13.7 +		// if no relPos have been set before, try to use current rel positions   
    13.8 +		if (selbi->getLMO())
    13.9 +			for (int i=0; i<selbi->branchCount();++i)
   13.10 +				selbi->getBranchNum(i)->getBranchObj()->setRelPos();
   13.11 +		
   13.12  		//QString oldsel=getSelectString();
   13.13  		if ( relinkBranch (selbi,rootItem,-1) )
   13.14  			saveState (
   13.15 -				selbi,QString("relink()"), //FIXME-1 add paramters
   13.16 +				selbi,QString("relink()"), //FIXME-1 add paramters when detaching
   13.17  				selbi,"detach ()",
   13.18  				QString("Detach %1").arg(getObjectName(selbi))
   13.19  			);
   13.20 @@ -2264,10 +2269,6 @@
   13.21  {
   13.22  	if (branch && dst)
   13.23  	{
   13.24 -		if (branch->depth()==0) 
   13.25 -		{
   13.26 -			cout <<"VM::relinkBranch  d=0 for "<<branch->getHeadingStd()<<endl;
   13.27 -		}
   13.28  		emit (layoutAboutToBeChanged() );
   13.29  		BranchItem *branchpi=(BranchItem*)branch->parent();
   13.30  		// Remove at current position
   13.31 @@ -2517,6 +2518,7 @@
   13.32  		if (bi->depth()==0) return false;
   13.33  		if (bi->toggleScroll())
   13.34  		{
   13.35 +			reposition();
   13.36  			QString u,r;
   13.37  			r="scroll";
   13.38  			u="unscroll";
   13.39 @@ -2546,21 +2548,21 @@
   13.40  		if (bi->toggleScroll())
   13.41  		{
   13.42  			reposition();
   13.43 -		QString u,r;
   13.44 -		u="scroll";
   13.45 -		r="unscroll";
   13.46 -		saveState(
   13.47 -			bi,
   13.48 -			QString ("%1 ()").arg(u),
   13.49 -			bi,
   13.50 -			QString ("%1 ()").arg(r),
   13.51 -			QString ("%1 %2").arg(r).arg(getObjectName(bi))
   13.52 -		);
   13.53 -		emitDataHasChanged(bi);
   13.54 -		emitSelectionChanged();
   13.55 +			QString u,r;
   13.56 +			u="scroll";
   13.57 +			r="unscroll";
   13.58 +			saveState(
   13.59 +				bi,
   13.60 +				QString ("%1 ()").arg(u),
   13.61 +				bi,
   13.62 +				QString ("%1 ()").arg(r),
   13.63 +				QString ("%1 %2").arg(r).arg(getObjectName(bi))
   13.64 +			);
   13.65 +			emitDataHasChanged(bi);
   13.66 +			emitSelectionChanged();
   13.67  			mapScene->update(); //Needed for _quick_ update,  even in 1.13.x 
   13.68 -		return true;
   13.69 -	}	
   13.70 +			return true;
   13.71 +		}	
   13.72  	}	
   13.73  	return false;
   13.74  }
   13.75 @@ -2657,6 +2659,7 @@
   13.76  
   13.77  void VymModel::colorBranch (QColor c)	
   13.78  {
   13.79 +cout << "VM::colBranch\n";
   13.80  	BranchItem *selbi=getSelectedBranch();
   13.81  	if (selbi)
   13.82  	{
   13.83 @@ -4225,6 +4228,7 @@
   13.84  }
   13.85  
   13.86  void VymModel::selectMapBackgroundImage ()	// FIXME-2 move to ME
   13.87 +// FIXME-4 for using background image: view.setCacheMode(QGraphicsView::CacheBackground);
   13.88  {
   13.89  	Q3FileDialog *fd=new Q3FileDialog( NULL);
   13.90  	fd->setMode (Q3FileDialog::ExistingFile);
   13.91 @@ -4400,6 +4404,7 @@
   13.92  
   13.93  void VymModel::startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest)
   13.94  {
   13.95 +	if (start==dest) return;
   13.96  	if (bo && bo->getTreeItem()->depth()>0) 
   13.97  	{
   13.98  		AnimPoint ap;
   13.99 @@ -4590,7 +4595,7 @@
  13.100  void VymModel::emitSelectionChanged(const QItemSelection &newsel)
  13.101  {
  13.102  	emit (selectionChanged(newsel,newsel));	// needed e.g. to update geometry in editor
  13.103 -	emitShowSelection();
  13.104 +	//FIXME-3 emitShowSelection();
  13.105  	sendSelection();
  13.106  }
  13.107  
    14.1 --- a/vymview.cpp	Wed Sep 23 12:14:08 2009 +0000
    14.2 +++ b/vymview.cpp	Thu Oct 01 11:28:50 2009 +0000
    14.3 @@ -118,7 +118,7 @@
    14.4  	mainWindow->changeSelection (model,newsel,oldsel);	// FIXME-5 maybe connect VymModel <-> MainWindow directly?
    14.5  	// would require to also get current model in mainWindow
    14.6  
    14.7 -	//showSelection();
    14.8 +	//showSelection();	// if called here, no tmpParObj can be set...
    14.9  }
   14.10  
   14.11  void VymView::expandAll()