diff -r 6783e13bb05d -r f688a9913724 branchobj.cpp --- a/branchobj.cpp Sat Apr 09 22:50:08 2005 +0000 +++ b/branchobj.cpp Mon Apr 18 06:17:00 2005 +0000 @@ -87,7 +87,7 @@ { branch.setAutoDelete (false); floatimage.setAutoDelete (true); - link.setAutoDelete (false); + xlink.setAutoDelete (false); if (parObj) { @@ -141,8 +141,8 @@ void BranchObj::clear() { floatimage.clear(); - while (!link.isEmpty()) - deleteLink (link.first() ); + while (!xlink.isEmpty()) + deleteXLink (xlink.first() ); BranchObj *bo; while (!branch.isEmpty()) @@ -163,7 +163,12 @@ int BranchObj::getNum(BranchObj *bo) { - return branch.findRef (bo); + // keep current pointer in branch, + // otherwise save might fail + int cur=branch.at(); + int ind=branch.findRef (bo); + branch.at(cur); + return ind; } int BranchObj::getFloatImageNum(FloatImageObj *fio) @@ -181,9 +186,9 @@ return floatimage.count(); } -int BranchObj::countLinks() +int BranchObj::countXLinks() { - return link.count(); + return xlink.count(); } void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off) @@ -380,9 +385,9 @@ FloatImageObj *fio; for (fio=floatimage.first(); fio; fio=floatimage.next()) fio->setVisibility (v); - LinkObj* lo; - for (lo=link.first(); lo;lo=link.next() ) - lo->setVisibility (); + XLinkObj* xlo; + for (xlo=xlink.first(); xlo;xlo=xlink.next() ) + xlo->setVisibility (); } } // depth <= toDepth requestReposition(); @@ -599,9 +604,9 @@ frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) ); // Update links to other branches - LinkObj *l; - for (l=link.first(); l; l=link.next() ) - l->updateLink(); + XLinkObj *xlo; + for (xlo=xlink.first(); xlo; xlo=xlink.next() ) + xlo->updateXLink(); } void BranchObj::calcBBoxSize() @@ -783,53 +788,55 @@ BranchObj *bo; for (bo=branch.first(); bo; bo=branch.next() ) s+=bo->saveToDir(tmpdir,prefix,offset); - decIndent(); // Save FloatImages FloatImageObj *fio; for (fio=floatimage.first(); fio; fio=floatimage.next() ) s+=fio->saveToDir (tmpdir,prefix); + // Save XLinks + XLinkObj *xlo; + for (xlo=xlink.first(); xlo; xlo=xlink.next() ) + s+=xlo->saveToDir(); + + decIndent(); s+=endElement ("branch"); return s; } -void BranchObj::addLink (LinkObj *lo) +void BranchObj::addXLink (XLinkObj *xlo) { - link.append (lo); + xlink.append (xlo); } -void BranchObj::removeLinkRef (LinkObj *lo) +void BranchObj::removeXLinkRef (XLinkObj *xlo) { - link.remove (lo); + xlink.remove (xlo); } -void BranchObj::deleteLink(LinkObj *lo) +void BranchObj::deleteXLink(XLinkObj *xlo) { - lo->deactivate(); - if (!lo->isUsed()) delete (lo); + xlo->deactivate(); + if (!xlo->isUsed()) delete (xlo); } -void BranchObj::deleteLinkAt (int i) +void BranchObj::deleteXLinkAt (int i) { - LinkObj *lo=link.at(i); - lo->deactivate(); - if (!lo->isUsed()) - { - delete(lo); - } + XLinkObj *xlo=xlink.at(i); + xlo->deactivate(); + if (!xlo->isUsed()) delete(xlo); } -int BranchObj::countLink() +int BranchObj::countXLink() { - return link.count(); + return xlink.count(); } -BranchObj* BranchObj::linkTargetAt (int i) +BranchObj* BranchObj::XLinkTargetAt (int i) { - if (link.at(i)) - return link.at(i)->otherBranch (this); + if (xlink.at(i)) + return xlink.at(i)->otherBranch (this); else return NULL; } @@ -1312,15 +1319,12 @@ QString s; if (parObj) { - if (parObj->getDepth()==0) + if (depth==1) s= "bo:" + QString("%1").arg(getNum()); else s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum()); } else - { s="mc:"; - } - return s; }