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