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