diff -r 4a84d7e444d8 -r c2ce9944148c branchitem.cpp --- a/branchitem.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/branchitem.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -1,3 +1,4 @@ +#include "attributeitem.h" #include "branchitem.h" #include "branchobj.h" #include "vymmodel.h" @@ -118,7 +119,7 @@ +getMapAttr() +getGeneralAttr() +scrolledAttr - // +areaAttr // FIXME-2 + // +areaAttr // FIXME-4 not needed anymore. Wait until end of 2010 before removing... +idAttr +getIncludeImageAttr() ); @@ -290,7 +291,7 @@ return result; } -void BranchItem::sortChildren() +void BranchItem::sortChildren(bool inverse) { int childCount=branchCounter; int curChildIndex; @@ -298,15 +299,28 @@ do { madeChanges=false; - for(curChildIndex=1;curChildIndexgetHeading().compare(curChild->getHeading())>0) + if (inverse) + for(curChildIndex=1;curChildIndexmoveUp(curChild); - madeChanges=true; + BranchItem* curChild =getBranchNum(curChildIndex); + BranchItem* prevChild=getBranchNum(curChildIndex-1); + if (prevChild->getHeading().compare(curChild->getHeading())<0) + { + model->moveUp (curChild); + madeChanges=true; + } + } + else + for(curChildIndex=1;curChildIndexgetHeading().compare(curChild->getHeading())>0) + { + model->moveUp(curChild); + madeChanges=true; + } } - } }while(madeChanges); } @@ -387,7 +401,6 @@ - TreeItem* BranchItem::findMapItem (QPointF p, TreeItem* excludeTI) { // Search branches @@ -415,34 +428,24 @@ mo->isVisibleObj() ) return ii; } + + // Search attributes + AttributeItem *ai; + for (int i=0; igetLMO(); + if (mo && mo->isInClickBox(p) && + (ii != excludeTI) && + this!= excludeTI && + mo->isVisibleObj() + ) return ai; + } + return NULL; } -/* -TreeItem* BranchItem::findID (QString sid) //FIXME-3 move to TreeItem //FIXME-4 search images -{ - // Search branches - TreeItem *ti; - for (int i=0; ifindID (sid); - if (ti != NULL) return ti; - } - - // Search myself - if (sid==objID) return this; - - // Search float images - for (int i=0; iinBox(p) && - (floatimage.at(i) != excludeLMO) && - floatimage.at(i)->getParObj()!= excludeLMO && - floatimage.at(i)->isVisibleObj() - ) return floatimage.at(i); - return NULL; -} -*/ -void BranchItem::updateStyles() +void BranchItem::updateStyles(const bool &keepFrame) { // FIXME-5 compare also MapItem::initLMO... @@ -452,7 +455,7 @@ lmo->setParObj ( ((MapItem*)parentItem)->getLMO() ); else lmo->setParObj (NULL); - ((BranchObj*)lmo)->setDefAttr(BranchObj::MovedBranch); + ((BranchObj*)lmo)->setDefAttr(BranchObj::MovedBranch,keepFrame); } }