branchobj.cpp
author insilmaril
Tue, 06 Jun 2006 14:58:11 +0000
branchqt4-port
changeset 2 608f976aa7bb
parent 0 7a96bd401351
child 7 84f76a3876d7
permissions -rw-r--r--
First compilation on QT4
     1 #include "branchobj.h"
     2 #include "texteditor.h"
     3 #include "mapeditor.h"
     4 #include "mainwindow.h"
     5 
     6 extern TextEditor *textEditor;
     7 extern Main *mainWindow;
     8 extern FlagRowObj *standardFlagsDefault;
     9 extern QAction *actionEditOpenURL;
    10 
    11 
    12 /////////////////////////////////////////////////////////////////
    13 // BranchObj
    14 /////////////////////////////////////////////////////////////////
    15 
    16 BranchObj* BranchObj::itLast=NULL;
    17 
    18 
    19 BranchObj::BranchObj () :OrnamentedObj()
    20 {
    21 //    cout << "Const BranchObj ()\n";
    22     setParObj (this);	
    23     init();
    24     depth=-1;
    25 }
    26 
    27 BranchObj::BranchObj (Q3Canvas* c):OrnamentedObj (c)
    28 {
    29 //    cout << "Const BranchObj (c)  called from MapCenterObj (c)\n";
    30 	parObj=NULL;
    31     canvas=c;
    32 }
    33 
    34 BranchObj::BranchObj (Q3Canvas* c, LinkableMapObj* p):OrnamentedObj (c)
    35 {
    36 //    cout << "Const BranchObj (c,p)\n";
    37     canvas=c;
    38     setParObj (p);	
    39     depth=p->getDepth()+1;
    40 	if (depth==1)
    41 		// Calc angle to mapCenter if I am a mainbranch
    42 		// needed for reordering the mainbranches clockwise 
    43 		// around mapcenter 
    44 		angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ), 
    45 								(int)(y() - parObj->getChildPos().y() ) ) );
    46     init();
    47 }
    48 
    49 BranchObj::~BranchObj ()
    50 {
    51 //	cout << "Destr BranchObj of "<<this<<endl;
    52 	// Check, if this branch was the last child to be deleted
    53 	// If so, unset the scrolled flags
    54 
    55 	BranchObj *po=(BranchObj*)(parObj);
    56 	BranchObj *bo;
    57 	if (po)
    58 	{
    59 		bo=((BranchObj*)(parObj))->getLastBranch();
    60 		if (!bo) po->unScroll();
    61 	}
    62 	clear();
    63 }
    64 
    65 bool BranchObj::operator< ( const BranchObj & other )
    66 {
    67     return  angle < other.angle;
    68 }
    69 
    70 bool BranchObj::operator== ( const BranchObj & other )
    71 {
    72     return angle == other.angle;
    73 }
    74 
    75 int BranchObjPtrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j)
    76 {
    77 	// Make sure PtrList::find works
    78 	if (i==j) return 0;
    79 
    80 	if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle )
    81 		return 1;
    82 	else
    83 		return -1;
    84 }
    85 
    86 void BranchObj::init () 
    87 {
    88     branch.setAutoDelete (false);
    89     floatimage.setAutoDelete (true);
    90     xlink.setAutoDelete (false);
    91 
    92 	if (parObj)
    93 	{
    94 		absPos=getRandPos();
    95 		absPos+=parObj->getChildPos();
    96 	}
    97 
    98     lastSelectedBranch=-1;
    99 
   100     setChildObj(this);
   101 
   102 	scrolled=false;
   103 	tmpUnscrolled=false;
   104 
   105 	includeImagesVer=false;
   106 	includeImagesHor=false;
   107 }
   108 
   109 void BranchObj::copy (BranchObj* other)
   110 {
   111     OrnamentedObj::copy(other);
   112 
   113 	branch.clear();
   114     BranchObj* b;
   115     for (b=other->branch.first(); b;b=other->branch.next() ) 
   116 		// Make deep copy of b
   117 		// Because addBranch again calls copy for the childs,
   118 		// Those will get a deep copy, too
   119 		addBranch(b);	
   120 
   121 	FloatImageObj *fi;
   122 	for (fi=other->floatimage.first(); fi;fi=other->floatimage.next() )
   123 		addFloatImage (fi);
   124 
   125 	scrolled=other->scrolled;
   126 	tmpUnscrolled=other->tmpUnscrolled;
   127 	setVisibility (other->visible);
   128 
   129 	angle=other->angle;
   130 
   131     positionBBox();
   132 }
   133 
   134 void BranchObj::clear() 
   135 {
   136 	floatimage.clear();
   137 	while (!xlink.isEmpty())
   138 		deleteXLink (xlink.first() );
   139 
   140 	BranchObj *bo;
   141 	while (!branch.isEmpty())
   142 	{
   143 		bo=branch.first();
   144 		branch.removeFirst();
   145 		delete (bo);
   146 	}
   147 }
   148 
   149 int BranchObj::getNum()
   150 {
   151 	if (parObj)
   152 		return ((BranchObj*)(parObj))->getNum ((BranchObj*)(this));
   153 	else
   154 		return 0;
   155 }
   156 
   157 int BranchObj::getNum(BranchObj *bo)
   158 {
   159 	// keep current pointer in branch, 
   160 	// otherwise save might fail
   161 	int cur=branch.at();
   162 	int ind=branch.findRef (bo);
   163 	branch.at(cur);
   164 	return ind;
   165 }
   166 
   167 int BranchObj::getFloatImageNum(FloatImageObj *fio)
   168 {
   169 	return floatimage.findRef (fio);
   170 }
   171 
   172 int BranchObj::countBranches()
   173 {
   174 	return branch.count();
   175 }
   176 
   177 int BranchObj::countFloatImages()
   178 {
   179 	return floatimage.count();
   180 }
   181 
   182 int BranchObj::countXLinks()
   183 {
   184 	return xlink.count();
   185 }
   186 
   187 void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
   188 {
   189 	// Temporary link to lmo
   190 	// m is position of mouse pointer 
   191 	// offset 0: default 1: below lmo   -1 above lmo  (if possible)
   192 
   193 
   194 	BranchObj* o=(BranchObj*)(lmo);
   195 	if (!parObjTmpBuf) 
   196 		parObjTmpBuf=parObj;
   197 
   198 	// ignore mapcenter and mainbranch
   199 	if (lmo->getDepth()<2) off=0;
   200 	if (off==0)
   201 		link2ParPos=false;
   202 	else
   203 		link2ParPos=true;
   204 	parObj=o;
   205 
   206 	depth=parObj->getDepth()+1;
   207 
   208 	// setLinkStyle calls updateLink, only set it once
   209 	if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle());
   210 
   211 	// Move temporary to new position at destination
   212 	// Usually the positioning would be done by reposition(),
   213 	// but then also the destination branch would "Jump" around...
   214 	// Better just do it approximately
   215 	if (depth==1)
   216 	{	// new parent is the mapcenter itself
   217 
   218 		QPoint p= normalise ( QPoint (m.x() - o->getChildPos().x(),
   219 									  m.y() - o->getChildPos().y() ));
   220 		if (p.x()<0) p.setX( p.x()-bbox.width() );
   221 		move2RelPos (p);
   222 	} else
   223 	{	
   224 		int y;
   225 		if (off==0)
   226 		{
   227 			// new parent is just a branch, link to it
   228 			QRect t=o->getBBoxSizeWithChilds();
   229 			if (o->getLastBranch())
   230 				y=t.y() + t.height() ;
   231 			else
   232 				y=t.y();
   233 
   234 		} else
   235 		{
   236 			if (off<0)
   237 				// we want to link above lmo
   238 				y=o->y() - height() + 5;
   239 			else	
   240 				// we want to link below lmo
   241 				// Bottom of sel should be 5 pixels above
   242 				// the bottom of the branch _below_ the target:
   243 				// Don't try to find that branch, guess 12 pixels
   244 				y=o->getChildPos().y()  -height() + 12; 
   245 		}	
   246 		if (o->getOrientation()==OrientLeftOfCenter)
   247 			move ( o->getChildPos().x() - linkwidth, y );
   248 		else	
   249 			move (o->getChildPos().x() + linkwidth, y );
   250 	}	
   251 
   252 	// updateLink is called implicitly in move
   253 	reposition();	// FIXME shouldn't be this a request?
   254 }
   255 
   256 void BranchObj::unsetParObjTmp()
   257 {
   258 	if (parObjTmpBuf) 
   259 	{
   260 		link2ParPos=false;
   261 		parObj=parObjTmpBuf;
   262 		parObjTmpBuf=NULL;
   263 		depth=parObj->getDepth()+1;
   264 		setLinkStyle (getDefLinkStyle() );
   265 		updateLink();
   266 	}		
   267 }
   268 
   269 void BranchObj::unScroll()
   270 {
   271 	if (tmpUnscrolled) resetTmpUnscroll();
   272 	if (scrolled) toggleScroll();
   273 }
   274 
   275 void BranchObj::toggleScroll()
   276 {
   277 	BranchObj *bo;
   278 	if (scrolled)
   279 	{
   280 		scrolled=false;
   281 		systemFlags->deactivate("scrolledright");
   282 		for (bo=branch.first(); bo; bo=branch.next() )
   283 		{
   284 			bo->setVisibility(true);
   285 		}
   286 	} else
   287 	{
   288 		scrolled=true;
   289 		systemFlags->activate("scrolledright");
   290 		for (bo=branch.first(); bo; bo=branch.next() )
   291 		{
   292 			bo->setVisibility(false);
   293 		}
   294 	}
   295 	calcBBoxSize();
   296 	positionBBox();	
   297 	move (absPos.x(), absPos.y() );
   298 	forceReposition();
   299 }
   300 
   301 bool BranchObj::isScrolled()
   302 {
   303 	return scrolled;
   304 }
   305 
   306 bool BranchObj::hasScrolledParent(BranchObj *start)
   307 {
   308 	// Calls parents recursivly to
   309 	// find out, if we are scrolled at all.
   310 	// But ignore myself, just look at parents.
   311 
   312 	if (this !=start && scrolled) return true;
   313 
   314 	BranchObj* bo=(BranchObj*)(parObj);
   315 	if (bo) 
   316 		return bo->hasScrolledParent(start);
   317 	else
   318 		return false;
   319 }
   320 
   321 void BranchObj::tmpUnscroll()
   322 {
   323 	// Unscroll parent (recursivly)
   324 	BranchObj* bo=(BranchObj*)(parObj);
   325 	if (bo) bo->tmpUnscroll();
   326 		
   327 	// Unscroll myself
   328 	if (scrolled)
   329 	{
   330 		tmpUnscrolled=true;
   331 		systemFlags->activate("tmpUnscrolledright");
   332 		toggleScroll();
   333 	}	
   334 }
   335 
   336 void BranchObj::resetTmpUnscroll()
   337 {
   338 	// Unscroll parent (recursivly)
   339 	BranchObj* bo=(BranchObj*)(parObj);
   340 	if (bo)
   341 		bo->resetTmpUnscroll();
   342 		
   343 	// Unscroll myself
   344 	if (tmpUnscrolled)
   345 	{
   346 		tmpUnscrolled=false;
   347 		systemFlags->deactivate("tmpUnscrolledright");
   348 		toggleScroll();
   349 	}	
   350 }
   351 
   352 void BranchObj::setVisibility(bool v, int toDepth)
   353 {
   354     if (depth <= toDepth)
   355     {
   356 		frame->setVisibility(v);
   357 		heading->setVisibility(v);
   358 		systemFlags->setVisibility(v);
   359 		standardFlags->setVisibility(v);
   360 		LinkableMapObj::setVisibility (v);
   361 		
   362 		// Only change childs, if I am not scrolled
   363 		if (!scrolled && (depth < toDepth))
   364 		{
   365 			// Now go recursivly through all childs
   366 			BranchObj* b;
   367 			for (b=branch.first(); b;b=branch.next() ) 
   368 				b->setVisibility (v,toDepth);	
   369 			FloatImageObj *fio;
   370 			for (fio=floatimage.first(); fio; fio=floatimage.next())
   371 				fio->setVisibility (v);
   372 			XLinkObj* xlo;
   373 			for (xlo=xlink.first(); xlo;xlo=xlink.next() ) 
   374 				xlo->setVisibility ();	
   375 		}
   376     } // depth <= toDepth	
   377 	requestReposition();
   378 }	
   379 
   380 void BranchObj::setVisibility(bool v)
   381 {
   382     setVisibility (v,MAX_DEPTH);
   383 }
   384 
   385 
   386 void BranchObj::setLinkColor ()
   387 {
   388 	// Overloaded from LinkableMapObj
   389 	// BranchObj can use color of heading
   390 
   391 	if (mapEditor)
   392 		if (mapEditor->getLinkColorHint()==HeadingColor)
   393 			LinkableMapObj::setLinkColor (heading->getColor() );
   394 		else	
   395 			LinkableMapObj::setLinkColor ();
   396 }
   397 
   398 void BranchObj::setColorChilds (QColor col)
   399 {
   400 	OrnamentedObj::setColor (col);
   401 	BranchObj *bo;
   402 	for (bo=branch.first(); bo; bo=branch.next() )
   403 		bo->setColorChilds(col);
   404 }
   405 
   406 BranchObj* BranchObj::first()
   407 {
   408 	itLast=NULL;	
   409 	return this; 
   410 }
   411 	
   412 BranchObj* BranchObj::next()
   413 {
   414 	BranchObj *lmo;
   415 	BranchObj *bo=branch.first();
   416 	BranchObj *po=(BranchObj*)(parObj);
   417 
   418 	if (!itLast)
   419 	{	// We are just beginning at the mapCenter
   420 		if (bo) 
   421 		{
   422 			itLast=this;
   423 			return bo;
   424 		}	
   425 		else
   426 		{
   427 			itLast=NULL;
   428 			return NULL;
   429 		}	
   430 	}
   431 
   432 	if (itLast==parObj)
   433 	{	// We come from above
   434 		if (bo)
   435 		{
   436 			// there are childs, go there
   437 			itLast=this;
   438 			return bo;
   439 		}	
   440 		else
   441 		{	// no childs, try to go up again
   442 			if (po)
   443 			{
   444 				// go up
   445 				itLast=this;
   446 				lmo=po->next();
   447 				itLast=this;
   448 				return lmo;
   449 
   450 			}	
   451 			else
   452 			{
   453 				// can't go up, I am mapCenter
   454 				itLast=NULL;
   455 				return NULL;
   456 			}	
   457 		}
   458 	}
   459 
   460 	// Try to find last child, we came from, in my own childs
   461 	bool searching=true;
   462 	while (bo && searching)
   463 	{
   464 		if (itLast==bo) searching=false;
   465 		bo=branch.next();
   466 	}
   467 	if (!searching)
   468 	{	// found lastLMO in my childs
   469 		if (bo)
   470 		{
   471 			// found a brother of lastLMO 
   472 			itLast=this;
   473 			return bo;
   474 		}	
   475 		else
   476 		{
   477 			if (po)
   478 			{
   479 				// go up
   480 				itLast=this;
   481 				lmo=po->next();
   482 				itLast=this;
   483 				return lmo;
   484 			}
   485 			else
   486 			{
   487 				// can't go up, I am mapCenter
   488 				itLast=NULL;
   489 				return NULL;
   490 			}	
   491 		}
   492 	}
   493 
   494 	// couldn't find last child, it must be a nephew of mine
   495 	bo=branch.first();
   496 	if (bo)
   497 	{
   498 		// proceed with my first child
   499 		itLast=this;	
   500 		return bo;
   501 	}	
   502 	else
   503 	{
   504 		// or go back to my parents
   505 		if (po)
   506 		{
   507 			// go up
   508 			itLast=this;
   509 			lmo=po->next();
   510 			itLast=this;
   511 			return lmo;
   512 		}	
   513 		else
   514 		{
   515 			// can't go up, I am mapCenter
   516 			itLast=NULL;
   517 			return NULL;
   518 		}	
   519 	}	
   520 }
   521 
   522 BranchObj* BranchObj::getLastIterator()
   523 {
   524 	return itLast;
   525 }
   526 
   527 void BranchObj::setLastIterator(BranchObj* it)
   528 {
   529 	itLast=it;
   530 }
   531 
   532 void BranchObj::positionContents()
   533 {
   534 	FloatImageObj *fio;
   535     for (fio=floatimage.first(); fio; fio=floatimage.next() )
   536 		fio->reposition();
   537 	OrnamentedObj::positionContents();
   538 }
   539 
   540 void BranchObj::move (double x, double y)
   541 {
   542 	OrnamentedObj::move (x,y);
   543 	FloatImageObj *fio;
   544     for (fio=floatimage.first(); fio; fio=floatimage.next() )
   545 		fio->reposition();
   546     positionBBox();
   547 }
   548 
   549 void BranchObj::move (QPoint p)
   550 {
   551 	move (p.x(), p.y());
   552 }
   553 
   554 void BranchObj::moveBy (double x, double y)
   555 {
   556 	OrnamentedObj::moveBy (x,y);
   557     BranchObj* b;
   558     for (b=branch.first(); b;b=branch.next() ) 
   559 		b->moveBy (x,y);
   560     positionBBox();
   561 }
   562 	
   563 void BranchObj::moveBy (QPoint p)
   564 {
   565 	moveBy (p.x(), p.y());
   566 }
   567 
   568 
   569 void BranchObj::positionBBox()
   570 {
   571 	QPoint ap=getAbsPos();
   572 	bbox.moveTopLeft (ap);
   573 	positionContents();
   574 	setSelBox();
   575 
   576 	// set the frame
   577 	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
   578 
   579 	// Update links to other branches
   580 	XLinkObj *xlo;
   581     for (xlo=xlink.first(); xlo; xlo=xlink.next() )
   582 		xlo->updateXLink();
   583 }
   584 
   585 void BranchObj::calcBBoxSize()
   586 {
   587     QSize heading_r=heading->getSize();
   588     int heading_w=(int) heading_r.width() ;
   589     int heading_h=(int) heading_r.height() ;
   590     QSize sysflags_r=systemFlags->getSize();
   591 	int sysflags_h=sysflags_r.height();
   592 	int sysflags_w=sysflags_r.width();
   593     QSize stanflags_r=standardFlags->getSize();
   594 	int stanflags_h=stanflags_r.height();
   595 	int stanflags_w=stanflags_r.width();
   596     int w;
   597     int h;
   598 
   599 	// set width to sum of all widths
   600 	w=heading_w + sysflags_w + stanflags_w;
   601 	// set height to maximum needed height
   602 	h=max (sysflags_h,stanflags_h);
   603 	h=max (h,heading_h);
   604 
   605 	// Save the dimension of flags and heading
   606 	ornamentsBBox.setSize ( QSize(w,h));
   607 
   608 	// clickBox includes Flags and Heading
   609     clickBox.setSize (ornamentsBBox.size() );
   610 
   611 	// Floatimages 
   612 	QPoint rp;
   613 	FloatImageObj *foi;
   614 
   615 	topPad=botPad=leftPad=rightPad=0;
   616 	if (includeImagesVer || includeImagesHor)
   617 	{
   618 		if (countFloatImages()>0)
   619 		{
   620 			for (foi=floatimage.first(); foi; foi=floatimage.next() )
   621 			{
   622 				rp=foi->getRelPos();
   623 				if (includeImagesVer)
   624 				{
   625 					if (rp.y() < 0) 
   626 						topPad=max (topPad,-rp.y()-h);
   627 					if (rp.y()+foi->height() > 0)
   628 						botPad=max (botPad,rp.y()+foi->height());
   629 				}		
   630 				if (includeImagesHor)
   631 				{
   632 					if (orientation==OrientRightOfCenter)
   633 					{
   634 						if (-rp.x()-w > 0) 
   635 							leftPad=max (leftPad,-rp.x()-w);
   636 						if (rp.x()+foi->width() > 0)
   637 							rightPad=max (rightPad,rp.x()+foi->width());
   638 					} else
   639 					{
   640 						if (rp.x()< 0) 
   641 							leftPad=max (leftPad,-rp.x());
   642 						if (rp.x()+foi->width() > w)
   643 							rightPad=max (rightPad,rp.x()+foi->width()-w);
   644 					}
   645 				}		
   646 			}	
   647 		}	
   648 		h+=topPad+botPad;
   649 		w+=leftPad+rightPad;
   650 	}
   651 
   652 	// Frame thickness
   653     w+=frame->getBorder();
   654     h+=frame->getBorder();
   655 	
   656 	// Finally set size
   657     bbox.setSize (QSize (w,h));
   658 }
   659 
   660 void BranchObj::setDockPos()
   661 {
   662 	if (getOrientation()==OrientLeftOfCenter )
   663     {
   664 		childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
   665 		parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
   666     } else
   667     {
   668 		childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
   669 		parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
   670     }
   671 }
   672 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
   673 {
   674 	// Search branches
   675     BranchObj *b;
   676     LinkableMapObj *lmo;
   677     for (b=branch.first(); b; b=branch.next() )
   678     {	
   679 		lmo=b->findMapObj(p, excludeLMO);
   680 		if (lmo != NULL) return lmo;
   681     }
   682 	
   683 	// Search myself
   684     if (inBox (p) && (this != excludeLMO) && isVisibleObj() ) 
   685 		return this;
   686 
   687 	// Search float images
   688 	FloatImageObj *foi;
   689     for (foi=floatimage.first(); foi; foi=floatimage.next() )
   690 		if (foi->inBox(p) && 
   691 			(foi != excludeLMO) && 
   692 			foi->getParObj()!= excludeLMO &&
   693 			foi->isVisibleObj() 
   694 		) return foi;
   695 
   696     return NULL;
   697 }
   698 
   699 void BranchObj::setHeading(QString s)
   700 {
   701     heading->setText(s);	// set new heading
   702 	calcBBoxSize();			// recalculate bbox
   703     positionBBox();			// rearrange contents
   704 	requestReposition();
   705 }
   706 
   707 void BranchObj::setHideTmp (HideTmpMode mode)
   708 {
   709 	if (mode==HideExport && hasHiddenExportParent(this))
   710 	{
   711 		setVisibility (false);
   712 		hidden=true;
   713 	}else
   714 	{
   715 		if (hasScrolledParent(this))
   716 			setVisibility (false);
   717 		else
   718 			setVisibility (true);
   719 		hidden=false;
   720 	}	
   721 
   722     BranchObj *bo;
   723     for (bo=branch.first(); bo; bo=branch.next() )
   724 		bo->setHideTmp (mode);
   725 }
   726 
   727 bool BranchObj::hasHiddenExportParent(BranchObj *start)
   728 {
   729 	// Calls parents recursivly to
   730 	// find out, if we are temp. hidden
   731 
   732 	if (hideExport) return true;
   733 
   734 	BranchObj* bo=(BranchObj*)(parObj);
   735 	if (bo) 
   736 		return bo->hasHiddenExportParent(start);
   737 	else
   738 		return false;
   739 }
   740 
   741 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
   742 {
   743 	if (hidden) return "";
   744 
   745     QString s,a;
   746 	QString scrolledAttr;
   747 	if (scrolled) 
   748 		scrolledAttr=attribut ("scrolled","yes");
   749 	else
   750 		scrolledAttr="";
   751 
   752 	QString frameAttr;
   753 	if (frame->getFrameType()!=NoFrame)
   754 		frameAttr=attribut ("frameType",frame->getFrameTypeName());
   755 	else
   756 		frameAttr="";
   757 
   758 	// save area, if not scrolled
   759 	QString areaAttr;
   760 	if (!((BranchObj*)(parObj))->isScrolled() )
   761 	{
   762 		areaAttr=
   763 			attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
   764 			attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
   765 			attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
   766 			attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
   767 
   768 	} else
   769 		areaAttr="";
   770 	
   771 	// Providing an ID for a branch makes export to XHTML easier
   772 	QString idAttr;
   773 	if (countXLinks()>0)
   774 		idAttr=attribut ("id",getSelectString());
   775 	else
   776 		idAttr="";
   777 
   778     s=beginElement ("branch" 
   779 		+getOrnAttr() 
   780 		+scrolledAttr 
   781 		+frameAttr 
   782 		+areaAttr 
   783 		+idAttr 
   784 		+getIncludeImageAttr() );
   785     incIndent();
   786 
   787 	// save heading
   788     s+=valueElement("heading", getHeading(),
   789 		attribut ("textColor",QColor(heading->getColor()).name()));
   790 
   791 	// save names of flags set
   792 	s+=standardFlags->saveToDir(tmpdir,prefix,0);
   793 	
   794 	// save note
   795 	if (!note.isEmpty() )
   796 		s+=note.saveToDir();
   797 	
   798 	// Save branches
   799     BranchObj *bo;
   800     for (bo=branch.first(); bo; bo=branch.next() )
   801 		s+=bo->saveToDir(tmpdir,prefix,offset);
   802 
   803 	// Save FloatImages
   804 	FloatImageObj *fio;
   805 	for (fio=floatimage.first(); fio; fio=floatimage.next() )
   806 		s+=fio->saveToDir (tmpdir,prefix,offset);
   807 
   808 	// Save XLinks
   809 	XLinkObj *xlo;
   810 	//FIXME exponential increase in xlinks...
   811 	QString ol;	// old link
   812 	QString cl;	// current link
   813     for (xlo=xlink.first(); xlo; xlo=xlink.next() )
   814 	{
   815 		cl=xlo->saveToDir();
   816 		if (cl!=ol)
   817 		{
   818 			s+=cl;
   819 			ol=cl;
   820 		} else
   821 		{
   822 			qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
   823 		}
   824 	}	
   825 
   826     decIndent();
   827     s+=endElement   ("branch");
   828     return s;
   829 }
   830 
   831 void BranchObj::addXLink (XLinkObj *xlo)
   832 {
   833 	xlink.append (xlo);
   834 	
   835 }
   836 
   837 void BranchObj::removeXLinkRef (XLinkObj *xlo)
   838 {
   839 	xlink.remove (xlo);
   840 }
   841 
   842 void BranchObj::deleteXLink(XLinkObj *xlo)
   843 {
   844 	xlo->deactivate();
   845 	if (!xlo->isUsed()) delete (xlo);
   846 }
   847 
   848 void BranchObj::deleteXLinkAt (int i)
   849 {
   850 	XLinkObj *xlo=xlink.at(i);
   851 	xlo->deactivate();
   852 	if (!xlo->isUsed()) delete(xlo);
   853 }
   854 
   855 XLinkObj* BranchObj::XLinkAt (int i)
   856 {
   857 	return xlink.at(i);
   858 }
   859 
   860 int BranchObj::countXLink()
   861 {
   862 	return xlink.count();
   863 }
   864 
   865 
   866 BranchObj* BranchObj::XLinkTargetAt (int i)
   867 {
   868 	if (xlink.at(i))
   869 		return xlink.at(i)->otherBranch (this);
   870 	else
   871 		return NULL;
   872 }
   873 
   874 void BranchObj::setIncludeImagesVer(bool b)
   875 {
   876 	includeImagesVer=b;
   877 	calcBBoxSize();
   878 	positionBBox();
   879 	requestReposition();
   880 	//FIXME undo needed
   881 }
   882 
   883 bool BranchObj::getIncludeImagesVer()
   884 {
   885 	return includeImagesVer;
   886 }
   887 
   888 void BranchObj::setIncludeImagesHor(bool b)
   889 {
   890 	includeImagesHor=b;
   891 	calcBBoxSize();
   892 	positionBBox();
   893 	requestReposition();
   894 	//FIXME undo needed
   895 }
   896 
   897 bool BranchObj::getIncludeImagesHor()
   898 {
   899 	return includeImagesHor;
   900 }
   901 
   902 QString BranchObj::getIncludeImageAttr()
   903 {
   904 	QString a;
   905 	if (includeImagesVer)
   906 		a=attribut ("incImgV","true");
   907 	else
   908 		a=attribut ("incImgV","false");
   909 	if (includeImagesHor)
   910 		a+=attribut ("incImgH","true");
   911 	else
   912 		a+=attribut ("incImgH","false");
   913 	return a;	
   914 }
   915 
   916 LinkableMapObj* BranchObj::addFloatImage ()
   917 {
   918 	FloatImageObj *newfi=new FloatImageObj (canvas,this);
   919 	floatimage.append (newfi);
   920 	if (hasScrolledParent(this) )
   921 		newfi->setVisibility (false);
   922 	else	
   923 		newfi->setVisibility(visible);
   924 	calcBBoxSize();
   925 	positionBBox();
   926 	requestReposition();
   927 	return newfi;
   928 	//FIXME undo needed
   929 }
   930 
   931 LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
   932 {
   933 	FloatImageObj *newfi=new FloatImageObj (canvas,this);
   934 	floatimage.append (newfi);
   935 	newfi->copy (fio);
   936 	if (hasScrolledParent(this) )
   937 		newfi->setVisibility (false);
   938 	else	
   939 		newfi->setVisibility(visible);
   940 	calcBBoxSize();
   941 	positionBBox();
   942 	requestReposition();
   943 	return newfi;
   944 	// FIMXE undo needed
   945 }
   946 
   947 FloatImageObj* BranchObj::getFirstFloatImage ()
   948 {
   949     return floatimage.first();
   950 }
   951 
   952 FloatImageObj* BranchObj::getLastFloatImage ()
   953 {
   954     return floatimage.last();
   955 }
   956 
   957 FloatImageObj* BranchObj::getFloatImageNum (const uint &i)
   958 {
   959     return floatimage.at(i);
   960 }
   961 
   962 void BranchObj::removeFloatImage (FloatImageObj *fio)
   963 {
   964 	floatimage.remove (fio);
   965 	calcBBoxSize();
   966 	positionBBox();
   967 	requestReposition();
   968 	// FIMXE undo needed
   969 }
   970 
   971 void BranchObj::savePosInAngle ()
   972 {
   973 	// Save position in angle
   974     BranchObj *b;
   975 	int i=0;
   976     for (b=branch.first(); b; b=branch.next() )
   977 	{
   978 		b->angle=i;
   979 		i++;
   980 	}
   981 }
   982 
   983 void BranchObj::setDefAttr (BranchModification mod)
   984 {
   985 	int fontsize;
   986 	switch (depth)
   987 	{
   988 		case 0: fontsize=16; break;
   989 		case 1: fontsize=12; break;
   990 		default: fontsize=10; break;
   991 	}	
   992 
   993 	setLinkColor ();
   994 	setLinkStyle(getDefLinkStyle());
   995 	QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
   996 	font.setPointSize(fontsize);
   997 	heading->setFont(font );
   998 
   999 	if (mod==NewBranch)
  1000 		setColor (((BranchObj*)(parObj))->getColor());
  1001 	
  1002 	calcBBoxSize();
  1003 }
  1004 
  1005 BranchObj* BranchObj::addBranch()
  1006 {
  1007     BranchObj* newbo=new BranchObj(canvas,this);
  1008     branch.append (newbo);
  1009     newbo->setParObj(this);
  1010 	newbo->setDefAttr(NewBranch);
  1011     newbo->setHeading ("new");
  1012 	if (scrolled)
  1013 		newbo->setVisibility (false);
  1014 	else	
  1015 		newbo->setVisibility(visible);
  1016 	newbo->updateLink();	
  1017 	requestReposition();
  1018 	return newbo;
  1019 }
  1020 
  1021 BranchObj* BranchObj::addBranch(BranchObj* bo)
  1022 {
  1023     BranchObj* newbo=new BranchObj(canvas,this);
  1024     branch.append (newbo);
  1025     newbo->copy(bo);
  1026     newbo->setParObj(this);
  1027 	newbo->setDefAttr(MovedBranch);
  1028 	if (scrolled)
  1029 		newbo->setVisibility (false);
  1030 	else	
  1031 		newbo->setVisibility(bo->visible);
  1032 	newbo->updateLink();	
  1033 	requestReposition();
  1034 	return newbo;
  1035 }
  1036 
  1037 BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
  1038 {
  1039 	branch.append (bo);
  1040 	bo->setParObj (this);
  1041 	bo->depth=depth+1;
  1042 	bo->setDefAttr(MovedBranch);
  1043 	if (scrolled) tmpUnscroll();
  1044 	setLastSelectedBranch (bo);
  1045 	return bo;
  1046 }
  1047 
  1048 BranchObj* BranchObj::insertBranch(int pos)
  1049 {
  1050 	savePosInAngle();
  1051 	// Add new bo and resort branches
  1052 	BranchObj *newbo=addBranch ();
  1053 	newbo->angle=pos-0.5;
  1054 	branch.sort();
  1055 	return newbo;
  1056 }
  1057 
  1058 BranchObj* BranchObj::insertBranch(BranchObj* bo, int pos)
  1059 {
  1060 	savePosInAngle();
  1061 	// Add new bo and resort branches
  1062 	bo->angle=pos-0.5;
  1063 	BranchObj *newbo=addBranch (bo);
  1064 	branch.sort();
  1065 	return newbo;
  1066 }
  1067 
  1068 BranchObj* BranchObj::insertBranchPtr (BranchObj* bo, int pos)
  1069 {
  1070 	savePosInAngle();
  1071 	// Add new bo and resort branches
  1072 	bo->angle=pos-0.5;
  1073 	branch.append (bo);
  1074 	bo->setParObj (this);
  1075 	bo->depth=depth+1;
  1076 	bo->setDefAttr (MovedBranch);
  1077 	if (scrolled) tmpUnscroll();
  1078 	setLastSelectedBranch (bo);
  1079 	branch.sort();
  1080 	return bo;
  1081 }
  1082 
  1083 void BranchObj::removeBranchHere(BranchObj* borem)
  1084 {
  1085 	// This removes the branch bo from list, but 
  1086 	// inserts its childs at the place of bo
  1087 	BranchObj *bo;
  1088 	bo=borem->getLastBranch();
  1089 	int pos=borem->getNum();
  1090 	while (bo)
  1091 	{
  1092 		bo->moveBranchTo (this,pos+1);
  1093 		bo=borem->getLastBranch();
  1094 	}	
  1095 	removeBranch (borem);
  1096 }
  1097 
  1098 void BranchObj::removeChilds()
  1099 {
  1100 	clear();
  1101 }
  1102 
  1103 void BranchObj::removeBranch(BranchObj* bo)
  1104 {
  1105     // if bo is not in branch remove returns false, we
  1106     // don't care...
  1107 	
  1108     if (branch.remove (bo))
  1109 		delete (bo);
  1110 	else
  1111 		qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
  1112 	requestReposition();
  1113 }
  1114 
  1115 void BranchObj::removeBranchPtr(BranchObj* bo)
  1116 {
  1117 	branch.remove (bo);
  1118 	requestReposition();
  1119 }
  1120 
  1121 void BranchObj::setLastSelectedBranch (BranchObj* bo)
  1122 {
  1123     lastSelectedBranch=branch.find(bo);
  1124 }
  1125 
  1126 BranchObj* BranchObj::getLastSelectedBranch ()
  1127 {
  1128     if (lastSelectedBranch>=0) 
  1129 	{
  1130 		BranchObj* bo=branch.at(lastSelectedBranch);
  1131 		if (bo) return bo;
  1132     }	
  1133     return branch.first();
  1134 }
  1135 
  1136 BranchObj* BranchObj::getFirstBranch ()
  1137 {
  1138     return branch.first();
  1139 }
  1140 
  1141 BranchObj* BranchObj::getLastBranch ()
  1142 {
  1143     return branch.last();
  1144 }
  1145 
  1146 BranchObj* BranchObj::getBranchNum (const uint &i)
  1147 {
  1148     return branch.at(i);
  1149 }
  1150 
  1151 bool BranchObj::canMoveBranchUp() 
  1152 {
  1153 	if (!parObj) return false;
  1154 	BranchObj* par=(BranchObj*)parObj;
  1155 	if (this==par->getFirstBranch())
  1156 		return false;
  1157 	else
  1158 		return true;
  1159 }
  1160 
  1161 BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // move a branch up (modify myself)
  1162 {
  1163 	savePosInAngle();
  1164     int i=branch.find(bo1);
  1165     if (i>0) 
  1166 	{	// -1 if bo1 not found 
  1167 		branch.at(i)->angle--;
  1168 		branch.at(i-1)->angle++;
  1169 		branch.sort();
  1170 		return branch.at(i-1);
  1171 	} else
  1172 		return branch.at(i);
  1173 }
  1174 
  1175 bool BranchObj::canMoveBranchDown() 
  1176 {
  1177 	if (!parObj) return false;
  1178 	BranchObj* par=(BranchObj*)parObj;
  1179 	if (this==par->getLastBranch())
  1180 		return false;
  1181 	else
  1182 		return true;
  1183 }
  1184 
  1185 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)
  1186 {
  1187 	savePosInAngle();
  1188     int i=branch.find(bo1);
  1189 	int j;
  1190 	if (branch.next())
  1191 	{
  1192 		j = branch.at();
  1193 		branch.at(i)->angle++;
  1194 		branch.at(j)->angle--;
  1195 		branch.sort();
  1196 		return branch.at(j);
  1197 	} else
  1198 		return branch.at(i);
  1199 }
  1200 
  1201 BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
  1202 {
  1203 	// Find current parent and 
  1204 	// remove pointer to myself there
  1205 	if (!dst) return NULL;
  1206 	BranchObj *par=(BranchObj*)(parObj);
  1207 	if (par)
  1208 		par->removeBranchPtr (this);
  1209 	else
  1210 		return NULL;
  1211 
  1212 	// Create new pointer to myself at dst
  1213 	if (pos<0||dst->getDepth()==0)
  1214 	{	
  1215 		// links myself as last branch at dst
  1216 		dst->addBranchPtr (this);
  1217 		updateLink();
  1218 		return this;
  1219 	} else
  1220 	{
  1221 		// inserts me at pos in parent of dst
  1222 		if (par)
  1223 		{
  1224 			BranchObj *bo=dst->insertBranchPtr (this,pos);
  1225 			bo->setDefAttr(MovedBranch);
  1226 			updateLink();
  1227 			return bo;
  1228 
  1229 		} else
  1230 			return NULL;
  1231 	}	
  1232 }
  1233 
  1234 void BranchObj::alignRelativeTo (QPoint ref)
  1235 {
  1236 	int th = bboxTotal.height();	
  1237 // TODO testing
  1238 /*
  1239 	cout << "BO::alignRelTo "<<getHeading()<<endl;
  1240 	cout << "  d="<<depth<<
  1241 		"  ref="<<ref<<
  1242 //		"  bbox.topLeft="<<bboxTotal.topLeft()<<
  1243 		"  absPos="<<absPos<<
  1244 //		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
  1245 		"  hidden="<<hidden<<
  1246 		"  th="<<th<<endl;
  1247 */
  1248 
  1249 	// If I am the mapcenter or a mainbranch, reposition heading
  1250 	if (depth<2)
  1251 	{	//FIXME ugly! optimize this   move for MCO needed to initially position text in box...
  1252 		if (depth==1)
  1253 			// Calc angle to mapCenter if I am a mainbranch
  1254 			// needed for reordering the mainbranches clockwise 
  1255 			// around mapcenter 
  1256 			angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ), 
  1257 									(int)(y() - parObj->getChildPos().y() ) ) );
  1258 	} 
  1259 	else
  1260     {
  1261 		// Align myself depending on orientation and parent, but
  1262 		// only if I am not the mainbranch or mapcenter itself
  1263 		switch (orientation) 
  1264 		{
  1265 			case OrientLeftOfCenter:
  1266 				move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
  1267 			break;
  1268 			case OrientRightOfCenter:	
  1269 				move (ref.x() , ref.y() + (th-bbox.height())/2  );
  1270 			break;
  1271 			default:
  1272 				qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
  1273 			break;
  1274 		}		
  1275     }		
  1276 
  1277 	if (scrolled) return;
  1278 
  1279     // Set reference point for alignment of childs
  1280     QPoint ref2;
  1281     if (orientation==OrientLeftOfCenter)
  1282 		ref2.setX(bbox.topLeft().x() - linkwidth);
  1283     else	
  1284 		ref2.setX(bbox.topRight().x() + linkwidth);
  1285 
  1286 	if (depth==1)
  1287 		ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
  1288 	else	
  1289 		ref2.setY(ref.y() );	
  1290 
  1291     // Align the childs depending on reference point 
  1292     BranchObj *b;
  1293     for (b=branch.first(); b; b=branch.next() )
  1294     {	
  1295 		if (!b->isHidden())
  1296 		{
  1297 			b->alignRelativeTo (ref2);
  1298 			ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
  1299 		}
  1300     }
  1301 }
  1302 
  1303 
  1304 void BranchObj::reposition()
  1305 {	
  1306 /* TODO testing only
  1307 	if (!getHeading().isEmpty())
  1308 		cout << "BO::reposition  "<<getHeading()<<endl;
  1309 	else	
  1310 		cout << "BO::reposition  ???"<<endl;
  1311 */		
  1312 	if (depth==0)
  1313 	{
  1314 		// only calculate the sizes once. If the deepest LMO 
  1315 		// changes its height,
  1316 		// all upper LMOs have to change, too.
  1317 		calcBBoxSizeWithChilds();
  1318 		updateLink();	// This update is needed if the canvas is resized 
  1319 						// due to excessive moving of a FIO
  1320 
  1321 	    alignRelativeTo ( QPoint (absPos.x(),
  1322 			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  1323 		branch.sort();	
  1324 		positionBBox();	// Reposition bbox and contents
  1325 	} else
  1326 	{
  1327 		// This is only important for moving branches:
  1328 		// For editing a branch it isn't called...
  1329 	    alignRelativeTo ( QPoint (absPos.x(),
  1330 							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  1331 	}
  1332 }
  1333 
  1334 
  1335 QRect BranchObj::getTotalBBox()
  1336 {
  1337 	QRect r=bbox;
  1338 
  1339 	if (scrolled) return r;
  1340 
  1341 	BranchObj* b;
  1342 	for (b=branch.first();b ;b=branch.next() )
  1343 		if (!b->isHidden())
  1344 			r=addBBox(b->getTotalBBox(),r);
  1345 
  1346 	FloatImageObj* fio;
  1347 	for (fio=floatimage.first();fio ;fio=floatimage.next() )
  1348 		if (!fio->isHidden())
  1349 			r=addBBox(fio->getTotalBBox(),r);
  1350 		
  1351 	return r;
  1352 }
  1353 
  1354 QRect BranchObj::getBBoxSizeWithChilds()
  1355 {
  1356 	return bboxTotal;
  1357 }
  1358 
  1359 void BranchObj::calcBBoxSizeWithChilds()
  1360 {	
  1361 	// This is initially called only from reposition and
  1362 	// and only for mapcenter. So it won't be
  1363 	// called more than once for a single user 
  1364 	// action
  1365 	
  1366 
  1367 	// Calculate size of LMO including all childs (to align them later)
  1368 	bboxTotal.setX(bbox.x() );
  1369 	bboxTotal.setY(bbox.y() );
  1370 
  1371 	// if branch is scrolled, ignore childs, but still consider floatimages
  1372 	if (scrolled)
  1373 	{
  1374 		bboxTotal.setWidth (bbox.width());
  1375 		bboxTotal.setHeight(bbox.height());
  1376 		return;
  1377 	}
  1378 	
  1379 	if (hidden)
  1380 	{
  1381 		bboxTotal.setWidth (0);
  1382 		bboxTotal.setHeight(0);
  1383 		if (parObj)
  1384 		{
  1385 			bboxTotal.setX (parObj->x());
  1386 			bboxTotal.setY (parObj->y());
  1387 		} else
  1388 		{
  1389 			bboxTotal.setX (bbox.x());
  1390 			bboxTotal.setY (bbox.y());
  1391 		}
  1392 		return;
  1393 	}
  1394 	
  1395 	QRect r(0,0,0,0);
  1396 	QRect br;
  1397 	// Now calculate recursivly
  1398 	// sum of heights 
  1399 	// maximum of widths 
  1400 	// minimum of y
  1401 	BranchObj* b;
  1402 	for (b=branch.first();b ;b=branch.next() )
  1403 	{
  1404 		if (!b->isHidden())
  1405 		{
  1406 			b->calcBBoxSizeWithChilds();
  1407 			br=b->getBBoxSizeWithChilds();
  1408 			r.setWidth( max (br.width(), r.width() ));
  1409 			r.setHeight(br.height() + r.height() );
  1410 			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
  1411 		}
  1412 	}
  1413 	// Add myself and also
  1414 	// add width of link to sum if necessary
  1415 	if (branch.isEmpty())
  1416 		bboxTotal.setWidth (bbox.width() + r.width() );
  1417 	else	
  1418 		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
  1419 	
  1420 	bboxTotal.setHeight(max (r.height(),  bbox.height()));
  1421 }
  1422 
  1423 void BranchObj::select()
  1424 {
  1425 	// set Text in Editor	
  1426 	textEditor->setText(note.getNote() );
  1427 	QString fnh=note.getFilenameHint();
  1428 	if (fnh!="")
  1429 		textEditor->setFilenameHint(note.getFilenameHint() );
  1430 	else	
  1431 		textEditor->setFilenameHint(getHeading() );
  1432 	textEditor->setFontHint (note.getFontHint() );
  1433 
  1434     LinkableMapObj::select();
  1435 	// Tell parent that I am selected now:
  1436 	BranchObj* po=(BranchObj*)(parObj);
  1437     if (po)	// TODO	    Try to get rid of this cast...
  1438         po->setLastSelectedBranch(this);
  1439 		
  1440 	// temporary unscroll, if we have scrolled parents somewhere
  1441 	if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
  1442 
  1443 	// Show URL and link in statusbar
  1444 	QString status;
  1445 	if (!url.isEmpty()) status+="URL: "+url+"  ";
  1446 	if (!vymLink.isEmpty()) status+="Link: "+vymLink;
  1447 	if (!status.isEmpty()) mainWindow->statusMessage (status);
  1448 
  1449 	// Update Toolbar
  1450 	standardFlags->updateToolbar();
  1451 
  1452 	// Update actions in mapeditor
  1453 	mapEditor->updateActions();
  1454 }
  1455 
  1456 void BranchObj::unselect()
  1457 {
  1458 	LinkableMapObj::unselect();
  1459 	// Delete any messages like vymLink in StatusBar
  1460 	mainWindow->statusMessage ("");
  1461 
  1462 	// save note from editor and set flag
  1463 	// text is done by updateNoteFlag(), just save
  1464 	// filename here
  1465 	note.setFilenameHint (textEditor->getFilename());
  1466 
  1467 	// reset temporary unscroll, if we have scrolled parents somewhere
  1468 	if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
  1469 
  1470 	// Erase content of editor 
  1471 	textEditor->setInactive();
  1472 
  1473 	// unselect all buttons in toolbar
  1474 	standardFlagsDefault->updateToolbar();
  1475 }
  1476 
  1477 QString BranchObj::getSelectString()
  1478 {
  1479 	QString s;
  1480 	if (parObj)
  1481 	{
  1482 		if (depth==1)
  1483 			s= "bo:" + QString("%1").arg(getNum());
  1484 		else	
  1485 			s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
  1486 	} else
  1487 		s="mc:";
  1488 	return s;
  1489 }
  1490