1.1 --- a/branchobj.cpp Mon Aug 01 20:45:55 2005 +0000
1.2 +++ b/branchobj.cpp Tue Aug 02 08:12:14 2005 +0000
1.3 @@ -95,10 +95,6 @@
1.4 absPos+=parObj->getChildPos();
1.5 }
1.6
1.7 - // TODO This should be done in TextObj later
1.8 - QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
1.9 - heading->setFont(font );
1.10 -
1.11 lastSelectedBranch=-1;
1.12
1.13 setChildObj(this);
1.14 @@ -661,23 +657,14 @@
1.15 return NULL;
1.16 }
1.17
1.18 -int BranchObj::getDefHeadingSize()
1.19 -{
1.20 - if (depth==0)
1.21 - return 16;
1.22 - else
1.23 - if (depth==1)
1.24 - return 12;
1.25 - else
1.26 - return 10;
1.27 -}
1.28 -
1.29 void BranchObj::setHeading(QString s)
1.30 {
1.31 + /*FIXME
1.32 // Adjusting font size
1.33 QFont font=heading->getFont();
1.34 font.setPointSize(getDefHeadingSize() );
1.35 heading->setFont(font);
1.36 + */
1.37 heading->setText(s); // set new heading
1.38 calcBBoxSize(); // recalculate bbox
1.39 positionBBox(); // rearrange contents
1.40 @@ -913,15 +900,35 @@
1.41 }
1.42 }
1.43
1.44 +void BranchObj::setDefAttr (BranchModification mod)
1.45 +{
1.46 + int fontsize;
1.47 + switch (depth)
1.48 + {
1.49 + case 0: fontsize=16; break;
1.50 + case 1: fontsize=12; break;
1.51 + default: fontsize=10; break;
1.52 + }
1.53 +
1.54 + setLinkColor ();
1.55 + setLinkStyle(getDefLinkStyle());
1.56 + QFont font("Sans Serif,8,-1,5,50,0,0,0,0,0");
1.57 + font.setPointSize(fontsize);
1.58 + heading->setFont(font );
1.59 +
1.60 + if (mod==NewBranch)
1.61 + setColor (((BranchObj*)(parObj))->getColor(),false);
1.62 +
1.63 + calcBBoxSize();
1.64 +}
1.65 +
1.66 BranchObj* BranchObj::addBranch()
1.67 {
1.68 BranchObj* newbo=new BranchObj(canvas,this);
1.69 branch.append (newbo);
1.70 newbo->setParObj(this);
1.71 - newbo->setColor(getColor(),false);
1.72 - newbo->setLinkColor();
1.73 + newbo->setDefAttr(NewBranch);
1.74 newbo->setHeading ("new");
1.75 - newbo->setLinkStyle (newbo->getDefLinkStyle());
1.76 if (scrolled)
1.77 newbo->setVisibility (false);
1.78 else
1.79 @@ -937,8 +944,7 @@
1.80 branch.append (newbo);
1.81 newbo->copy(bo);
1.82 newbo->setParObj(this);
1.83 - newbo->setHeading (newbo->getHeading()); // adjust fontsize to depth
1.84 - newbo->setLinkStyle (newbo->getDefLinkStyle());
1.85 + newbo->setDefAttr(NewBranch);
1.86 if (scrolled)
1.87 newbo->setVisibility (false);
1.88 else
1.89 @@ -953,7 +959,7 @@
1.90 branch.append (bo);
1.91 bo->setParObj (this);
1.92 bo->depth=depth+1;
1.93 - bo->setLinkStyle (bo->getDefLinkStyle() );
1.94 + bo->setDefAttr(MovedBranch);
1.95 if (scrolled) tmpUnscroll();
1.96 setLastSelectedBranch (bo);
1.97 return bo;
1.98 @@ -987,7 +993,7 @@
1.99 branch.append (bo);
1.100 bo->setParObj (this);
1.101 bo->depth=depth+1;
1.102 - bo->setLinkStyle (bo->getDefLinkStyle() );
1.103 + bo->setDefAttr (MovedBranch);
1.104 if (scrolled) tmpUnscroll();
1.105 setLastSelectedBranch (bo);
1.106 branch.sort();
1.107 @@ -1116,7 +1122,7 @@
1.108 if (par)
1.109 {
1.110 BranchObj *bo=dst->insertBranchPtr (this,pos);
1.111 - bo->setHeading (bo->getHeading());
1.112 + bo->setDefAttr(MovedBranch);
1.113 return bo;
1.114
1.115 } else