1.1 --- a/branchitem.cpp Mon May 18 09:41:31 2009 +0000
1.2 +++ b/branchitem.cpp Mon May 18 11:22:41 2009 +0000
1.3 @@ -45,7 +45,7 @@
1.4 branchCounter++;
1.5 }
1.6
1.7 -QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-1
1.8 +QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-3 Check if everything is saved...
1.9 {
1.10 // Cloudy stuff can be hidden during exports
1.11 if (hidden) return QString();
1.12 @@ -150,7 +150,7 @@
1.13 return s;
1.14 }
1.15
1.16 -void BranchItem::updateVisibility() // FIXME-1
1.17 +void BranchItem::updateVisibility() // FIXME-3 Check if this is needed after all...
1.18 {
1.19 }
1.20
2.1 --- a/branchobj.cpp Mon May 18 09:41:31 2009 +0000
2.2 +++ b/branchobj.cpp Mon May 18 11:22:41 2009 +0000
2.3 @@ -892,7 +892,7 @@
2.4 */
2.5
2.6 /*
2.7 - FIXME-1 for (int i=0; i<floatimage.size(); ++i)
2.8 + FIXME-3 for (int i=0; i<floatimage.size(); ++i)
2.9 if (!floatimage.at(i)->isHidden())
2.10 r=addBBox(floatimage.at(i)->getTotalBBox(),r);
2.11 */
3.1 --- a/mainwindow.cpp Mon May 18 09:41:31 2009 +0000
3.2 +++ b/mainwindow.cpp Mon May 18 11:22:41 2009 +0000
3.3 @@ -2826,7 +2826,7 @@
3.4 VymModel *m=currentModel();
3.5 if (m)
3.6 {
3.7 - BranchItem *bi=m->createBranch(); //FIXME-1 missing: m->addNewBranchBefore();
3.8 + BranchItem *bi=m->addNewBranchBefore();
3.9
3.10 if (bi)
3.11 m->select (bi);
4.1 --- a/mapcenteritem.cpp Mon May 18 09:41:31 2009 +0000
4.2 +++ b/mapcenteritem.cpp Mon May 18 11:22:41 2009 +0000
4.3 @@ -16,7 +16,7 @@
4.4 qDeleteAll(childItems);
4.5 }
4.6
4.7 -QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-1
4.8 +QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-3 Check if everything is saved...
4.9 {
4.10 // Cloudy stuff can be hidden during exports
4.11 if (hidden) return QString();
5.1 --- a/treeitem.cpp Mon May 18 09:41:31 2009 +0000
5.2 +++ b/treeitem.cpp Mon May 18 11:22:41 2009 +0000
5.3 @@ -68,7 +68,7 @@
5.4
5.5 QString TreeItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
5.6 {
5.7 - cout << "TreeItem::saveToDir called directly for ("<<getHeadingStd()<<"), instead of inherited type...\n"; //FIXME-1 triggered on save
5.8 + cout<< "TreeItem::saveToDir called directly for ("<<getHeadingStd()<<"), instead of inherited type...\n";
5.9 return QString();
5.10 }
5.11
6.1 --- a/vymmodel.cpp Mon May 18 09:41:31 2009 +0000
6.2 +++ b/vymmodel.cpp Mon May 18 11:22:41 2009 +0000
6.3 @@ -252,11 +252,9 @@
6.4 //s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
6.5 }
6.6
6.7 - cout << "VM::saveToDir 1 \n";
6.8 // Save local settings
6.9 s+=settings.getDataXML (destPath);
6.10
6.11 - cout << "VM::saveToDir 2 \n";
6.12 // Save selection
6.13 if (getSelectedItem() && !saveSel )
6.14 s+=xml.valueElement("select",getSelectString());
6.15 @@ -1619,23 +1617,19 @@
6.16 return QString();
6.17 }
6.18
6.19 -QStringList VymModel::getURLs() // FIXME-1 first, next moved to vymmodel
6.20 -{
6.21 - return QStringList();
6.22 - /*
6.23 +QStringList VymModel::getURLs()
6.24 +{
6.25 QStringList urls;
6.26 - BranchObj *bo=getSelectedBranch();
6.27 - if (bo)
6.28 - {
6.29 - bo=bo->first();
6.30 - while (bo)
6.31 - {
6.32 - if (!bo->getURL().isEmpty()) urls.append( bo->getURL());
6.33 - bo=bo->next();
6.34 - }
6.35 + BranchItem *cur=getSelectedBranchItem();
6.36 + BranchItem *prev=NULL;
6.37 + int d=0;
6.38 + next (cur,prev,d);
6.39 + while (cur)
6.40 + {
6.41 + if (!cur->getURL().isEmpty()) urls.append( cur->getURL());
6.42 + cur=next (cur,prev,d);
6.43 }
6.44 return urls;
6.45 - */
6.46 }
6.47
6.48 void VymModel::linkFloatImageTo(const QString &dstString) // FIXME-2
6.49 @@ -1976,7 +1970,11 @@
6.50
6.51 BranchItem* VymModel::createBranch()
6.52 {
6.53 - return addNewBranchInt (-2);
6.54 + BranchItem *selbi=getSelectedBranchItem();
6.55 + if (selbi)
6.56 + return addNewBranchInt (selbi,-2);
6.57 + else
6.58 + return NULL;
6.59 }
6.60
6.61 TreeItem* VymModel::createImage() //FIXME-2
6.62 @@ -2069,64 +2067,60 @@
6.63 return mci;
6.64 }
6.65
6.66 -BranchItem* VymModel::addNewBranchInt(int num)
6.67 +BranchItem* VymModel::addNewBranchInt(BranchItem *dst,int num) //FIXME-4 simplify...
6.68 {
6.69 // Depending on pos:
6.70 // -3 insert in children of parent above selection
6.71 // -2 add branch to selection
6.72 // -1 insert in children of parent below selection
6.73 // 0..n insert in children of parent at pos
6.74 - BranchItem *selbi=getSelectedBranchItem();
6.75 - if (selbi)
6.76 +
6.77 + // Create TreeItem
6.78 + QList<QVariant> cData;
6.79 + cData << "new" << "undef"<<"undef";
6.80 +
6.81 + BranchItem *parbi;
6.82 + QModelIndex parix;
6.83 + int n;
6.84 + BranchItem *newbi=new BranchItem (cData);
6.85 + newbi->setHeading (QApplication::translate("Heading of new branch in map", "new"));
6.86 +
6.87 + emit (layoutAboutToBeChanged() );
6.88 +
6.89 + if (num==-2)
6.90 {
6.91 - // Create TreeItem
6.92 - QList<QVariant> cData;
6.93 - cData << "new" << "undef"<<"undef";
6.94 -
6.95 - BranchItem *parbi;
6.96 - QModelIndex parix;
6.97 - int n;
6.98 - BranchItem *newbi=new BranchItem (cData);
6.99 - newbi->setHeading (QApplication::translate("Heading of new branch in map", "new"));
6.100 -
6.101 - emit (layoutAboutToBeChanged() );
6.102 -
6.103 - if (num==-2)
6.104 - {
6.105 - parbi=selbi;
6.106 - parix=index(parbi);
6.107 - n=parbi->childCount();
6.108 - beginInsertRows (parix,n,n+1);
6.109 - parbi->appendChild (newbi);
6.110 - endInsertRows ();
6.111 - }else if (num==-1)
6.112 - {
6.113 - // insert below selection
6.114 - parbi=(BranchItem*)selbi->parent();
6.115 - parix=index(parbi);
6.116 - n=selbi->childNumber()+1;
6.117 - beginInsertRows (parix,n,n);
6.118 - parbi->insertBranch(n,newbi);
6.119 - endInsertRows ();
6.120 - }else if (num==-3)
6.121 - {
6.122 - // insert above selection
6.123 - parbi=(BranchItem*)selbi->parent();
6.124 - parix=index(parbi);
6.125 - n=selbi->childNumber();
6.126 - beginInsertRows (parix,n,n);
6.127 - parbi->insertBranch(n,newbi);
6.128 - endInsertRows ();
6.129 - }
6.130 - emit (layoutChanged() );
6.131 -
6.132 - // save scroll state. If scrolled, automatically select
6.133 - // new branch in order to tmp unscroll parent...
6.134 - newbi->createMapObj(mapScene);
6.135 - select (newbi);
6.136 - return newbi;
6.137 - }
6.138 - return NULL;
6.139 + parbi=dst;
6.140 + parix=index(parbi);
6.141 + n=parbi->childCount();
6.142 + beginInsertRows (parix,n,n+1);
6.143 + parbi->appendChild (newbi);
6.144 + endInsertRows ();
6.145 + }else if (num==-1)
6.146 + {
6.147 + // insert below selection
6.148 + parbi=(BranchItem*)dst->parent();
6.149 + parix=index(parbi);
6.150 + n=dst->childNumber()+1;
6.151 + beginInsertRows (parix,n,n);
6.152 + parbi->insertBranch(n,newbi);
6.153 + endInsertRows ();
6.154 + }else if (num==-3)
6.155 + {
6.156 + // insert above selection
6.157 + parbi=(BranchItem*)dst->parent();
6.158 + parix=index(parbi);
6.159 + n=dst->childNumber();
6.160 + beginInsertRows (parix,n,n);
6.161 + parbi->insertBranch(n,newbi);
6.162 + endInsertRows ();
6.163 + }
6.164 + emit (layoutChanged() );
6.165 +
6.166 + // save scroll state. If scrolled, automatically select
6.167 + // new branch in order to tmp unscroll parent...
6.168 + newbi->createMapObj(mapScene);
6.169 + select (newbi);
6.170 + return newbi;
6.171 }
6.172
6.173 BranchItem* VymModel::addNewBranch(int pos)
6.174 @@ -2140,9 +2134,10 @@
6.175
6.176 if (selbi)
6.177 {
6.178 - // FIXME-3 VM do we still need this in model? setCursor (Qt::ArrowCursor);
6.179 -
6.180 - newbi=addNewBranchInt (pos-2);
6.181 + // FIXME-3 setCursor (Qt::ArrowCursor); //Still needed?
6.182 +
6.183 +
6.184 + newbi=addNewBranchInt (selbi,pos-2);
6.185
6.186 if (newbi)
6.187 {
6.188 @@ -2170,40 +2165,35 @@
6.189 }
6.190
6.191
6.192 -BranchItem* VymModel::addNewBranchBefore() //FIXME-2
6.193 -{
6.194 -/*
6.195 - BranchObj *newbo=NULL;
6.196 - BranchObj *bo = getSelectedBranch();
6.197 - if (bo && selectionType()==TreeItem::Branch)
6.198 - // We accept no MapCenterObj here, so we _have_ a parent
6.199 +BranchItem* VymModel::addNewBranchBefore() //FIXME-0
6.200 +{
6.201 + BranchItem *newbi=NULL;
6.202 + BranchItem *selbi=getSelectedBranchItem();
6.203 + if (selbi && selbi->getType()==TreeItem::Branch)
6.204 + // We accept no MapCenter here, so we _have_ a parent
6.205 {
6.206 - QPointF p=bo->getRelPos();
6.207 -
6.208 -
6.209 - BranchObj *parbo=(BranchObj*)(bo->getParObj());
6.210 + //QPointF p=bo->getRelPos();
6.211 +
6.212
6.213 // add below selection
6.214 - newbo=parbo->insertBranch(bo->getTreeItem()->num()+1); //FIXME-1 VM still missing
6.215 -
6.216 - if (newbo)
6.217 + newbi=addNewBranchInt (selbi,-1);
6.218 +
6.219 + if (newbi)
6.220 {
6.221 - newbo->move2RelPos (p);
6.222 + //newbi->move2RelPos (p);
6.223
6.224 // Move selection to new branch
6.225 - bo->linkTo (newbo,-1);
6.226 -
6.227 - saveState (newbo, "deleteKeepChildren ()", newbo, "addBranchBefore ()",
6.228 - QString ("Add branch before %1").arg(getObjectName(bo)));
6.229 -
6.230 - reposition();
6.231 + relinkBranch (selbi,newbi,0);
6.232 +
6.233 + saveState (newbi, "deleteKeepChildren ()", newbi, "addBranchBefore ()",
6.234 + QString ("Add branch before %1").arg(getObjectName(selbi)));
6.235 +
6.236 + // FIXME-3 needed? reposition();
6.237 // selection.update(); FIXME-3
6.238 }
6.239 }
6.240 - latestSelectionString=selection.getSelectString();
6.241 - return newbo;
6.242 - */
6.243 - return NULL;
6.244 + //FIXME-3 needed? latestSelectionString=selection.getSelectString();
6.245 + return newbi;
6.246 }
6.247
6.248 bool VymModel::relinkBranch (BranchItem *branch, BranchItem *dst, int pos)
6.249 @@ -2681,23 +2671,19 @@
6.250
6.251 }
6.252
6.253 -QStringList VymModel::getVymLinks() // FIXME-1 first, next moved to vymmodel
6.254 -{
6.255 - return QStringList();
6.256 -/*
6.257 +QStringList VymModel::getVymLinks()
6.258 +{
6.259 QStringList links;
6.260 - BranchObj *bo=getSelectedBranch();
6.261 - if (bo)
6.262 - {
6.263 - bo=bo->first();
6.264 - while (bo)
6.265 - {
6.266 - if (!bo->getVymLink().isEmpty()) links.append( bo->getVymLink());
6.267 - bo=bo->next();
6.268 - }
6.269 + BranchItem *cur=getSelectedBranchItem();
6.270 + BranchItem *prev=NULL;
6.271 + int d=0;
6.272 + next (cur,prev,d);
6.273 + while (cur)
6.274 + {
6.275 + if (!cur->getVymLink().isEmpty()) links.append( cur->getVymLink());
6.276 + cur=next (cur,prev,d);
6.277 }
6.278 return links;
6.279 -*/
6.280 }
6.281
6.282
6.283 @@ -2756,7 +2742,6 @@
6.284
6.285 void VymModel::parseAtom(const QString &atom)
6.286 {
6.287 - //BranchObj *selb=getSelectedBranch(); // FIXME-4
6.288 TreeItem* selti=getSelectedItem();
6.289 BranchItem *selbi=getSelectedBranchItem();
6.290 QString s,t;
6.291 @@ -2903,12 +2888,14 @@
6.292 if (!selti)
6.293 {
6.294 parser.setError (Aborted,"Nothing selected");
6.295 - } else if (! selbi )
6.296 + } else if ( selectionType()!=TreeItem::Branch &&
6.297 + selectionType()!=TreeItem::MapCenter &&
6.298 + selectionType()!=TreeItem::Image )
6.299 {
6.300 - parser.setError (Aborted,"Type of selection is not a branch");
6.301 + parser.setError (Aborted,"Type of selection is not a branch or floatimage");
6.302 } else if (parser.checkParCount(0))
6.303 {
6.304 - //FIXME-1 missing action for copy
6.305 + copy();
6.306 }
6.307 /////////////////////////////////////////////////////////////////////
6.308 } else if (com=="cut")
7.1 --- a/vymmodel.h Mon May 18 09:41:31 2009 +0000
7.2 +++ b/vymmodel.h Mon May 18 11:22:41 2009 +0000
7.3 @@ -306,7 +306,7 @@
7.4 */
7.5
7.6 private:
7.7 - BranchItem* addNewBranchInt(int); // pos allows to add above/below selection
7.8 + BranchItem* addNewBranchInt(BranchItem *dst, int pos); // pos allows to add above/below selection
7.9 public:
7.10 /*! \Add new branch
7.11