vymmodel.cpp
changeset 740 6dc0a20031f7
parent 739 3d43b46a8564
child 741 1b4d1ea6ea8c
     1.1 --- a/vymmodel.cpp	Wed Feb 04 11:52:52 2009 +0000
     1.2 +++ b/vymmodel.cpp	Wed Feb 04 16:33:16 2009 +0000
     1.3 @@ -703,7 +703,7 @@
     1.4  		return fio;
     1.5  	}
     1.6  	return NULL;
     1.7 -	}	
     1.8 +}	
     1.9  
    1.10  void VymModel::loadFloatImage ()
    1.11  {
    1.12 @@ -1353,36 +1353,6 @@
    1.13  	return mapScene;
    1.14  }
    1.15  
    1.16 -BranchObj* VymModel::first()
    1.17 -{
    1.18 -	if (mapCenters.count()>0) 
    1.19 -		return mapCenters.first();
    1.20 -	else	
    1.21 -		return NULL;
    1.22 -}
    1.23 -	
    1.24 -BranchObj* VymModel::next(BranchObj *bo_start)
    1.25 -{
    1.26 -	BranchObj *rbo;
    1.27 -	BranchObj *bo=bo_start;
    1.28 -	if (bo)
    1.29 -	{
    1.30 -		// Try to find next branch in current MapCenter
    1.31 -		rbo=bo->next();
    1.32 -		if (rbo) return rbo;
    1.33 -
    1.34 -		// Try to find MapCenter of bo
    1.35 -		while (bo->getDepth()>0) bo=(BranchObj*)bo->getParObj();
    1.36 -
    1.37 -		// Try to find next MapCenter
    1.38 -		int i=mapCenters.indexOf ((MapCenterObj*)bo);
    1.39 -		if (i+2 > mapCenters.count() || i<0) return NULL;
    1.40 -		if (mapCenters.at(i+1)!=bo_start)
    1.41 -			return mapCenters.at(i+1);
    1.42 -	} 
    1.43 -	return NULL;
    1.44 -}
    1.45 -
    1.46  LinkableMapObj* VymModel::findMapObj(QPointF p, LinkableMapObj *excludeLMO)
    1.47  {
    1.48  	LinkableMapObj *lmo;
    1.49 @@ -1520,8 +1490,9 @@
    1.50  	}
    1.51  }
    1.52  
    1.53 -BranchObj* VymModel::findText (QString s, bool cs)
    1.54 +BranchObj* VymModel::findText (QString s, bool cs)   // FIXME needs to converted to first() next() next (ti)
    1.55  {
    1.56 +	/*
    1.57  	QTextDocument::FindFlags flags=0;
    1.58  	if (cs) flags=QTextDocument::FindCaseSensitively;
    1.59  
    1.60 @@ -1571,6 +1542,7 @@
    1.61  		return getSelectedBranch();
    1.62  	else
    1.63  		return NULL;
    1.64 +		*/
    1.65  }
    1.66  
    1.67  void VymModel::findReset()
    1.68 @@ -3925,13 +3897,13 @@
    1.69  	else
    1.70  		linkstyle=LinkableMapObj::UndefinedStyle;
    1.71  
    1.72 +	TreeItem *ti=first();
    1.73  	BranchObj *bo;
    1.74 -	bo=first();
    1.75 -	bo=next(bo);
    1.76 -	while (bo) 
    1.77 +	while (ti) 
    1.78  	{
    1.79 +		bo=(BranchObj*)(ti->getLMO() );
    1.80  		bo->setLinkStyle(bo->getDefLinkStyle());
    1.81 -		bo=next(bo);
    1.82 +		ti=next();
    1.83  	}
    1.84  	reposition();
    1.85  }
    1.86 @@ -3951,12 +3923,14 @@
    1.87  	);
    1.88  
    1.89  	defLinkColor=col;
    1.90 +	TreeItem *ti;
    1.91  	BranchObj *bo;
    1.92 -	bo=first();
    1.93 -	while (bo) 
    1.94 +	ti=first();
    1.95 +	while (ti) 
    1.96  	{
    1.97 +		bo=(BranchObj*)(ti->getLMO() );
    1.98  		bo->setLinkColor();
    1.99 -		bo=next(bo);
   1.100 +		ti=next();
   1.101  	}
   1.102  	updateActions();
   1.103  }
   1.104 @@ -3964,12 +3938,14 @@
   1.105  void VymModel::setMapLinkColorHintInt()
   1.106  {
   1.107  	// called from setMapLinkColorHint(lch) or at end of parse
   1.108 +	TreeItem *ti;
   1.109  	BranchObj *bo;
   1.110 -	bo=first();
   1.111 -	while (bo) 
   1.112 +	ti=first();
   1.113 +	while (ti) 
   1.114  	{
   1.115 +		bo=(BranchObj*)(ti->getLMO() );
   1.116  		bo->setLinkColor();
   1.117 -		bo=next(bo);
   1.118 +		ti=next();
   1.119  	}
   1.120  }
   1.121  
   1.122 @@ -3985,12 +3961,14 @@
   1.123  		linkcolorhint=LinkableMapObj::DefaultColor;
   1.124  	else	
   1.125  		linkcolorhint=LinkableMapObj::HeadingColor;
   1.126 +	TreeItem *ti;
   1.127  	BranchObj *bo;
   1.128 -	bo=first();
   1.129 +	ti=first();
   1.130  	while (bo) 
   1.131  	{
   1.132 +		bo=(BranchObj*)(ti->getLMO() );
   1.133  		bo->setLinkColor();
   1.134 -		bo=next(bo);
   1.135 +		ti=next();
   1.136  	}
   1.137  }
   1.138