branchobj.cpp
changeset 382 8b0ab4c0f767
parent 377 5391ab620c95
child 390 0e1aeb21cb78
     1.1 --- a/branchobj.cpp	Fri Sep 08 12:30:09 2006 +0000
     1.2 +++ b/branchobj.cpp	Thu Sep 14 11:38:17 2006 +0000
     1.3 @@ -664,6 +664,7 @@
     1.4  
     1.5  void BranchObj::setDockPos()
     1.6  {
     1.7 +	// Sets childpos and parpos depending on orientation
     1.8  	if (getOrientation()==OrientLeftOfCenter )
     1.9      {
    1.10  		childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
    1.11 @@ -674,6 +675,7 @@
    1.12  		parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
    1.13      }
    1.14  }
    1.15 +
    1.16  LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
    1.17  {
    1.18  	// Search branches
    1.19 @@ -1242,30 +1244,42 @@
    1.20  	int th = bboxTotal.height();	
    1.21  // TODO testing
    1.22  /*
    1.23 -	cout << "BO::alignRelTo "<<getHeading()<<endl;
    1.24 +	cout << "BO::alignRelTo "<<getHeading().ascii()<<endl;
    1.25  	cout << "  d="<<depth<<
    1.26  		"  ref="<<ref<<
    1.27  //		"  bbox.topLeft="<<bboxTotal.topLeft()<<
    1.28  		"  absPos="<<absPos<<
    1.29 +		"  relPos="<<relPos<<
    1.30 +		"  orient="<<orientation<<
    1.31  //		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
    1.32 -		"  hidden="<<hidden<<
    1.33 -		"  th="<<th<<endl;
    1.34 +//		"  hidden="<<hidden<<
    1.35 +//		"  th="<<th<<
    1.36 +		endl;
    1.37  */
    1.38  
    1.39 -	// If I am the mapcenter or a mainbranch, reposition heading
    1.40 +	setOrientation();
    1.41 +	//updateLink();
    1.42 +
    1.43  	if (depth<2)
    1.44  	{
    1.45  		if (depth==1)
    1.46 +		{
    1.47 +			// Position relatively, if needed
    1.48 +			//if (useRelPos) move2RelPos (relPos.x(), relPos.y());
    1.49 +
    1.50  			// Calc angle to mapCenter if I am a mainbranch
    1.51  			// needed for reordering the mainbranches clockwise 
    1.52  			// around mapcenter 
    1.53  			angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ), 
    1.54  									(int)(y() - parObj->getChildPos().y() ) ) );
    1.55 +		}							
    1.56  	} 
    1.57  	else
    1.58      {
    1.59  		// Align myself depending on orientation and parent, but
    1.60 -		// only if I am not the mainbranch or mapcenter itself
    1.61 +		// only if I am not a mainbranch or mapcenter itself
    1.62 +		LinkOrient o;
    1.63 +		o=parObj->getOrientation();
    1.64  		switch (orientation) 
    1.65  		{
    1.66  			case OrientLeftOfCenter:
    1.67 @@ -1311,10 +1325,13 @@
    1.68  {	
    1.69  /* TODO testing only
    1.70  	if (!getHeading().isEmpty())
    1.71 -		cout << "BO::reposition  "<<getHeading()<<endl;
    1.72 +		cout << "BO::reposition  "<<getHeading().ascii()<<endl;
    1.73  	else	
    1.74  		cout << "BO::reposition  ???"<<endl;
    1.75 +
    1.76 +	cout << "  orient="<<orientation<<endl;
    1.77  */		
    1.78 +
    1.79  	if (depth==0)
    1.80  	{
    1.81  		// only calculate the sizes once. If the deepest LMO 
    1.82 @@ -1323,6 +1340,7 @@
    1.83  		calcBBoxSizeWithChilds();
    1.84  		updateLink();	// This update is needed if the canvas is resized 
    1.85  						// due to excessive moving of a FIO
    1.86 +						// FIXME really needed? reposition is also called from updateLink...
    1.87  
    1.88  	    alignRelativeTo ( QPoint (absPos.x(),
    1.89  			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
    1.90 @@ -1337,6 +1355,16 @@
    1.91  	}
    1.92  }
    1.93  
    1.94 +void BranchObj::unsetAllRepositionRequests()
    1.95 +{
    1.96 +	repositionRequest=false;
    1.97 +	BranchObj *b;
    1.98 +	for (b=branch.first(); b; b=branch.next() ) 
    1.99 +	{
   1.100 +		b->unsetAllRepositionRequests();
   1.101 +	}	
   1.102 +}
   1.103 +
   1.104  
   1.105  QRect BranchObj::getTotalBBox()
   1.106  {