1.1 --- a/branchobj.cpp Sat Apr 09 22:50:08 2005 +0000
1.2 +++ b/branchobj.cpp Mon Apr 18 06:17:00 2005 +0000
1.3 @@ -87,7 +87,7 @@
1.4 {
1.5 branch.setAutoDelete (false);
1.6 floatimage.setAutoDelete (true);
1.7 - link.setAutoDelete (false);
1.8 + xlink.setAutoDelete (false);
1.9
1.10 if (parObj)
1.11 {
1.12 @@ -141,8 +141,8 @@
1.13 void BranchObj::clear()
1.14 {
1.15 floatimage.clear();
1.16 - while (!link.isEmpty())
1.17 - deleteLink (link.first() );
1.18 + while (!xlink.isEmpty())
1.19 + deleteXLink (xlink.first() );
1.20
1.21 BranchObj *bo;
1.22 while (!branch.isEmpty())
1.23 @@ -163,7 +163,12 @@
1.24
1.25 int BranchObj::getNum(BranchObj *bo)
1.26 {
1.27 - return branch.findRef (bo);
1.28 + // keep current pointer in branch,
1.29 + // otherwise save might fail
1.30 + int cur=branch.at();
1.31 + int ind=branch.findRef (bo);
1.32 + branch.at(cur);
1.33 + return ind;
1.34 }
1.35
1.36 int BranchObj::getFloatImageNum(FloatImageObj *fio)
1.37 @@ -181,9 +186,9 @@
1.38 return floatimage.count();
1.39 }
1.40
1.41 -int BranchObj::countLinks()
1.42 +int BranchObj::countXLinks()
1.43 {
1.44 - return link.count();
1.45 + return xlink.count();
1.46 }
1.47
1.48 void BranchObj::setParObjTmp(LinkableMapObj* lmo, QPoint m, int off)
1.49 @@ -380,9 +385,9 @@
1.50 FloatImageObj *fio;
1.51 for (fio=floatimage.first(); fio; fio=floatimage.next())
1.52 fio->setVisibility (v);
1.53 - LinkObj* lo;
1.54 - for (lo=link.first(); lo;lo=link.next() )
1.55 - lo->setVisibility ();
1.56 + XLinkObj* xlo;
1.57 + for (xlo=xlink.first(); xlo;xlo=xlink.next() )
1.58 + xlo->setVisibility ();
1.59 }
1.60 } // depth <= toDepth
1.61 requestReposition();
1.62 @@ -599,9 +604,9 @@
1.63 frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
1.64
1.65 // Update links to other branches
1.66 - LinkObj *l;
1.67 - for (l=link.first(); l; l=link.next() )
1.68 - l->updateLink();
1.69 + XLinkObj *xlo;
1.70 + for (xlo=xlink.first(); xlo; xlo=xlink.next() )
1.71 + xlo->updateXLink();
1.72 }
1.73
1.74 void BranchObj::calcBBoxSize()
1.75 @@ -783,53 +788,55 @@
1.76 BranchObj *bo;
1.77 for (bo=branch.first(); bo; bo=branch.next() )
1.78 s+=bo->saveToDir(tmpdir,prefix,offset);
1.79 - decIndent();
1.80
1.81 // Save FloatImages
1.82 FloatImageObj *fio;
1.83 for (fio=floatimage.first(); fio; fio=floatimage.next() )
1.84 s+=fio->saveToDir (tmpdir,prefix);
1.85
1.86 + // Save XLinks
1.87 + XLinkObj *xlo;
1.88 + for (xlo=xlink.first(); xlo; xlo=xlink.next() )
1.89 + s+=xlo->saveToDir();
1.90 +
1.91 + decIndent();
1.92 s+=endElement ("branch");
1.93 return s;
1.94 }
1.95
1.96 -void BranchObj::addLink (LinkObj *lo)
1.97 +void BranchObj::addXLink (XLinkObj *xlo)
1.98 {
1.99 - link.append (lo);
1.100 + xlink.append (xlo);
1.101
1.102 }
1.103
1.104 -void BranchObj::removeLinkRef (LinkObj *lo)
1.105 +void BranchObj::removeXLinkRef (XLinkObj *xlo)
1.106 {
1.107 - link.remove (lo);
1.108 + xlink.remove (xlo);
1.109 }
1.110
1.111 -void BranchObj::deleteLink(LinkObj *lo)
1.112 +void BranchObj::deleteXLink(XLinkObj *xlo)
1.113 {
1.114 - lo->deactivate();
1.115 - if (!lo->isUsed()) delete (lo);
1.116 + xlo->deactivate();
1.117 + if (!xlo->isUsed()) delete (xlo);
1.118 }
1.119
1.120 -void BranchObj::deleteLinkAt (int i)
1.121 +void BranchObj::deleteXLinkAt (int i)
1.122 {
1.123 - LinkObj *lo=link.at(i);
1.124 - lo->deactivate();
1.125 - if (!lo->isUsed())
1.126 - {
1.127 - delete(lo);
1.128 - }
1.129 + XLinkObj *xlo=xlink.at(i);
1.130 + xlo->deactivate();
1.131 + if (!xlo->isUsed()) delete(xlo);
1.132 }
1.133
1.134 -int BranchObj::countLink()
1.135 +int BranchObj::countXLink()
1.136 {
1.137 - return link.count();
1.138 + return xlink.count();
1.139 }
1.140
1.141 -BranchObj* BranchObj::linkTargetAt (int i)
1.142 +BranchObj* BranchObj::XLinkTargetAt (int i)
1.143 {
1.144 - if (link.at(i))
1.145 - return link.at(i)->otherBranch (this);
1.146 + if (xlink.at(i))
1.147 + return xlink.at(i)->otherBranch (this);
1.148 else
1.149 return NULL;
1.150 }
1.151 @@ -1312,15 +1319,12 @@
1.152 QString s;
1.153 if (parObj)
1.154 {
1.155 - if (parObj->getDepth()==0)
1.156 + if (depth==1)
1.157 s= "bo:" + QString("%1").arg(getNum());
1.158 else
1.159 s= ((BranchObj*)(parObj))->getSelectString() + ",bo:" + QString("%1").arg(getNum());
1.160 } else
1.161 - {
1.162 s="mc:";
1.163 - }
1.164 -
1.165 return s;
1.166 }
1.167