branchitem.cpp
changeset 787 c6bb4fdcc55f
parent 786 6269016c9905
child 788 78ba80b54bc4
     1.1 --- a/branchitem.cpp	Thu Aug 06 10:42:17 2009 +0000
     1.2 +++ b/branchitem.cpp	Sat Aug 08 21:58:26 2009 +0000
     1.3 @@ -17,6 +17,9 @@
     1.4  
     1.5  	includeImagesVer=false;
     1.6  	includeImagesHor=false;
     1.7 +	 
     1.8 +	lastSelectedBranchNum=-1;
     1.9 +	lastSelectedBranchNumAlt=-1;
    1.10  }
    1.11  
    1.12  BranchItem::~BranchItem()
    1.13 @@ -299,6 +302,41 @@
    1.14  	return a;	
    1.15  }
    1.16  
    1.17 +void BranchItem::setLastSelectedBranch()
    1.18 +{
    1.19 +	int d=depth();
    1.20 +	if (d>=0)
    1.21 +	{
    1.22 +		if (d==1)
    1.23 +			// Hack to save an additional lastSelected for mapcenters in MapEditor
    1.24 +			// depending on orientation
    1.25 +			// this allows to go both left and right from there
    1.26 +			if (lmo && lmo->getOrientation()==LinkableMapObj::LeftOfCenter)
    1.27 +			{
    1.28 +				((BranchItem*)parentItem)->lastSelectedBranchNumAlt=parentItem->num(this);
    1.29 +				return;
    1.30 +			}
    1.31 +		((BranchItem*)parentItem)->lastSelectedBranchNum=parentItem->num(this);
    1.32 +	}
    1.33 +}
    1.34 +
    1.35 +void BranchItem::setLastSelectedBranch(int i)
    1.36 +{
    1.37 +		lastSelectedBranchNum=i;
    1.38 +}
    1.39 +
    1.40 +BranchItem* BranchItem::getLastSelectedBranch()
    1.41 +{
    1.42 +	return getBranchNum (lastSelectedBranchNum);
    1.43 +}
    1.44 +
    1.45 +BranchItem* BranchItem::getLastSelectedBranchAlt()
    1.46 +{
    1.47 +	return getBranchNum (lastSelectedBranchNumAlt);
    1.48 +}
    1.49 +
    1.50 +
    1.51 +
    1.52  
    1.53  
    1.54  TreeItem* BranchItem::findMapItem (QPointF p, TreeItem* excludeTI)