branchobj.cpp
author insilmaril
Thu, 31 Aug 2006 12:51:20 +0000
branchqt4-port
changeset 19 caba269c3757
parent 18 70c41284cb48
child 20 9ad3d0391be1
permissions -rw-r--r--
More undo/redo commands. Undo debug output still enabled
     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 ((BranchObj*)(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 	int cur=branch.at();
   163 	int ind=branch.findRef (bo);
   164 	branch.at(cur);
   165 	return ind;
   166 }
   167 
   168 int BranchObj::getFloatImageNum(FloatImageObj *fio)
   169 {
   170 	return floatimage.findRef (fio);
   171 }
   172 
   173 int BranchObj::countBranches()
   174 {
   175 	return branch.count();
   176 }
   177 
   178 int BranchObj::countFloatImages()
   179 {
   180 	return floatimage.count();
   181 }
   182 
   183 int BranchObj::countXLinks()
   184 {
   185 	return xlink.count();
   186 }
   187 
   188 void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
   189 {
   190 	// Temporary link to lmo
   191 	// m is position of mouse pointer 
   192 	// offset 0: default 1: below lmo   -1 above lmo  (if possible)
   193 
   194 
   195 	BranchObj* o=(BranchObj*)(lmo);
   196 	if (!parObjTmpBuf) 
   197 		parObjTmpBuf=parObj;
   198 
   199 	// ignore mapcenter and mainbranch
   200 	if (lmo->getDepth()<2) off=0;
   201 	if (off==0)
   202 		link2ParPos=false;
   203 	else
   204 		link2ParPos=true;
   205 	parObj=o;
   206 
   207 	depth=parObj->getDepth()+1;
   208 
   209 	// setLinkStyle calls updateLink, only set it once
   210 	if (style!=getDefLinkStyle() ) setLinkStyle (getDefLinkStyle());
   211 
   212 	// Move temporary to new position at destination
   213 	// Usually the positioning would be done by reposition(),
   214 	// but then also the destination branch would "Jump" around...
   215 	// Better just do it approximately
   216 	if (depth==1)
   217 	{	// new parent is the mapcenter itself
   218 
   219 		QPoint p= normalise ( QPoint (m.x() - o->getChildPos().x(),
   220 									  m.y() - o->getChildPos().y() ));
   221 		if (p.x()<0) p.setX( p.x()-bbox.width() );
   222 		move2RelPos (p);
   223 	} else
   224 	{	
   225 		int y;
   226 		if (off==0)
   227 		{
   228 			// new parent is just a branch, link to it
   229 			QRect t=o->getBBoxSizeWithChilds();
   230 			if (o->getLastBranch())
   231 				y=t.y() + t.height() ;
   232 			else
   233 				y=t.y();
   234 
   235 		} else
   236 		{
   237 			if (off<0)
   238 				// we want to link above lmo
   239 				y=o->y() - height() + 5;
   240 			else	
   241 				// we want to link below lmo
   242 				// Bottom of sel should be 5 pixels above
   243 				// the bottom of the branch _below_ the target:
   244 				// Don't try to find that branch, guess 12 pixels
   245 				y=o->getChildPos().y()  -height() + 12; 
   246 		}	
   247 		if (o->getOrientation()==OrientLeftOfCenter)
   248 			move ( o->getChildPos().x() - linkwidth, y );
   249 		else	
   250 			move (o->getChildPos().x() + linkwidth, y );
   251 	}	
   252 
   253 	// updateLink is called implicitly in move
   254 	reposition();	// FIXME shouldn't be this a request?
   255 }
   256 
   257 void BranchObj::unsetParObjTmp()
   258 {
   259 	if (parObjTmpBuf) 
   260 	{
   261 		link2ParPos=false;
   262 		parObj=parObjTmpBuf;
   263 		parObjTmpBuf=NULL;
   264 		depth=parObj->getDepth()+1;
   265 		setLinkStyle (getDefLinkStyle() );
   266 		updateLink();
   267 	}		
   268 }
   269 
   270 void BranchObj::unScroll()
   271 {
   272 	if (tmpUnscrolled) resetTmpUnscroll();
   273 	if (scrolled) toggleScroll();
   274 }
   275 
   276 void BranchObj::toggleScroll()
   277 {
   278 	BranchObj *bo;
   279 	if (scrolled)
   280 	{
   281 		scrolled=false;
   282 		systemFlags->deactivate("scrolledright");
   283 		for (bo=branch.first(); bo; bo=branch.next() )
   284 		{
   285 			bo->setVisibility(true);
   286 		}
   287 	} else
   288 	{
   289 		scrolled=true;
   290 		systemFlags->activate("scrolledright");
   291 		for (bo=branch.first(); bo; bo=branch.next() )
   292 		{
   293 			bo->setVisibility(false);
   294 		}
   295 	}
   296 	calcBBoxSize();
   297 	positionBBox();	
   298 	move (absPos.x(), absPos.y() );
   299 	forceReposition();
   300 }
   301 
   302 bool BranchObj::isScrolled()
   303 {
   304 	return scrolled;
   305 }
   306 
   307 bool BranchObj::hasScrolledParent(BranchObj *start)
   308 {
   309 	// Calls parents recursivly to
   310 	// find out, if we are scrolled at all.
   311 	// But ignore myself, just look at parents.
   312 
   313 	if (this !=start && scrolled) return true;
   314 
   315 	BranchObj* bo=(BranchObj*)(parObj);
   316 	if (bo) 
   317 		return bo->hasScrolledParent(start);
   318 	else
   319 		return false;
   320 }
   321 
   322 void BranchObj::tmpUnscroll()
   323 {
   324 	// Unscroll parent (recursivly)
   325 	BranchObj* bo=(BranchObj*)(parObj);
   326 	if (bo) bo->tmpUnscroll();
   327 		
   328 	// Unscroll myself
   329 	if (scrolled)
   330 	{
   331 		tmpUnscrolled=true;
   332 		systemFlags->activate("tmpUnscrolledright");
   333 		toggleScroll();
   334 	}	
   335 }
   336 
   337 void BranchObj::resetTmpUnscroll()
   338 {
   339 	// Unscroll parent (recursivly)
   340 	BranchObj* bo=(BranchObj*)(parObj);
   341 	if (bo)
   342 		bo->resetTmpUnscroll();
   343 		
   344 	// Unscroll myself
   345 	if (tmpUnscrolled)
   346 	{
   347 		tmpUnscrolled=false;
   348 		systemFlags->deactivate("tmpUnscrolledright");
   349 		toggleScroll();
   350 	}	
   351 }
   352 
   353 void BranchObj::setVisibility(bool v, int toDepth)
   354 {
   355     if (depth <= toDepth)
   356     {
   357 		frame->setVisibility(v);
   358 		heading->setVisibility(v);
   359 		systemFlags->setVisibility(v);
   360 		standardFlags->setVisibility(v);
   361 		LinkableMapObj::setVisibility (v);
   362 		
   363 		// Only change childs, if I am not scrolled
   364 		if (!scrolled && (depth < toDepth))
   365 		{
   366 			// Now go recursivly through all childs
   367 			BranchObj* b;
   368 			for (b=branch.first(); b;b=branch.next() ) 
   369 				b->setVisibility (v,toDepth);	
   370 			FloatImageObj *fio;
   371 			for (fio=floatimage.first(); fio; fio=floatimage.next())
   372 				fio->setVisibility (v);
   373 			XLinkObj* xlo;
   374 			for (xlo=xlink.first(); xlo;xlo=xlink.next() ) 
   375 				xlo->setVisibility ();	
   376 		}
   377     } // depth <= toDepth	
   378 	requestReposition();
   379 }	
   380 
   381 void BranchObj::setVisibility(bool v)
   382 {
   383     setVisibility (v,MAX_DEPTH);
   384 }
   385 
   386 
   387 void BranchObj::setLinkColor ()
   388 {
   389 	// Overloaded from LinkableMapObj
   390 	// BranchObj can use color of heading
   391 
   392 	if (mapEditor)
   393 		if (mapEditor->getLinkColorHint()==HeadingColor)
   394 			LinkableMapObj::setLinkColor (heading->getColor() );
   395 		else	
   396 			LinkableMapObj::setLinkColor ();
   397 }
   398 
   399 void BranchObj::setColorChilds (QColor col)
   400 {
   401 	OrnamentedObj::setColor (col);
   402 	BranchObj *bo;
   403 	for (bo=branch.first(); bo; bo=branch.next() )
   404 		bo->setColorChilds(col);
   405 }
   406 
   407 BranchObj* BranchObj::first()
   408 {
   409 	itLast=NULL;	
   410 	itFirst=this;
   411 	return this; 
   412 }
   413 	
   414 BranchObj* BranchObj::next()
   415 {
   416 	BranchObj *lmo;
   417 	BranchObj *bo=branch.first();
   418 	BranchObj *po=(BranchObj*)(parObj);
   419 
   420 	if (!itLast)
   421 	{
   422 		if (bo) 
   423 		{	// We are just beginning, 
   424 			// return first child  
   425 			itLast=this;
   426 			return bo;
   427 		}	
   428 		else
   429 		{
   430 			// No childs
   431 			itLast=this;
   432 			return NULL;
   433 		}	
   434 	}
   435 
   436 	if (itLast==parObj)
   437 	{	// We come from above
   438 		if (bo)
   439 		{
   440 			// there are childs, go there
   441 			itLast=this;
   442 			return bo;
   443 		}	
   444 		else
   445 		{	// no childs, try to go up again
   446 			if (po)
   447 			{
   448 				// go up
   449 				itLast=this;
   450 				lmo=po->next();
   451 				itLast=this;
   452 				return lmo;
   453 
   454 			}	
   455 			else
   456 			{
   457 				// can't go up, I am mapCenter
   458 				itLast=NULL;
   459 				return NULL;
   460 			}	
   461 		}
   462 	}
   463 
   464 	// Try to find last child, where we came from, in my own childs
   465 	bool searching=true;
   466 	while (bo && searching)
   467 	{
   468 		if (itLast==bo) searching=false;
   469 		bo=branch.next();
   470 	}
   471 	if (!searching)
   472 	{	// found lastLMO in my childs
   473 		if (bo)
   474 		{
   475 			// found a brother of lastLMO 
   476 			itLast=this;
   477 			return bo;
   478 		}	
   479 		else
   480 		{
   481 			if (po)
   482 			{
   483 				if (this==itFirst) return NULL;	// Stop at starting point
   484 				// go up
   485 				itLast=this;
   486 				lmo=po->next();
   487 				itLast=this;
   488 				return lmo;
   489 			}
   490 			else
   491 			{
   492 				// can't go up, I am mapCenter
   493 				itLast=NULL;
   494 				return NULL;
   495 			}	
   496 		}
   497 	}
   498 
   499 	// couldn't find last child, it must be a nephew of mine
   500 	bo=branch.first();
   501 	if (bo)
   502 	{
   503 		// proceed with my first child
   504 		itLast=this;	
   505 		return bo;
   506 	}	
   507 	else
   508 	{
   509 		// or go back to my parents
   510 		if (po)
   511 		{
   512 			// go up
   513 			itLast=this;
   514 			lmo=po->next();
   515 			itLast=this;
   516 			return lmo;
   517 		}	
   518 		else
   519 		{
   520 			// can't go up, I am mapCenter
   521 			itLast=NULL;
   522 			return NULL;
   523 		}	
   524 	}	
   525 }
   526 
   527 BranchObj* BranchObj::getLastIterator()
   528 {
   529 	return itLast;
   530 }
   531 
   532 void BranchObj::setLastIterator(BranchObj* it)
   533 {
   534 	itLast=it;
   535 }
   536 
   537 void BranchObj::positionContents()
   538 {
   539 	FloatImageObj *fio;
   540     for (fio=floatimage.first(); fio; fio=floatimage.next() )
   541 		fio->reposition();
   542 	OrnamentedObj::positionContents();
   543 }
   544 
   545 void BranchObj::move (double x, double y)
   546 {
   547 	OrnamentedObj::move (x,y);
   548 	FloatImageObj *fio;
   549     for (fio=floatimage.first(); fio; fio=floatimage.next() )
   550 		fio->reposition();
   551     positionBBox();
   552 }
   553 
   554 void BranchObj::move (QPoint p)
   555 {
   556 	move (p.x(), p.y());
   557 }
   558 
   559 void BranchObj::moveBy (double x, double y)
   560 {
   561 	OrnamentedObj::moveBy (x,y);
   562     BranchObj* b;
   563     for (b=branch.first(); b;b=branch.next() ) 
   564 		b->moveBy (x,y);
   565     positionBBox();
   566 }
   567 	
   568 void BranchObj::moveBy (QPoint p)
   569 {
   570 	moveBy (p.x(), p.y());
   571 }
   572 
   573 
   574 void BranchObj::positionBBox()
   575 {
   576 	QPoint ap=getAbsPos();
   577 	bbox.moveTopLeft (ap);
   578 	positionContents();
   579 	setSelBox();
   580 
   581 	// set the frame
   582 	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
   583 
   584 	// Update links to other branches
   585 	XLinkObj *xlo;
   586     for (xlo=xlink.first(); xlo; xlo=xlink.next() )
   587 		xlo->updateXLink();
   588 }
   589 
   590 void BranchObj::calcBBoxSize()
   591 {
   592     QSize heading_r=heading->getSize();
   593     int heading_w=(int) heading_r.width() ;
   594     int heading_h=(int) heading_r.height() ;
   595     QSize sysflags_r=systemFlags->getSize();
   596 	int sysflags_h=sysflags_r.height();
   597 	int sysflags_w=sysflags_r.width();
   598     QSize stanflags_r=standardFlags->getSize();
   599 	int stanflags_h=stanflags_r.height();
   600 	int stanflags_w=stanflags_r.width();
   601     int w;
   602     int h;
   603 
   604 	// set width to sum of all widths
   605 	w=heading_w + sysflags_w + stanflags_w;
   606 	// set height to maximum needed height
   607 	h=max (sysflags_h,stanflags_h);
   608 	h=max (h,heading_h);
   609 
   610 	// Save the dimension of flags and heading
   611 	ornamentsBBox.setSize ( QSize(w,h));
   612 
   613 	// clickBox includes Flags and Heading
   614     clickBox.setSize (ornamentsBBox.size() );
   615 
   616 	// Floatimages 
   617 	QPoint rp;
   618 	FloatImageObj *foi;
   619 
   620 	topPad=botPad=leftPad=rightPad=0;
   621 	if (includeImagesVer || includeImagesHor)
   622 	{
   623 		if (countFloatImages()>0)
   624 		{
   625 			for (foi=floatimage.first(); foi; foi=floatimage.next() )
   626 			{
   627 				rp=foi->getRelPos();
   628 				if (includeImagesVer)
   629 				{
   630 					if (rp.y() < 0) 
   631 						topPad=max (topPad,-rp.y()-h);
   632 					if (rp.y()+foi->height() > 0)
   633 						botPad=max (botPad,rp.y()+foi->height());
   634 				}		
   635 				if (includeImagesHor)
   636 				{
   637 					if (orientation==OrientRightOfCenter)
   638 					{
   639 						if (-rp.x()-w > 0) 
   640 							leftPad=max (leftPad,-rp.x()-w);
   641 						if (rp.x()+foi->width() > 0)
   642 							rightPad=max (rightPad,rp.x()+foi->width());
   643 					} else
   644 					{
   645 						if (rp.x()< 0) 
   646 							leftPad=max (leftPad,-rp.x());
   647 						if (rp.x()+foi->width() > w)
   648 							rightPad=max (rightPad,rp.x()+foi->width()-w);
   649 					}
   650 				}		
   651 			}	
   652 		}	
   653 		h+=topPad+botPad;
   654 		w+=leftPad+rightPad;
   655 	}
   656 
   657 	// Frame thickness
   658     w+=frame->getBorder();
   659     h+=frame->getBorder();
   660 	
   661 	// Finally set size
   662     bbox.setSize (QSize (w,h));
   663 }
   664 
   665 void BranchObj::setDockPos()
   666 {
   667 	if (getOrientation()==OrientLeftOfCenter )
   668     {
   669 		childPos=QPoint (ornamentsBBox.bottomLeft().x(), ornamentsBBox.bottomLeft().y() );
   670 		parPos=QPoint (ornamentsBBox.bottomRight().x(),ornamentsBBox.bottomRight().y() );
   671     } else
   672     {
   673 		childPos=QPoint (ornamentsBBox.bottomRight().x(), ornamentsBBox.bottomRight().y() );
   674 		parPos=QPoint (ornamentsBBox.bottomLeft().x(),ornamentsBBox.bottomLeft().y() );
   675     }
   676 }
   677 LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO)
   678 {
   679 	// Search branches
   680     BranchObj *b;
   681     LinkableMapObj *lmo;
   682     for (b=branch.first(); b; b=branch.next() )
   683     {	
   684 		lmo=b->findMapObj(p, excludeLMO);
   685 		if (lmo != NULL) return lmo;
   686     }
   687 	
   688 	// Search myself
   689     if (inBox (p) && (this != excludeLMO) && isVisibleObj() ) 
   690 		return this;
   691 
   692 	// Search float images
   693 	FloatImageObj *foi;
   694     for (foi=floatimage.first(); foi; foi=floatimage.next() )
   695 		if (foi->inBox(p) && 
   696 			(foi != excludeLMO) && 
   697 			foi->getParObj()!= excludeLMO &&
   698 			foi->isVisibleObj() 
   699 		) return foi;
   700 
   701     return NULL;
   702 }
   703 
   704 void BranchObj::setHeading(QString s)
   705 {
   706     heading->setText(s);	// set new heading
   707 	calcBBoxSize();			// recalculate bbox
   708     positionBBox();			// rearrange contents
   709 	requestReposition();
   710 }
   711 
   712 void BranchObj::setHideTmp (HideTmpMode mode)
   713 {
   714 	if (mode==HideExport && hasHiddenExportParent(this))
   715 	{
   716 		setVisibility (false);
   717 		hidden=true;
   718 	}else
   719 	{
   720 		if (hasScrolledParent(this))
   721 			setVisibility (false);
   722 		else
   723 			setVisibility (true);
   724 		hidden=false;
   725 	}	
   726 
   727     BranchObj *bo;
   728     for (bo=branch.first(); bo; bo=branch.next() )
   729 		bo->setHideTmp (mode);
   730 }
   731 
   732 bool BranchObj::hasHiddenExportParent(BranchObj *start)
   733 {
   734 	// Calls parents recursivly to
   735 	// find out, if we are temp. hidden
   736 
   737 	if (hideExport) return true;
   738 
   739 	BranchObj* bo=(BranchObj*)(parObj);
   740 	if (bo) 
   741 		return bo->hasHiddenExportParent(start);
   742 	else
   743 		return false;
   744 }
   745 
   746 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
   747 {
   748 	if (hidden) return "";
   749 
   750     QString s,a;
   751 	QString scrolledAttr;
   752 	if (scrolled) 
   753 		scrolledAttr=attribut ("scrolled","yes");
   754 	else
   755 		scrolledAttr="";
   756 
   757 	QString frameAttr;
   758 	if (frame->getFrameType()!=NoFrame)
   759 		frameAttr=attribut ("frameType",frame->getFrameTypeName());
   760 	else
   761 		frameAttr="";
   762 
   763 	// save area, if not scrolled
   764 	QString areaAttr;
   765 	if (!((BranchObj*)(parObj))->isScrolled() )
   766 	{
   767 		areaAttr=
   768 			attribut("x1",QString().setNum(absPos.x()-offset.x(),10)) +
   769 			attribut("y1",QString().setNum(absPos.y()-offset.y(),10)) +
   770 			attribut("x2",QString().setNum(absPos.x()+width()-offset.x(),10)) +
   771 			attribut("y2",QString().setNum(absPos.y()+height()-offset.y(),10));
   772 
   773 	} else
   774 		areaAttr="";
   775 	
   776 	// Providing an ID for a branch makes export to XHTML easier
   777 	QString idAttr;
   778 	if (countXLinks()>0)
   779 		idAttr=attribut ("id",getSelectString());
   780 	else
   781 		idAttr="";
   782 
   783     s=beginElement ("branch" 
   784 		+getOrnAttr() 
   785 		+scrolledAttr 
   786 		+frameAttr 
   787 		+areaAttr 
   788 		+idAttr 
   789 		+getIncludeImageAttr() );
   790     incIndent();
   791 
   792 	// save heading
   793     s+=valueElement("heading", getHeading(),
   794 		attribut ("textColor",QColor(heading->getColor()).name()));
   795 
   796 	// save names of flags set
   797 	s+=standardFlags->saveToDir(tmpdir,prefix,0);
   798 	
   799 	// Save FloatImages
   800 	FloatImageObj *fio;
   801 	for (fio=floatimage.first(); fio; fio=floatimage.next() )
   802 		s+=fio->saveToDir (tmpdir,prefix,offset);
   803 
   804 	// save note
   805 	if (!note.isEmpty() )
   806 		s+=note.saveToDir();
   807 	
   808 	// Save branches
   809     BranchObj *bo;
   810     for (bo=branch.first(); bo; bo=branch.next() )
   811 		s+=bo->saveToDir(tmpdir,prefix,offset);
   812 
   813 	// Save XLinks
   814 	XLinkObj *xlo;
   815 	QString ol;	// old link
   816 	QString cl;	// current link
   817     for (xlo=xlink.first(); xlo; xlo=xlink.next() )
   818 	{
   819 		cl=xlo->saveToDir();
   820 		if (cl!=ol)
   821 		{
   822 			s+=cl;
   823 			ol=cl;
   824 		} else
   825 		{
   826 			qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
   827 		}
   828 	}	
   829 
   830     decIndent();
   831     s+=endElement   ("branch");
   832     return s;
   833 }
   834 
   835 void BranchObj::addXLink (XLinkObj *xlo)
   836 {
   837 	xlink.append (xlo);
   838 	
   839 }
   840 
   841 void BranchObj::removeXLinkRef (XLinkObj *xlo)
   842 {
   843 	xlink.remove (xlo);
   844 }
   845 
   846 void BranchObj::deleteXLink(XLinkObj *xlo)
   847 {
   848 	xlo->deactivate();
   849 	if (!xlo->isUsed()) delete (xlo);
   850 }
   851 
   852 void BranchObj::deleteXLinkAt (int i)
   853 {
   854 	XLinkObj *xlo=xlink.at(i);
   855 	xlo->deactivate();
   856 	if (!xlo->isUsed()) delete(xlo);
   857 }
   858 
   859 XLinkObj* BranchObj::XLinkAt (int i)
   860 {
   861 	return xlink.at(i);
   862 }
   863 
   864 int BranchObj::countXLink()
   865 {
   866 	return xlink.count();
   867 }
   868 
   869 
   870 BranchObj* BranchObj::XLinkTargetAt (int i)
   871 {
   872 	if (xlink.at(i))
   873 		return xlink.at(i)->otherBranch (this);
   874 	else
   875 		return NULL;
   876 }
   877 
   878 void BranchObj::setIncludeImagesVer(bool b)
   879 {
   880 	includeImagesVer=b;
   881 	calcBBoxSize();
   882 	positionBBox();
   883 	requestReposition();
   884 }
   885 
   886 bool BranchObj::getIncludeImagesVer()
   887 {
   888 	return includeImagesVer;
   889 }
   890 
   891 void BranchObj::setIncludeImagesHor(bool b)
   892 {
   893 	includeImagesHor=b;
   894 	calcBBoxSize();
   895 	positionBBox();
   896 	requestReposition();
   897 }
   898 
   899 bool BranchObj::getIncludeImagesHor()
   900 {
   901 	return includeImagesHor;
   902 }
   903 
   904 QString BranchObj::getIncludeImageAttr()
   905 {
   906 	QString a;
   907 	if (includeImagesVer)
   908 		a=attribut ("incImgV","true");
   909 	else
   910 		a=attribut ("incImgV","false");
   911 	if (includeImagesHor)
   912 		a+=attribut ("incImgH","true");
   913 	else
   914 		a+=attribut ("incImgH","false");
   915 	return a;	
   916 }
   917 
   918 LinkableMapObj* BranchObj::addFloatImage ()
   919 {
   920 	FloatImageObj *newfi=new FloatImageObj (canvas,this);
   921 	floatimage.append (newfi);
   922 	if (hasScrolledParent(this) )
   923 		newfi->setVisibility (false);
   924 	else	
   925 		newfi->setVisibility(visible);
   926 	calcBBoxSize();
   927 	positionBBox();
   928 	requestReposition();
   929 	return newfi;
   930 }
   931 
   932 LinkableMapObj* BranchObj::addFloatImage (FloatImageObj *fio)
   933 {
   934 	FloatImageObj *newfi=new FloatImageObj (canvas,this);
   935 	floatimage.append (newfi);
   936 	newfi->copy (fio);
   937 	if (hasScrolledParent(this) )
   938 		newfi->setVisibility (false);
   939 	else	
   940 		newfi->setVisibility(visible);
   941 	calcBBoxSize();
   942 	positionBBox();
   943 	requestReposition();
   944 	return newfi;
   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 || depth==1) 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) // modify my childlist
  1162 {
  1163 	savePosInAngle();
  1164     int i=branch.find(bo1);
  1165 	cout << "BO: i="<<i<<endl;
  1166     if (i>0) 
  1167 	{	// -1 if bo1 not found 
  1168 		branch.at(i)->angle--;
  1169 		branch.at(i-1)->angle++;
  1170 		branch.sort();
  1171 		return branch.at(i);
  1172 	} else
  1173 		return NULL;
  1174 }
  1175 
  1176 bool BranchObj::canMoveBranchDown() 
  1177 {
  1178 	if (!parObj|| depth==1) return false;
  1179 	BranchObj* par=(BranchObj*)parObj;
  1180 	if (this==par->getLastBranch())
  1181 		return false;
  1182 	else
  1183 		return true;
  1184 }
  1185 
  1186 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
  1187 {
  1188 	savePosInAngle();
  1189     int i=branch.find(bo1);
  1190 	int j;
  1191 	if (branch.next())
  1192 	{
  1193 		j = branch.at();
  1194 		branch.at(i)->angle++;
  1195 		branch.at(j)->angle--;
  1196 		branch.sort();
  1197 		return branch.at(i);
  1198 	} else
  1199 		return NULL;
  1200 }
  1201 
  1202 BranchObj* BranchObj::moveBranchTo (BranchObj* dst, int pos)
  1203 {
  1204 	// Find current parent and 
  1205 	// remove pointer to myself there
  1206 	if (!dst) return NULL;
  1207 	BranchObj *par=(BranchObj*)(parObj);
  1208 	if (par)
  1209 		par->removeBranchPtr (this);
  1210 	else
  1211 		return NULL;
  1212 
  1213 	// Create new pointer to myself at dst
  1214 	if (pos<0||dst->getDepth()==0)
  1215 	{	
  1216 		// links myself as last branch at dst
  1217 		dst->addBranchPtr (this);
  1218 		updateLink();
  1219 		return this;
  1220 	} else
  1221 	{
  1222 		// inserts me at pos in parent of dst
  1223 		if (par)
  1224 		{
  1225 			BranchObj *bo=dst->insertBranchPtr (this,pos);
  1226 			bo->setDefAttr(MovedBranch);
  1227 			updateLink();
  1228 			return bo;
  1229 
  1230 		} else
  1231 			return NULL;
  1232 	}	
  1233 }
  1234 
  1235 void BranchObj::alignRelativeTo (QPoint ref)
  1236 {
  1237 	int th = bboxTotal.height();	
  1238 // TODO testing
  1239 /*
  1240 	cout << "BO::alignRelTo "<<getHeading()<<endl;
  1241 	cout << "  d="<<depth<<
  1242 		"  ref="<<ref<<
  1243 //		"  bbox.topLeft="<<bboxTotal.topLeft()<<
  1244 		"  absPos="<<absPos<<
  1245 //		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
  1246 		"  hidden="<<hidden<<
  1247 		"  th="<<th<<endl;
  1248 */
  1249 
  1250 	// If I am the mapcenter or a mainbranch, reposition heading
  1251 	if (depth<2)
  1252 	{
  1253 		if (depth==1)
  1254 			// Calc angle to mapCenter if I am a mainbranch
  1255 			// needed for reordering the mainbranches clockwise 
  1256 			// around mapcenter 
  1257 			angle=getAngle (QPoint ((int)(x() - parObj->getChildPos().x() ), 
  1258 									(int)(y() - parObj->getChildPos().y() ) ) );
  1259 	} 
  1260 	else
  1261     {
  1262 		// Align myself depending on orientation and parent, but
  1263 		// only if I am not the mainbranch or mapcenter itself
  1264 		switch (orientation) 
  1265 		{
  1266 			case OrientLeftOfCenter:
  1267 				move (ref.x() - bbox.width(), ref.y() + (th-bbox.height())/2 );
  1268 			break;
  1269 			case OrientRightOfCenter:	
  1270 				move (ref.x() , ref.y() + (th-bbox.height())/2  );
  1271 			break;
  1272 			default:
  1273 				qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
  1274 			break;
  1275 		}		
  1276     }		
  1277 
  1278 	if (scrolled) return;
  1279 
  1280     // Set reference point for alignment of childs
  1281     QPoint ref2;
  1282     if (orientation==OrientLeftOfCenter)
  1283 		ref2.setX(bbox.topLeft().x() - linkwidth);
  1284     else	
  1285 		ref2.setX(bbox.topRight().x() + linkwidth);
  1286 
  1287 	if (depth==1)
  1288 		ref2.setY(absPos.y()-(bboxTotal.height()-bbox.height())/2);
  1289 	else	
  1290 		ref2.setY(ref.y() );	
  1291 
  1292     // Align the childs depending on reference point 
  1293     BranchObj *b;
  1294     for (b=branch.first(); b; b=branch.next() )
  1295     {	
  1296 		if (!b->isHidden())
  1297 		{
  1298 			b->alignRelativeTo (ref2);
  1299 			ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
  1300 		}
  1301     }
  1302 }
  1303 
  1304 
  1305 void BranchObj::reposition()
  1306 {	
  1307 /* TODO testing only
  1308 	if (!getHeading().isEmpty())
  1309 		cout << "BO::reposition  "<<getHeading()<<endl;
  1310 	else	
  1311 		cout << "BO::reposition  ???"<<endl;
  1312 */		
  1313 	if (depth==0)
  1314 	{
  1315 		// only calculate the sizes once. If the deepest LMO 
  1316 		// changes its height,
  1317 		// all upper LMOs have to change, too.
  1318 		calcBBoxSizeWithChilds();
  1319 		updateLink();	// This update is needed if the canvas is resized 
  1320 						// due to excessive moving of a FIO
  1321 
  1322 	    alignRelativeTo ( QPoint (absPos.x(),
  1323 			absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  1324 		branch.sort();	
  1325 		positionBBox();	// Reposition bbox and contents
  1326 	} else
  1327 	{
  1328 		// This is only important for moving branches:
  1329 		// For editing a branch it isn't called...
  1330 	    alignRelativeTo ( QPoint (absPos.x(),
  1331 							absPos.y()-(bboxTotal.height()-bbox.height())/2) );
  1332 	}
  1333 }
  1334 
  1335 
  1336 QRect BranchObj::getTotalBBox()
  1337 {
  1338 	QRect r=bbox;
  1339 
  1340 	if (scrolled) return r;
  1341 
  1342 	BranchObj* b;
  1343 	for (b=branch.first();b ;b=branch.next() )
  1344 		if (!b->isHidden())
  1345 			r=addBBox(b->getTotalBBox(),r);
  1346 
  1347 	FloatImageObj* fio;
  1348 	for (fio=floatimage.first();fio ;fio=floatimage.next() )
  1349 		if (!fio->isHidden())
  1350 			r=addBBox(fio->getTotalBBox(),r);
  1351 		
  1352 	return r;
  1353 }
  1354 
  1355 QRect BranchObj::getBBoxSizeWithChilds()
  1356 {
  1357 	return bboxTotal;
  1358 }
  1359 
  1360 void BranchObj::calcBBoxSizeWithChilds()
  1361 {	
  1362 	// This is initially called only from reposition and
  1363 	// and only for mapcenter. So it won't be
  1364 	// called more than once for a single user 
  1365 	// action
  1366 	
  1367 
  1368 	// Calculate size of LMO including all childs (to align them later)
  1369 	bboxTotal.setX(bbox.x() );
  1370 	bboxTotal.setY(bbox.y() );
  1371 
  1372 	// if branch is scrolled, ignore childs, but still consider floatimages
  1373 	if (scrolled)
  1374 	{
  1375 		bboxTotal.setWidth (bbox.width());
  1376 		bboxTotal.setHeight(bbox.height());
  1377 		return;
  1378 	}
  1379 	
  1380 	if (hidden)
  1381 	{
  1382 		bboxTotal.setWidth (0);
  1383 		bboxTotal.setHeight(0);
  1384 		if (parObj)
  1385 		{
  1386 			bboxTotal.setX (parObj->x());
  1387 			bboxTotal.setY (parObj->y());
  1388 		} else
  1389 		{
  1390 			bboxTotal.setX (bbox.x());
  1391 			bboxTotal.setY (bbox.y());
  1392 		}
  1393 		return;
  1394 	}
  1395 	
  1396 	QRect r(0,0,0,0);
  1397 	QRect br;
  1398 	// Now calculate recursivly
  1399 	// sum of heights 
  1400 	// maximum of widths 
  1401 	// minimum of y
  1402 	BranchObj* b;
  1403 	for (b=branch.first();b ;b=branch.next() )
  1404 	{
  1405 		if (!b->isHidden())
  1406 		{
  1407 			b->calcBBoxSizeWithChilds();
  1408 			br=b->getBBoxSizeWithChilds();
  1409 			r.setWidth( max (br.width(), r.width() ));
  1410 			r.setHeight(br.height() + r.height() );
  1411 			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
  1412 		}
  1413 	}
  1414 	// Add myself and also
  1415 	// add width of link to sum if necessary
  1416 	if (branch.isEmpty())
  1417 		bboxTotal.setWidth (bbox.width() + r.width() );
  1418 	else	
  1419 		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
  1420 	
  1421 	bboxTotal.setHeight(max (r.height(),  bbox.height()));
  1422 }
  1423 
  1424 void BranchObj::select()
  1425 {
  1426 	// set Text in Editor	
  1427 	textEditor->setText(note.getNote() );
  1428 	QString fnh=note.getFilenameHint();
  1429 	if (fnh!="")
  1430 		textEditor->setFilenameHint(note.getFilenameHint() );
  1431 	else	
  1432 		textEditor->setFilenameHint(getHeading() );
  1433 	textEditor->setFontHint (note.getFontHint() );
  1434 
  1435     LinkableMapObj::select();
  1436 	// Tell parent that I am selected now:
  1437 	BranchObj* po=(BranchObj*)(parObj);
  1438     if (po)	// TODO	    Try to get rid of this cast...
  1439         po->setLastSelectedBranch(this);
  1440 		
  1441 	// temporary unscroll, if we have scrolled parents somewhere
  1442 	if (parObj) ((BranchObj*)(parObj))->tmpUnscroll();
  1443 
  1444 	// Show URL and link in statusbar
  1445 	QString status;
  1446 	if (!url.isEmpty()) status+="URL: "+url+"  ";
  1447 	if (!vymLink.isEmpty()) status+="Link: "+vymLink;
  1448 	if (!status.isEmpty()) mainWindow->statusMessage (status);
  1449 
  1450 	// Update Toolbar
  1451 	updateFlagsToolbar();
  1452 
  1453 	// Update actions in mapeditor
  1454 	mapEditor->updateActions();
  1455 }
  1456 
  1457 void BranchObj::unselect()
  1458 {
  1459 	LinkableMapObj::unselect();
  1460 	// Delete any messages like vymLink in StatusBar
  1461 	mainWindow->statusMessage ("");
  1462 
  1463 	// save note from editor and set flag
  1464 	// text is done by updateNoteFlag(), just save
  1465 	// filename here
  1466 	note.setFilenameHint (textEditor->getFilename());
  1467 
  1468 	// reset temporary unscroll, if we have scrolled parents somewhere
  1469 	if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();
  1470 
  1471 	// Erase content of editor 
  1472 	textEditor->setInactive();
  1473 
  1474 	// unselect all buttons in toolbar
  1475 	standardFlagsDefault->updateToolbar();
  1476 }
  1477 
  1478 QString BranchObj::getSelectString()
  1479 {
  1480 	QString s;
  1481 	if (parObj)
  1482 	{
  1483 		if (depth==1)
  1484 			s= "bo:" + QString("%1").arg(getNum());
  1485 		else	
  1486 			s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
  1487 	} else
  1488 		s="mc:";
  1489 	return s;
  1490 }
  1491