diff -r 0683c8e87fac -r 1b52ff19aad5 branchobj.cpp --- a/branchobj.cpp Mon Aug 01 20:45:55 2005 +0000 +++ b/branchobj.cpp Tue Aug 02 08:12:14 2005 +0000 @@ -95,10 +95,6 @@ absPos+=parObj->getChildPos(); } - // TODO This should be done in TextObj later - QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0"); - heading->setFont(font ); - lastSelectedBranch=-1; setChildObj(this); @@ -661,23 +657,14 @@ return NULL; } -int BranchObj::getDefHeadingSize() -{ - if (depth==0) - return 16; - else - if (depth==1) - return 12; - else - return 10; -} - void BranchObj::setHeading(QString s) { + /*FIXME // Adjusting font size QFont font=heading->getFont(); font.setPointSize(getDefHeadingSize() ); heading->setFont(font); + */ heading->setText(s); // set new heading calcBBoxSize(); // recalculate bbox positionBBox(); // rearrange contents @@ -913,15 +900,35 @@ } } +void BranchObj::setDefAttr (BranchModification mod) +{ + int fontsize; + switch (depth) + { + case 0: fontsize=16; break; + case 1: fontsize=12; break; + default: fontsize=10; break; + } + + setLinkColor (); + setLinkStyle(getDefLinkStyle()); + QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0"); + font.setPointSize(fontsize); + heading->setFont(font ); + + if (mod==NewBranch) + setColor (((BranchObj*)(parObj))->getColor(),false); + + calcBBoxSize(); +} + BranchObj* BranchObj::addBranch() { BranchObj* newbo=new BranchObj(canvas,this); branch.append (newbo); newbo->setParObj(this); - newbo->setColor(getColor(),false); - newbo->setLinkColor(); + newbo->setDefAttr(NewBranch); newbo->setHeading ("new"); - newbo->setLinkStyle (newbo->getDefLinkStyle()); if (scrolled) newbo->setVisibility (false); else @@ -937,8 +944,7 @@ branch.append (newbo); newbo->copy(bo); newbo->setParObj(this); - newbo->setHeading (newbo->getHeading()); // adjust fontsize to depth - newbo->setLinkStyle (newbo->getDefLinkStyle()); + newbo->setDefAttr(NewBranch); if (scrolled) newbo->setVisibility (false); else @@ -953,7 +959,7 @@ branch.append (bo); bo->setParObj (this); bo->depth=depth+1; - bo->setLinkStyle (bo->getDefLinkStyle() ); + bo->setDefAttr(MovedBranch); if (scrolled) tmpUnscroll(); setLastSelectedBranch (bo); return bo; @@ -987,7 +993,7 @@ branch.append (bo); bo->setParObj (this); bo->depth=depth+1; - bo->setLinkStyle (bo->getDefLinkStyle() ); + bo->setDefAttr (MovedBranch); if (scrolled) tmpUnscroll(); setLastSelectedBranch (bo); branch.sort(); @@ -1116,7 +1122,7 @@ if (par) { BranchObj *bo=dst->insertBranchPtr (this,pos); - bo->setHeading (bo->getHeading()); + bo->setDefAttr(MovedBranch); return bo; } else