diff -r 4a84d7e444d8 -r c2ce9944148c branchobj.cpp --- a/branchobj.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/branchobj.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -1,5 +1,6 @@ #include "branchobj.h" +#include "attributeitem.h" #include "branchitem.h" #include "geometry.h" #include "mapeditor.h" @@ -439,26 +440,22 @@ if (changed) updateContentSize(); } -void BranchObj::setDefAttr (BranchModification mod) +void BranchObj::setDefAttr (BranchModification mod, bool keepFrame) { int fontsize; switch (treeItem->depth()) { case 0: fontsize=16; - setFrameType (FrameObj::Rectangle); break; case 1: fontsize=14; - setFrameType (FrameObj::NoFrame); break; case 2: fontsize=12; - setFrameType (FrameObj::NoFrame); break; default: fontsize=10; - setFrameType (FrameObj::NoFrame); break; } setLinkStyle(getDefLinkStyle(treeItem->parent() )); @@ -467,12 +464,20 @@ font.setPointSize(fontsize); heading->setFont(font ); + if (mod==NewBranch && !keepFrame) + if (treeItem->depth()==0) + setFrameType (FrameObj::Rectangle); + else + setFrameType (FrameObj::NoFrame); + if (mod==NewBranch) setColor (treeItem->getHeadingColor() ); else + { // Also set styles for children for (int i=0; ibranchCount(); ++i) treeItem->getBranchObjNum(i)->setDefAttr(MovedBranch); + } calcBBoxSize(); } @@ -559,7 +564,21 @@ else ref2.setY(ref.y() ); - // Align the children depending on reference point + // Align the attribute children depending on reference point + // on top like in TreeEditor + for (int i=0; iattributeCount(); ++i) + { + if (!treeItem->getAttributeNum(i)->isHidden()) + { + BranchObj *bo=(BranchObj*)(treeItem->getAttributeNum(i)->getBranchObj()); + if (!bo) break; + bo->alignRelativeTo (ref2,true); + + // append next branch below current one + ref2.setY(ref2.y() + bo->getBBoxSizeWithChildren().height() ); + } + } + // Align the branch children depending on reference point for (int i=0; ibranchCount(); ++i) { if (!treeItem->getBranchNum(i)->isHidden()) @@ -718,8 +737,22 @@ { if (!bi->getBranchNum(i)->isHidden()) { - bi->getBranchObjNum(i)->calcBBoxSizeWithChildren(); - br=bi->getBranchObjNum(i)->getBBoxSizeWithChildren(); + BranchObj *bo=bi->getBranchObjNum(i); + bo->calcBBoxSizeWithChildren(); + br=bo->getBBoxSizeWithChildren(); + r.setWidth( max (br.width(), r.width() )); + r.setHeight(br.height() + r.height() ); + if (br.y()attributeCount(); i++) + { + if (!bi->getAttributeNum(i)->isHidden()) + { + BranchObj *bo=bi->getAttributeNum(i)->getBranchObj(); + bo->calcBBoxSizeWithChildren(); + br=bo->getBBoxSizeWithChildren(); r.setWidth( max (br.width(), r.width() )); r.setHeight(br.height() + r.height() ); if (br.y()