vymmodel.cpp
changeset 798 d251c7b2de54
parent 796 cf634bbf9e04
child 800 959bd133cd1a
     1.1 --- a/vymmodel.cpp	Wed Sep 23 12:14:08 2009 +0000
     1.2 +++ b/vymmodel.cpp	Thu Oct 01 11:28:50 2009 +0000
     1.3 @@ -1963,10 +1963,15 @@
     1.4  	BranchItem *selbi=getSelectedBranch();
     1.5  	if (selbi && selbi->depth()>0)
     1.6  	{
     1.7 +		// if no relPos have been set before, try to use current rel positions   
     1.8 +		if (selbi->getLMO())
     1.9 +			for (int i=0; i<selbi->branchCount();++i)
    1.10 +				selbi->getBranchNum(i)->getBranchObj()->setRelPos();
    1.11 +		
    1.12  		//QString oldsel=getSelectString();
    1.13  		if ( relinkBranch (selbi,rootItem,-1) )
    1.14  			saveState (
    1.15 -				selbi,QString("relink()"), //FIXME-1 add paramters
    1.16 +				selbi,QString("relink()"), //FIXME-1 add paramters when detaching
    1.17  				selbi,"detach ()",
    1.18  				QString("Detach %1").arg(getObjectName(selbi))
    1.19  			);
    1.20 @@ -2264,10 +2269,6 @@
    1.21  {
    1.22  	if (branch && dst)
    1.23  	{
    1.24 -		if (branch->depth()==0) 
    1.25 -		{
    1.26 -			cout <<"VM::relinkBranch  d=0 for "<<branch->getHeadingStd()<<endl;
    1.27 -		}
    1.28  		emit (layoutAboutToBeChanged() );
    1.29  		BranchItem *branchpi=(BranchItem*)branch->parent();
    1.30  		// Remove at current position
    1.31 @@ -2517,6 +2518,7 @@
    1.32  		if (bi->depth()==0) return false;
    1.33  		if (bi->toggleScroll())
    1.34  		{
    1.35 +			reposition();
    1.36  			QString u,r;
    1.37  			r="scroll";
    1.38  			u="unscroll";
    1.39 @@ -2546,21 +2548,21 @@
    1.40  		if (bi->toggleScroll())
    1.41  		{
    1.42  			reposition();
    1.43 -		QString u,r;
    1.44 -		u="scroll";
    1.45 -		r="unscroll";
    1.46 -		saveState(
    1.47 -			bi,
    1.48 -			QString ("%1 ()").arg(u),
    1.49 -			bi,
    1.50 -			QString ("%1 ()").arg(r),
    1.51 -			QString ("%1 %2").arg(r).arg(getObjectName(bi))
    1.52 -		);
    1.53 -		emitDataHasChanged(bi);
    1.54 -		emitSelectionChanged();
    1.55 +			QString u,r;
    1.56 +			u="scroll";
    1.57 +			r="unscroll";
    1.58 +			saveState(
    1.59 +				bi,
    1.60 +				QString ("%1 ()").arg(u),
    1.61 +				bi,
    1.62 +				QString ("%1 ()").arg(r),
    1.63 +				QString ("%1 %2").arg(r).arg(getObjectName(bi))
    1.64 +			);
    1.65 +			emitDataHasChanged(bi);
    1.66 +			emitSelectionChanged();
    1.67  			mapScene->update(); //Needed for _quick_ update,  even in 1.13.x 
    1.68 -		return true;
    1.69 -	}	
    1.70 +			return true;
    1.71 +		}	
    1.72  	}	
    1.73  	return false;
    1.74  }
    1.75 @@ -2657,6 +2659,7 @@
    1.76  
    1.77  void VymModel::colorBranch (QColor c)	
    1.78  {
    1.79 +cout << "VM::colBranch\n";
    1.80  	BranchItem *selbi=getSelectedBranch();
    1.81  	if (selbi)
    1.82  	{
    1.83 @@ -4225,6 +4228,7 @@
    1.84  }
    1.85  
    1.86  void VymModel::selectMapBackgroundImage ()	// FIXME-2 move to ME
    1.87 +// FIXME-4 for using background image: view.setCacheMode(QGraphicsView::CacheBackground);
    1.88  {
    1.89  	Q3FileDialog *fd=new Q3FileDialog( NULL);
    1.90  	fd->setMode (Q3FileDialog::ExistingFile);
    1.91 @@ -4400,6 +4404,7 @@
    1.92  
    1.93  void VymModel::startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest)
    1.94  {
    1.95 +	if (start==dest) return;
    1.96  	if (bo && bo->getTreeItem()->depth()>0) 
    1.97  	{
    1.98  		AnimPoint ap;
    1.99 @@ -4590,7 +4595,7 @@
   1.100  void VymModel::emitSelectionChanged(const QItemSelection &newsel)
   1.101  {
   1.102  	emit (selectionChanged(newsel,newsel));	// needed e.g. to update geometry in editor
   1.103 -	emitShowSelection();
   1.104 +	//FIXME-3 emitShowSelection();
   1.105  	sendSelection();
   1.106  }
   1.107