1.1 --- a/branchitem.cpp Thu Apr 02 09:57:47 2009 +0000
1.2 +++ b/branchitem.cpp Tue Apr 07 16:15:53 2009 +0000
1.3 @@ -1,7 +1,10 @@
1.4 #include "branchitem.h"
1.5 #include "branchobj.h"
1.6 +#include "vymmodel.h"
1.7
1.8 #include <iostream>
1.9 +#include <QDir>
1.10 +
1.11 using namespace std;
1.12
1.13 BranchItem::BranchItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
1.14 @@ -122,6 +125,47 @@
1.15 return s;
1.16 }
1.17
1.18 +void BranchItem::updateVisibility() // FIXME-1
1.19 +{
1.20 +}
1.21 +
1.22 +void BranchItem::setVymLink(QString s)
1.23 +{
1.24 + if (!s.isEmpty())
1.25 + {
1.26 + // We need the relative (from loading)
1.27 + // or absolute path (from User event)
1.28 + // and build the absolute path.
1.29 + // Note: If we have relative, use path of
1.30 + // current map to build absolute path
1.31 + QDir d(s);
1.32 + if (!d.path().startsWith ("/"))
1.33 + {
1.34 + QString p=model->getDestPath();
1.35 + int i=p.findRev("/",-1);
1.36 + d.setPath(p.left(i)+"/"+s);
1.37 + d.convertToAbs();
1.38 + }
1.39 + vymLink=d.path();
1.40 + //FIXME-2 systemFlags->activate("vymLink");
1.41 + }
1.42 + else
1.43 + {
1.44 + //FIXME-2 systemFlags->deactivate("vymLink");
1.45 + vymLink="";
1.46 + }
1.47 + /* FIXME-2
1.48 + calcBBoxSize(); // recalculate bbox
1.49 + positionBBox(); // rearrange contents
1.50 + forceReposition();
1.51 + */
1.52 +}
1.53 +
1.54 +QString BranchItem::getVymLink()
1.55 +{
1.56 + return vymLink;
1.57 +}
1.58 +
1.59 void BranchItem::unScroll()
1.60 {
1.61 if (tmpUnscrolled) resetTmpUnscroll();
1.62 @@ -147,7 +191,7 @@
1.63 branch.at(i)->setVisibility(false);
1.64 */
1.65 }
1.66 - /*
1.67 + /*
1.68 calcBBoxSize();
1.69 positionBBox();
1.70 move (absPos.x(), absPos.y() );
2.1 --- a/branchitem.h Thu Apr 02 09:57:47 2009 +0000
2.2 +++ b/branchitem.h Tue Apr 07 16:15:53 2009 +0000
2.3 @@ -15,6 +15,18 @@
2.4
2.5 QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
2.6
2.7 + virtual void updateVisibility();
2.8 +
2.9 +protected:
2.10 + QString vymLink;
2.11 +public:
2.12 + virtual void setVymLink (QString);
2.13 + virtual QString getVymLink ();
2.14 +
2.15 +protected:
2.16 + bool scrolled; // true if all children are scrolled and thus invisible
2.17 + bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
2.18 +public:
2.19 virtual void unScroll();
2.20 virtual void toggleScroll(); // scroll or unscroll
2.21 virtual bool isScrolled(); // returns scroll state
2.22 @@ -24,9 +36,6 @@
2.23
2.24 BranchObj* getBranchObj();
2.25
2.26 -protected:
2.27 - bool scrolled; // true if all children are scrolled and thus invisible
2.28 - bool tmpUnscrolled; // can only be true (temporary) for a scrolled subtree
2.29
2.30 };
2.31
3.1 --- a/branchobj.cpp Thu Apr 02 09:57:47 2009 +0000
3.2 +++ b/branchobj.cpp Tue Apr 07 16:15:53 2009 +0000
3.3 @@ -1,17 +1,16 @@
3.4 #include "branchobj.h"
3.5
3.6 -// #include "texteditor.h"
3.7 #include "branchitem.h"
3.8 #include "geometry.h"
3.9 #include "mapeditor.h"
3.10 #include "mainwindow.h"
3.11 #include "misc.h"
3.12
3.13 -class TextEditor;
3.14 +//class TextEditor; //FIXME-3
3.15
3.16 -extern TextEditor *textEditor;
3.17 -extern Main *mainWindow;
3.18 -extern FlagRowObj *standardFlagsDefault;
3.19 +//extern TextEditor *textEditor;
3.20 +//extern Main *mainWindow;
3.21 +//extern FlagRowObj *standardFlagsDefault;
3.22
3.23
3.24 /////////////////////////////////////////////////////////////////
3.25 @@ -57,7 +56,7 @@
3.26 model->stopAnimation (this);
3.27 }
3.28
3.29 - cout << "Destr BranchObj of "<<this<<" ("<<getHeading().toStdString()<<")"<<endl;
3.30 + cout << "Destr BranchObj of "<<this<<" ("<<treeItem->getHeading().toStdString()<<")"<<endl;
3.31 // Check, if this branch was the last child to be deleted
3.32 // If so, unset the scrolled flags in parent // FIXME-2 better do this in model?
3.33
3.34 @@ -101,12 +100,13 @@
3.35 {
3.36 OrnamentedObj::copy(other);
3.37
3.38 - branch.clear();
3.39 +/* FIXME-3 not needed
3.40 for (int i=0; i<other->treeItem->branchCount(); ++i)
3.41 // Make deep copy of b
3.42 // Because addBranch again calls copy for the children,
3.43 // Those will get a deep copy, too
3.44 addBranch(other->branch.at(i) );
3.45 +*/
3.46
3.47 for (int i=0; i<other->floatimage.size(); ++i)
3.48 addFloatImage (other->floatimage.at(i));
3.49 @@ -127,9 +127,6 @@
3.50
3.51 while (!xlink.isEmpty())
3.52 delete xlink.takeFirst();
3.53 -
3.54 - while (!branch.isEmpty())
3.55 - delete branch.takeFirst();
3.56 }
3.57
3.58 bool isAbove (BranchObj* a, BranchObj *b)
3.59 @@ -243,7 +240,7 @@
3.60 {
3.61 // Now go recursivly through all children
3.62 for (i=0; i<treeItem->branchCount(); ++i)
3.63 - branch.at(i)->setVisibility (v,toDepth);
3.64 + treeItem->getBranchObjNum(i)->setVisibility (v,toDepth);
3.65 }
3.66 } // depth <= toDepth
3.67 requestReposition();
3.68 @@ -273,7 +270,14 @@
3.69 {
3.70 setColor (col);
3.71 for (int i=0; i<treeItem->branchCount(); ++i)
3.72 - branch.at(i)->setColorSubtree(col);
3.73 + treeItem->getBranchObjNum(i)->setColorSubtree(col);
3.74 +}
3.75 +
3.76 +void BranchObj::updateContentSize()
3.77 +{
3.78 + calcBBoxSize();
3.79 + positionBBox();
3.80 + requestReposition();
3.81 }
3.82
3.83 void BranchObj::positionContents()
3.84 @@ -300,7 +304,7 @@
3.85 {
3.86 OrnamentedObj::moveBy (x,y);
3.87 for (int i=0; i<treeItem->branchCount(); ++i)
3.88 - branch.at(i)->moveBy (x,y);
3.89 + treeItem->getBranchObjNum(i)->moveBy (x,y);
3.90 positionBBox();
3.91 }
3.92
3.93 @@ -329,12 +333,12 @@
3.94 QSizeF heading_r=heading->getSize();
3.95 qreal heading_w=(qreal) heading_r.width() ;
3.96 qreal heading_h=(qreal) heading_r.height() ;
3.97 - QSizeF sysflags_r=systemFlags->getSize();
3.98 - qreal sysflags_h=sysflags_r.height();
3.99 - qreal sysflags_w=sysflags_r.width();
3.100 - QSizeF stanflags_r=standardFlags->getSize();
3.101 - qreal stanflags_h=stanflags_r.height();
3.102 - qreal stanflags_w=stanflags_r.width();
3.103 + QSizeF sysflags_r; //FIXME-1 =systemFlags->getSize();
3.104 + qreal sysflags_h=0;//sysflags_r.height();
3.105 + qreal sysflags_w=0;//sysflags_r.width();
3.106 + QSizeF stanflags_r; //FIXME-1 =standardFlags->getSize();
3.107 + qreal stanflags_h=0; //stanflags_r.height();
3.108 + qreal stanflags_w=0; //stanflags_r.width();
3.109 qreal w;
3.110 qreal h;
3.111
3.112 @@ -426,7 +430,7 @@
3.113 LinkableMapObj *lmo;
3.114 for (int i=0; i<treeItem->branchCount(); ++i)
3.115 {
3.116 - lmo=branch.at(i)->findMapObj(p, excludeLMO);
3.117 + lmo=treeItem->getBranchObjNum(i)->findMapObj(p, excludeLMO);
3.118 if (lmo != NULL) return lmo;
3.119 }
3.120
3.121 @@ -452,7 +456,7 @@
3.122 LinkableMapObj *lmo;
3.123 for (int i=0; i<treeItem->branchCount(); ++i)
3.124 {
3.125 - lmo=branch.at(i)->findID (sid);
3.126 + lmo=treeItem->getBranchObjNum(i)->findID (sid);
3.127 if (lmo != NULL) return lmo;
3.128 }
3.129
3.130 @@ -472,54 +476,22 @@
3.131 return NULL;
3.132 }
3.133
3.134 -void BranchObj::setHeading(QString s)
3.135 +void BranchObj::updateHeading()
3.136 {
3.137 - heading->setText(s); // set new heading
3.138 - calcBBoxSize(); // recalculate bbox
3.139 - positionBBox(); // rearrange contents
3.140 - requestReposition();
3.141 -}
3.142 -
3.143 -void BranchObj::setHideTmp (HideTmpMode mode)
3.144 -{
3.145 - if (mode==HideExport && (hideExport|| hasHiddenExportParent() ) )
3.146 + if (!treeItem)
3.147 {
3.148 - // Hide stuff according to hideExport flag and parents
3.149 - setVisibility (false);
3.150 - hidden=true;
3.151 - }else
3.152 - {
3.153 - // Do not hide, but still take care of scrolled status
3.154 - if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem))
3.155 - setVisibility (false);
3.156 - else
3.157 - setVisibility (true);
3.158 - hidden=false;
3.159 - }
3.160 -
3.161 - // And take care of my children
3.162 - for (int i=0; i<treeItem->branchCount(); ++i)
3.163 - branch.at(i)->setHideTmp (mode);
3.164 -}
3.165 -
3.166 -bool BranchObj::hasHiddenExportParent()
3.167 -{
3.168 - // Calls parents recursivly to
3.169 - // find out, if we or parents are temp. hidden
3.170 -
3.171 - if (hidden || hideExport) return true;
3.172 -
3.173 - BranchObj* bo=(BranchObj*)parObj;
3.174 - if (bo)
3.175 - return bo->hasHiddenExportParent();
3.176 - else
3.177 - return false;
3.178 + qWarning ("BranchObj::udpateHeading treeItem==NULL");
3.179 + return;
3.180 + }
3.181 + cout << "BO::updateHeading: "<<treeItem->getHeading().toStdString()<<endl;
3.182 + heading->setText (treeItem->getHeading() );
3.183 + updateContentSize();
3.184 }
3.185
3.186 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
3.187 {
3.188 // Cloudy stuff can be hidden during exports
3.189 - if (hidden) return "";
3.190 + // FIXME-1 if (hidden) return "";
3.191
3.192 // Update of note is usually done while unselecting a branch
3.193 // if (isNoteInEditor) getNoteFromTextEditor(); //FIXME-2 moved to TreeItem
3.194 @@ -560,7 +532,7 @@
3.195 incIndent();
3.196
3.197 // save heading
3.198 - s+=valueElement("heading", getHeading(),
3.199 + s+=valueElement("heading", treeItem->getHeading(),
3.200 attribut ("textColor",QColor(heading->getColor()).name()));
3.201
3.202 // Save frame
3.203 @@ -580,7 +552,7 @@
3.204
3.205 // Save branches
3.206 for (int i=0; i<treeItem->branchCount(); ++i)
3.207 - s+=branch.at(i)->saveToDir(tmpdir,prefix,offset);
3.208 + s+=treeItem->getBranchObjNum(i)->saveToDir(tmpdir,prefix,offset);
3.209
3.210 // Save XLinks
3.211 QString ol; // old link
3.212 @@ -594,7 +566,7 @@
3.213 ol=cl;
3.214 } else
3.215 {
3.216 - qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
3.217 + qWarning (QString("Ignoring of duplicate xLink in %1").arg(treeItem->getHeading()));
3.218 }
3.219 }
3.220
3.221 @@ -743,7 +715,7 @@
3.222 {
3.223 // Save position in angle
3.224 for (int i=0; i<treeItem->branchCount(); ++i)
3.225 - branch.at(i)->angle=i;
3.226 + treeItem->getBranchObjNum(i)->angle=i;
3.227 }
3.228
3.229 void BranchObj::setDefAttr (BranchModification mod)
3.230 @@ -771,10 +743,9 @@
3.231 BranchObj* BranchObj::addBranch()
3.232 {
3.233 BranchObj* newbo=new BranchObj(scene,this);
3.234 - branch.append (newbo);
3.235 + //FIXME-1 branch.append (newbo);
3.236 newbo->setParObj(this);
3.237 newbo->setDefAttr(NewBranch);
3.238 - newbo->setHeading ("new");
3.239 /* FIXME-2 treeItem not set yet!!!
3.240 if ( ((BranchItem*)treeItem)->isScrolled() )
3.241 newbo->setVisibility (false);
3.242 @@ -789,7 +760,7 @@
3.243 BranchObj* BranchObj::addBranch(BranchObj* bo)
3.244 {
3.245 BranchObj* newbo=new BranchObj(scene,this);
3.246 - branch.append (newbo);
3.247 + //FIXME-1 branch.append (newbo);
3.248 newbo->copy(bo);
3.249 newbo->setParObj(this);
3.250 newbo->setDefAttr(MovedBranch);
3.251 @@ -804,7 +775,7 @@
3.252
3.253 BranchObj* BranchObj::addBranchPtr(BranchObj* bo)
3.254 {
3.255 - branch.append (bo);
3.256 + //FIXME-1 branch.append (bo);
3.257 bo->setParObj (this);
3.258 bo->depth=depth+1;
3.259 bo->setDefAttr(MovedBranch);
3.260 @@ -820,7 +791,7 @@
3.261 // Add new bo and resort branches
3.262 BranchObj *newbo=addBranch ();
3.263 newbo->angle=pos-0.5;
3.264 - qSort (branch.begin(),branch.end(), isAbove);
3.265 + //FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
3.266 return newbo;
3.267 }
3.268
3.269 @@ -830,7 +801,7 @@
3.270 // Add new bo and resort branches
3.271 bo->angle=pos-0.5;
3.272 BranchObj *newbo=addBranch (bo);
3.273 - qSort (branch.begin(),branch.end(), isAbove);
3.274 + //FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
3.275 return newbo;
3.276 }
3.277
3.278 @@ -839,14 +810,14 @@
3.279 savePosInAngle();
3.280 // Add new bo and resort branches
3.281 bo->angle=pos-0.5;
3.282 - branch.append (bo);
3.283 + //FIXME-1 branch.append (bo);
3.284 bo->setParObj (this);
3.285 bo->depth=depth+1;
3.286 bo->setDefAttr (MovedBranch);
3.287 BranchItem *bi=(BranchItem*)treeItem;
3.288 if ( bi->isScrolled() ) bi->tmpUnscroll();
3.289 //setLastSelectedBranch (bo); //FIXME-3 needed?
3.290 - qSort (branch.begin(),branch.end(), isAbove);
3.291 + //FIXME-1 qSort (branch.begin(),branch.end(), isAbove);
3.292 return bo;
3.293 }
3.294
3.295 @@ -872,8 +843,9 @@
3.296 clear();
3.297 }
3.298
3.299 -void BranchObj::removeBranch(BranchObj* bo)
3.300 +void BranchObj::removeBranch(BranchObj* bo) // FIXME-1 not needed here
3.301 {
3.302 +/*
3.303 // if bo is not in branch remove returns false, we
3.304 // don't care...
3.305
3.306 @@ -885,10 +857,12 @@
3.307 } else
3.308 qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n");
3.309 requestReposition();
3.310 + */
3.311 }
3.312
3.313 -void BranchObj::removeBranchPtr(BranchObj* bo)
3.314 +void BranchObj::removeBranchPtr(BranchObj* bo) // FIXME-1 not needed here
3.315 {
3.316 +/*
3.317 int i=branch.indexOf(bo);
3.318
3.319 if (i>=0)
3.320 @@ -896,6 +870,7 @@
3.321 else
3.322 qWarning ("BranchObj::removeBranchPtr tried to remove non existing branch?!\n");
3.323 requestReposition();
3.324 +*/
3.325 }
3.326
3.327 bool BranchObj::canMoveBranchUp()
3.328 @@ -911,17 +886,19 @@
3.329 return false;
3.330 }
3.331
3.332 -BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist
3.333 +BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // FIXME-1
3.334 {
3.335 +/*
3.336 savePosInAngle();
3.337 int i=branch.indexOf(bo1);
3.338 if (i>0)
3.339 { // -1 if bo1 not found
3.340 - branch.at(i)->angle--;
3.341 - branch.at(i-1)->angle++;
3.342 + treeItem->getBranchObjNum(i)->angle--;
3.343 + treeItem->getBranchObjNum(i-1)->angle++;
3.344 qSort (branch.begin(),branch.end(), isAbove);
3.345 - return branch.at(i);
3.346 + return treeItem->getBranchObjNum(i);
3.347 } else
3.348 +*/
3.349 return NULL;
3.350 }
3.351
3.352 @@ -938,19 +915,21 @@
3.353 return false;
3.354 }
3.355
3.356 -BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
3.357 +BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// FIXME-1
3.358 {
3.359 +/*
3.360 savePosInAngle();
3.361 int i=branch.indexOf(bo1);
3.362 int j;
3.363 if (i <treeItem->branchCount())
3.364 {
3.365 j = i+1;
3.366 - branch.at(i)->angle++;
3.367 - branch.at(j)->angle--;
3.368 + treeItem->getBranchObjNum(i)->angle++;
3.369 + treeItem->getBranchObjNum(j)->angle--;
3.370 qSort (branch.begin(),branch.end(), isAbove);
3.371 - return branch.at(i);
3.372 + return treeItem->getBranchObjNum(i);
3.373 } else
3.374 +*/
3.375 return NULL;
3.376 }
3.377
3.378 @@ -964,8 +943,8 @@
3.379 {
3.380 madeChanges=false;
3.381 for(curChildIndex=1;curChildIndex<childCount;curChildIndex++){
3.382 - BranchObj* curChild=(BranchObj*)branch.at(curChildIndex);
3.383 - BranchObj* prevChild=(BranchObj*)branch.at(curChildIndex-1);
3.384 + BranchObj* curChild=(BranchObj*)treeItem->getBranchObjNum(curChildIndex);
3.385 + BranchObj* prevChild=(BranchObj*)treeItem->getBranchObjNum(curChildIndex-1);
3.386 if(prevChild->heading->text().compare(curChild->heading->text())>0)
3.387 {
3.388 this->moveBranchUp(curChild);
3.389 @@ -1015,41 +994,45 @@
3.390 qreal th = bboxTotal.height();
3.391 // TODO testing
3.392 /*
3.393 + QString h=QString (treeItem->depth(),' ');
3.394 + h+=treeItem->getHeading();
3.395 + h+=QString (15,' ');
3.396 + h.truncate (15);
3.397 QPointF pp; if (parObj) pp=parObj->getChildPos();
3.398 - cout << "BO::alignRelTo "<<qPrintable (getHeading());
3.399 - cout << " d="<<depth<<
3.400 - " ref="<<ref<<
3.401 -// " bbox.topLeft="<<bboxTotal.topLeft()<<
3.402 + cout << "BO::alignRelTo ";
3.403 + cout<<h.toStdString();
3.404 +// cout << " d="<<treeItem->depth()<<
3.405 +cout<< " ref="<<ref<<
3.406 + " bbox.tL="<<bboxTotal.topLeft()<<
3.407 " absPos="<<absPos<<
3.408 // " relPos="<<relPos<<
3.409 // " parPos="<<pp<<
3.410 - " width="<<bbox.width()<<
3.411 - " orient="<<orientation<<
3.412 - " alignSelf="<<alignSelf<<
3.413 + " w="<<bbox.width()<<
3.414 + " h="<<bbox.height()<<
3.415 +// " orient="<<orientation<<
3.416 +// " alignSelf="<<alignSelf<<
3.417 +// " scrolled="<<((BranchItem*)treeItem)->isScrolled()<<
3.418 // " pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
3.419 // " hidden="<<hidden<<
3.420 -// " th="<<th<<
3.421 + " th="<<th<<
3.422 endl;
3.423 */
3.424
3.425 setOrientation();
3.426 //updateLink();
3.427
3.428 - if (depth<2)
3.429 + if (depth==1)
3.430 {
3.431 - if (depth==1)
3.432 - {
3.433 - // Position relatively, if needed
3.434 - //if (useRelPos) move2RelPos (relPos.x(), relPos.y());
3.435 + // Position relatively, if needed
3.436 + //if (useRelPos) move2RelPos (relPos.x(), relPos.y());
3.437
3.438 - // Calc angle to mapCenter if I am a mainbranch
3.439 - // needed for reordering the mainbranches clockwise
3.440 - // around mapcenter
3.441 - angle=getAngle (QPointF ((int)(x() - parObj->getChildPos().x() ),
3.442 - (int)(y() - parObj->getChildPos().y() ) ) );
3.443 - }
3.444 - }
3.445 - else
3.446 + // Calc angle to mapCenter if I am a mainbranch
3.447 + // needed for reordering the mainbranches clockwise
3.448 + // around mapcenter
3.449 + angle=getAngle (QPointF ((int)(x() - parObj->getChildPos().x() ),
3.450 + (int)(y() - parObj->getChildPos().y() ) ) );
3.451 + }
3.452 + if (depth>1)
3.453 {
3.454 // Align myself depending on orientation and parent, but
3.455 // only if I am not a mainbranch or mapcenter itself
3.456 @@ -1074,7 +1057,7 @@
3.457 default:
3.458 qWarning ("LMO::alignRelativeTo: oops, no orientation given...");
3.459 break;
3.460 - }
3.461 + }
3.462 }
3.463 }
3.464
3.465 @@ -1095,12 +1078,12 @@
3.466 // Align the children depending on reference point
3.467 for (int i=0; i<treeItem->branchCount(); ++i)
3.468 {
3.469 - if (!branch.at(i)->isHidden())
3.470 + if (!treeItem->getBranchNum(i)->isHidden())
3.471 {
3.472 - branch.at(i)->alignRelativeTo (ref2,true);
3.473 + treeItem->getBranchObjNum(i)->alignRelativeTo (ref2,true);
3.474
3.475 // append next branch below current one
3.476 - ref2.setY(ref2.y() + branch.at(i)->getBBoxSizeWithChildren().height() );
3.477 + ref2.setY(ref2.y() + treeItem->getBranchObjNum(i)->getBBoxSizeWithChildren().height() );
3.478 }
3.479 }
3.480 }
3.481 @@ -1109,12 +1092,11 @@
3.482 void BranchObj::reposition()
3.483 {
3.484 /* TODO testing only
3.485 - if (!getHeading().isEmpty())
3.486 - cout << "BO::reposition "<<qPrintable(getHeading())<<endl;
3.487 + if (!treeItem->getHeading().isEmpty())
3.488 + cout << "BO::reposition "<<qPrintable(treeItem->getHeading())<<endl;
3.489 else
3.490 cout << "BO::reposition ???"<<endl;
3.491 -
3.492 - cout << " orient="<<orientation<<endl;
3.493 +// cout << " orient="<<orientation<<endl;
3.494 */
3.495
3.496 if (depth==0)
3.497 @@ -1128,7 +1110,7 @@
3.498
3.499 alignRelativeTo ( QPointF (absPos.x(),
3.500 absPos.y()-(bboxTotal.height()-bbox.height())/2) );
3.501 - qSort (branch.begin(),branch.end(), isAbove);
3.502 + //FIXME-2 qSort (branch.begin(),branch.end(), isAbove);
3.503 positionBBox(); // Reposition bbox and contents
3.504 } else
3.505 {
3.506 @@ -1143,7 +1125,7 @@
3.507 {
3.508 repositionRequest=false;
3.509 for (int i=0; i<treeItem->branchCount(); ++i)
3.510 - branch.at(i)->unsetAllRepositionRequests();
3.511 + treeItem->getBranchObjNum(i)->unsetAllRepositionRequests();
3.512 }
3.513
3.514
3.515 @@ -1176,13 +1158,14 @@
3.516 if ( ((BranchItem*)treeItem)->isScrolled() ) return r;
3.517
3.518 for (int i=0; i<treeItem->branchCount(); ++i)
3.519 - if (!branch.at(i)->isHidden())
3.520 - r=addBBox(branch.at(i)->getTotalBBox(),r);
3.521 + if (!treeItem->getBranchNum(i)->isHidden())
3.522 + r=addBBox(treeItem->getBranchObjNum(i)->getTotalBBox(),r);
3.523
3.524 - for (int i=0; i<floatimage.size(); ++i)
3.525 +/*
3.526 + FIXME-1 for (int i=0; i<floatimage.size(); ++i)
3.527 if (!floatimage.at(i)->isHidden())
3.528 r=addBBox(floatimage.at(i)->getTotalBBox(),r);
3.529 -
3.530 + */
3.531 return r;
3.532 }
3.533
3.534 @@ -1204,14 +1187,15 @@
3.535 bboxTotal.setY(bbox.y() );
3.536
3.537 // if branch is scrolled, ignore children, but still consider floatimages
3.538 - if ( ((BranchItem*)treeItem)->isScrolled() )
3.539 + BranchItem *bi=(BranchItem*)treeItem;
3.540 + if ( bi->isScrolled() )
3.541 {
3.542 bboxTotal.setWidth (bbox.width());
3.543 bboxTotal.setHeight(bbox.height());
3.544 return;
3.545 }
3.546
3.547 - if (hidden)
3.548 + if (bi->isHidden())
3.549 {
3.550 bboxTotal.setWidth (0);
3.551 bboxTotal.setHeight(0);
3.552 @@ -1235,10 +1219,10 @@
3.553 // minimum of y
3.554 for (int i=0; i<treeItem->branchCount(); ++i)
3.555 {
3.556 - if (!branch.at(i)->isHidden())
3.557 + if (!bi->getBranchNum(i)->isHidden())
3.558 {
3.559 - branch.at(i)->calcBBoxSizeWithChildren();
3.560 - br=branch.at(i)->getBBoxSizeWithChildren();
3.561 + bi->getBranchObjNum(i)->calcBBoxSizeWithChildren();
3.562 + br=bi->getBranchObjNum(i)->getBBoxSizeWithChildren();
3.563 r.setWidth( max (br.width(), r.width() ));
3.564 r.setHeight(br.height() + r.height() );
3.565 if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
3.566 @@ -1246,7 +1230,7 @@
3.567 }
3.568 // Add myself and also
3.569 // add width of link to sum if necessary
3.570 - if (branch.isEmpty())
3.571 + if (bi->branchCount()<1)
3.572 bboxTotal.setWidth (bbox.width() + r.width() );
3.573 else
3.574 bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
3.575 @@ -1255,7 +1239,7 @@
3.576 }
3.577
3.578 /*
3.579 -void BranchObj::select() // FIXME-2 try to get rid of this in BO completely
3.580 +void BranchObj::select() // FIXME-4 try to get rid of this in BO completely
3.581 {
3.582 cout << "BO::select()\n";
3.583 textEditor->setText(treeItem->getNoteObj().getNote() );
3.584 @@ -1291,7 +1275,7 @@
3.585 */
3.586
3.587 /*
3.588 -void BranchObj::unselect() //FIXME-3 should not be needed
3.589 +void BranchObj::unselect() //FIXME-4 should not be needed
3.590 {
3.591 cout << "BO::unselect()\n";
3.592 LinkableMapObj::unselect();
4.1 --- a/branchobj.h Thu Apr 02 09:57:47 2009 +0000
4.2 +++ b/branchobj.h Tue Apr 07 16:15:53 2009 +0000
4.3 @@ -11,10 +11,6 @@
4.4
4.5 /*! \brief A branch visible in the map */
4.6
4.7 -/*! If HideExport is used, this branch and its children will be hidden in export */
4.8 -enum HideTmpMode {HideNone, HideExport};
4.9 -
4.10 -
4.11 /////////////////////////////////////////////////////////////////////////////
4.12 class BranchObj:public OrnamentedObj {
4.13 public:
4.14 @@ -40,6 +36,7 @@
4.15 virtual void setLinkColor(); // set the color of link
4.16 virtual void setColorSubtree(QColor); // set the color of heading
4.17
4.18 + virtual void updateContentSize();
4.19 virtual void positionContents();
4.20 virtual void move (double x,double y);
4.21 virtual void move (QPointF);
4.22 @@ -50,10 +47,7 @@
4.23 virtual void setDockPos();
4.24 virtual LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
4.25 virtual LinkableMapObj* findID (QString sid); // find Obj by ID string
4.26 - virtual void setHeading (QString);
4.27 -
4.28 - virtual void setHideTmp (HideTmpMode);
4.29 - virtual bool hasHiddenExportParent ();
4.30 + virtual void updateHeading ();
4.31
4.32 virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data recursivly to tempdir
4.33
4.34 @@ -112,9 +106,6 @@
4.35 virtual bool animate();
4.36
4.37 protected:
4.38 - static BranchObj* itLast; // iterator for first(), next()
4.39 - static BranchObj* itFirst; // first iterator for first(), next()
4.40 - QList<BranchObj*> branch; // all child branches
4.41 QList<FloatImageObj*> floatimage;// child images
4.42 QList<XLinkObj*> xlink; // xlinks to other branches
4.43
5.1 --- a/branchpropwindow.cpp Thu Apr 02 09:57:47 2009 +0000
5.2 +++ b/branchpropwindow.cpp Tue Apr 07 16:15:53 2009 +0000
5.3 @@ -156,7 +156,7 @@
5.4 {
5.5 model=m;
5.6 if (model)
5.7 - setBranch (model->getSelectedBranch() );
5.8 + setBranch (model->getSelectedBranchObj() );
5.9 else
5.10 ui.tabWidget->setEnabled (false);
5.11
6.1 --- a/exports.cpp Thu Apr 02 09:57:47 2009 +0000
6.2 +++ b/exports.cpp Tue Apr 07 16:15:53 2009 +0000
6.3 @@ -149,7 +149,7 @@
6.4 BranchItem *prev=NULL;
6.5 int d;
6.6
6.7 - BranchObj *bo;
6.8 + BranchObj *bo; //FIXME-3 still needed?
6.9 cur=model->next (cur,prev,d);
6.10 while (cur)
6.11 {
6.12 @@ -162,7 +162,7 @@
6.13 curIndent="";
6.14 for (i=0;i<cur->depth()-1;i++) curIndent+= indentPerDepth;
6.15
6.16 - if (!bo->hasHiddenExportParent() )
6.17 + if (!cur->hasHiddenExportParent() )
6.18 {
6.19 switch (cur->depth())
6.20 {
6.21 @@ -230,7 +230,7 @@
6.22 QString s;
6.23 QString curIndent("");
6.24 int i;
6.25 - BranchObj *bo;
6.26 + BranchObj *bo; //FIXME-3 still needed?
6.27 BranchItem *cur=NULL;
6.28 BranchItem *prev=NULL;
6.29 int d;
6.30 @@ -239,7 +239,7 @@
6.31 {
6.32 bo=(BranchObj*)(cur->getLMO());
6.33
6.34 - if (!bo->hasHiddenExportParent() )
6.35 + if (!cur->hasHiddenExportParent() )
6.36 {
6.37 // If necessary, write note
6.38 if (!cur->getNoteObj().isEmpty())
6.39 @@ -393,31 +393,31 @@
6.40 BranchObj *bo;
6.41 BranchItem *cur=NULL;
6.42 BranchItem *prev=NULL;
6.43 - int d;
6.44 + int d; //FIXME-3 still needed?
6.45 model->next(cur,prev,d);
6.46 while (cur)
6.47 {
6.48 bo=(BranchObj*)(cur->getLMO());
6.49
6.50 - if (!bo->hasHiddenExportParent() )
6.51 + if (!cur->hasHiddenExportParent() )
6.52 {
6.53 switch (cur->depth() )
6.54 {
6.55 case 0: break;
6.56 case 1:
6.57 - ts << ("\\chapter{" + bo->getHeading()+ "}\n");
6.58 + ts << ("\\chapter{" + cur->getHeading()+ "}\n");
6.59 break;
6.60 case 2:
6.61 - ts << ("\\section{" + bo->getHeading()+ "}\n");
6.62 + ts << ("\\section{" + cur->getHeading()+ "}\n");
6.63 break;
6.64 case 3:
6.65 - ts << ("\\subsection{" + bo->getHeading()+ "}\n");
6.66 + ts << ("\\subsection{" + cur->getHeading()+ "}\n");
6.67 break;
6.68 case 4:
6.69 - ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
6.70 + ts << ("\\subsubsection{" + cur->getHeading()+ "}\n");
6.71 break;
6.72 default:
6.73 - ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
6.74 + ts << ("\\paragraph*{" + cur->getHeading()+ "}\n");
6.75
6.76 }
6.77 // If necessary, write note
7.1 --- a/floatimageobj.cpp Thu Apr 02 09:57:47 2009 +0000
7.2 +++ b/floatimageobj.cpp Tue Apr 07 16:15:53 2009 +0000
7.3 @@ -159,7 +159,7 @@
7.4
7.5 QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix)
7.6 {
7.7 - if (hidden) return "";
7.8 + //FIXME-2 if (hidden) return "";
7.9
7.10 saveCounter++;
7.11
8.1 Binary file icons/icons.xcf has changed
9.1 --- a/linkablemapobj.cpp Thu Apr 02 09:57:47 2009 +0000
9.2 +++ b/linkablemapobj.cpp Tue Apr 07 16:15:53 2009 +0000
9.3 @@ -123,7 +123,7 @@
9.4 treeItem=ti;
9.5 }
9.6
9.7 -TreeItem* LinkableMapObj::getTreeItem ()
9.8 +TreeItem* LinkableMapObj::getTreeItem () const
9.9 {
9.10 return treeItem;
9.11 }
9.12 @@ -410,7 +410,7 @@
9.13 if (p) p->show();
9.14 break;
9.15 case PolyParabel:
9.16 - if (!p) cout << "LMO::setVis p==0 (PolyParabel) "<<((BranchObj*)this)->getHeading().toStdString()<<endl; //FIXME-3
9.17 + if (!p) cout << "LMO::setVis p==0 (PolyParabel) "<<treeItem->getHeading().toStdString()<<endl; //FIXME-3
9.18 if (p) p->show();
9.19 break;
9.20 default:
10.1 --- a/linkablemapobj.h Thu Apr 02 09:57:47 2009 +0000
10.2 +++ b/linkablemapobj.h Tue Apr 07 16:15:53 2009 +0000
10.3 @@ -59,7 +59,7 @@
10.4 virtual void copy (LinkableMapObj*);
10.5
10.6 virtual void setTreeItem(TreeItem *);
10.7 - virtual TreeItem* getTreeItem();
10.8 + virtual TreeItem* getTreeItem() const;
10.9 virtual void setModel (VymModel *vm);
10.10 virtual VymModel* getModel ();
10.11
11.1 --- a/mainwindow.cpp Thu Apr 02 09:57:47 2009 +0000
11.2 +++ b/mainwindow.cpp Tue Apr 07 16:15:53 2009 +0000
11.3 @@ -541,7 +541,7 @@
11.4 editMenu->addAction (a);
11.5 actionPaste=a;
11.6
11.7 -/*
11.8 +/* FIXME-5
11.9 // Shortcuts to modify heading:
11.10 a = new QAction(tr( "Edit heading","Edit menu" ),this);
11.11 a->setStatusTip ( tr( "edit Heading" ));
11.12 @@ -579,8 +579,12 @@
11.13 actionDelete=a;
11.14
11.15 // Shortcut to add mapcenter
11.16 - a= new QAction(tr( "Add mapcenter","Canvas context menu" ), this);
11.17 + a= new QAction(QPixmap(iconPath+"newmapcenter.png"),tr( "Add mapcenter","Canvas context menu" ), this);
11.18 + a->setShortcut ( Qt::Key_M);
11.19 + a->setShortcutContext (Qt::WindowShortcut);
11.20 connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) );
11.21 + //actionListBranches.append(a);
11.22 + tb->addAction (a);
11.23 actionAddMapCenter = a;
11.24
11.25
11.26 @@ -1590,6 +1594,7 @@
11.27 // Submenu "Add"
11.28 branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
11.29 branchAddContextMenu->addAction (actionPaste );
11.30 + branchAddContextMenu->addAction ( actionAddMapCenter );
11.31 branchAddContextMenu->addAction ( actionAddBranch );
11.32 branchAddContextMenu->addAction ( actionAddBranchBefore );
11.33 branchAddContextMenu->addAction ( actionAddBranchAbove);
11.34 @@ -1660,8 +1665,7 @@
11.35
11.36 // Context menu for canvas
11.37 canvasContextMenu =new QMenu (this);
11.38 - if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
11.39 - actionAddMapCenter->addTo( canvasContextMenu );
11.40 + actionAddMapCenter->addTo( canvasContextMenu );
11.41 actionMapInfo->addTo( canvasContextMenu );
11.42 canvasContextMenu->insertSeparator();
11.43 actionGroupFormatLinkStyles->addTo( canvasContextMenu );
11.44 @@ -2496,10 +2500,10 @@
11.45 if (m)
11.46 {
11.47 bool cs=false;
11.48 - BranchObj *bo=m->findText(s, cs);
11.49 - if (bo)
11.50 + BranchItem *bi=m->findText(s, cs);
11.51 + if (bi)
11.52 {
11.53 - statusBar()->message( "Found: " + bo->getHeading(), statusbarTime );
11.54 + statusBar()->message( "Found: " + bi->getHeading(), statusbarTime );
11.55 } else
11.56 {
11.57 QMessageBox::information( findWindow, tr( "VYM -Information:" ),
11.58 @@ -2935,6 +2939,7 @@
11.59 VymModel *m=currentModel();
11.60 if (m)
11.61 {
11.62 + cout <<"Main::editAddMapCenter\n";
11.63 m->addMapCenter ();
11.64 }
11.65 }
11.66 @@ -2944,12 +2949,10 @@
11.67 VymModel *m=currentModel();
11.68 if (m)
11.69 {
11.70 - BranchObj *bo=m->getSelectedBranch();
11.71 - prevSelection=m->getSelectString(bo);
11.72 - BranchObj *newbo=m->addNewBranch(0);
11.73 -
11.74 - if (newbo)
11.75 - m->select (newbo);
11.76 + BranchItem *bi=m->createBranch();
11.77 +
11.78 + if (bi)
11.79 + m->select (bi);
11.80 else
11.81 return;
11.82
11.83 @@ -2971,18 +2974,17 @@
11.84 VymModel *m=currentModel();
11.85 if (m)
11.86 {
11.87 - BranchObj *bo=m->getSelectedBranch();
11.88 - BranchObj *newbo=m->addNewBranchBefore();
11.89 -
11.90 - if (newbo)
11.91 - m->select (newbo);
11.92 + BranchItem *bi=m->createBranch(); //FIXME-1 missing: m->addNewBranchBefore();
11.93 +
11.94 + if (bi)
11.95 + m->select (bi);
11.96 else
11.97 return;
11.98
11.99 if (actionSettingsAutoEditNewBranch->isOn())
11.100 {
11.101 if (!actionSettingsAutoSelectNewBranch->isOn())
11.102 - prevSelection=m->getSelectString(bo);
11.103 + prevSelection=m->getSelectString(bi);
11.104 currentMapEditor()->editHeading();
11.105 }
11.106 }
11.107 @@ -2993,18 +2995,18 @@
11.108 VymModel *m=currentModel();
11.109 if ( m)
11.110 {
11.111 - BranchObj *bo=m->getSelectedBranch();
11.112 - BranchObj *newbo=m->addNewBranch (-1);
11.113 -
11.114 - if (newbo)
11.115 - m->select (newbo);
11.116 + BranchItem *bi=m->createBranch(); //FIXME-1 missing: m->addNewBranch (-1);
11.117 +
11.118 +
11.119 + if (bi)
11.120 + m->select (bi);
11.121 else
11.122 return;
11.123
11.124 if (actionSettingsAutoEditNewBranch->isOn())
11.125 {
11.126 if (!actionSettingsAutoSelectNewBranch->isOn())
11.127 - prevSelection=m->getSelectString (bo);
11.128 + prevSelection=m->getSelectString (bi);
11.129 currentMapEditor()->editHeading();
11.130 }
11.131 }
11.132 @@ -3015,18 +3017,17 @@
11.133 VymModel *m=currentModel();
11.134 if (m)
11.135 {
11.136 - BranchObj *bo=m->getSelectedBranch();
11.137 - BranchObj *newbo=m->addNewBranch (1);
11.138 -
11.139 - if (newbo)
11.140 - m->select (newbo);
11.141 + BranchItem *bi=m->createBranch();//FIXME-1 *newbo=m->addNewBranch (1);
11.142 +
11.143 + if (bi)
11.144 + m->select (bi);
11.145 else
11.146 return;
11.147
11.148 if (actionSettingsAutoEditNewBranch->isOn())
11.149 {
11.150 if (!actionSettingsAutoSelectNewBranch->isOn())
11.151 - prevSelection=m->getSelectString(bo);
11.152 + prevSelection=m->getSelectString(bi);
11.153 currentMapEditor()->editHeading();
11.154 }
11.155 }
11.156 @@ -3474,9 +3475,9 @@
11.157 }
11.158 */
11.159
11.160 -void Main::updateContent (QModelIndex index )
11.161 +void Main::updateNoteEditor(QModelIndex index )
11.162 {
11.163 - cout << "Main::updateContent model="<<sender();
11.164 + cout << "Main::updateNoteEditor model="<<sender();
11.165 TreeItem *ti=((VymModel*)sender())->getItem(index);
11.166 cout << " item="<<ti->getHeading().toStdString()<<" ("<<ti<<")"<<endl;
11.167 textEditor->setNote (ti->getNoteObj() );
11.168 @@ -3510,14 +3511,15 @@
11.169 textEditor->setInactive();
11.170 }
11.171
11.172 - // Show URL and link in statusbar
11.173 + // Show URL and link in statusbar // FIXME-2
11.174 + /*
11.175 QString status;
11.176 QString s=model->getURL();
11.177 if (!s.isEmpty() ) status+="URL: "+s+" ";
11.178 s=model->getVymLink();
11.179 if (!s.isEmpty() ) status+="Link: "+s;
11.180 if (!status.isEmpty() ) statusMessage (status);
11.181 -
11.182 +*/
11.183
11.184 // Update Toolbar // FIXME-1, was so far in BranchObj
11.185 //updateFlagsToolbar();
11.186 @@ -3604,13 +3606,12 @@
11.187 else
11.188 actionRedo->setEnabled( false);
11.189
11.190 - if (selection)
11.191 + TreeItem *selti=m->getSelectedItem();
11.192 + BranchItem *selbi=m->getSelectedBranchItem();
11.193 + if (selti)
11.194 {
11.195 - if ( (typeid(*selection) == typeid(BranchObj)) ||
11.196 - (typeid(*selection) == typeid(MapCenterObj)) )
11.197 + if (selbi)
11.198 {
11.199 - BranchItem *bi=(BranchItem*)(selection->getTreeItem() );
11.200 - BranchObj *bo=(BranchObj*)selection;
11.201 // Take care of links // FIXME-1
11.202 /*
11.203 if (bo->countXLinks()==0)
11.204 @@ -3641,12 +3642,12 @@
11.205 standardFlagsDefault->setEnabled (true);
11.206
11.207 actionToggleScroll->setEnabled (true);
11.208 - if ( bi->isScrolled() )
11.209 + if ( selbi->isScrolled() )
11.210 actionToggleScroll->setOn(true);
11.211 else
11.212 actionToggleScroll->setOn(false);
11.213
11.214 - if ( bo->getURL().isEmpty() )
11.215 +/* FIXME-1 if ( selti->getURL().isEmpty() )
11.216 {
11.217 actionOpenURL->setEnabled (false);
11.218 actionOpenURLTab->setEnabled (false);
11.219 @@ -3656,7 +3657,7 @@
11.220 actionOpenURL->setEnabled (true);
11.221 actionOpenURLTab->setEnabled (true);
11.222 }
11.223 - if ( bo->getVymLink().isEmpty() )
11.224 + if ( selti->getVymLink().isEmpty() )
11.225 {
11.226 actionOpenVymLink->setEnabled (false);
11.227 actionDeleteVymLink->setEnabled (false);
11.228 @@ -3665,20 +3666,20 @@
11.229 actionOpenVymLink->setEnabled (true);
11.230 actionDeleteVymLink->setEnabled (true);
11.231 }
11.232 -
11.233 - if (bo->canMoveBranchUp())
11.234 +*/
11.235 +/* FIXME-1 if (selbi->canMoveBranchUp())
11.236 actionMoveUp->setEnabled (true);
11.237 else
11.238 actionMoveUp->setEnabled (false);
11.239 - if (bo->canMoveBranchDown())
11.240 + if (selbi->canMoveBranchDown())
11.241 actionMoveDown->setEnabled (true);
11.242 else
11.243 actionMoveDown->setEnabled (false);
11.244 -
11.245 +*/
11.246 actionSortChildren->setEnabled (true);
11.247
11.248 actionToggleHideExport->setEnabled (true);
11.249 - actionToggleHideExport->setOn (bo->hideInExport() );
11.250 + actionToggleHideExport->setOn (selbi->hideInExport() );
11.251
11.252 actionFileSave->setEnabled (true);
11.253 actionCopy->setEnabled (true);
11.254 @@ -3693,8 +3694,9 @@
11.255 actionFormatHideLinkUnselected->setOn
11.256 (selection->getHideLinkUnselected());
11.257 }
11.258 - if ( (typeid(*selection) == typeid(FloatImageObj)) )
11.259 + if ( selti->getType()==TreeItem::Image)
11.260 {
11.261 + /* FIXME-2
11.262 FloatObj *fo=(FloatImageObj*)selection;
11.263
11.264 actionOpenURL->setEnabled (false);
11.265 @@ -3714,6 +3716,7 @@
11.266 ( selection->getHideLinkUnselected());
11.267 actionMoveUp->setEnabled (false);
11.268 actionMoveDown->setEnabled (false);
11.269 + */
11.270 }
11.271
11.272 } else
12.1 --- a/mainwindow.h Thu Apr 02 09:57:47 2009 +0000
12.2 +++ b/mainwindow.h Tue Apr 07 16:15:53 2009 +0000
12.3 @@ -216,7 +216,7 @@
12.4 void windowToggleSmoothPixmap();
12.5 void updateNoteFlag();
12.6 // void updateNoteInEditor (VymModel *model, const NoteObj ¬e);
12.7 - void updateContent (QModelIndex index);
12.8 + void updateNoteEditor (QModelIndex index);
12.9 void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
12.10
12.11 void updateActions();
13.1 --- a/mapcenterobj.cpp Thu Apr 02 09:57:47 2009 +0000
13.2 +++ b/mapcenterobj.cpp Tue Apr 07 16:15:53 2009 +0000
13.3 @@ -90,8 +90,8 @@
13.4 childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 );
13.5 childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 );
13.6 parPos=childPos;
13.7 - for (int i=0; i<branch.size(); ++i)
13.8 - branch.at(i)->updateLink();
13.9 + for (int i=0; i<treeItem->branchCount(); ++i)
13.10 + treeItem->getBranchObjNum(i)->updateLink();
13.11 }
13.12
13.13 void MapCenterObj::updateRelPositions()
13.14 @@ -99,10 +99,10 @@
13.15 if (repositionRequest) unsetAllRepositionRequests();
13.16
13.17 // update relative Positions of branches and floats
13.18 - for (int i=0; i<branch.size(); ++i)
13.19 + for (int i=0; i<treeItem->branchCount(); ++i)
13.20 {
13.21 - branch.at(i)->setRelPos();
13.22 - branch.at(i)->setOrientation();
13.23 + treeItem->getBranchObjNum(i)->setRelPos();
13.24 + treeItem->getBranchObjNum(i)->setOrientation();
13.25 }
13.26
13.27 for (int i=0; i<floatimage.size(); ++i)
13.28 @@ -116,9 +116,9 @@
13.29 LinkableMapObj *lmo;
13.30
13.31 // Search through child branches
13.32 - for (int i=0; i<branch.size(); ++i)
13.33 + for (int i=0; i<treeItem->branchCount(); ++i)
13.34 {
13.35 - lmo = branch.at(i)->findMapObj(p, excludeLMO);
13.36 + lmo = treeItem->getBranchObjNum(i)->findMapObj(p, excludeLMO);
13.37 if (lmo!= NULL) return lmo;
13.38 }
13.39 // is p in MapCenter?
13.40 @@ -169,7 +169,7 @@
13.41 s+=standardFlags->saveToDir(tmpdir+"/flags", "/standardFlag-", verbose);
13.42
13.43 // Save heading
13.44 - s+=valueElement("heading", getHeading(),a);
13.45 + s+=valueElement("heading", treeItem->getHeading(),a);
13.46
13.47 // Save frame
13.48 s+=frame->saveToDir ();
13.49 @@ -182,8 +182,8 @@
13.50 s+=treeItem->getNoteObj().saveToDir();
13.51
13.52 // Save branches
13.53 - for (int i=0; i<branch.size(); ++i)
13.54 - s+=branch.at(i)->saveToDir(tmpdir,prefix, offset);
13.55 + for (int i=0; i<treeItem->branchCount(); ++i)
13.56 + s+=treeItem->getBranchObjNum(i)->saveToDir(tmpdir,prefix, offset);
13.57
13.58 // Save FloatImages
13.59 for (int i=0; i<floatimage.size(); ++i)
14.1 --- a/mapeditor.cpp Thu Apr 02 09:57:47 2009 +0000
14.2 +++ b/mapeditor.cpp Tue Apr 07 16:15:53 2009 +0000
14.3 @@ -252,11 +252,12 @@
14.4
14.5 void MapEditor::toggleStandardFlag(QString f)
14.6 {
14.7 - BranchObj *bo=model->getSelectedBranch();
14.8 - if (bo)
14.9 + BranchItem *bi=model->getSelectedBranchItem();
14.10 + if (bi)
14.11 {
14.12 QString u,r;
14.13 - if (bo->isSetStandardFlag(f))
14.14 + /* FIXME-2 isSetStandardFlag needs to be ported
14.15 + if (bi->isSetStandardFlag(f))
14.16 {
14.17 r="unsetFlag";
14.18 u="setFlag";
14.19 @@ -266,13 +267,14 @@
14.20 u="unsetFlag";
14.21 r="setFlag";
14.22 }
14.23 + */
14.24 model->saveState(
14.25 - bo,
14.26 + bi,
14.27 QString("%1 (\"%2\")").arg(u).arg(f),
14.28 - bo,
14.29 + bi,
14.30 QString("%1 (\"%2\")").arg(r).arg(f),
14.31 - QString("Toggling standard flag \"%1\" of %2").arg(f).arg(model->getObjectName(bo)));
14.32 - bo->toggleStandardFlag (f,mainWindow->useFlagGroups());
14.33 + QString("Toggling standard flag \"%1\" of %2").arg(f).arg(model->getObjectName(bi)));
14.34 + // FIXME-2 bi->toggleStandardFlag (f,mainWindow->useFlagGroups());
14.35 model->updateSelection(); // geometry has changed
14.36 }
14.37 }
14.38 @@ -292,7 +294,7 @@
14.39 cout << "*** " <<cur->getHeading().toStdString()<<endl;
14.40
14.41
14.42 - //BranchObj *bo=model->getSelectedBranch();
14.43 + //BranchObj *bo=model->getSelectedBranchObj();
14.44 //if (bo) model->moveAway (bo);
14.45 //if (bo) bo->setLinkStyle (LinkableMapObj::Line);
14.46
14.47 @@ -367,12 +369,13 @@
14.48 editHeadingFinished();
14.49 return;
14.50 }
14.51 - BranchObj *bo=model->getSelectedBranch();
14.52 - if (bo)
14.53 + BranchObj *bo=model->getSelectedBranchObj();
14.54 + BranchItem *bi=model->getSelectedBranchItem();
14.55 + if (bo) //FIXME-3
14.56 {
14.57 model->setSelectionBlocked(true);
14.58
14.59 - lineEdit->setText (bo->getHeading());
14.60 + lineEdit->setText (bi->getHeading());
14.61 QPoint p = mapTo (this,bo->getAbsPos().toPoint() );
14.62 lineEdit->setGeometry(p.x(),p.y(),230,25);
14.63 lineEdit->selectAll();
14.64 @@ -412,7 +415,7 @@
14.65 model->select(lmo);
14.66 }
14.67 // Context Menu
14.68 - if (model->getSelectedBranch() )
14.69 + if (model->getSelectedBranchObj() )
14.70 {
14.71 // Context Menu on branch or mapcenter
14.72 //FIXME-3 model->updateActions(); needed?
14.73 @@ -533,7 +536,7 @@
14.74 if (lmo)
14.75 bo_begin=(BranchObj*)(lmo);
14.76 else
14.77 - bo_begin=model->getSelectedBranch();
14.78 + bo_begin=model->getSelectedBranchObj();
14.79 if (bo_begin)
14.80 {
14.81 drawingLink=true;
14.82 @@ -674,9 +677,9 @@
14.83 QString pold=qpointfToString(movingObj_orgRelPos);
14.84 QString pnow=qpointfToString(fio->getRelPos());
14.85 model->saveState(
14.86 - fio,
14.87 + fio->getTreeItem(), // FIXME-3
14.88 "moveRel "+pold,
14.89 - fio,
14.90 + fio->getTreeItem(),
14.91 "moveRel "+pnow,
14.92 QString("Move %1 to relative position %2").arg(model->getObjectName(fio)).arg(pnow));
14.93 fio->getParObj()->requestReposition();
14.94 @@ -719,7 +722,7 @@
14.95 }
14.96
14.97 // Maybe we can relink temporary?
14.98 - if (lmo && (lmo!=lmosel) && model->getSelectedBranch() &&
14.99 + if (lmo && (lmo!=lmosel) && model->getSelectedBranchObj() &&
14.100 (typeid(*lmo)==typeid(BranchObj) ||
14.101 typeid(*lmo)==typeid(MapCenterObj)) )
14.102
14.103 @@ -821,9 +824,9 @@
14.104 QString pold=qpointfToString(movingObj_orgRelPos);
14.105 QString pnow=qpointfToString(fo->getRelPos());
14.106 model->saveState(
14.107 - fo,
14.108 + fo->getTreeItem(), // FIXME-3
14.109 "moveRel "+pold,
14.110 - fo,
14.111 + fo->getTreeItem(), // FIXME-3
14.112 "moveRel "+pnow,
14.113 QString("Move %1 to relative position %2").arg(model->getObjectName(fo)).arg(pnow));
14.114
14.115 @@ -838,19 +841,20 @@
14.116 if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj)))
14.117 dst=NULL;
14.118
14.119 - BranchObj *bo=model->getSelectedBranch();
14.120 - if (bo && bo->getDepth()==0)
14.121 + BranchItem *bi=model->getSelectedBranchItem();
14.122 + if (bi && bi->depth()==0)
14.123 {
14.124 - if (movingObj_orgPos != bo->getAbsPos())
14.125 + if (movingObj_orgPos != bi->getBranchObj()->getAbsPos()) // FIXME-3 check getBO here...
14.126 {
14.127 QString pold=qpointfToString(movingObj_orgPos);
14.128 - QString pnow=qpointfToString(bo->getAbsPos());
14.129 + QString pnow=qpointfToString(bi->getBranchObj()->getAbsPos()); // FIXME-3 check getBO here...
14.130 +
14.131 model->saveState(
14.132 - bo,
14.133 + bi,
14.134 "move "+pold,
14.135 - bo,
14.136 + bi,
14.137 "move "+pnow,
14.138 - QString("Move mapcenter %1 to position %2").arg(model->getObjectName(bo)).arg(pnow));
14.139 + QString("Move mapcenter %1 to position %2").arg(model->getObjectName(bi)).arg(pnow));
14.140 }
14.141 }
14.142
14.143 @@ -871,7 +875,7 @@
14.144 {
14.145 // We have a destination, relink to that
14.146
14.147 - BranchObj* bsel=model->getSelectedBranch();
14.148 + BranchObj* bsel=model->getSelectedBranchObj();
14.149 TreeItem * tisel=model->getSelectedItem();
14.150 BranchObj* bdst=(BranchObj*)dst;
14.151 TreeItem* tidst=dst->getTreeItem();
14.152 @@ -938,7 +942,7 @@
14.153 if (settings.value("/animation/use",false).toBool() && lmosel->getDepth()>1)
14.154 {
14.155 lmosel->setRelPos(); // calc relPos first for starting point
14.156 - QPointF dst=bo->getParObj()->getChildPos();
14.157 + QPointF dst=bi->getBranchObj()->getParObj()->getChildPos(); // FIXME-3 check getBO here...
14.158 // if (lmosel->getOrientation()==LinkableMapObj::LeftOfCenter) dst.setX (dst.x()+lmosel->width() );
14.159
14.160 model->startAnimation(
14.161 @@ -1012,8 +1016,8 @@
14.162
14.163 void MapEditor::dropEvent(QDropEvent *event)
14.164 {
14.165 - BranchObj *sel=model->getSelectedBranch();
14.166 - if (sel)
14.167 + BranchItem *selbi=model->getSelectedBranchItem();
14.168 + if (selbi)
14.169 {
14.170 if (debug)
14.171 foreach (QString format,event->mimeData()->formats())
14.172 @@ -1034,15 +1038,16 @@
14.173 QStringList files;
14.174 QString s;
14.175 QString heading;
14.176 - BranchObj *bo;
14.177 + BranchItem *bi;
14.178 for (int i=0; i<uris.count();i++)
14.179 {
14.180 // Workaround to avoid adding empty branches
14.181 if (!uris.at(i).toString().isEmpty())
14.182 {
14.183 - bo=sel->addBranch();
14.184 - if (bo)
14.185 + bi=model->createBranch();
14.186 + if (bi)
14.187 {
14.188 + /* FIXME-2
14.189 s=uris.at(i).toLocalFile();
14.190 if (!s.isEmpty())
14.191 {
14.192 @@ -1050,18 +1055,20 @@
14.193 heading = QFileInfo(file).baseName();
14.194 files.append(file);
14.195 if (file.endsWith(".vym", false))
14.196 - bo->setVymLink(file);
14.197 + bi->setVymLink(file);
14.198 else
14.199 - bo->setURL(uris.at(i).toString());
14.200 + bi->setURL(uris.at(i).toString());
14.201 } else
14.202 {
14.203 bo->setURL(uris.at(i).toString());
14.204 }
14.205 + */
14.206
14.207 if (!heading.isEmpty())
14.208 - bo->setHeading(heading);
14.209 + bi->setHeading(heading);
14.210 else
14.211 - bo->setHeading(uris.at(i).toString());
14.212 + bi->setHeading(uris.at(i).toString());
14.213 +
14.214 }
14.215 }
14.216 }
14.217 @@ -1112,18 +1119,22 @@
14.218 }
14.219 }
14.220
14.221 -void MapEditor::updateCurrent (const QModelIndex &,const QModelIndex &) //FIXME-3 not used?
14.222 +void MapEditor::updateData (const QModelIndex &sel)
14.223 {
14.224 + TreeItem *ti= static_cast<TreeItem*>(sel.internalPointer());
14.225
14.226 /* testing
14.227 + cout << "ME::updateData\n";
14.228
14.229 - cout << "ME::updateCurrent\n";
14.230 -
14.231 - TreeItem *item = static_cast<TreeItem*>(newsel.internalPointer());
14.232 - LinkableMapObj *lmo=item->getLMO();
14.233 - cout << " lmo="<<lmo<<endl;
14.234 - cout << " h="<<((BranchObj*)lmo)->getHeading().toStdString()<<endl;
14.235 + cout << " ti="<<ti<<endl;
14.236 + cout << " h="<<ti->getHeading().toStdString()<<endl;
14.237 */
14.238 +
14.239 + if (ti->isBranchLikeType())
14.240 + {
14.241 + BranchObj *bo=(BranchObj*)ti->getLMO();
14.242 + bo->updateHeading();
14.243 + }
14.244
14.245 }
14.246
14.247 @@ -1134,6 +1145,7 @@
14.248 updateSelection(sel,sel);
14.249 }
14.250
14.251 +
14.252 QColor MapEditor::getSelectionColor ()
14.253 {
14.254 return selectionColor;
15.1 --- a/mapeditor.h Thu Apr 02 09:57:47 2009 +0000
15.2 +++ b/mapeditor.h Tue Apr 07 16:15:53 2009 +0000
15.3 @@ -101,7 +101,7 @@
15.4
15.5 public slots:
15.6 void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
15.7 - void updateCurrent (const QModelIndex&,const QModelIndex&); // update selection
15.8 + void updateData (const QModelIndex&); // update data
15.9 public:
15.10 void setSelectionColor (QColor c);
15.11 QColor getSelectionColor ();
16.1 --- a/ornamentedobj.cpp Thu Apr 02 09:57:47 2009 +0000
16.2 +++ b/ornamentedobj.cpp Tue Apr 07 16:15:53 2009 +0000
16.3 @@ -57,9 +57,6 @@
16.4
16.5 frame = new FrameObj (scene);
16.6
16.7 - hideExport=false;
16.8 - hidden=false;
16.9 -
16.10 url="";
16.11 vymLink="";
16.12
16.13 @@ -76,16 +73,10 @@
16.14
16.15 ornamentsBBox=other->ornamentsBBox;
16.16
16.17 - hideExport=other->hideExport;
16.18 url=other->url;
16.19 vymLink=other->vymLink;
16.20 }
16.21
16.22 -QString OrnamentedObj::getHeading()
16.23 -{
16.24 - return heading->text();
16.25 -}
16.26 -
16.27 void OrnamentedObj::setLinkColor()
16.28 {
16.29 if (model->getMapLinkColorHint()==HeadingColor)
16.30 @@ -198,13 +189,13 @@
16.31 ox=leftPad + d;
16.32 oy=topPad + d;
16.33
16.34 - systemFlags-> move (ox +x , oy + y );
16.35 + //FIXME-2 systemFlags-> move (ox +x , oy + y );
16.36
16.37 // vertical align heading to bottom
16.38 heading->move (ox + x + systemFlags->getBBox().width(),
16.39 oy + y + ornamentsBBox.height() - heading->getHeight()
16.40 );
16.41 - standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
16.42 + //FIXME-2 standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
16.43
16.44 ornamentsBBox.moveTopLeft ( QPointF ((int)(ox+x),(int)(oy+y)));
16.45 clickBox.moveTopLeft (QPointF ((int)(ox + x), (int)(oy + y)));
16.46 @@ -412,32 +403,6 @@
16.47 standardFlags->updateToolbar();
16.48 }
16.49
16.50 -void OrnamentedObj::setHideInExport(bool b)
16.51 -{
16.52 - if (parObj)
16.53 - {
16.54 - // Don't allow to MapCenter to be hidden
16.55 - hideExport=b;
16.56 - if (b)
16.57 - systemFlags->activate("hideInExport");
16.58 - else
16.59 - systemFlags->deactivate("hideInExport");
16.60 - calcBBoxSize();
16.61 - positionBBox();
16.62 - requestReposition();
16.63 - }
16.64 -}
16.65 -
16.66 -bool OrnamentedObj::hideInExport()
16.67 -{
16.68 - return hideExport;
16.69 -}
16.70 -
16.71 -bool OrnamentedObj::isHidden()
16.72 -{
16.73 - return hidden;
16.74 -}
16.75 -
16.76 QString OrnamentedObj::getOrnXMLAttr()
16.77 {
16.78 QString posAttr;
16.79 @@ -467,12 +432,12 @@
16.80 if (!vymLink.isEmpty())
16.81 vymLinkAttr=attribut ("vymLink",convertToRel(model->getDestPath(),vymLink) );
16.82
16.83 - QString hideExpAttr;
16.84 +/* FIXME-2 QString hideExpAttr;
16.85 if (hideExport)
16.86 hideExpAttr= attribut("hideInExport","true");
16.87 else
16.88 hideExpAttr="";
16.89 -
16.90 - return posAttr +urlAttr +vymLinkAttr +getLinkAttr() +hideExpAttr;
16.91 +*/
16.92 + return posAttr +urlAttr +vymLinkAttr +getLinkAttr() ;//+hideExpAttr;
16.93 }
16.94
17.1 --- a/ornamentedobj.h Thu Apr 02 09:57:47 2009 +0000
17.2 +++ b/ornamentedobj.h Tue Apr 07 16:15:53 2009 +0000
17.3 @@ -28,7 +28,6 @@
17.4 virtual void init ();
17.5 virtual void copy (OrnamentedObj*);
17.6
17.7 - virtual QString getHeading(); //!< returns the heading
17.8 virtual void setLinkColor(); // sets color according to colorhint, overloaded
17.9 virtual void setColor(QColor); // set the color of text and link
17.10 QColor getColor (); // get color of heading
17.11 @@ -71,11 +70,9 @@
17.12 virtual QString getSystemFlagName (const QPointF &p);
17.13 virtual bool isActiveFlag(const QString&); // check if flag is set
17.14 virtual void updateSystemFlags();
17.15 + virtual void updateFlagsToolbar();
17.16 +
17.17 //virtual void getNoteFromTextEditor ();// FIXME should move to vymview?!
17.18 - virtual void updateFlagsToolbar();
17.19 - virtual void setHideInExport(bool); // set export of object (and children)
17.20 - virtual bool hideInExport(); // FIXME moved to treeitem
17.21 - virtual bool isHidden (); // FIXME moved to treeitem
17.22 virtual QString getOrnXMLAttr(); // get attributes for saveToDir
17.23
17.24 protected:
17.25 @@ -85,11 +82,8 @@
17.26 FrameObj *frame; // frame around object
17.27 QRectF ornamentsBBox; // bbox of flags and heading
17.28 QString url; // url to external doc
17.29 - QString vymLink; // path to another map
17.30 + QString vymLink; // path to another map // FIXME-1 remove this
17.31 QList <Attribute> attributes; // List with attributes
17.32 -
17.33 - bool hideExport; // hide in exports if set
17.34 - bool hidden; // true if temporary hidden // FIXME moved to treeitem needs to move
17.35 };
17.36
17.37 #endif
18.1 --- a/treeitem.cpp Thu Apr 02 09:57:47 2009 +0000
18.2 +++ b/treeitem.cpp Tue Apr 07 16:15:53 2009 +0000
18.3 @@ -24,6 +24,8 @@
18.4 note.setNote("");
18.5 // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2
18.6 // isNoteInEditor=false;
18.7 +
18.8 + hidden=false;
18.9 }
18.10
18.11 TreeItem::~TreeItem()
18.12 @@ -39,11 +41,12 @@
18.13
18.14
18.15 /*
18.16 -void TreeItem::copy (OrnamentedObj* other) //FIXME-2
18.17 +void TreeItem::copy (OrnamentedObj* other) //FIXME-2 probably need deep copy of branches and data!
18.18
18.19 {
18.20 note.copy (other->note);
18.21 model=other->model;
18.22 + hideExport=other->hideExport;
18.23 }
18.24 */
18.25
18.26 @@ -186,17 +189,22 @@
18.27 itemData[0]=s;
18.28 }
18.29
18.30 -QString TreeItem::getHeading ()
18.31 +QString TreeItem::getHeading () const
18.32 {
18.33 return itemData[0].toString();
18.34 }
18.35
18.36 +std::string TreeItem::headingStd () const
18.37 +{
18.38 + return itemData[0].toString().toStdString();
18.39 +}
18.40 +
18.41 void TreeItem::setNote(const QString s)
18.42 {
18.43 note.setNote(s);
18.44 // updateNoteFlag(); FIXME-2 needed?
18.45 if (model)
18.46 - model->emitContentHasChanged (this);
18.47 + model->emitNoteHasChanged (this);
18.48 }
18.49
18.50 void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor)
18.51 @@ -204,7 +212,7 @@
18.52 note=n;
18.53 // updateNoteFlag(); FIXME-2 needed?
18.54 if (model && updateNoteEditor)
18.55 - model->emitContentHasChanged (this);
18.56 + model->emitNoteHasChanged (this);
18.57 }
18.58
18.59 QString TreeItem::getNote()
18.60 @@ -243,6 +251,12 @@
18.61 return type;
18.62 }
18.63
18.64 +bool TreeItem::isBranchLikeType() const
18.65 +{
18.66 + if (type==Branch ||type==MapCenter) return true;
18.67 + return false;
18.68 +}
18.69 +
18.70 QString TreeItem::getTypeName()
18.71 {
18.72 switch (type)
18.73 @@ -308,6 +322,94 @@
18.74 return getBranchNum (lastSelectedBranchNum);
18.75 }
18.76
18.77 +
18.78 +void TreeItem::setHideTmp (HideTmpMode mode)
18.79 +{
18.80 + if (isBranchLikeType() )
18.81 + ((BranchItem*)this)->updateVisibility();
18.82 + /*
18.83 + if (type==Image)
18.84 + //updateVisibility();
18.85 + */
18.86 +
18.87 +/*
18.88 +
18.89 + if (mode==HideExport && (hideExport || hasHiddenExportParent() ) )
18.90 + {
18.91 + // Hide stuff according to hideExport flag and parents
18.92 + //setVisibility (false);
18.93 + updateVisibility();
18.94 + //FIXME-2 hidden=true;
18.95 + }else
18.96 + {
18.97 + // Do not hide, but still take care of scrolled status
18.98 +
18.99 +
18.100 + XXXXXXXX treeItem should be THIS
18.101 +
18.102 + move visible to TreeItem???
18.103 +
18.104 + BranchObj now has updateContents
18.105 +
18.106 + maybe also start "bool TreeItem::branchlikeType"
18.107 +
18.108 +
18.109 +
18.110 + if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem))
18.111 + setVisibility (false);
18.112 + else
18.113 + setVisibility (true);
18.114 + //FIXME-2 hidden=false;
18.115 + }
18.116 +
18.117 +*/
18.118 + // And take care of my children
18.119 + for (int i=0; i<branchCount(); ++i)
18.120 + getBranchNum(i)->setHideTmp (mode);
18.121 +}
18.122 +
18.123 +bool TreeItem::hasHiddenExportParent()
18.124 +{
18.125 + // Calls parents recursivly to
18.126 + // find out, if we or parents are temp. hidden
18.127 +
18.128 + if (hidden || hideExport) return true;
18.129 +
18.130 + if (parentItem)
18.131 + return parentItem->hasHiddenExportParent();
18.132 + else
18.133 + return false;
18.134 +}
18.135 +
18.136 +
18.137 +void TreeItem::setHideInExport(bool b)
18.138 +{
18.139 + if (isBranchLikeType() )
18.140 + {
18.141 + hideExport=b;
18.142 + /* FIXME-1 call setVis and updateContentsSize...
18.143 + if (b)
18.144 + systemFlags->activate("hideInExport");
18.145 + else
18.146 + systemFlags->deactivate("hideInExport");
18.147 + calcBBoxSize();
18.148 + positionBBox();
18.149 + requestReposition();
18.150 + */
18.151 + }
18.152 +}
18.153 +
18.154 +bool TreeItem::hideInExport()
18.155 +{
18.156 + return hideExport;
18.157 +}
18.158 +
18.159 +bool TreeItem::isHidden()
18.160 +{
18.161 + return hidden;
18.162 +}
18.163 +
18.164 +
18.165 LinkableMapObj* TreeItem::getLMO() // FIXME-3 VM should be unnecessary in the end
18.166 {
18.167 return lmo;
19.1 --- a/treeitem.h Thu Apr 02 09:57:47 2009 +0000
19.2 +++ b/treeitem.h Tue Apr 07 16:15:53 2009 +0000
19.3 @@ -10,12 +10,16 @@
19.4 class LinkableMapObj;
19.5 class BranchObj;
19.6 class BranchItem;
19.7 +
19.8 +
19.9 class VymModel;
19.10
19.11 class TreeItem:public XMLObj
19.12 {
19.13 public:
19.14 enum Type {Undefined,MapCenter,Branch,Image};
19.15 + enum HideTmpMode {HideNone, HideExport};
19.16 +
19.17 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
19.18 ~TreeItem();
19.19 QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
19.20 @@ -49,7 +53,8 @@
19.21 // Accessing data
19.22 QVariant data(int column) const;
19.23 void setHeading (const QString s);
19.24 - QString getHeading();
19.25 + QString getHeading() const;
19.26 + std::string headingStd() const; //! convenience function used for debugging
19.27
19.28 protected:
19.29 NoteObj note;
19.30 @@ -68,6 +73,7 @@
19.31 public:
19.32 void setType (const Type t);
19.33 Type getType ();
19.34 + bool isBranchLikeType() const;
19.35 QString getTypeName ();
19.36
19.37 // Navigation and selection
19.38 @@ -79,8 +85,14 @@
19.39 void setLastSelectedBranch();
19.40 TreeItem* getLastSelectedBranch();
19.41
19.42 + virtual void setHideTmp (HideTmpMode);
19.43 + virtual bool hasHiddenExportParent ();
19.44 + virtual void setHideInExport(bool); // set export of object (and children)
19.45 + virtual bool hideInExport();
19.46 + virtual bool isHidden ();
19.47 +
19.48
19.49 - // Relation to map objects in graphicsscene
19.50 + // Relation to map objects in graphicsscene // FIXME-3 should be obsolete
19.51 LinkableMapObj* getLMO();
19.52 void setLMO (LinkableMapObj*);
19.53
19.54 @@ -97,6 +109,7 @@
19.55 int branchCounter;
19.56 int lastSelectedBranchNum;
19.57
19.58 + bool hideExport;//! Hide this item in export
19.59 bool hidden; //! Hidden in export if true
19.60 };
19.61
20.1 --- a/version.h Thu Apr 02 09:57:47 2009 +0000
20.2 +++ b/version.h Tue Apr 07 16:15:53 2009 +0000
20.3 @@ -7,7 +7,7 @@
20.4 #define __VYM_VERSION "1.13.0"
20.5 //#define __VYM_CODENAME "Codename: RC-1"
20.6 #define __VYM_CODENAME "Codename: development version"
20.7 -#define __VYM_BUILD_DATE "2009-04-02"
20.8 +#define __VYM_BUILD_DATE "2009-04-07"
20.9
20.10
20.11 bool checkVersion(const QString &);
21.1 --- a/vymmodel.cpp Thu Apr 02 09:57:47 2009 +0000
21.2 +++ b/vymmodel.cpp Tue Apr 07 16:15:53 2009 +0000
21.3 @@ -3,6 +3,7 @@
21.4
21.5 #include "vymmodel.h"
21.6
21.7 +#include "treeitem.h"
21.8 #include "branchitem.h"
21.9 #include "mapcenteritem.h"
21.10 #include "editxlinkdialog.h"
21.11 @@ -147,7 +148,7 @@
21.12 defXLinkWidth=1;
21.13 defXLinkColor=QColor (230,230,230);
21.14
21.15 - hidemode=HideNone;
21.16 + hidemode=TreeItem::HideNone;
21.17
21.18 // Network
21.19 netstate=Offline;
21.20 @@ -186,7 +187,7 @@
21.21
21.22
21.23
21.24 -QString VymModel::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel)
21.25 +QString VymModel::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, TreeItem *saveSel)
21.26 {
21.27 // tmpdir temporary directory to which data will be written
21.28 // prefix mapname, which will be appended to images etc.
21.29 @@ -357,20 +358,20 @@
21.30 // (map state is set later at end of load...)
21.31 } else
21.32 {
21.33 - BranchObj *bo=getSelectedBranch();
21.34 - if (!bo) return aborted;
21.35 + BranchItem *bi=getSelectedBranchItem();
21.36 + if (!bi) return aborted;
21.37 if (lmode==ImportAdd)
21.38 saveStateChangingPart(
21.39 - bo,
21.40 - bo,
21.41 + bi,
21.42 + bi,
21.43 QString("addMapInsert (%1)").arg(fname),
21.44 - QString("Add map %1 to %2").arg(fname).arg(getObjectName(bo)));
21.45 + QString("Add map %1 to %2").arg(fname).arg(getObjectName(bi)));
21.46 else
21.47 saveStateChangingPart(
21.48 - bo,
21.49 - bo,
21.50 + bi,
21.51 + bi,
21.52 QString("addMapReplace(%1)").arg(fname),
21.53 - QString("Add map %1 to %2").arg(fname).arg(getObjectName(bo)));
21.54 + QString("Add map %1 to %2").arg(fname).arg(getObjectName(bi)));
21.55 }
21.56
21.57
21.58 @@ -602,7 +603,7 @@
21.59 if (selectionType()==TreeItem::Image)
21.60 saveFloatImage();
21.61 else
21.62 - saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),getSelectedBranch());
21.63 + saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),getSelectedBranchItem());
21.64 // TODO take care of multiselections
21.65 }
21.66
21.67 @@ -719,8 +720,9 @@
21.68 return NULL;
21.69 }
21.70
21.71 -void VymModel::loadFloatImage ()
21.72 -{
21.73 +void VymModel::loadFloatImage () // FIXME-2
21.74 +{
21.75 +/*
21.76 BranchObj *bo=getSelectedBranch();
21.77 if (bo)
21.78 {
21.79 @@ -762,6 +764,7 @@
21.80 delete (p);
21.81 delete (fd);
21.82 }
21.83 +*/
21.84 }
21.85
21.86 void VymModel::saveFloatImageInt (FloatImageObj *fio, const QString &type, const QString &fn)
21.87 @@ -867,8 +870,9 @@
21.88 */
21.89 }
21.90
21.91 -void VymModel::importDirInt (const QString &s)
21.92 -{
21.93 +void VymModel::importDirInt (const QString &s) // FIXME-2
21.94 +{
21.95 +/*
21.96 BranchObj *bo=getSelectedBranch();
21.97 if (bo)
21.98 {
21.99 @@ -877,10 +881,12 @@
21.100 QDir d(s);
21.101 importDirInt (bo,d);
21.102 }
21.103 +*/
21.104 }
21.105
21.106 -void VymModel::importDir()
21.107 -{
21.108 +void VymModel::importDir() //FIXME-2
21.109 +{
21.110 +/*
21.111 BranchObj *bo=getSelectedBranch();
21.112 if (bo)
21.113 {
21.114 @@ -900,6 +906,7 @@
21.115 //FIXME-3 VM needed? scene()->update();
21.116 }
21.117 }
21.118 +*/
21.119 }
21.120
21.121
21.122 @@ -993,8 +1000,7 @@
21.123 findReset();
21.124 }
21.125
21.126 -
21.127 -QString VymModel::getObjectName (const LinkableMapObj *lmo)
21.128 +QString VymModel::getObjectName (const LinkableMapObj *lmo) // FIXME-3 should be obsolete
21.129 {
21.130 QString s;
21.131 if (!lmo) return QString("Error: NULL has no name!");
21.132 @@ -1003,7 +1009,7 @@
21.133 typeid(*lmo) == typeid(MapCenterObj)))
21.134 {
21.135
21.136 - s=(((BranchObj*)lmo)->getHeading());
21.137 + s=lmo->getTreeItem()->getHeading();
21.138 if (s=="") s="unnamed";
21.139 return QString("branch (%1)").arg(s);
21.140 }
21.141 @@ -1012,6 +1018,25 @@
21.142 return QString("Unknown type has no name!");
21.143 }
21.144
21.145 +
21.146 +QString VymModel::getObjectName (const TreeItem *ti)
21.147 +{
21.148 + QString s;
21.149 + if (!ti) return QString("Error: NULL has no name!");
21.150 +
21.151 + if (ti->isBranchLikeType() )
21.152 + {
21.153 + s=ti->getHeading();
21.154 + if (s=="") s="unnamed";
21.155 + return QString("branch (%1)").arg(s);
21.156 + }
21.157 + /* FIXME-2 move floatimage to TreeModel first
21.158 + if (type==TreeItem::Image)
21.159 + return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
21.160 + */
21.161 + return QString("Unknown type has no name!");
21.162 +}
21.163 +
21.164 void VymModel::redo()
21.165 {
21.166 // Can we undo at all?
21.167 @@ -1206,7 +1231,7 @@
21.168 return (tmpMapDir+"/"+histName);
21.169 }
21.170
21.171 -void VymModel::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
21.172 +void VymModel::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, TreeItem *saveSel)
21.173 {
21.174 sendData(redoCom); //FIXME-3 testing
21.175
21.176 @@ -1290,7 +1315,7 @@
21.177 }
21.178
21.179
21.180 -void VymModel::saveStateChangingPart(LinkableMapObj *undoSel, LinkableMapObj* redoSel, const QString &rc, const QString &comment)
21.181 +void VymModel::saveStateChangingPart(TreeItem *undoSel, TreeItem* redoSel, const QString &rc, const QString &comment)
21.182 {
21.183 // save the selected part of the map, Undo will replace part of map
21.184 QString undoSelection="";
21.185 @@ -1312,20 +1337,20 @@
21.186 undoSel);
21.187 }
21.188
21.189 -void VymModel::saveStateRemovingPart(LinkableMapObj *redoSel, const QString &comment)
21.190 +void VymModel::saveStateRemovingPart(TreeItem*redoSel, const QString &comment)
21.191 {
21.192 if (!redoSel)
21.193 {
21.194 qWarning ("VymModel::saveStateRemovingPart no redoSel given!");
21.195 return;
21.196 }
21.197 - QString undoSelection=getSelectString (redoSel->getParObj());
21.198 + QString undoSelection=getSelectString (redoSel->parent() );
21.199 QString redoSelection=getSelectString(redoSel);
21.200 - if (typeid(*redoSel) == typeid(BranchObj) )
21.201 + if (redoSel->getType()==TreeItem::Branch)
21.202 {
21.203 // save the selected branch of the map, Undo will insert part of map
21.204 saveState (PartOfMap,
21.205 - undoSelection, QString("addMapInsert (\"PATH\",%1)").arg(redoSel->getTreeItem()->num()),
21.206 + undoSelection, QString("addMapInsert (\"PATH\",%1)").arg(redoSel->num()),
21.207 redoSelection, "delete ()",
21.208 comment,
21.209 redoSel);
21.210 @@ -1333,7 +1358,7 @@
21.211 }
21.212
21.213
21.214 -void VymModel::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment)
21.215 +void VymModel::saveState(TreeItem *undoSel, const QString &uc, TreeItem *redoSel, const QString &rc, const QString &comment)
21.216 {
21.217 // "Normal" savestate: save commands, selections and comment
21.218 // so just save commands for undo and redo
21.219 @@ -1489,42 +1514,28 @@
21.220
21.221 void VymModel::setHeading(const QString &s)
21.222 {
21.223 - BranchObj *sel=getSelectedBranch();
21.224 - if (sel)
21.225 + BranchItem *selbi=getSelectedBranchItem();
21.226 + if (selbi)
21.227 {
21.228 saveState(
21.229 - sel,
21.230 - "setHeading (\""+sel->getHeading()+"\")",
21.231 - sel,
21.232 + selbi,
21.233 + "setHeading (\""+selbi->getHeading()+"\")",
21.234 + selbi,
21.235 "setHeading (\""+s+"\")",
21.236 - QString("Set heading of %1 to \"%2\"").arg(getObjectName(sel)).arg(s) );
21.237 - sel->setHeading(s );
21.238 + QString("Set heading of %1 to \"%2\"").arg(getObjectName(selbi)).arg(s) );
21.239 + selbi->setHeading(s );
21.240 + QModelIndex ix2=index (selbi);
21.241 + emit (dataChanged ( ix2,ix2));
21.242 /* FIXME-3 testing only
21.243 */
21.244 - TreeItem *ti=getSelectedItem();
21.245 - if (ti)
21.246 - {
21.247 - ti->setHeading (s);
21.248 - //FIXME-3 VM ix is wrong ModelIndex below, ix2 is (hopefully) correct:
21.249 - //QModelIndex ix=index( ti->row(), ti->column(), index (0,0,QModelIndex()) );
21.250 - //FIXME-3 VM testing only cout <<"VM::setHeading s="<<s.toStdString()<<" ti="<<ti<<" r,c=("<<ti->row()<<","<<ti->column()<<")"<<endl;
21.251 - QModelIndex ix2=index (ti);
21.252 - emit (dataChanged ( ix2,ix2));
21.253 - }
21.254 - else
21.255 - {
21.256 - cout << "Warning: VM::setHeading ti==NULL\n";
21.257 - }
21.258 -
21.259 - //cout <<" (r,c)=("<<ix2.row()<<","<<ix2.column()<<")"<<endl;
21.260
21.261 reposition();
21.262 - selection.update();
21.263 +// selection.update(); //FIXME-4
21.264 ensureSelectionVisible();
21.265 }
21.266 }
21.267
21.268 -BranchObj* VymModel::findText (QString s, bool cs)
21.269 +BranchItem* VymModel::findText (QString s, bool cs)
21.270 {
21.271 int d=0;
21.272 QTextDocument::FindFlags flags=0;
21.273 @@ -1577,7 +1588,7 @@
21.274 //cout <<"still searching... "<<qPrintable( itFind->getHeading())<<endl;
21.275 }
21.276 if (!searching)
21.277 - return getSelectedBranch();
21.278 + return getSelectedBranchItem();
21.279 else
21.280 return NULL;
21.281 }
21.282 @@ -1598,8 +1609,9 @@
21.283 // which is (still) needed to create MapCenters
21.284 }
21.285
21.286 -void VymModel::setURL(const QString &url)
21.287 -{
21.288 +void VymModel::setURL(const QString &url) //FIXME-2
21.289 +{
21.290 +/*
21.291 BranchObj *bo=getSelectedBranch();
21.292 if (bo)
21.293 {
21.294 @@ -1617,15 +1629,18 @@
21.295 selection.update();
21.296 ensureSelectionVisible();
21.297 }
21.298 +*/
21.299 }
21.300
21.301 -QString VymModel::getURL()
21.302 -{
21.303 +QString VymModel::getURL() //FIXME-2
21.304 +{
21.305 +/*
21.306 BranchObj *bo=getSelectedBranch();
21.307 if (bo)
21.308 return bo->getURL();
21.309 else
21.310 return "";
21.311 +*/
21.312 }
21.313
21.314 QStringList VymModel::getURLs() // FIXME-1 first, next moved to vymmodel
21.315 @@ -1678,8 +1693,9 @@
21.316 }
21.317
21.318
21.319 -void VymModel::setFrameType(const FrameObj::FrameType &t)
21.320 -{
21.321 +void VymModel::setFrameType(const FrameObj::FrameType &t) //FIXME-2
21.322 +{
21.323 +/*
21.324 BranchObj *bo=getSelectedBranch();
21.325 if (bo)
21.326 {
21.327 @@ -1690,10 +1706,12 @@
21.328 reposition();
21.329 bo->updateLink();
21.330 }
21.331 +*/
21.332 }
21.333
21.334 -void VymModel::setFrameType(const QString &s)
21.335 -{
21.336 +void VymModel::setFrameType(const QString &s) //FIXME-2
21.337 +{
21.338 +/*
21.339 BranchObj *bo=getSelectedBranch();
21.340 if (bo)
21.341 {
21.342 @@ -1703,10 +1721,12 @@
21.343 reposition();
21.344 bo->updateLink();
21.345 }
21.346 +*/
21.347 }
21.348
21.349 -void VymModel::setFramePenColor(const QColor &c)
21.350 -{
21.351 +void VymModel::setFramePenColor(const QColor &c) //FIXME-2
21.352 +{
21.353 +/*
21.354 BranchObj *bo=getSelectedBranch();
21.355 if (bo)
21.356 {
21.357 @@ -1714,10 +1734,12 @@
21.358 bo, QString ("setFramePenColor (\"%1\")").arg(c.name() ),QString ("set pen color of frame to %1").arg(c.name() ));
21.359 bo->setFramePenColor (c);
21.360 }
21.361 +*/
21.362 }
21.363
21.364 -void VymModel::setFrameBrushColor(const QColor &c)
21.365 -{
21.366 +void VymModel::setFrameBrushColor(const QColor &c) //FIXME-2
21.367 +{
21.368 +/*
21.369 BranchObj *bo=getSelectedBranch();
21.370 if (bo)
21.371 {
21.372 @@ -1725,10 +1747,11 @@
21.373 bo, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
21.374 bo->setFrameBrushColor (c);
21.375 }
21.376 -}
21.377 -
21.378 -void VymModel::setFramePadding (const int &i)
21.379 -{
21.380 +*/}
21.381 +
21.382 +void VymModel::setFramePadding (const int &i) //FIXME-2
21.383 +{
21.384 +/*
21.385 BranchObj *bo=getSelectedBranch();
21.386 if (bo)
21.387 {
21.388 @@ -1738,10 +1761,12 @@
21.389 reposition();
21.390 bo->updateLink();
21.391 }
21.392 + */
21.393 }
21.394
21.395 -void VymModel::setFrameBorderWidth(const int &i)
21.396 -{
21.397 +void VymModel::setFrameBorderWidth(const int &i) //FIXME-2
21.398 +{
21.399 +/*
21.400 BranchObj *bo=getSelectedBranch();
21.401 if (bo)
21.402 {
21.403 @@ -1751,10 +1776,12 @@
21.404 reposition();
21.405 bo->updateLink();
21.406 }
21.407 +*/
21.408 }
21.409
21.410 -void VymModel::setIncludeImagesVer(bool b)
21.411 -{
21.412 +void VymModel::setIncludeImagesVer(bool b) //FIXME-2
21.413 +{
21.414 +/*
21.415 BranchObj *bo=getSelectedBranch();
21.416 if (bo)
21.417 {
21.418 @@ -1771,10 +1798,11 @@
21.419 bo->setIncludeImagesVer(b);
21.420 reposition();
21.421 }
21.422 -}
21.423 -
21.424 -void VymModel::setIncludeImagesHor(bool b)
21.425 -{
21.426 +*/}
21.427 +
21.428 +void VymModel::setIncludeImagesHor(bool b) //FIXME-2
21.429 +{
21.430 +/*
21.431 BranchObj *bo=getSelectedBranch();
21.432 if (bo)
21.433 {
21.434 @@ -1791,10 +1819,12 @@
21.435 bo->setIncludeImagesHor(b);
21.436 reposition();
21.437 }
21.438 + */
21.439 }
21.440
21.441 -void VymModel::setHideLinkUnselected (bool b)
21.442 -{
21.443 +void VymModel::setHideLinkUnselected (bool b)//FIXME-2
21.444 +{
21.445 +/*
21.446 LinkableMapObj *sel=getSelectedLMO();
21.447 if (sel &&
21.448 (selectionType() == TreeItem::Branch ||
21.449 @@ -1813,41 +1843,43 @@
21.450 );
21.451 sel->setHideLinkUnselected(b);
21.452 }
21.453 +*/
21.454 }
21.455
21.456 void VymModel::setHideExport(bool b)
21.457 {
21.458 - BranchObj *bo=getSelectedBranch();
21.459 - if (bo)
21.460 + BranchItem *bi=getSelectedBranchItem();
21.461 + if (bi)
21.462 {
21.463 - bo->setHideInExport (b);
21.464 + bi->setHideInExport (b);
21.465 QString u= b ? "false" : "true";
21.466 QString r=!b ? "false" : "true";
21.467
21.468 saveState(
21.469 - bo,
21.470 + bi,
21.471 QString ("setHideExport (%1)").arg(u),
21.472 - bo,
21.473 + bi,
21.474 QString ("setHideExport (%1)").arg(r),
21.475 - QString ("Set HideExport flag of %1 to %2").arg(getObjectName(bo)).arg (r)
21.476 + QString ("Set HideExport flag of %1 to %2").arg(getObjectName(bi)).arg (r)
21.477 );
21.478 updateActions();
21.479 reposition();
21.480 - selection.update();
21.481 + // selection.update();
21.482 // FIXME-3 VM needed? scene()->update();
21.483 }
21.484 }
21.485
21.486 void VymModel::toggleHideExport()
21.487 {
21.488 - BranchObj *bo=getSelectedBranch();
21.489 - if (bo)
21.490 - setHideExport ( !bo->hideInExport() );
21.491 + BranchItem *selbi=getSelectedBranchItem();
21.492 + if (selbi)
21.493 + setHideExport ( !selbi->hideInExport() );
21.494 }
21.495
21.496
21.497 -void VymModel::copy()
21.498 -{
21.499 +void VymModel::copy() //FIXME-2
21.500 +{
21.501 +/*
21.502 LinkableMapObj *sel=getSelectedLMO();
21.503 if (sel &&
21.504 (selectionType() == TreeItem::Branch ||
21.505 @@ -1870,11 +1902,13 @@
21.506 clipboardEmpty=false;
21.507 updateActions();
21.508 }
21.509 +*/
21.510 }
21.511
21.512
21.513 -void VymModel::pasteNoSave(const int &n)
21.514 -{
21.515 +void VymModel::pasteNoSave(const int &n) //FIXME-2
21.516 +{
21.517 +/*
21.518 bool old=blockSaveState;
21.519 blockSaveState=true;
21.520 bool zippedOrg=zipped;
21.521 @@ -1889,10 +1923,12 @@
21.522 load (clipboardDir+"/"+clipboardFile,ImportAdd, VymMap);
21.523 zipped=zippedOrg;
21.524 blockSaveState=old;
21.525 +*/
21.526 }
21.527
21.528 -void VymModel::paste()
21.529 +void VymModel::paste() //FIXME-2
21.530 {
21.531 +/*
21.532 BranchObj *sel=getSelectedBranch();
21.533 if (sel)
21.534 {
21.535 @@ -1905,15 +1941,18 @@
21.536 pasteNoSave(0);
21.537 reposition();
21.538 }
21.539 +*/
21.540 }
21.541
21.542 -void VymModel::cut()
21.543 -{
21.544 +void VymModel::cut() //FIXME-2
21.545 +{
21.546 +/*
21.547 LinkableMapObj *sel=getSelectedLMO();
21.548 if ( sel && (selectionType() == TreeItem::Branch ||
21.549 selectionType()==TreeItem::MapCenter ||
21.550 selectionType()==TreeItem::Image))
21.551 {
21.552 +*/
21.553 /* No savestate! savestate is called in cutNoSave
21.554 saveStateChangingPart(
21.555 sel->getParObj(),
21.556 @@ -1922,14 +1961,16 @@
21.557 QString("Cut %1").arg(getObjectName(sel ))
21.558 );
21.559 */
21.560 +/*
21.561 copy();
21.562 deleteSelection();
21.563 reposition();
21.564 }
21.565 -}
21.566 -
21.567 -void VymModel::moveBranchUp()
21.568 -{
21.569 +*/}
21.570 +
21.571 +void VymModel::moveBranchUp() //FIXME-2
21.572 +{
21.573 +/*
21.574 BranchObj* bo=getSelectedBranch();
21.575 BranchObj* par;
21.576 if (bo)
21.577 @@ -1943,10 +1984,12 @@
21.578 selection.update();
21.579 ensureSelectionVisible();
21.580 }
21.581 + */
21.582 }
21.583
21.584 -void VymModel::moveBranchDown()
21.585 -{
21.586 +void VymModel::moveBranchDown() //FIXME-2
21.587 +{
21.588 +/*
21.589 BranchObj* bo=getSelectedBranch();
21.590 BranchObj* par;
21.591 if (bo)
21.592 @@ -1960,9 +2003,10 @@
21.593 selection.update();
21.594 ensureSelectionVisible();
21.595 }
21.596 +*/
21.597 }
21.598
21.599 -void VymModel::sortChildren() // FIXME-1 not implemented yet
21.600 +void VymModel::sortChildren() // FIXME-2 not implemented yet
21.601 {
21.602 /*
21.603 BranchObj* bo=getSelectedBranch();
21.604 @@ -1979,10 +2023,11 @@
21.605 */
21.606 }
21.607
21.608 -void VymModel::createMapCenter()
21.609 -{
21.610 - MapCenterObj *mco=addMapCenter (QPointF (0,0) );
21.611 - select (mco);
21.612 +MapCenterItem* VymModel::createMapCenter()
21.613 +{
21.614 + MapCenterItem *mci=addMapCenter (QPointF (0,0) );
21.615 + select (mci);
21.616 + return mci;
21.617 }
21.618
21.619 BranchItem* VymModel::createBranch() // FIXME-2 switcht addNewBrancInt to BranchItem...
21.620 @@ -1991,8 +2036,9 @@
21.621 return (BranchItem*)bo->getTreeItem();
21.622 }
21.623
21.624 -TreeItem* VymModel::createImage()
21.625 -{
21.626 +TreeItem* VymModel::createImage() //FIXME-2
21.627 +{
21.628 +/*
21.629 BranchObj *bo=getSelectedBranch();
21.630 if (bo)
21.631 {
21.632 @@ -2015,25 +2061,26 @@
21.633 }
21.634 }
21.635 return NULL;
21.636 +*/
21.637 }
21.638
21.639 -MapCenterObj* VymModel::addMapCenter ()
21.640 -{
21.641 - MapCenterObj *mco=addMapCenter (contextPos);
21.642 +MapCenterItem* VymModel::addMapCenter ()
21.643 +{
21.644 + MapCenterItem *mci=addMapCenter (contextPos); //FIXME-2 get rid of MCO here
21.645 //FIXME-3 selection.select (mco);
21.646 updateActions();
21.647 ensureSelectionVisible();
21.648 saveState (
21.649 - mco,
21.650 + mci,
21.651 "delete()",
21.652 NULL,
21.653 QString ("addMapCenter (%1,%2)").arg (contextPos.x()).arg(contextPos.y()),
21.654 QString ("Adding MapCenter to (%1,%2)").arg (contextPos.x()).arg(contextPos.y())
21.655 );
21.656 - return mco;
21.657 + return mci;
21.658 }
21.659
21.660 -MapCenterObj* VymModel::addMapCenter(QPointF absPos)
21.661 +MapCenterItem* VymModel::addMapCenter(QPointF absPos)
21.662 {
21.663
21.664 // Create TreeItem
21.665 @@ -2046,10 +2093,11 @@
21.666
21.667 QList<QVariant> cData;
21.668 cData << "VM:addMapCenter" << "undef"<<"undef";
21.669 - MapCenterItem *ti=new MapCenterItem (cData,rootItem);
21.670 - cout << "VM::addMapCenter ti="<<ti<<endl;
21.671 - ti->setType (TreeItem::MapCenter);
21.672 - rootItem->appendChild (ti);
21.673 + MapCenterItem *mci=new MapCenterItem (cData,rootItem);
21.674 + cout << "VM::addMapCenter mci="<<mci<<endl;
21.675 + mci->setType (TreeItem::MapCenter);
21.676 + mci->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
21.677 + rootItem->appendChild (mci);
21.678
21.679 endInsertRows();
21.680 emit (newChildObject (parix));
21.681 @@ -2058,12 +2106,13 @@
21.682 // Create MapObj
21.683 MapCenterObj *mapCenter = new MapCenterObj(mapScene,this);
21.684 mapCenter->setMapEditor(mapEditor); //FIXME-3 VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects
21.685 - mapCenter->setTreeItem (ti); // TreeItem needs to exist before setVisibility
21.686 - ti->setLMO (mapCenter);
21.687 + mapCenter->setTreeItem (mci); // TreeItem needs to exist before setVisibility
21.688 + mci->setLMO (mapCenter);
21.689 + mapCenter->updateHeading();
21.690 mapCenter->move (absPos);
21.691 mapCenter->setVisibility (true);
21.692 - mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
21.693 - mapCenters.append(mapCenter);
21.694 + //mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
21.695 + mapCenters.append(mapCenter); //FIXME-1 get rid of mapCenters...
21.696 // Testing
21.697 /*
21.698 qWarning ("MW::insertRow a");
21.699 @@ -2074,11 +2123,12 @@
21.700 qWarning ("MW::insertRow b");
21.701 */
21.702
21.703 - return mapCenter;
21.704 + return mci;
21.705 }
21.706
21.707 -MapCenterObj* VymModel::removeMapCenter(MapCenterObj* mco)
21.708 -{
21.709 +MapCenterItem* VymModel::removeMapCenter(MapCenterItem* mci) //FIXME-2
21.710 +{
21.711 +/*
21.712 int i=mapCenters.indexOf (mco);
21.713 if (i>=0)
21.714 {
21.715 @@ -2086,6 +2136,7 @@
21.716 delete (mco);
21.717 if (i>0) return mapCenters.at(i-1); // Return previous MCO
21.718 }
21.719 +*/
21.720 return NULL;
21.721 }
21.722
21.723 @@ -2107,7 +2158,7 @@
21.724 // -1 insert in children of parent below selection
21.725 // 0..n insert in children of parent at pos
21.726 BranchObj *newbo=NULL;
21.727 - BranchObj *bo=getSelectedBranch();
21.728 + BranchObj *bo=getSelectedBranchObj(); //FIXME-2
21.729 BranchItem *bi=getSelectedBranchItem();
21.730 if (bo)
21.731 {
21.732 @@ -2125,6 +2176,7 @@
21.733 beginInsertRows (parix,n,n+1);
21.734 bi=new BranchItem (cData,parbi);
21.735 bi->setType (TreeItem::Branch);
21.736 + bi->setHeading (QApplication::translate("Heading of new branch in map", "new"));
21.737
21.738 parbi->appendChild (bi);
21.739 endInsertRows ();
21.740 @@ -2139,7 +2191,7 @@
21.741 {
21.742 bi->setLMO (newbo);
21.743 newbo->setTreeItem (bi);
21.744 - select (newbo); // FIXME-2 VM really needed here?
21.745 + select (bi);
21.746 }
21.747
21.748 }else if (num==-1)
21.749 @@ -2163,7 +2215,7 @@
21.750 // -1 add above
21.751 // 0 add as child
21.752 // +1 add below
21.753 - BranchObj *bo = getSelectedBranch();
21.754 + BranchObj *bo = getSelectedBranchObj(); //FIXME-2
21.755 BranchObj *newbo=NULL;
21.756
21.757 if (bo)
21.758 @@ -2175,9 +2227,9 @@
21.759 if (newbo)
21.760 {
21.761 saveState(
21.762 - newbo,
21.763 + newbo->getTreeItem(),
21.764 "delete ()",
21.765 - bo,
21.766 + bo->getTreeItem(),
21.767 QString ("addBranch (%1)").arg(pos),
21.768 QString ("Add new branch to %1").arg(getObjectName(bo)));
21.769
21.770 @@ -2197,8 +2249,9 @@
21.771 }
21.772
21.773
21.774 -BranchObj* VymModel::addNewBranchBefore()
21.775 -{
21.776 +BranchObj* VymModel::addNewBranchBefore() //FIXME-2
21.777 +{
21.778 +/*
21.779 BranchObj *newbo=NULL;
21.780 BranchObj *bo = getSelectedBranch();
21.781 if (bo && selectionType()==TreeItem::Branch)
21.782 @@ -2228,14 +2281,18 @@
21.783 }
21.784 latestSelectionString=selection.getSelectString();
21.785 return newbo;
21.786 + */
21.787 + return NULL;
21.788 }
21.789
21.790 void VymModel::deleteSelection()
21.791 {
21.792 - BranchObj *bo = getSelectedBranch(); // FIXME-2 VM should not be necessary
21.793 - if (!bo) return;
21.794 -
21.795 - QModelIndex ix=getSelectedIndex();
21.796 + BranchObj *bo = getSelectedBranchObj(); // FIXME-2 VM should not be necessary
21.797 + BranchItem *selbi=getSelectedBranchItem();
21.798 +
21.799 + if (!selbi) return;
21.800 +
21.801 + QModelIndex ix=index (selbi);
21.802 if (!ix.isValid() ) return;
21.803
21.804 QModelIndex parentIndex=parent(ix);
21.805 @@ -2246,45 +2303,45 @@
21.806 return;
21.807 }
21.808 */
21.809 - TreeItem *ti=bo->getTreeItem();
21.810
21.811 - if (selectionType()==TreeItem::MapCenter)
21.812 + /*
21.813 + if (selbi->getType()==TreeItem::MapCenter)
21.814 {
21.815 // BranchObj* par=(BranchObj*)(bo->getParObj());
21.816 //selection.unselect();
21.817 - /* FIXME-1 VM Note: does saveStateRemovingPart work for MCO? (No parent!)
21.818 - saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
21.819 - */
21.820 + // FIXME-1 VM Note: does saveStateRemovingPart work for MCO? (No parent!)
21.821 + //saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
21.822 emit (layoutAboutToBeChanged() );
21.823
21.824 - parentIndex=parent(index(ti));
21.825 - cout << "VM::delete ti="<<ti<<" row="<<ix.row()<<" parIndex.valid="<<parentIndex.isValid()<<endl;
21.826 + parentIndex=parent(index(selbi));
21.827 + cout << "VM::delete selbi="<<selbi<<" row="<<ix.row()<<" parIndex.valid="<<parentIndex.isValid()<<endl;
21.828 int n=ix.row();
21.829 beginRemoveRows (parentIndex,n,n);
21.830 removeRows (n,1,parentIndex);
21.831 - bo=removeMapCenter ((MapCenterObj*)bo);
21.832 + MapCenterItem *mci=removeMapCenter (selbi);
21.833 endRemoveRows();
21.834 - if (bo)
21.835 + if (mci)
21.836 {
21.837 - select (bo);
21.838 - ensureSelectionVisible();
21.839 + select (mci);
21.840 ensureSelectionVisible();
21.841 reposition();
21.842 }
21.843
21.844 emit (layoutChanged() );
21.845 }
21.846 - if (selectionType()==TreeItem::Branch)
21.847 + if (selbi->getType()==TreeItem::Branch)
21.848 + */
21.849 + if (selbi->isBranchLikeType() )
21.850 {
21.851
21.852 BranchObj* par=(BranchObj*)bo->getParObj();
21.853 unselect();
21.854 - saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo)));
21.855 + saveStateRemovingPart (selbi, QString ("Delete %1").arg(getObjectName(bo)));
21.856
21.857 emit (layoutAboutToBeChanged() );
21.858
21.859 - cout << "VM::delete ti="<<ti<<" row="<<ix.row()<<endl;
21.860 - parentIndex=parent(index(ti));
21.861 + cout << "VM::delete selbi="<<selbi<<" row="<<ix.row()<<endl;
21.862 + parentIndex=parent(index(selbi));
21.863 int n=ix.row();
21.864 beginRemoveRows (parentIndex,n,n);
21.865 removeRows (n,1,parentIndex);
21.866 @@ -2319,9 +2376,10 @@
21.867 */
21.868 }
21.869
21.870 -void VymModel::deleteKeepChildren() //FIXME-1 VM still missing
21.871 -
21.872 -{
21.873 +void VymModel::deleteKeepChildren() //FIXME-2 VM still missing
21.874 +
21.875 +{
21.876 +/*
21.877 BranchObj *bo=getSelectedBranch();
21.878 BranchObj *par;
21.879 if (bo)
21.880 @@ -2354,11 +2412,12 @@
21.881 getSelectedBranch()->move2RelPos (p);
21.882 reposition();
21.883 }
21.884 -}
21.885 -
21.886 -void VymModel::deleteChildren() //FIXME-1 VM still missing
21.887 -
21.888 -{
21.889 +*/}
21.890 +
21.891 +void VymModel::deleteChildren() //FIXME-2 VM still missing
21.892 +
21.893 +{
21.894 +/*
21.895 BranchObj *bo=getSelectedBranch();
21.896 if (bo)
21.897 {
21.898 @@ -2371,7 +2430,7 @@
21.899 bo->removeChildren();
21.900 reposition();
21.901 }
21.902 -}
21.903 +*/}
21.904
21.905
21.906 bool VymModel::scrollBranch(BranchItem *bi)
21.907 @@ -2384,7 +2443,7 @@
21.908 QString u,r;
21.909 r="scroll";
21.910 u="unscroll";
21.911 - /* FIXME-1 no savestate yet
21.912 + /* FIXME-3 no savestate yet
21.913 saveState(
21.914 bo,
21.915 QString ("%1 ()").arg(u),
21.916 @@ -2412,7 +2471,7 @@
21.917 QString u,r;
21.918 u="scroll";
21.919 r="unscroll";
21.920 - /* FIXME-1 no savestate yet
21.921 + /* FIXME-3 no savestate yet
21.922 saveState(
21.923 bo,
21.924 QString ("%1 ()").arg(u),
21.925 @@ -2458,8 +2517,9 @@
21.926 */
21.927 }
21.928
21.929 -void VymModel::addFloatImage (const QPixmap &img)
21.930 -{
21.931 +void VymModel::addFloatImage (const QPixmap &img) //FIXME-2
21.932 +{
21.933 +/*
21.934 BranchObj *bo=getSelectedBranch();
21.935 if (bo)
21.936 {
21.937 @@ -2472,11 +2532,13 @@
21.938 reposition();
21.939 // FIXME-3 VM needed? scene()->update();
21.940 }
21.941 +*/
21.942 }
21.943
21.944
21.945 -void VymModel::colorBranch (QColor c)
21.946 -{
21.947 +void VymModel::colorBranch (QColor c) //FIXME-2
21.948 +{
21.949 +/*
21.950 BranchObj *bo=getSelectedBranch();
21.951 if (bo)
21.952 {
21.953 @@ -2489,10 +2551,12 @@
21.954 );
21.955 bo->setColor(c); // color branch
21.956 }
21.957 +*/
21.958 }
21.959
21.960 -void VymModel::colorSubtree (QColor c)
21.961 -{
21.962 +void VymModel::colorSubtree (QColor c) //FIXME-2
21.963 +{
21.964 +/*
21.965 BranchObj *bo=getSelectedBranch();
21.966 if (bo)
21.967 {
21.968 @@ -2504,21 +2568,25 @@
21.969 );
21.970 bo->setColorSubtree (c); // color links, color children
21.971 }
21.972 +*/
21.973 }
21.974
21.975 -QColor VymModel::getCurrentHeadingColor()
21.976 -{
21.977 +QColor VymModel::getCurrentHeadingColor() //FIXME-2
21.978 +{
21.979 +/*
21.980 BranchObj *bo=getSelectedBranch();
21.981 if (bo) return bo->getColor();
21.982
21.983 QMessageBox::warning(0,"Warning","Can't get color of heading,\nthere's no branch selected");
21.984 + */
21.985 return Qt::black;
21.986 }
21.987
21.988
21.989
21.990 -void VymModel::editURL()
21.991 -{
21.992 +void VymModel::editURL() //FIXME-2
21.993 +{
21.994 +/*
21.995 BranchObj *bo=getSelectedBranch();
21.996 if (bo)
21.997 {
21.998 @@ -2530,10 +2598,12 @@
21.999 // user entered something and pressed OK
21.1000 setURL(text);
21.1001 }
21.1002 +*/
21.1003 }
21.1004
21.1005 -void VymModel::editLocalURL()
21.1006 -{
21.1007 +void VymModel::editLocalURL() //FIXME-2
21.1008 +{
21.1009 +/*
21.1010 BranchObj *bo=getSelectedBranch();
21.1011 if (bo)
21.1012 {
21.1013 @@ -2557,28 +2627,34 @@
21.1014 setURL (fd->selectedFile() );
21.1015 }
21.1016 }
21.1017 + */
21.1018 }
21.1019
21.1020
21.1021 -void VymModel::editHeading2URL()
21.1022 -{
21.1023 +void VymModel::editHeading2URL() //FIXME-2
21.1024 +{
21.1025 +/*
21.1026 BranchObj *bo=getSelectedBranch();
21.1027 if (bo)
21.1028 setURL (bo->getHeading());
21.1029 +*/
21.1030 }
21.1031
21.1032 -void VymModel::editBugzilla2URL()
21.1033 -{
21.1034 +void VymModel::editBugzilla2URL() //FIXME-2
21.1035 +{
21.1036 +/*
21.1037 BranchObj *bo=getSelectedBranch();
21.1038 if (bo)
21.1039 {
21.1040 QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
21.1041 setURL (url);
21.1042 }
21.1043 +*/
21.1044 }
21.1045
21.1046 -void VymModel::editFATE2URL()
21.1047 -{
21.1048 +void VymModel::editFATE2URL() //FIXME-2
21.1049 +{
21.1050 +/*
21.1051 BranchObj *bo=getSelectedBranch();
21.1052 if (bo)
21.1053 {
21.1054 @@ -2593,12 +2669,13 @@
21.1055 bo->setURL (url);
21.1056 updateActions();
21.1057 }
21.1058 +*/
21.1059 }
21.1060
21.1061 void VymModel::editVymLink()
21.1062 {
21.1063 - BranchObj *bo=getSelectedBranch();
21.1064 - if (bo)
21.1065 + BranchItem *bi=getSelectedBranchItem();
21.1066 + if (bi)
21.1067 {
21.1068 QStringList filters;
21.1069 filters <<"VYM map (*.vym)";
21.1070 @@ -2606,8 +2683,8 @@
21.1071 fd->setFilters (filters);
21.1072 fd->setCaption(vymName+" - " +tr("Link to another map"));
21.1073 fd->setDirectory (lastFileDir);
21.1074 - if (! bo->getVymLink().isEmpty() )
21.1075 - fd->selectFile( bo->getVymLink() );
21.1076 + if (! bi->getVymLink().isEmpty() )
21.1077 + fd->selectFile( bi->getVymLink() );
21.1078 fd->show();
21.1079
21.1080 QString fn;
21.1081 @@ -2615,44 +2692,45 @@
21.1082 {
21.1083 lastFileDir=QDir (fd->directory().path());
21.1084 saveState(
21.1085 - bo,
21.1086 - "setVymLink (\""+bo->getVymLink()+"\")",
21.1087 - bo,
21.1088 + bi,
21.1089 + "setVymLink (\""+bi->getVymLink()+"\")",
21.1090 + bi,
21.1091 "setVymLink (\""+fd->selectedFile()+"\")",
21.1092 - QString("Set vymlink of %1 to %2").arg(getObjectName(bo)).arg(fd->selectedFile())
21.1093 + QString("Set vymlink of %1 to %2").arg(getObjectName(bi)).arg(fd->selectedFile())
21.1094 );
21.1095 setVymLink (fd->selectedFile() ); // FIXME-2 ok?
21.1096 }
21.1097 }
21.1098 }
21.1099
21.1100 -void VymModel::setVymLink (const QString &s)
21.1101 +void VymModel::setVymLink (const QString &s) // FIXME-3 no savestate?
21.1102 {
21.1103 // Internal function, no saveState needed
21.1104 - BranchObj *bo=getSelectedBranch();
21.1105 - if (bo)
21.1106 + BranchItem *bi=getSelectedBranchItem();
21.1107 + if (bi)
21.1108 {
21.1109 - bo->setVymLink(s);
21.1110 + bi->getBranchObj()->setVymLink(s); //FIXME-3 check getBO
21.1111 reposition();
21.1112 updateActions();
21.1113 - selection.update();
21.1114 + //selection.update();
21.1115 ensureSelectionVisible();
21.1116 }
21.1117 }
21.1118
21.1119 void VymModel::deleteVymLink()
21.1120 {
21.1121 - BranchObj *bo=getSelectedBranch();
21.1122 - if (bo)
21.1123 + BranchItem *bi=getSelectedBranchItem();
21.1124 + if (bi)
21.1125 {
21.1126 saveState(
21.1127 - bo,
21.1128 - "setVymLink (\""+bo->getVymLink()+"\")",
21.1129 - bo,
21.1130 + bi,
21.1131 + "setVymLink (\""+bi->getBranchObj()->getVymLink()+"\")", //FIXME-3 check getBO
21.1132 +
21.1133 + bi,
21.1134 "setVymLink (\"\")",
21.1135 - QString("Unset vymlink of %1").arg(getObjectName(bo))
21.1136 + QString("Unset vymlink of %1").arg(getObjectName(bi))
21.1137 );
21.1138 - bo->setVymLink ("" );
21.1139 + bi->getBranchObj()->setVymLink ("" ); //FIXME-3 check getBO
21.1140 updateActions();
21.1141 reposition();
21.1142 // FIXME-3 VM needed? scene()->update();
21.1143 @@ -2661,9 +2739,9 @@
21.1144
21.1145 QString VymModel::getVymLink()
21.1146 {
21.1147 - BranchObj *bo=getSelectedBranch();
21.1148 - if (bo)
21.1149 - return bo->getVymLink();
21.1150 + BranchItem *bi=getSelectedBranchItem();
21.1151 + if (bi)
21.1152 + return bi->getBranchObj()->getVymLink(); //FIXME-3 check getBO here...
21.1153 else
21.1154 return "";
21.1155
21.1156 @@ -2689,8 +2767,10 @@
21.1157 }
21.1158
21.1159
21.1160 -void VymModel::followXLink(int i)
21.1161 -{
21.1162 +void VymModel::followXLink(int i) // FIXME-2
21.1163 +{
21.1164 + i=0;
21.1165 + /*
21.1166 BranchObj *bo=getSelectedBranch();
21.1167 if (bo)
21.1168 {
21.1169 @@ -2701,10 +2781,13 @@
21.1170 ensureSelectionVisible();
21.1171 }
21.1172 }
21.1173 + */
21.1174 }
21.1175
21.1176 -void VymModel::editXLink(int i) // FIXME-1 VM missing saveState
21.1177 -{
21.1178 +void VymModel::editXLink(int i) // FIXME-2 VM missing saveState
21.1179 +{
21.1180 + i=0;
21.1181 + /*
21.1182 BranchObj *bo=getSelectedBranch();
21.1183 if (bo)
21.1184 {
21.1185 @@ -2726,6 +2809,7 @@
21.1186 }
21.1187 }
21.1188 }
21.1189 +*/
21.1190 }
21.1191
21.1192
21.1193 @@ -2738,7 +2822,7 @@
21.1194
21.1195 void VymModel::parseAtom(const QString &atom)
21.1196 {
21.1197 - BranchObj *selb=getSelectedBranch();
21.1198 + //BranchObj *selb=getSelectedBranch(); // FIXME-4
21.1199 TreeItem* selti=getSelectedItem();
21.1200 BranchItem *selbi=getSelectedBranchItem();
21.1201 QString s,t;
21.1202 @@ -2757,7 +2841,7 @@
21.1203 if (!selti)
21.1204 {
21.1205 parser.setError (Aborted,"Nothing selected");
21.1206 - } else if (! selb )
21.1207 + } else if (! selbi )
21.1208 {
21.1209 parser.setError (Aborted,"Type of selection is not a branch");
21.1210 } else
21.1211 @@ -2781,7 +2865,7 @@
21.1212 if (!selti)
21.1213 {
21.1214 parser.setError (Aborted,"Nothing selected");
21.1215 - } else if (! selb )
21.1216 + } else if (! selbi )
21.1217 {
21.1218 parser.setError (Aborted,"Type of selection is not a branch");
21.1219 } else
21.1220 @@ -2809,7 +2893,7 @@
21.1221 if (!selti)
21.1222 {
21.1223 parser.setError (Aborted,"Nothing selected");
21.1224 - } else if (! selb )
21.1225 + } else if (! selbi )
21.1226 {
21.1227 parser.setError (Aborted,"Type of selection is not a branch");
21.1228 } else if (parser.checkParCount(1))
21.1229 @@ -2817,7 +2901,7 @@
21.1230 //s=parser.parString (ok,0); // selection
21.1231 t=parser.parString (ok,0); // path to map
21.1232 if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
21.1233 - addMapReplaceInt(getSelectString(selb),t);
21.1234 + addMapReplaceInt(getSelectString(selbi),t);
21.1235 }
21.1236 /////////////////////////////////////////////////////////////////////
21.1237 } else if (com==QString("addMapInsert"))
21.1238 @@ -2825,7 +2909,7 @@
21.1239 if (!selti)
21.1240 {
21.1241 parser.setError (Aborted,"Nothing selected");
21.1242 - } else if (! selb )
21.1243 + } else if (! selbi )
21.1244 {
21.1245 parser.setError (Aborted,"Type of selection is not a branch");
21.1246 } else
21.1247 @@ -2839,12 +2923,12 @@
21.1248 }
21.1249 }
21.1250 /////////////////////////////////////////////////////////////////////
21.1251 - } else if (com=="clearFlags")
21.1252 + } else /*if (com=="clearFlags") // FIXME-2
21.1253 {
21.1254 if (!selti )
21.1255 {
21.1256 parser.setError (Aborted,"Nothing selected");
21.1257 - } else if (! selb )
21.1258 + } else if (! selbi )
21.1259 {
21.1260 parser.setError (Aborted,"Type of selection is not a branch");
21.1261 } else if (parser.checkParCount(0))
21.1262 @@ -2853,12 +2937,12 @@
21.1263 selb->updateFlagsToolbar();
21.1264 }
21.1265 /////////////////////////////////////////////////////////////////////
21.1266 - } else if (com=="colorBranch")
21.1267 + } else */ if (com=="colorBranch")
21.1268 {
21.1269 if (!selti)
21.1270 {
21.1271 parser.setError (Aborted,"Nothing selected");
21.1272 - } else if (! selb )
21.1273 + } else if (! selbi )
21.1274 {
21.1275 parser.setError (Aborted,"Type of selection is not a branch");
21.1276 } else if (parser.checkParCount(1))
21.1277 @@ -2872,7 +2956,7 @@
21.1278 if (!selti)
21.1279 {
21.1280 parser.setError (Aborted,"Nothing selected");
21.1281 - } else if (! selb )
21.1282 + } else if (! selbi )
21.1283 {
21.1284 parser.setError (Aborted,"Type of selection is not a branch");
21.1285 } else if (parser.checkParCount(1))
21.1286 @@ -2886,7 +2970,7 @@
21.1287 if (!selti)
21.1288 {
21.1289 parser.setError (Aborted,"Nothing selected");
21.1290 - } else if (! selb )
21.1291 + } else if (! selbi )
21.1292 {
21.1293 parser.setError (Aborted,"Type of selection is not a branch");
21.1294 } else if (parser.checkParCount(0))
21.1295 @@ -2930,7 +3014,7 @@
21.1296 if (!selti)
21.1297 {
21.1298 parser.setError (Aborted,"Nothing selected");
21.1299 - } else if (! selb )
21.1300 + } else if (! selbi )
21.1301 {
21.1302 parser.setError (Aborted,"Type of selection is not a branch");
21.1303 } else if (parser.checkParCount(0))
21.1304 @@ -2943,7 +3027,7 @@
21.1305 if (!selti)
21.1306 {
21.1307 parser.setError (Aborted,"Nothing selected");
21.1308 - } else if (! selb)
21.1309 + } else if (! selbi)
21.1310 {
21.1311 parser.setError (Aborted,"Type of selection is not a branch");
21.1312 } else if (parser.checkParCount(0))
21.1313 @@ -3021,7 +3105,7 @@
21.1314 if (!selti)
21.1315 {
21.1316 parser.setError (Aborted,"Nothing selected");
21.1317 - } else if (! selb )
21.1318 + } else if (! selbi )
21.1319 {
21.1320 parser.setError (Aborted,"Type of selection is not a branch");
21.1321 } else if (parser.checkParCount(1))
21.1322 @@ -3030,12 +3114,12 @@
21.1323 if (ok) importDirInt(s);
21.1324 }
21.1325 /////////////////////////////////////////////////////////////////////
21.1326 - } else if (com=="linkTo")
21.1327 + } else /* FIXME-2 if (com=="linkTo")
21.1328 {
21.1329 if (!selti)
21.1330 {
21.1331 parser.setError (Aborted,"Nothing selected");
21.1332 - } else if ( selb)
21.1333 + } else if ( selbi)
21.1334 {
21.1335 if (parser.checkParCount(4))
21.1336 {
21.1337 @@ -3065,7 +3149,7 @@
21.1338 y=parser.parDouble(ok,3);
21.1339 if (ok)
21.1340 {
21.1341 - selb->move (x,y);
21.1342 + selbi->move (x,y);
21.1343 selection.update();
21.1344 }
21.1345 }
21.1346 @@ -3090,12 +3174,12 @@
21.1347 } else
21.1348 parser.setError (Aborted,"Type of selection is not a floatimage or branch");
21.1349 /////////////////////////////////////////////////////////////////////
21.1350 - } else if (com=="loadImage")
21.1351 + } else */ if (com=="loadImage")
21.1352 {
21.1353 if (!selti)
21.1354 {
21.1355 parser.setError (Aborted,"Nothing selected");
21.1356 - } else if (! selb )
21.1357 + } else if (! selbi )
21.1358 {
21.1359 parser.setError (Aborted,"Type of selection is not a branch");
21.1360 } else if (parser.checkParCount(1))
21.1361 @@ -3109,7 +3193,7 @@
21.1362 if (!selti )
21.1363 {
21.1364 parser.setError (Aborted,"Nothing selected");
21.1365 - } else if (! selb )
21.1366 + } else if (! selbi )
21.1367 {
21.1368 parser.setError (Aborted,"Type of selection is not a branch");
21.1369 } else if (parser.checkParCount(0))
21.1370 @@ -3122,7 +3206,7 @@
21.1371 if (!selti )
21.1372 {
21.1373 parser.setError (Aborted,"Nothing selected");
21.1374 - } else if (! selb )
21.1375 + } else if (! selbi )
21.1376 {
21.1377 parser.setError (Aborted,"Type of selection is not a branch");
21.1378 } else if (parser.checkParCount(0))
21.1379 @@ -3178,7 +3262,7 @@
21.1380 if (!selti )
21.1381 {
21.1382 parser.setError (Aborted,"Nothing selected");
21.1383 - } else if (! selb )
21.1384 + } else if (! selbi )
21.1385 {
21.1386 parser.setError (Aborted,"Type of selection is not a branch");
21.1387 } else if (parser.checkParCount(1))
21.1388 @@ -3192,7 +3276,7 @@
21.1389 if (!selti )
21.1390 {
21.1391 parser.setError (Aborted,"Nothing selected");
21.1392 - } else if (! selb )
21.1393 + } else if (! selbi )
21.1394 {
21.1395 parser.setError (Aborted,"Type of selection is not a branch");
21.1396 } else if (parser.checkParCount(4))
21.1397 @@ -3232,12 +3316,12 @@
21.1398 parser.setError (Aborted,"Unknown operator: "+t);
21.1399 } else
21.1400 {
21.1401 - if (! selb )
21.1402 + if (! selbi )
21.1403 {
21.1404 parser.setError (Aborted,"Type of selection is not a branch");
21.1405 } else
21.1406 {
21.1407 - if (selb->getHeading() == u)
21.1408 + if (selbi->getHeading() == u)
21.1409 {
21.1410 cout << "PASSED: " << qPrintable (c) << endl;
21.1411 } else
21.1412 @@ -3296,7 +3380,7 @@
21.1413 if (!selti )
21.1414 {
21.1415 parser.setError (Aborted,"Nothing selected");
21.1416 - } else if (! selb )
21.1417 + } else if (! selbi )
21.1418 {
21.1419 parser.setError (Aborted,"Type of selection is not a branch");
21.1420 } else if (parser.checkParCount(0))
21.1421 @@ -3308,12 +3392,12 @@
21.1422
21.1423 }
21.1424 /////////////////////////////////////////////////////////////////////
21.1425 - } else if (com=="selectLastImage")
21.1426 + } else /* FIXME-2 if (com=="selectLastImage")
21.1427 {
21.1428 if (!selti )
21.1429 {
21.1430 parser.setError (Aborted,"Nothing selected");
21.1431 - } else if (! selb )
21.1432 + } else if (! selbi )
21.1433 {
21.1434 parser.setError (Aborted,"Type of selection is not a branch");
21.1435 } else if (parser.checkParCount(0))
21.1436 @@ -3325,7 +3409,7 @@
21.1437
21.1438 }
21.1439 /////////////////////////////////////////////////////////////////////
21.1440 - } else if (com=="selectLatestAdded")
21.1441 + } else */ if (com=="selectLatestAdded")
21.1442 {
21.1443 if (latestSelectionString.isEmpty() )
21.1444 {
21.1445 @@ -3417,7 +3501,7 @@
21.1446 if (!selti )
21.1447 {
21.1448 parser.setError (Aborted,"Nothing selected");
21.1449 - } else if (! getSelectedBranch() )
21.1450 + } else if (! selbi )
21.1451 {
21.1452 parser.setError (Aborted,"Type of selection is not a branch");
21.1453 } else if (parser.checkParCount(1))
21.1454 @@ -3431,7 +3515,7 @@
21.1455 if (!selti )
21.1456 {
21.1457 parser.setError (Aborted,"Nothing selected");
21.1458 - } else if (! selb )
21.1459 + } else if (! selbi )
21.1460 {
21.1461 parser.setError (Aborted,"Type of selection is not a branch");
21.1462 } else if (parser.checkParCount(1))
21.1463 @@ -3453,7 +3537,7 @@
21.1464 if (!selti )
21.1465 {
21.1466 parser.setError (Aborted,"Nothing selected");
21.1467 - } else if (! selb )
21.1468 + } else if (! selbi )
21.1469 {
21.1470 parser.setError (Aborted,"Type of selection is not a branch");
21.1471 } else if (parser.checkParCount(1))
21.1472 @@ -3482,7 +3566,7 @@
21.1473 if (!selti )
21.1474 {
21.1475 parser.setError (Aborted,"Nothing selected");
21.1476 - } else if (! selb)
21.1477 + } else if (! selbi)
21.1478 {
21.1479 parser.setError (Aborted,"Type of selection is not a branch");
21.1480 } else if (parser.checkParCount(1))
21.1481 @@ -3496,7 +3580,7 @@
21.1482 if (!selti )
21.1483 {
21.1484 parser.setError (Aborted,"Nothing selected");
21.1485 - } else if (! selb)
21.1486 + } else if (! selbi)
21.1487 {
21.1488 parser.setError (Aborted,"Type of selection is not a branch");
21.1489 } else if (parser.checkParCount(1))
21.1490 @@ -3532,7 +3616,7 @@
21.1491 if (!selti )
21.1492 {
21.1493 parser.setError (Aborted,"Nothing selected");
21.1494 - } else if (! selb )
21.1495 + } else if (! selbi )
21.1496 {
21.1497 parser.setError (Aborted,"Type of selection is not a branch");
21.1498 } else if (parser.checkParCount(1))
21.1499 @@ -3546,7 +3630,7 @@
21.1500 if (!selti )
21.1501 {
21.1502 parser.setError (Aborted,"Nothing selected");
21.1503 - } else if (! selb )
21.1504 + } else if (! selbi )
21.1505 {
21.1506 parser.setError (Aborted,"Type of selection is not a branch");
21.1507 } else if (parser.checkParCount(1))
21.1508 @@ -3556,12 +3640,12 @@
21.1509 }
21.1510 }
21.1511 /////////////////////////////////////////////////////////////////////
21.1512 - else if (com=="setFlag")
21.1513 + else /* FIXME-2 if (com=="setFlag")
21.1514 {
21.1515 if (!selti )
21.1516 {
21.1517 parser.setError (Aborted,"Nothing selected");
21.1518 - } else if (! selb )
21.1519 + } else if (! selbi )
21.1520 {
21.1521 parser.setError (Aborted,"Type of selection is not a branch");
21.1522 } else if (parser.checkParCount(1))
21.1523 @@ -3574,7 +3658,7 @@
21.1524 }
21.1525 }
21.1526 /////////////////////////////////////////////////////////////////////
21.1527 - } else if (com=="setFrameType")
21.1528 + } else */ /* FIXME-2 if (com=="setFrameType")
21.1529 {
21.1530 if (!selti )
21.1531 {
21.1532 @@ -3589,12 +3673,12 @@
21.1533 setFrameType (s);
21.1534 }
21.1535 /////////////////////////////////////////////////////////////////////
21.1536 - } else if (com=="sortChildren")
21.1537 + } else*/ if (com=="sortChildren")
21.1538 {
21.1539 if (!selti )
21.1540 {
21.1541 parser.setError (Aborted,"Nothing selected");
21.1542 - } else if (! selb )
21.1543 + } else if (! selbi )
21.1544 {
21.1545 parser.setError (Aborted,"Type of selection is not a branch");
21.1546 } else if (parser.checkParCount(0))
21.1547 @@ -3602,12 +3686,12 @@
21.1548 sortChildren();
21.1549 }
21.1550 /////////////////////////////////////////////////////////////////////
21.1551 - } else if (com=="toggleFlag")
21.1552 + } else /* FIXME-2 if (com=="toggleFlag")
21.1553 {
21.1554 if (!selti )
21.1555 {
21.1556 parser.setError (Aborted,"Nothing selected");
21.1557 - } else if (! selb )
21.1558 + } else if (! selbi )
21.1559 {
21.1560 parser.setError (Aborted,"Type of selection is not a branch");
21.1561 } else if (parser.checkParCount(1))
21.1562 @@ -3615,17 +3699,17 @@
21.1563 s=parser.parString(ok,0);
21.1564 if (ok)
21.1565 {
21.1566 - selb->toggleStandardFlag(s);
21.1567 + selbi->toggleStandardFlag(s);
21.1568 selb->updateFlagsToolbar();
21.1569 }
21.1570 }
21.1571 /////////////////////////////////////////////////////////////////////
21.1572 - } else if (com=="unscroll")
21.1573 + } else */ if (com=="unscroll")
21.1574 {
21.1575 if (!selti)
21.1576 {
21.1577 parser.setError (Aborted,"Nothing selected");
21.1578 - } else if (! selb )
21.1579 + } else if (! selbi )
21.1580 {
21.1581 parser.setError (Aborted,"Type of selection is not a branch");
21.1582 } else if (parser.checkParCount(0))
21.1583 @@ -3639,7 +3723,7 @@
21.1584 if (!selti)
21.1585 {
21.1586 parser.setError (Aborted,"Nothing selected");
21.1587 - } else if (! selb )
21.1588 + } else if (! selbi )
21.1589 {
21.1590 parser.setError (Aborted,"Type of selection is not a branch");
21.1591 } else if (parser.checkParCount(0))
21.1592 @@ -3647,12 +3731,12 @@
21.1593 unscrollChildren ();
21.1594 }
21.1595 /////////////////////////////////////////////////////////////////////
21.1596 - } else if (com=="unsetFlag")
21.1597 + } else /* FIXME-2 if (com=="unsetFlag")
21.1598 {
21.1599 if (selection.isEmpty() )
21.1600 {
21.1601 parser.setError (Aborted,"Nothing selected");
21.1602 - } else if (! selb )
21.1603 + } else if (! selbi )
21.1604 {
21.1605 parser.setError (Aborted,"Type of selection is not a branch");
21.1606 } else if (parser.checkParCount(1))
21.1607 @@ -3664,7 +3748,7 @@
21.1608 selb->updateFlagsToolbar();
21.1609 }
21.1610 }
21.1611 - } else
21.1612 + } else */
21.1613 parser.setError (Aborted,"Unknown command");
21.1614
21.1615 // Any errors?
21.1616 @@ -3694,9 +3778,9 @@
21.1617 // should be called before and after exports
21.1618 // depending on the settings
21.1619 if (b && settings.value("/export/useHideExport","true")=="true")
21.1620 - setHideTmpMode (HideExport);
21.1621 + setHideTmpMode (TreeItem::HideExport);
21.1622 else
21.1623 - setHideTmpMode (HideNone);
21.1624 + setHideTmpMode (TreeItem::HideNone);
21.1625 }
21.1626
21.1627 void VymModel::exportImage(QString fname, bool askName, QString format)
21.1628 @@ -3897,7 +3981,7 @@
21.1629 mapCenters.at(i)->updateRelPositions();
21.1630 }
21.1631
21.1632 -void VymModel::reposition()
21.1633 +void VymModel::reposition() //FIXME-2 get rid of mapCenters...
21.1634 {
21.1635 for (int i=0;i<mapCenters.count(); i++)
21.1636 mapCenters.at(i)->reposition(); // for positioning heading
21.1637 @@ -3937,7 +4021,7 @@
21.1638
21.1639 }
21.1640
21.1641 -void VymModel::moveAway(LinkableMapObj *lmo)
21.1642 +void VymModel::moveAway(LinkableMapObj *lmo) //FIXME-5
21.1643 {
21.1644 // Autolayout:
21.1645 //
21.1646 @@ -3955,6 +4039,7 @@
21.1647 pA=shape (boA);
21.1648 pB=shape (boB);
21.1649 PolygonCollisionResult r = PolygonCollision(pA, pB, QPoint(0,0));
21.1650 + /*
21.1651 cout <<"------->"
21.1652 <<"="<<r.intersect
21.1653 <<" ("<<qPrintable(boA->getHeading() )<<")"
21.1654 @@ -3962,6 +4047,7 @@
21.1655 <<") willIntersect"
21.1656 <<r.willIntersect
21.1657 <<" minT="<<r.minTranslation<<endl<<endl;
21.1658 + */
21.1659 }
21.1660 }
21.1661
21.1662 @@ -4147,7 +4233,7 @@
21.1663 mapScene->setBackgroundBrush(brush);
21.1664 }
21.1665
21.1666 -void VymModel::selectMapBackgroundColor() // FIXME-1 move to ME
21.1667 +void VymModel::selectMapBackgroundColor() // FIXME-3 move to ME
21.1668 {
21.1669 QColor col = QColorDialog::getColor( mapScene->backgroundBrush().color(), NULL);
21.1670 if ( !col.isValid() ) return;
21.1671 @@ -4155,7 +4241,7 @@
21.1672 }
21.1673
21.1674
21.1675 -void VymModel::setMapBackgroundColor(QColor col) // FIXME-1 move to ME
21.1676 +void VymModel::setMapBackgroundColor(QColor col) // FIXME-3 move to ME
21.1677 {
21.1678 QColor oldcol=mapScene->backgroundBrush().color();
21.1679 saveState(
21.1680 @@ -4165,44 +4251,46 @@
21.1681 mapScene->setBackgroundBrush(col);
21.1682 }
21.1683
21.1684 -QColor VymModel::getMapBackgroundColor() // FIXME-1 move to ME
21.1685 +QColor VymModel::getMapBackgroundColor() // FIXME-3 move to ME
21.1686 {
21.1687 return mapScene->backgroundBrush().color();
21.1688 }
21.1689
21.1690
21.1691 -LinkableMapObj::ColorHint VymModel::getMapLinkColorHint() // FIXME-1 move to ME
21.1692 +LinkableMapObj::ColorHint VymModel::getMapLinkColorHint() // FIXME-3 move to ME
21.1693 {
21.1694 return linkcolorhint;
21.1695 }
21.1696
21.1697 -QColor VymModel::getMapDefLinkColor() // FIXME-1 move to ME
21.1698 +QColor VymModel::getMapDefLinkColor() // FIXME-3 move to ME
21.1699 {
21.1700 return defLinkColor;
21.1701 }
21.1702
21.1703 -void VymModel::setMapDefXLinkColor(QColor col) // FIXME-1 move to ME
21.1704 +void VymModel::setMapDefXLinkColor(QColor col) // FIXME-3 move to ME
21.1705 {
21.1706 defXLinkColor=col;
21.1707 }
21.1708
21.1709 -QColor VymModel::getMapDefXLinkColor() // FIXME-1 move to ME
21.1710 +QColor VymModel::getMapDefXLinkColor() // FIXME-3 move to ME
21.1711 {
21.1712 return defXLinkColor;
21.1713 }
21.1714
21.1715 -void VymModel::setMapDefXLinkWidth (int w) // FIXME-1 move to ME
21.1716 +void VymModel::setMapDefXLinkWidth (int w) // FIXME-3 move to ME
21.1717 {
21.1718 defXLinkWidth=w;
21.1719 }
21.1720
21.1721 -int VymModel::getMapDefXLinkWidth() // FIXME-1 move to ME
21.1722 +int VymModel::getMapDefXLinkWidth() // FIXME-3 move to ME
21.1723 {
21.1724 return defXLinkWidth;
21.1725 }
21.1726
21.1727 -void VymModel::move(const double &x, const double &y)
21.1728 -{
21.1729 +void VymModel::move(const double &x, const double &y) // FIXME-3
21.1730 +{
21.1731 + int i=x; i=y;
21.1732 +/*
21.1733 BranchObj *bo = getSelectedBranch();
21.1734 if (bo &&
21.1735 (selectionType()==TreeItem::Branch ||
21.1736 @@ -4225,10 +4313,13 @@
21.1737 selection.update();
21.1738 }
21.1739 }
21.1740 +*/
21.1741 }
21.1742
21.1743 -void VymModel::moveRel (const double &x, const double &y)
21.1744 -{
21.1745 +void VymModel::moveRel (const double &x, const double &y) // FIXME-3
21.1746 +{
21.1747 + int i=x; i=y;
21.1748 +/*
21.1749 BranchObj *bo = getSelectedBranch();
21.1750 if (bo &&
21.1751 (selectionType()==TreeItem::Branch ||
21.1752 @@ -4253,6 +4344,7 @@
21.1753 selection.update();
21.1754 }
21.1755 }
21.1756 +*/
21.1757 }
21.1758
21.1759
21.1760 @@ -4501,11 +4593,11 @@
21.1761 return mapEditor->getSelectionColor();
21.1762 }
21.1763
21.1764 -void VymModel::setHideTmpMode (HideTmpMode mode)
21.1765 +void VymModel::setHideTmpMode (TreeItem::HideTmpMode mode)
21.1766 {
21.1767 hidemode=mode;
21.1768 - for (int i=0;i<mapCenters.count(); i++)
21.1769 - mapCenters.at(i)->setHideTmp (mode);
21.1770 + for (int i=0;i<rootItem->childCount();i++)
21.1771 + rootItem->child(i)->setHideTmp (mode);
21.1772 reposition();
21.1773 // FIXME-3 needed? scene()->update();
21.1774 }
21.1775 @@ -4607,10 +4699,16 @@
21.1776 if (lmo &&mapEditor) mapEditor->ensureVisible (lmo->getBBox() );
21.1777 }
21.1778
21.1779 -void VymModel::emitContentHasChanged (TreeItem *ti)
21.1780 +void VymModel::emitNoteHasChanged (TreeItem *ti)
21.1781 {
21.1782 QModelIndex ix=index(ti);
21.1783 - emit (contentHasChanged (ix) );
21.1784 + emit (noteHasChanged (ix) );
21.1785 +}
21.1786 +
21.1787 +void VymModel::emitDataHasChanged (TreeItem *ti)
21.1788 +{
21.1789 + QModelIndex ix=index(ti);
21.1790 + emit (dataHasChanged (ix) );
21.1791 }
21.1792
21.1793
21.1794 @@ -4637,8 +4735,8 @@
21.1795 void VymModel::selectNextBranchInt()
21.1796 {
21.1797 // Increase number of branch
21.1798 - LinkableMapObj *sel=getSelectedBranch();
21.1799 - if (sel)
21.1800 + BranchItem *selbi=getSelectedBranchItem();
21.1801 + if (selbi)
21.1802 {
21.1803 QString s=getSelectString();
21.1804 QString part;
21.1805 @@ -4664,7 +4762,7 @@
21.1806 // try to increase the parental number in order to
21.1807 // find a successor with same depth
21.1808
21.1809 - int d=getSelectedLMO()->getDepth();
21.1810 + int d=getSelectedBranchItem()->depth();
21.1811 int oldDepth=d;
21.1812 int i;
21.1813 bool found=false;
21.1814 @@ -4685,7 +4783,7 @@
21.1815 } else
21.1816 {
21.1817 // Special case, look at orientation
21.1818 - if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter)
21.1819 + if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter) // FIXME-3 check access to LMO
21.1820 num=QString ("%1").arg(num.toUInt()+1);
21.1821 else
21.1822 num=QString ("%1").arg(num.toUInt()-1);
21.1823 @@ -4745,7 +4843,7 @@
21.1824 // try to decrease the parental number in order to
21.1825 // find a precessor with same depth
21.1826
21.1827 - int d=getSelectedLMO()->getDepth();
21.1828 + int d=getSelectedBranchItem()->depth();
21.1829 int oldDepth=d;
21.1830 int i;
21.1831 bool found=false;
21.1832 @@ -4766,7 +4864,7 @@
21.1833 } else
21.1834 {
21.1835 // Special case, look at orientation
21.1836 - if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter)
21.1837 + if (getSelectedLMO()->getOrientation()==LinkableMapObj::RightOfCenter) // FIXME-3 check access to LMO
21.1838 num=QString ("%1").arg(num.toInt()-1);
21.1839 else
21.1840 num=QString ("%1").arg(num.toInt()+1);
21.1841 @@ -4799,13 +4897,13 @@
21.1842 {
21.1843 if (selection.isBlocked() ) return;
21.1844
21.1845 - BranchObj *bo=getSelectedBranch();
21.1846 - if (bo && selectionType()==TreeItem::Branch)
21.1847 + BranchItem *bi=getSelectedBranchItem();
21.1848 + if (bi && bi->getType()==TreeItem::Branch)
21.1849 {
21.1850 - if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
21.1851 + if (bi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter) //FIXME-3 check getBO
21.1852 selectPrevBranchInt();
21.1853 else
21.1854 - if (bo->getDepth()==1)
21.1855 + if (bi->depth()==1)
21.1856 selectNextBranchInt();
21.1857 else
21.1858 selectPrevBranchInt();
21.1859 @@ -4816,13 +4914,13 @@
21.1860 {
21.1861 if (selection.isBlocked() ) return;
21.1862
21.1863 - BranchObj *bo=getSelectedBranch();
21.1864 - if (bo && selectionType()==TreeItem::Branch)
21.1865 + BranchItem *bi=getSelectedBranchItem();
21.1866 + if (bi && bi->getType()==TreeItem::Branch)
21.1867 {
21.1868 - if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
21.1869 + if (bi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter) //FIXME-3 check getBO
21.1870 selectNextBranchInt();
21.1871 else
21.1872 - if (bo->getDepth()==1)
21.1873 + if (bi->depth()==1)
21.1874 selectPrevBranchInt();
21.1875 else
21.1876 selectNextBranchInt();
21.1877 @@ -4836,31 +4934,31 @@
21.1878
21.1879 QItemSelection oldsel=selModel->selection();
21.1880
21.1881 - BranchObj* par;
21.1882 - LinkableMapObj *sel=getSelectedBranch();
21.1883 - if (sel)
21.1884 + BranchItem* par;
21.1885 + BranchItem *selbi=getSelectedBranchItem();
21.1886 + TreeItem::Type type=selbi->getType();
21.1887 + if (selbi)
21.1888 {
21.1889 - if (selectionType()== TreeItem::MapCenter)
21.1890 + if (type == TreeItem::MapCenter)
21.1891 {
21.1892 - QModelIndex ix=getSelectedIndex();
21.1893 + QModelIndex ix=index(selbi);
21.1894 selModel->select (index (rowCount(ix)-1,0,ix),QItemSelectionModel::ClearAndSelect );
21.1895 } else
21.1896 {
21.1897 - par=(BranchObj*)(sel->getParObj());
21.1898 - if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
21.1899 + par=(BranchItem*)selbi->parent();
21.1900 + if (selbi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter) //FIXME-3 check getBO...
21.1901 {
21.1902 // right of center
21.1903 - if (selectionType() == TreeItem::Branch ||
21.1904 - selectionType() == TreeItem::Image)
21.1905 + if (type == TreeItem::Branch ||
21.1906 + type == TreeItem::Image)
21.1907 {
21.1908 - QModelIndex ix=getSelectedIndex();
21.1909 - ix=parent(ix);
21.1910 + QModelIndex ix=index (selbi->parent());
21.1911 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
21.1912 }
21.1913 } else
21.1914 {
21.1915 // left of center
21.1916 - if (selectionType() == TreeItem::Branch )
21.1917 + if (type == TreeItem::Branch )
21.1918 {
21.1919 selectLastSelectedBranch();
21.1920 return;
21.1921 @@ -4877,21 +4975,22 @@
21.1922
21.1923 QItemSelection oldsel=selModel->selection();
21.1924
21.1925 - BranchObj* par;
21.1926 - LinkableMapObj *sel=getSelectedBranch();
21.1927 - if (sel)
21.1928 + BranchItem* par;
21.1929 + BranchItem *selbi=getSelectedBranchItem();
21.1930 + TreeItem::Type type=selbi->getType();
21.1931 + if (selbi)
21.1932 {
21.1933 - if (selectionType()== TreeItem::MapCenter)
21.1934 + if (type==TreeItem::MapCenter)
21.1935 {
21.1936 - QModelIndex ix=getSelectedIndex();
21.1937 + QModelIndex ix=index(selbi);
21.1938 selModel->select (index (0,0,ix),QItemSelectionModel::ClearAndSelect );
21.1939 } else
21.1940 {
21.1941 - par=(BranchObj*)(sel->getParObj());
21.1942 - if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
21.1943 + par=(BranchItem*)selbi->parent();
21.1944 + if (selbi->getBranchObj()->getOrientation()==LinkableMapObj::RightOfCenter) //FIXME-3 check getBO
21.1945 {
21.1946 // right of center
21.1947 - if (selectionType() == TreeItem::Branch )
21.1948 + if ( type== TreeItem::Branch )
21.1949 {
21.1950 selectLastSelectedBranch();
21.1951 return;
21.1952 @@ -4899,11 +4998,10 @@
21.1953 } else
21.1954 {
21.1955 // left of center
21.1956 - if (selectionType() == TreeItem::Branch ||
21.1957 - selectionType() == TreeItem::Image)
21.1958 + if (type == TreeItem::Branch ||
21.1959 + type == TreeItem::Image)
21.1960 {
21.1961 - QModelIndex ix=getSelectedIndex();
21.1962 - ix=parent(ix);
21.1963 + QModelIndex ix=index(selbi->parent());
21.1964 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
21.1965 }
21.1966 }
21.1967 @@ -4995,7 +5093,7 @@
21.1968 return NULL;
21.1969 }
21.1970
21.1971 -BranchObj* VymModel::getSelectedBranch()
21.1972 +BranchObj* VymModel::getSelectedBranchObj() // FIXME-3 this should not be needed in the end!!!
21.1973 {
21.1974 TreeItem *ti = getSelectedBranchItem();
21.1975 if (ti)
21.1976 @@ -5017,6 +5115,19 @@
21.1977 return NULL;
21.1978 }
21.1979
21.1980 +MapCenterItem* VymModel::getSelectedMapCenterItem()
21.1981 +{
21.1982 + QModelIndexList list=selModel->selectedIndexes();
21.1983 + if (!list.isEmpty() )
21.1984 + {
21.1985 + TreeItem *ti = getItem (list.first() );
21.1986 + TreeItem::Type type=ti->getType();
21.1987 + if (ti->getType()==TreeItem::MapCenter)
21.1988 + return (MapCenterItem*)ti;
21.1989 + }
21.1990 + return NULL;
21.1991 +}
21.1992 +
21.1993 TreeItem* VymModel::getSelectedItem()
21.1994 {
21.1995 QModelIndexList list=selModel->selectedIndexes();
22.1 --- a/vymmodel.h Thu Apr 02 09:57:47 2009 +0000
22.2 +++ b/vymmodel.h Tue Apr 07 16:15:53 2009 +0000
22.3 @@ -13,6 +13,7 @@
22.4 #include "treemodel.h"
22.5
22.6 class BranchItem;
22.7 +class MapCenterItem;
22.8
22.9 class VymModel : public TreeModel {
22.10 Q_OBJECT
22.11 @@ -68,7 +69,7 @@
22.12 The structure of the map itself is returned as QString and passed back to Main,
22.13 where saveToDir is called initially
22.14 */
22.15 - QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel);
22.16 + QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, TreeItem *saveSel);
22.17
22.18 /*! Save all data in tree*/
22.19 QString saveTreeToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
22.20 @@ -153,6 +154,7 @@
22.21 of undo/redo history
22.22 */
22.23 QString getObjectName(const LinkableMapObj*);
22.24 + QString getObjectName(const TreeItem*);
22.25
22.26 void redo(); //!< Redo last action
22.27 bool isRedoAvailable(); //!< True, if redo is available
22.28 @@ -180,22 +182,22 @@
22.29 const QString &redoSelection,
22.30 const QString &redoCommand,
22.31 const QString &comment,
22.32 - LinkableMapObj *saveSelection);
22.33 + TreeItem *saveSelection);
22.34 /*! Overloaded for convenience */
22.35 void saveStateChangingPart(
22.36 - LinkableMapObj *undoSelection,
22.37 - LinkableMapObj* redoSelection,
22.38 + TreeItem *undoSelection,
22.39 + TreeItem* redoSelection,
22.40 const QString &redoCommand,
22.41 const QString &comment);
22.42 /*! Overloaded for convenience */
22.43 void saveStateRemovingPart(
22.44 - LinkableMapObj *redoSelection,
22.45 + TreeItem *redoSelection,
22.46 const QString &comment);
22.47 /*! Overloaded for convenience */
22.48 void saveState(
22.49 - LinkableMapObj *undoSelection,
22.50 + TreeItem *undoSelection,
22.51 const QString &undoCommand,
22.52 - LinkableMapObj *redoSelection,
22.53 + TreeItem *redoSelection,
22.54 const QString &redoCommand,
22.55 const QString &comment);
22.56 /*! Overloaded for convenience */
22.57 @@ -244,7 +246,7 @@
22.58 BranchItem* findPrevious; // next object in find process
22.59 bool EOFind; // true, if search failed
22.60 public:
22.61 - BranchObj* findText(QString,bool); // Find object
22.62 + BranchItem* findText(QString,bool); // Find object
22.63 void findReset(); // Reset Search
22.64
22.65 void setURL(const QString &url);
22.66 @@ -281,19 +283,19 @@
22.67 void sortChildren(); //!< Sort children lexically
22.68
22.69 // The create methods are used to quickly parse a XML file
22.70 - void createMapCenter(); //!< Create and select MapCenter
22.71 - BranchItem* createBranch(); //!< Create and select Branch
22.72 - TreeItem* createImage(); //!< Create and select image
22.73 + MapCenterItem* createMapCenter(); //!< Create and select MapCenter
22.74 + BranchItem* createBranch(); //!< Create and select Branch
22.75 + TreeItem* createImage(); //!< Create and select image
22.76
22.77 /*! \brief Add new mapcenter
22.78
22.79 Disclaimer: Still experimental, not fully supported yet.
22.80 */
22.81 - MapCenterObj* addMapCenter();
22.82 + MapCenterItem* addMapCenter();
22.83 private:
22.84 - MapCenterObj* addMapCenter(QPointF absPos);
22.85 + MapCenterItem* addMapCenter(QPointF absPos);
22.86 public:
22.87 - MapCenterObj* removeMapCenter(MapCenterObj *mco);
22.88 + MapCenterItem* removeMapCenter(MapCenterItem *mci);
22.89
22.90 /*! \brief Add new branch
22.91
22.92 @@ -371,7 +373,7 @@
22.93 // Exports
22.94 ////////////////////////////////////////////
22.95 private:
22.96 - HideTmpMode hidemode; // true while exporting to hide some stuff
22.97 + TreeItem::HideTmpMode hidemode; // true while exporting to hide some stuff
22.98
22.99 public:
22.100 /*! Set or unset temporary hiding of objects during export */
22.101 @@ -412,17 +414,19 @@
22.102
22.103 QRectF getTotalBBox();
22.104 void reposition(); //!< Call reposition for all MCOs
22.105 - void setHideTmpMode (HideTmpMode mode);
22.106 + void setHideTmpMode (TreeItem::HideTmpMode mode);
22.107
22.108 QPolygonF shape(BranchObj *bo); //!< Returns arbitrary shape of subtree
22.109 void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
22.110
22.111 //void ensureSelectionVisible(); //!< Show selection in all views
22.112
22.113 - void emitContentHasChanged (TreeItem *ti);
22.114 + void emitNoteHasChanged (TreeItem *ti);
22.115 + void emitDataHasChanged (TreeItem *ti);
22.116
22.117 signals:
22.118 - void contentHasChanged (QModelIndex ix);
22.119 + void noteHasChanged (QModelIndex ix);
22.120 + void dataHasChanged (QModelIndex ix); //FIXME-3 necessary? There is dataChanged in AbstractModel
22.121 void newChildObject(QModelIndex ix);
22.122
22.123 private:
22.124 @@ -569,8 +573,9 @@
22.125 public:
22.126 TreeItem::Type selectionType();
22.127 LinkableMapObj* getSelectedLMO();
22.128 - BranchObj* getSelectedBranch();
22.129 + BranchObj* getSelectedBranchObj(); // FIXME-2 replace by item...
22.130 BranchItem* getSelectedBranchItem();
22.131 + MapCenterItem* getSelectedMapCenterItem();
22.132 TreeItem* getSelectedItem();
22.133 QModelIndex getSelectedIndex();
22.134 FloatImageObj* getSelectedFloatImage();
23.1 --- a/vymview.cpp Thu Apr 02 09:57:47 2009 +0000
23.2 +++ b/vymview.cpp Tue Apr 07 16:15:53 2009 +0000
23.3 @@ -31,9 +31,16 @@
23.4 connect (
23.5 selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
23.6 me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
23.7 + /*
23.8 connect (
23.9 selModel, SIGNAL (currentChanged(const QModelIndex &, const QModelIndex &)),
23.10 me,SLOT (updateCurrent(const QModelIndex &,const QModelIndex &)));
23.11 + */
23.12 + /*
23.13 +*/
23.14 + connect (
23.15 + model, SIGNAL (dataChanged(const QModelIndex &, const QModelIndex &)),
23.16 + me,SLOT (updateData(const QModelIndex &) ) );
23.17
23.18 // VymModel may want to update selection or other data, e.g. during animation
23.19 connect (
23.20 @@ -43,8 +50,8 @@
23.21 model, SIGNAL (newChildObject(QModelIndex) ),
23.22 this,SLOT (updateChilds (QModelIndex) ) );
23.23 connect (
23.24 - model, SIGNAL (contentHasChanged(QModelIndex) ),
23.25 - mainWindow, SLOT (updateContent(QModelIndex) ) );
23.26 + model, SIGNAL (noteHasChanged(QModelIndex) ),
23.27 + mainWindow, SLOT (updateNoteEditor (QModelIndex) ) );
23.28
23.29
23.30 //me->viewport()->setFocus(); //FIXME-3 needed?
24.1 --- a/xml-freemind.cpp Thu Apr 02 09:57:47 2009 +0000
24.2 +++ b/xml-freemind.cpp Tue Apr 07 16:15:53 2009 +0000
24.3 @@ -78,14 +78,13 @@
24.4
24.5 //cout <<"model="<<model<<" first="<<model->first()<<endl;
24.6
24.7 - lastBranch=bo->addBranch();
24.8 + lastBranchItem=model->createBranch();
24.9
24.10 - lastBranch->move2RelPos (200,0);
24.11 - lastBranch->setHeading (" ");
24.12 - lastBranch=bo->addBranch();
24.13 - lastBranch->move2RelPos (-200,0);
24.14 - lastBranch->setHeading (" ");
24.15 - lastBranch=bo;
24.16 + //FIXME-3 lastBranch->move2RelPos (200,0);
24.17 + lastBranchItem->setHeading (" ");
24.18 + //FIXME-3 lastBranch->move2RelPos (-200,0);
24.19 + lastBranchItem->setHeading (" ");
24.20 + lastBranchItem=(BranchItem*)lastBranchItem->parent();
24.21
24.22 } else if ( eName == "node" && (state == StateMap || state == StateNode ))
24.23 {
24.24 @@ -98,7 +97,6 @@
24.25 if (lastBranchItem)
24.26 {
24.27 lastBranchItem=model->createBranch();
24.28 - lastBranch=lastBranchItem->getBranchObj();
24.29 readNodeAttr (atts);
24.30 }
24.31 } else if (atts.value ("POSITION")=="right")
24.32 @@ -108,7 +106,6 @@
24.33 if (lastBranchItem)
24.34 {
24.35 lastBranchItem=model->createBranch();
24.36 - lastBranch=lastBranchItem->getBranchObj();
24.37 readNodeAttr (atts);
24.38 }
24.39 }
24.40 @@ -117,7 +114,6 @@
24.41 if (state!=StateMap)
24.42 {
24.43 lastBranchItem=model->createBranch();
24.44 - lastBranch=lastBranchItem->getBranchObj();
24.45 }
24.46 readNodeAttr (atts);
24.47 }
24.48 @@ -193,7 +189,7 @@
24.49 else if (f=="licq")
24.50 v="freemind-licq";
24.51
24.52 - lastBranch->activateStandardFlag( v);
24.53 + //FIXME-3 lastBranch->activateStandardFlag( v);
24.54 }
24.55 } else if ( eName == "arrowlink" && state == StateNode)
24.56 {
24.57 @@ -221,7 +217,7 @@
24.58 switch ( state )
24.59 {
24.60 case StateNode:
24.61 - lastBranch=(BranchObj*)(lastBranch->getParObj());
24.62 + lastBranchItem=(BranchItem*)lastBranchItem->parent();
24.63 break;
24.64 default:
24.65 break;
24.66 @@ -250,7 +246,7 @@
24.67 case StateFont: break;
24.68 case StateHook: break;
24.69 case StateText:
24.70 - lastBranch->getTreeItem()->setNote (ch_simplified);
24.71 + lastBranchItem->setNote (ch_simplified);
24.72 break;
24.73 default:
24.74 return false;
24.75 @@ -263,8 +259,9 @@
24.76 return "the document is not in the Freemind file format";
24.77 }
24.78
24.79 -bool parseFreemindHandler::readNodeAttr (const QXmlAttributes& a)
24.80 +bool parseFreemindHandler::readNodeAttr (const QXmlAttributes& a) //FIXME-3
24.81 {
24.82 +/*
24.83 lastOO=lastBranch;
24.84 lastBranchItem=(BranchItem*)(lastBranch->getTreeItem() );
24.85
24.86 @@ -278,7 +275,7 @@
24.87
24.88 if (!a.value( "LINK").isEmpty() )
24.89 lastBranch->setURL (a.value ("LINK"));
24.90 -
24.91 +*/
24.92 return true;
24.93 }
24.94
25.1 --- a/xml-freemind.h Thu Apr 02 09:57:47 2009 +0000
25.2 +++ b/xml-freemind.h Tue Apr 07 16:15:53 2009 +0000
25.3 @@ -37,7 +37,6 @@
25.4 State state;
25.5 State laststate;
25.6 QList <State> stateStack;
25.7 - BranchObj *lastBranch;
25.8 BranchItem *lastBranchItem;
25.9 };
25.10 #endif
26.1 --- a/xml-vym.cpp Thu Apr 02 09:57:47 2009 +0000
26.2 +++ b/xml-vym.cpp Tue Apr 07 16:15:53 2009 +0000
26.3 @@ -54,7 +54,6 @@
26.4 {
26.5 // Create mapCenter
26.6 model->clear();
26.7 - lastBranch=NULL;
26.8 lastBranchItem=NULL;
26.9
26.10 if (!atts.value( "author").isEmpty() )
26.11 @@ -141,23 +140,21 @@
26.12 {
26.13 // Really use the found mapcenter as MCO in a new map
26.14
26.15 - model->createMapCenter();
26.16 - lastBranch=model->getSelectedBranch();
26.17 + lastBranchItem=(BranchItem*)model->createMapCenter();
26.18 } else
26.19 {
26.20 // Treat the found mapcenter as a branch
26.21 // in an existing map
26.22 - LinkableMapObj* lmo=model->getSelectedLMO();
26.23 - if (lmo && ( (typeid(*lmo) == typeid(BranchObj) )
26.24 - || (typeid(*lmo) == typeid(MapCenterObj) ) ) )
26.25 + BranchItem *bi=model->getSelectedBranchItem();
26.26 + if (bi)
26.27 {
26.28 - lastBranch=(BranchObj*)lmo;
26.29 + lastBranchItem=bi;
26.30 if (loadMode==ImportAdd)
26.31 {
26.32 model->createBranch();
26.33 - lastBranch=model->getSelectedBranch();
26.34 - } else
26.35 - lastBranch->clear();
26.36 + lastBranchItem=model->getSelectedBranchItem();
26.37 + } //else
26.38 + //FIXME-3 lastBranch->clear();
26.39 } else
26.40 return false;
26.41 }
26.42 @@ -174,7 +171,7 @@
26.43 if (!atts.value( "textColor").isEmpty() )
26.44 {
26.45 col.setNamedColor(atts.value("textColor"));
26.46 - lastBranch->setColor(col );
26.47 + //FIXME-2 lastBranch->setColor(col );
26.48 }
26.49 } else if ( eName == "note" &&
26.50 (state == StateMapCenter ||state==StateBranch))
26.51 @@ -189,15 +186,15 @@
26.52 (state == StateMapCenter ||state==StateBranch))
26.53 {
26.54 state=StateFloatImage;
26.55 - lastBranch->addFloatImage();
26.56 - lastFloat=lastBranch->getLastFloatImage();
26.57 + //FIXME-2lastBranch->addFloatImage();
26.58 + //FIXME-2lastFloat=lastBranch->getLastFloatImage();
26.59 if (!readFloatImageAttr(atts)) return false;
26.60 } else if ( (eName == "branch"||eName=="floatimage") && state == StateMap)
26.61 {
26.62 // This is used in vymparts, which have no mapcenter!
26.63 isVymPart=true;
26.64 - LinkableMapObj* lmo=model->getSelectedLMO();
26.65 - if (!lmo)
26.66 + TreeItem *ti=model->getSelectedItem();
26.67 + if (!ti)
26.68 {
26.69 // If a vym part is _loaded_ (not imported),
26.70 // selection==lmo==NULL
26.71 @@ -207,26 +204,25 @@
26.72 // Do we really have no MCO when loading?????
26.73 cout << "xml-vym aborted\n";
26.74 }
26.75 - if (lmo && ( (typeid(*lmo) == typeid(BranchObj) )
26.76 - || (typeid(*lmo) == typeid(MapCenterObj) ) ) )
26.77 + if (ti && ti->isBranchLikeType() )
26.78 {
26.79 - lastBranch=(BranchObj*)(lmo);
26.80 + lastBranchItem=(BranchItem*)ti;
26.81 if (eName=="branch")
26.82 {
26.83 state=StateBranch;
26.84 if (loadMode==ImportAdd)
26.85 {
26.86 model->createBranch();
26.87 - lastBranch=model->getSelectedBranch();
26.88 + lastBranchItem=model->getSelectedBranchItem();
26.89
26.90 } else
26.91 - lastBranch->clear();
26.92 + //FIXME-2 lastBranch->clear();
26.93 readBranchAttr (atts);
26.94 } else if (eName=="floatimage")
26.95 {
26.96 state=StateFloatImage;
26.97 - lastBranch->addFloatImage();
26.98 - lastFloat=lastBranch->getLastFloatImage();
26.99 + //FIXME-2 lastBranch->addFloatImage();
26.100 + //FIXME-2 lastFloat=lastBranch->getLastFloatImage();
26.101 if (!readFloatImageAttr(atts)) return false;
26.102 } else return false;
26.103 } else return false;
26.104 @@ -234,7 +230,7 @@
26.105 {
26.106 state=StateBranch;
26.107 model->createBranch();
26.108 - lastBranch=model->getSelectedBranch();
26.109 + lastBranchItem=model->getSelectedBranchItem();
26.110 readBranchAttr (atts);
26.111 } else if ( eName == "htmlnote" && state == StateBranch)
26.112 {
26.113 @@ -255,7 +251,7 @@
26.114 } else if ( eName == "branch" && state == StateBranch )
26.115 {
26.116 model->createBranch();
26.117 - lastBranch=model->getSelectedBranch();
26.118 + lastBranchItem=model->getSelectedBranchItem();
26.119 readBranchAttr (atts);
26.120 } else if ( eName == "html" && state == StateHtmlNote )
26.121 {
26.122 @@ -290,7 +286,7 @@
26.123 break;
26.124 case StateBranch:
26.125 model->selectParent();
26.126 - lastBranch=model->getSelectedBranch();
26.127 + lastBranchItem=model->getSelectedBranchItem();
26.128 break;
26.129 case StateHtml:
26.130 htmldata+="</"+eName+">";
26.131 @@ -299,7 +295,7 @@
26.132 state=StateHtmlNote;
26.133 htmldata.replace ("<br></br>","<br />");
26.134 no.setNote (htmldata);
26.135 - lastBranch->getTreeItem()->setNoteObj (no);
26.136 + lastBranchItem->setNoteObj (no);
26.137 }
26.138 break;
26.139 default:
26.140 @@ -327,11 +323,11 @@
26.141 case StateMapSetting:break;
26.142 case StateMapCenter: break;
26.143 case StateNote:
26.144 - lastBranch->getTreeItem()->setNote(ch_simplified);
26.145 + lastBranchItem->setNote(ch_simplified);
26.146 break;
26.147 case StateBranch: break;
26.148 case StateStandardFlag:
26.149 - lastBranch->activateStandardFlag(ch_simplified);
26.150 + //FIXME-2 lastBranchItem->activateStandardFlag(ch_simplified);
26.151 break;
26.152 case StateFloatImage: break;
26.153 case StateHtmlNote: break;
26.154 @@ -352,13 +348,14 @@
26.155 return "the document is not in the VYM file format";
26.156 }
26.157
26.158 -bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)
26.159 +bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a) //FIXME-2
26.160 {
26.161 branchesCurrent++;
26.162 mainWindow->setProgressValue (branchesCurrent);
26.163 - lastOO=lastBranch;
26.164 - lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
26.165 + //lastOO=lastBranch;
26.166 + //lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
26.167
26.168 +/*
26.169 if (!readOOAttr(a)) return false;
26.170
26.171 if (!a.value( "scrolled").isEmpty() )
26.172 @@ -380,6 +377,7 @@
26.173 else
26.174 lastBranch->setIncludeImagesHor(false);
26.175 }
26.176 +*/
26.177 return true;
26.178 }
26.179
26.180 @@ -450,7 +448,7 @@
26.181 lastOO->setVymLink (a.value ("vymLink"));
26.182 if (!a.value( "hideInExport").isEmpty() )
26.183 if (a.value("hideInExport")=="true")
26.184 - lastOO->setHideInExport(true);
26.185 + lastOO->getTreeItem()->setHideInExport(true);
26.186
26.187 if (!a.value( "hideLink").isEmpty())
26.188 {
26.189 @@ -491,7 +489,7 @@
26.190 }
26.191 if (!a.value( "fonthint").isEmpty() )
26.192 no.setFontHint(a.value ("fonthint") );
26.193 - lastBranch->getTreeItem()->setNoteObj(no);
26.194 + lastBranchItem->setNoteObj(no);
26.195 return true;
26.196 }
26.197
26.198 @@ -515,7 +513,7 @@
26.199 {
26.200 QMessageBox::warning( 0, "Warning: " ,
26.201 "Couldn't load float image\n"+parseHREF(a.value ("href") ));
26.202 - lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
26.203 + //FIXME-2 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
26.204 lastFloat=NULL;
26.205 return true;
26.206 }
26.207 @@ -545,7 +543,7 @@
26.208 {
26.209 lastFloat->setRelPos (QPointF (x,y) );
26.210 // make sure floats in mapcenter are repositioned to relative pos
26.211 - if (lastBranch->getDepth()==0) lastBranch->positionContents();
26.212 + //FIXME-2 if (lastBranchItem->depth()==0) lastBranch->positionContents();
26.213 }
26.214 else
26.215 // Couldn't read relPos
27.1 --- a/xml-vym.h Thu Apr 02 09:57:47 2009 +0000
27.2 +++ b/xml-vym.h Tue Apr 07 16:15:53 2009 +0000
27.3 @@ -53,7 +53,6 @@
27.4 QString htmldata;
27.5 NoteObj no;
27.6
27.7 - BranchObj* lastBranch;
27.8 BranchItem* lastBranchItem;
27.9 };
27.10 #endif