branchobj.cpp
changeset 288 24a51ea91118
parent 239 bdeb503d2b7f
child 301 4258723b534c
     1.1 --- a/branchobj.cpp	Tue Mar 14 14:27:04 2006 +0000
     1.2 +++ b/branchobj.cpp	Mon Apr 10 11:21:35 2006 +0000
     1.3 @@ -359,6 +359,7 @@
     1.4  		standardFlags->setVisibility(v);
     1.5  		LinkableMapObj::setVisibility (v);
     1.6  		
     1.7 +		// Only change childs, if I am not scrolled
     1.8  		if (!scrolled && (depth < toDepth))
     1.9  		{
    1.10  			// Now go recursivly through all childs
    1.11 @@ -696,8 +697,41 @@
    1.12  	requestReposition();
    1.13  }
    1.14  
    1.15 +void BranchObj::setHideTmp (HideTmpMode mode)
    1.16 +{
    1.17 +	if (mode==HideExport && hasHiddenExportParent(this))
    1.18 +	{
    1.19 +		setVisibility (false);
    1.20 +		hidden=true;
    1.21 +	}else
    1.22 +	{
    1.23 +		setVisibility (true);
    1.24 +		hidden=false;
    1.25 +	}	
    1.26 +
    1.27 +    BranchObj *bo;
    1.28 +    for (bo=branch.first(); bo; bo=branch.next() )
    1.29 +		bo->setHideTmp (mode);
    1.30 +}
    1.31 +
    1.32 +bool BranchObj::hasHiddenExportParent(BranchObj *start)
    1.33 +{
    1.34 +	// Calls parents recursivly to
    1.35 +	// find out, if we are temp. hidden
    1.36 +
    1.37 +	if (hideExport) return true;
    1.38 +
    1.39 +	BranchObj* bo=(BranchObj*)(parObj);
    1.40 +	if (bo) 
    1.41 +		return bo->hasHiddenExportParent(start);
    1.42 +	else
    1.43 +		return false;
    1.44 +}
    1.45 +
    1.46  QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
    1.47  {
    1.48 +	if (hidden) return "";
    1.49 +
    1.50      QString s,a;
    1.51  	QString scrolledAttr;
    1.52  	if (scrolled) 
    1.53 @@ -1163,9 +1197,10 @@
    1.54  	cout << "BO::alignRelTo "<<getHeading()<<endl;
    1.55  	cout << "  d="<<depth<<
    1.56  		"  ref="<<ref<<
    1.57 -		"  bbTot="<<bboxTotal.topLeft()<<
    1.58 +//		"  bbox.topLeft="<<bboxTotal.topLeft()<<
    1.59  		"  absPos="<<absPos<<
    1.60 -		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
    1.61 +//		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
    1.62 +		"  hidden="<<hidden<<
    1.63  		"  th="<<th<<endl;
    1.64  */
    1.65  
    1.66 @@ -1218,8 +1253,11 @@
    1.67      BranchObj *b;
    1.68      for (b=branch.first(); b; b=branch.next() )
    1.69      {	
    1.70 -		b->alignRelativeTo (ref2);
    1.71 -		ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
    1.72 +		if (!b->isHidden())
    1.73 +		{
    1.74 +			b->alignRelativeTo (ref2);
    1.75 +			ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
    1.76 +		}
    1.77      }
    1.78  }
    1.79  
    1.80 @@ -1265,11 +1303,13 @@
    1.81  
    1.82  	BranchObj* b;
    1.83  	for (b=branch.first();b ;b=branch.next() )
    1.84 -		r=addBBox(b->getTotalBBox(),r);
    1.85 +		if (!b->isHidden())
    1.86 +			r=addBBox(b->getTotalBBox(),r);
    1.87  
    1.88  	FloatImageObj* fio;
    1.89  	for (fio=floatimage.first();fio ;fio=floatimage.next() )
    1.90 -		r=addBBox(fio->getTotalBBox(),r);
    1.91 +		if (!fio->isHidden())
    1.92 +			r=addBBox(fio->getTotalBBox(),r);
    1.93  		
    1.94  	return r;
    1.95  }
    1.96 @@ -1299,6 +1339,22 @@
    1.97  		return;
    1.98  	}
    1.99  	
   1.100 +	if (hidden)
   1.101 +	{
   1.102 +		bboxTotal.setWidth (0);
   1.103 +		bboxTotal.setHeight(0);
   1.104 +		if (parObj)
   1.105 +		{
   1.106 +			bboxTotal.setX (parObj->x());
   1.107 +			bboxTotal.setY (parObj->y());
   1.108 +		} else
   1.109 +		{
   1.110 +			bboxTotal.setX (bbox.x());
   1.111 +			bboxTotal.setY (bbox.y());
   1.112 +		}
   1.113 +		return;
   1.114 +	}
   1.115 +	
   1.116  	QRect r(0,0,0,0);
   1.117  	QRect br;
   1.118  	// Now calculate recursivly
   1.119 @@ -1308,11 +1364,14 @@
   1.120  	BranchObj* b;
   1.121  	for (b=branch.first();b ;b=branch.next() )
   1.122  	{
   1.123 -		b->calcBBoxSizeWithChilds();
   1.124 -		br=b->getBBoxSizeWithChilds();
   1.125 -		r.setWidth( max (br.width(), r.width() ));
   1.126 -		r.setHeight(br.height() + r.height() );
   1.127 -		if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
   1.128 +		if (!b->isHidden())
   1.129 +		{
   1.130 +			b->calcBBoxSizeWithChilds();
   1.131 +			br=b->getBBoxSizeWithChilds();
   1.132 +			r.setWidth( max (br.width(), r.width() ));
   1.133 +			r.setHeight(br.height() + r.height() );
   1.134 +			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
   1.135 +		}
   1.136  	}
   1.137  	// Add myself and also
   1.138  	// add width of link to sum if necessary
   1.139 @@ -1322,8 +1381,6 @@
   1.140  		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
   1.141  	
   1.142  	bboxTotal.setHeight(max (r.height(),  bbox.height()));
   1.143 -//	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
   1.144 -
   1.145  }
   1.146  
   1.147  void BranchObj::select()
   1.148 @@ -1355,12 +1412,6 @@
   1.149  	// Update Toolbar
   1.150  	standardFlags->updateToolbar();
   1.151  
   1.152 -	// Update Browserbutton
   1.153 -	if (!url.isEmpty())
   1.154 -		actionEditOpenURL->setEnabled (true);
   1.155 -	else	
   1.156 -		actionEditOpenURL->setEnabled (false);
   1.157 -
   1.158  	// Update actions in mapeditor
   1.159  	mapEditor->updateActions();
   1.160  }