branchitem.cpp
changeset 795 6b0a5f4923d3
parent 791 f1006de05c54
child 796 cf634bbf9e04
     1.1 --- a/branchitem.cpp	Fri Sep 11 12:56:15 2009 +0000
     1.2 +++ b/branchitem.cpp	Thu Sep 17 09:41:09 2009 +0000
     1.3 @@ -45,6 +45,11 @@
     1.4  	tmpUnscrolled=other->tmpUnscrolled;
     1.5  }
     1.6  
     1.7 +BranchItem* BranchItem::parentBranch ()
     1.8 +{
     1.9 +	return (BranchItem*) parentItem;
    1.10 +}
    1.11 +
    1.12  void BranchItem::insertBranch (int pos, BranchItem *branch)
    1.13  {
    1.14  	if (pos<0) pos=0;
    1.15 @@ -216,7 +221,7 @@
    1.16  			}
    1.17  		}
    1.18  	}
    1.19 -	model->reposition();	// FIXME-3 we don't really want to update view from here...
    1.20 +	//model->reposition();	// FIXME-3 we don't really want to update view from here...
    1.21  	return true;
    1.22  }
    1.23  
    1.24 @@ -273,10 +278,30 @@
    1.25  	}	
    1.26  }
    1.27  
    1.28 +void BranchItem::sortChildren()
    1.29 +{
    1.30 +	int childCount=branchCounter; 
    1.31 +	int curChildIndex;
    1.32 +	bool madeChanges=false;
    1.33 +	do
    1.34 +	{
    1.35 +		madeChanges=false;
    1.36 +		for(curChildIndex=1;curChildIndex<childCount;curChildIndex++){
    1.37 +			BranchItem* curChild =getBranchNum(curChildIndex);
    1.38 +			BranchItem* prevChild=getBranchNum(curChildIndex-1);
    1.39 +			if(prevChild->getHeading().compare(curChild->getHeading())>0)
    1.40 +			{
    1.41 +				model->moveUp(curChild);
    1.42 +				madeChanges=true;
    1.43 +			}
    1.44 +		}
    1.45 +	}while(madeChanges);
    1.46 +}
    1.47 +
    1.48  void BranchItem::setIncludeImagesVer(bool b)
    1.49  {
    1.50  	includeImagesVer=b;
    1.51 -	/* calcBBoxSize(); FIXME-2
    1.52 +	/* calcBBoxSize(); FIXME-3
    1.53  	positionBBox();
    1.54  	requestReposition();
    1.55  	*/
    1.56 @@ -290,7 +315,7 @@
    1.57  void BranchItem::setIncludeImagesHor(bool b)
    1.58  {
    1.59  	includeImagesHor=b;
    1.60 -	/* calcBBoxSize(); FIXME-2
    1.61 +	/* calcBBoxSize(); FIXME-3
    1.62  	positionBBox();
    1.63  	requestReposition();
    1.64  	*/
    1.65 @@ -377,7 +402,7 @@
    1.66  	}
    1.67  	return NULL;
    1.68  }
    1.69 -
    1.70 +/*
    1.71  TreeItem* BranchItem::findID (QString sid)	//FIXME-3 move to TreeItem	//FIXME-4 search images
    1.72  {
    1.73  	// Search branches
    1.74 @@ -392,7 +417,6 @@
    1.75  	if (sid==objID) return this;
    1.76  
    1.77  
    1.78 -/*
    1.79  	// Search float images 
    1.80      for (int i=0; i<floatimage.size(); ++i )
    1.81  		if (floatimage.at(i)->inBox(p) && 
    1.82 @@ -400,10 +424,9 @@
    1.83  			floatimage.at(i)->getParObj()!= excludeLMO &&
    1.84  			floatimage.at(i)->isVisibleObj() 
    1.85  		) return floatimage.at(i);
    1.86 -*/
    1.87      return NULL;
    1.88  }
    1.89 -
    1.90 +*/
    1.91  void BranchItem::updateStyles()
    1.92  {
    1.93  	// FIXME-5 compare also MapItem::initLMO...