branchobj.cpp
changeset 142 3590c3490789
parent 129 9b9c7e8b9147
child 146 1b52ff19aad5
     1.1 --- a/branchobj.cpp	Tue Jul 19 14:44:30 2005 +0000
     1.2 +++ b/branchobj.cpp	Sun Jul 31 12:24:53 2005 +0000
     1.3 @@ -661,17 +661,22 @@
     1.4      return NULL;
     1.5  }
     1.6  
     1.7 +int BranchObj::getDefHeadingSize()
     1.8 +{
     1.9 +	if (depth==0)
    1.10 +		return 16;
    1.11 +	else	
    1.12 +		if (depth==1) 
    1.13 +			return 12;
    1.14 +		else
    1.15 +			return 10;
    1.16 +}
    1.17 +
    1.18  void BranchObj::setHeading(QString s)
    1.19  {
    1.20      // Adjusting font size
    1.21      QFont font=heading->getFont();
    1.22 -	if (depth==0)
    1.23 -		font.setPointSize(16);
    1.24 -	else	
    1.25 -		if (depth>1) 
    1.26 -			font.setPointSize(10);
    1.27 -		else
    1.28 -			font.setPointSize(12);
    1.29 +	font.setPointSize(getDefHeadingSize() );
    1.30      heading->setFont(font);
    1.31      heading->setText(s);	// set new heading
    1.32  	calcBBoxSize();			// recalculate bbox
    1.33 @@ -995,9 +1000,10 @@
    1.34  	// inserts its childs at the place of bo
    1.35  	BranchObj *bo;
    1.36  	bo=borem->getLastBranch();
    1.37 +	int pos=borem->getNum();
    1.38  	while (bo)
    1.39  	{
    1.40 -		bo->moveBranchTo (borem,1);
    1.41 +		bo->moveBranchTo (this,pos+1);
    1.42  		bo=borem->getLastBranch();
    1.43  	}	
    1.44  	removeBranch (borem);
    1.45 @@ -1107,10 +1113,13 @@
    1.46  	} else
    1.47  	{
    1.48  		// inserts me at pos in parent of dst
    1.49 -		par=(BranchObj*)(dst->getParObj());
    1.50  		if (par)
    1.51 -			return par->insertBranchPtr (this,pos);
    1.52 -		else
    1.53 +		{
    1.54 +			BranchObj *bo=dst->insertBranchPtr (this,pos);
    1.55 +			bo->setHeading (bo->getHeading());
    1.56 +			return bo;
    1.57 +
    1.58 +		} else
    1.59  			return NULL;
    1.60  	}	
    1.61  }