1.1 --- a/branchitem.cpp Wed Apr 01 15:06:57 2009 +0000
1.2 +++ b/branchitem.cpp Thu Apr 02 09:46:29 2009 +0000
1.3 @@ -205,4 +205,8 @@
1.4 }
1.5 }
1.6
1.7 +BranchObj* BranchItem::getBranchObj() // FIXME-3 only for transition BO->BI
1.8 +{
1.9 + return (BranchObj*)lmo;
1.10 +}
1.11
2.1 --- a/branchitem.h Wed Apr 01 15:06:57 2009 +0000
2.2 +++ b/branchitem.h Thu Apr 02 09:46:29 2009 +0000
2.3 @@ -4,6 +4,7 @@
2.4 #include "treeitem.h"
2.5
2.6 class QString;
2.7 +class BranchObj;
2.8
2.9 class BranchItem:public TreeItem
2.10 {
2.11 @@ -21,6 +22,7 @@
2.12 virtual void tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process
2.13 virtual void resetTmpUnscroll(); // scroll all tmp scrolled parents again e.g. when unselecting
2.14
2.15 + BranchObj* getBranchObj();
2.16
2.17 protected:
2.18 bool scrolled; // true if all children are scrolled and thus invisible
3.1 --- a/branchobj.cpp Wed Apr 01 15:06:57 2009 +0000
3.2 +++ b/branchobj.cpp Thu Apr 02 09:46:29 2009 +0000
3.3 @@ -102,7 +102,7 @@
3.4 OrnamentedObj::copy(other);
3.5
3.6 branch.clear();
3.7 - for (int i=0; i<other->branch.size(); ++i)
3.8 + for (int i=0; i<other->treeItem->branchCount(); ++i)
3.9 // Make deep copy of b
3.10 // Because addBranch again calls copy for the children,
3.11 // Those will get a deep copy, too
3.12 @@ -182,7 +182,7 @@
3.13 {
3.14 // new parent is just a branch, link to it
3.15 QRectF t=o->getBBoxSizeWithChildren();
3.16 - if (o->getLastBranch())
3.17 + if (o->getTreeItem()->getLastBranch())
3.18 y=t.y() + t.height() ;
3.19 else
3.20 y=t.y();
3.21 @@ -242,7 +242,7 @@
3.22 if (! bi->isScrolled() && (bi->depth() < toDepth))
3.23 {
3.24 // Now go recursivly through all children
3.25 - for (i=0; i<branch.size(); ++i)
3.26 + for (i=0; i<treeItem->branchCount(); ++i)
3.27 branch.at(i)->setVisibility (v,toDepth);
3.28 }
3.29 } // depth <= toDepth
3.30 @@ -272,7 +272,7 @@
3.31 void BranchObj::setColorSubtree(QColor col)
3.32 {
3.33 setColor (col);
3.34 - for (int i=0; i<branch.size(); ++i)
3.35 + for (int i=0; i<treeItem->branchCount(); ++i)
3.36 branch.at(i)->setColorSubtree(col);
3.37 }
3.38
3.39 @@ -299,7 +299,7 @@
3.40 void BranchObj::moveBy (double x, double y)
3.41 {
3.42 OrnamentedObj::moveBy (x,y);
3.43 - for (int i=0; i<branch.size(); ++i)
3.44 + for (int i=0; i<treeItem->branchCount(); ++i)
3.45 branch.at(i)->moveBy (x,y);
3.46 positionBBox();
3.47 }
3.48 @@ -424,7 +424,7 @@
3.49 {
3.50 // Search branches
3.51 LinkableMapObj *lmo;
3.52 - for (int i=0; i<branch.size(); ++i)
3.53 + for (int i=0; i<treeItem->branchCount(); ++i)
3.54 {
3.55 lmo=branch.at(i)->findMapObj(p, excludeLMO);
3.56 if (lmo != NULL) return lmo;
3.57 @@ -450,7 +450,7 @@
3.58 {
3.59 // Search branches
3.60 LinkableMapObj *lmo;
3.61 - for (int i=0; i<branch.size(); ++i)
3.62 + for (int i=0; i<treeItem->branchCount(); ++i)
3.63 {
3.64 lmo=branch.at(i)->findID (sid);
3.65 if (lmo != NULL) return lmo;
3.66 @@ -498,7 +498,7 @@
3.67 }
3.68
3.69 // And take care of my children
3.70 - for (int i=0; i<branch.size(); ++i)
3.71 + for (int i=0; i<treeItem->branchCount(); ++i)
3.72 branch.at(i)->setHideTmp (mode);
3.73 }
3.74
3.75 @@ -579,7 +579,7 @@
3.76 s+=treeItem->getNoteObj().saveToDir();
3.77
3.78 // Save branches
3.79 - for (int i=0; i<branch.size(); ++i)
3.80 + for (int i=0; i<treeItem->branchCount(); ++i)
3.81 s+=branch.at(i)->saveToDir(tmpdir,prefix,offset);
3.82
3.83 // Save XLinks
3.84 @@ -742,7 +742,7 @@
3.85 void BranchObj::savePosInAngle ()
3.86 {
3.87 // Save position in angle
3.88 - for (int i=0; i<branch.size(); ++i)
3.89 + for (int i=0; i<treeItem->branchCount(); ++i)
3.90 branch.at(i)->angle=i;
3.91 }
3.92
3.93 @@ -898,9 +898,10 @@
3.94 requestReposition();
3.95 }
3.96
3.97 +/* FIXME-1 not needed
3.98 BranchObj* BranchObj::getFirstBranch ()
3.99 {
3.100 - if (branch.size()>0)
3.101 + if (treeItem->branchCount()>0)
3.102 return branch.first();
3.103 else
3.104 return NULL;
3.105 @@ -908,7 +909,7 @@
3.106
3.107 BranchObj* BranchObj::getLastBranch ()
3.108 {
3.109 - if (branch.size()>0)
3.110 + if (treeItem->branchCount()>0)
3.111 return branch.last();
3.112 else
3.113 return NULL;
3.114 @@ -916,20 +917,24 @@
3.115
3.116 BranchObj* BranchObj::getBranchNum (int i)
3.117 {
3.118 - if (i>=0 && i<branch.size())
3.119 + if (i>=0 && i<treeItem->branchCount())
3.120 return branch.at(i);
3.121 else
3.122 return NULL;
3.123 }
3.124 +*/
3.125
3.126 bool BranchObj::canMoveBranchUp()
3.127 {
3.128 + /* FIXME-1 move to BranchItem
3.129 if (!parObj || depth==1) return false;
3.130 BranchObj* par=(BranchObj*)parObj;
3.131 - if (this==par->getFirstBranch())
3.132 + if (this==par->getTreeItem()->getFirstBranch())
3.133 return false;
3.134 else
3.135 return true;
3.136 + */
3.137 +return false;
3.138 }
3.139
3.140 BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist
3.141 @@ -948,12 +953,15 @@
3.142
3.143 bool BranchObj::canMoveBranchDown()
3.144 {
3.145 + /* FIXME-1 move to BranchItem
3.146 if (!parObj|| depth==1) return false;
3.147 BranchObj* par=(BranchObj*)parObj;
3.148 - if (this==par->getLastBranch())
3.149 + if (this==par->getTreeItem()->getLastBranch())
3.150 return false;
3.151 else
3.152 return true;
3.153 + */
3.154 +return false;
3.155 }
3.156
3.157 BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist
3.158 @@ -961,7 +969,7 @@
3.159 savePosInAngle();
3.160 int i=branch.indexOf(bo1);
3.161 int j;
3.162 - if (i <branch.size())
3.163 + if (i <treeItem->branchCount())
3.164 {
3.165 j = i+1;
3.166 branch.at(i)->angle++;
3.167 @@ -1111,7 +1119,7 @@
3.168 ref2.setY(ref.y() );
3.169
3.170 // Align the children depending on reference point
3.171 - for (int i=0; i<branch.size(); ++i)
3.172 + for (int i=0; i<treeItem->branchCount(); ++i)
3.173 {
3.174 if (!branch.at(i)->isHidden())
3.175 {
3.176 @@ -1160,7 +1168,7 @@
3.177 void BranchObj::unsetAllRepositionRequests()
3.178 {
3.179 repositionRequest=false;
3.180 - for (int i=0; i<branch.size(); ++i)
3.181 + for (int i=0; i<treeItem->branchCount(); ++i)
3.182 branch.at(i)->unsetAllRepositionRequests();
3.183 }
3.184
3.185 @@ -1193,7 +1201,7 @@
3.186
3.187 if ( ((BranchItem*)treeItem)->isScrolled() ) return r;
3.188
3.189 - for (int i=0; i<branch.size(); ++i)
3.190 + for (int i=0; i<treeItem->branchCount(); ++i)
3.191 if (!branch.at(i)->isHidden())
3.192 r=addBBox(branch.at(i)->getTotalBBox(),r);
3.193
3.194 @@ -1251,7 +1259,7 @@
3.195 // sum of heights
3.196 // maximum of widths
3.197 // minimum of y
3.198 - for (int i=0; i<branch.size(); ++i)
3.199 + for (int i=0; i<treeItem->branchCount(); ++i)
3.200 {
3.201 if (!branch.at(i)->isHidden())
3.202 {
4.1 --- a/branchobj.h Wed Apr 01 15:06:57 2009 +0000
4.2 +++ b/branchobj.h Thu Apr 02 09:46:29 2009 +0000
4.3 @@ -91,10 +91,6 @@
4.4 virtual void removeBranch(BranchObj*);
4.5 virtual void removeBranchPtr (BranchObj*);
4.6
4.7 - virtual BranchObj* getFirstBranch();
4.8 - virtual BranchObj* getLastBranch();
4.9 - virtual BranchObj* getBranchNum(int);
4.10 -
4.11 virtual bool canMoveBranchUp();
4.12 virtual BranchObj* moveBranchUp(BranchObj*);
4.13 virtual bool canMoveBranchDown();
5.1 --- a/exports.cpp Wed Apr 01 15:06:57 2009 +0000
5.2 +++ b/exports.cpp Thu Apr 02 09:46:29 2009 +0000
5.3 @@ -1,4 +1,6 @@
5.4 #include "exports.h"
5.5 +
5.6 +#include "branchitem.h"
5.7 #include "file.h"
5.8 #include "linkablemapobj.h"
5.9 #include "misc.h"
5.10 @@ -143,8 +145,8 @@
5.11 QString s;
5.12 QString curIndent;
5.13 int i;
5.14 - TreeItem *cur=NULL;
5.15 - TreeItem *prev=NULL;
5.16 + BranchItem *cur=NULL;
5.17 + BranchItem *prev=NULL;
5.18 int d;
5.19
5.20 BranchObj *bo;
5.21 @@ -229,8 +231,8 @@
5.22 QString curIndent("");
5.23 int i;
5.24 BranchObj *bo;
5.25 - TreeItem *cur=NULL;
5.26 - TreeItem *prev=NULL;
5.27 + BranchItem *cur=NULL;
5.28 + BranchItem *prev=NULL;
5.29 int d;
5.30 cur=model->next (cur,prev,d);
5.31 while (cur)
5.32 @@ -389,8 +391,8 @@
5.33 // QString curIndent("");
5.34 // int i;
5.35 BranchObj *bo;
5.36 - TreeItem *cur=NULL;
5.37 - TreeItem *prev=NULL;
5.38 + BranchItem *cur=NULL;
5.39 + BranchItem *prev=NULL;
5.40 int d;
5.41 model->next(cur,prev,d);
5.42 while (cur)
5.43 @@ -439,32 +441,30 @@
5.44 {
5.45 }
5.46
5.47 -QString ExportOO::buildList (BranchObj *current)
5.48 +QString ExportOO::buildList (TreeItem *current)
5.49 {
5.50 QString r;
5.51 - BranchObj *bo;
5.52
5.53 uint i=0;
5.54 - bo=current->getFirstBranch();
5.55 - TreeItem *ti=bo->getTreeItem();
5.56 - if (bo)
5.57 + BranchItem *bi=current->getFirstBranch();
5.58 + if (bi)
5.59 {
5.60 - if (!bo->hasHiddenExportParent() )
5.61 + if (true) //if (!bo->hasHiddenExportParent() ) // FIXME-2 use BranchItem...
5.62 {
5.63 // Start list
5.64 r+="<text:list text:style-name=\"vym-list\">\n";
5.65 - while (bo)
5.66 + while (bi)
5.67 {
5.68 r+="<text:list-item><text:p >";
5.69 - r+=quotemeta(bo->getHeading());
5.70 + r+=quotemeta(bi->getHeading());
5.71 // If necessary, write note
5.72 - if (!ti->getNoteObj().isEmpty())
5.73 - r+=ti->getNoteOpenDoc();
5.74 + if (!bi->getNoteObj().isEmpty())
5.75 + r+=bi->getNoteOpenDoc();
5.76 r+="</text:p>";
5.77 - r+=buildList (bo); // recursivly add deeper branches
5.78 + r+=buildList (bi); // recursivly add deeper branches
5.79 r+="</text:list-item>\n";
5.80 i++;
5.81 - bo=current->getBranchNum(i);
5.82 + bi=current->getBranchNum(i);
5.83 }
5.84 r+="</text:list>\n";
5.85 }
5.86 @@ -514,7 +514,7 @@
5.87 // Add page with list of items
5.88 onePage=pageTemplate;
5.89 onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
5.90 - list=buildList (pagesBO);
5.91 + list=buildList (pagesBO->getTreeItem() );
5.92 onePage.replace ("<!-- INSERT LIST -->", list);
5.93 allPages+=onePage;
5.94 j++;
6.1 --- a/exports.h Wed Apr 01 15:06:57 2009 +0000
6.2 +++ b/exports.h Thu Apr 02 09:46:29 2009 +0000
6.3 @@ -106,7 +106,7 @@
6.4 void exportPresentation();
6.5 bool setConfigFile (const QString &);
6.6 private:
6.7 - QString buildList (BranchObj*);
6.8 + QString buildList (TreeItem *);
6.9 bool useSections;
6.10 QString configFile;
6.11 QString configDir;
7.1 --- a/linkablemapobj.cpp Wed Apr 01 15:06:57 2009 +0000
7.2 +++ b/linkablemapobj.cpp Thu Apr 02 09:46:29 2009 +0000
7.3 @@ -580,7 +580,7 @@
7.4 return parObj;
7.5 }
7.6
7.7 -LinkableMapObj* LinkableMapObj::findObjBySelect (QString s)
7.8 +LinkableMapObj* LinkableMapObj::findObjBySelect (QString s) // FIXME-2 port to TreeItem...
7.9 {
7.10 LinkableMapObj *lmo=this;
7.11 QString part;
7.12 @@ -599,7 +599,7 @@
7.13 break;
7.14 } else
7.15 if (typ=="bo:")
7.16 - lmo=((BranchObj*)lmo)->getBranchNum (num.toInt());
7.17 + lmo=lmo->getTreeItem()->getBranchObjNum (num.toInt());
7.18 else
7.19 if (typ=="fi:")
7.20 lmo=((BranchObj*)lmo)->getFloatImageNum (num.toUInt());
8.1 --- a/mapeditor.cpp Wed Apr 01 15:06:57 2009 +0000
8.2 +++ b/mapeditor.cpp Thu Apr 02 09:46:29 2009 +0000
8.3 @@ -6,6 +6,7 @@
8.4
8.5 #include <QObject>
8.6
8.7 +#include "branchitem.h"
8.8 #include "mainwindow.h"
8.9 #include "misc.h"
8.10 #include "warningdialog.h"
8.11 @@ -283,8 +284,8 @@
8.12
8.13 void MapEditor::testFunction1()
8.14 {
8.15 - TreeItem *cur=NULL;
8.16 - TreeItem *prev=NULL;
8.17 + BranchItem *cur=NULL;
8.18 + BranchItem *prev=NULL;
8.19 int d;
8.20 cout << "ME::testFunction1 starting to walk the map...\n";
8.21 while (model->next (cur,prev,d) )
8.22 @@ -496,7 +497,7 @@
8.23 if (!foname.isEmpty())
8.24 {
8.25 // systemFlag clicked
8.26 - model->selectInt (lmo);
8.27 + model->select (lmo); // FIXME-3 was selectInt
8.28 if (foname=="url")
8.29 {
8.30 if (e->state() & Qt::ControlModifier)
8.31 @@ -585,13 +586,14 @@
8.32 if (mainWindow->getModMode()==Main::ModModeCopy &&
8.33 e->state() & Qt::ControlModifier)
8.34 {
8.35 - BranchObj *bo=model->getSelectedBranch();
8.36 - if (bo)
8.37 + BranchItem *bi=model->getSelectedBranchItem();
8.38 + if (bi)
8.39 {
8.40 copyingObj=true;
8.41 - bo->addBranch (model->getSelectedBranch());
8.42 + //FIXME-2 TreeItem::addBranch (BranchItem still missing)
8.43 + //bi->addBranch (model->getSelectedBranchItem());
8.44 model->unselect();
8.45 - model->select(bo->getLastBranch());
8.46 + model->select(bi->getLastBranch());
8.47 model->reposition();
8.48 }
8.49 }
9.1 --- a/treeitem.cpp Wed Apr 01 15:06:57 2009 +0000
9.2 +++ b/treeitem.cpp Thu Apr 02 09:46:29 2009 +0000
9.3 @@ -3,8 +3,10 @@
9.4
9.5 #include <QStringList>
9.6
9.7 +#include "treeitem.h"
9.8 +
9.9 #include "branchobj.h"
9.10 -#include "treeitem.h"
9.11 +#include "branchitem.h"
9.12 #include "vymmodel.h"
9.13
9.14 TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
9.15 @@ -261,7 +263,7 @@
9.16 return NULL;
9.17 }
9.18
9.19 -TreeItem* TreeItem::getFirstBranch()
9.20 +BranchItem* TreeItem::getFirstBranch()
9.21 {
9.22 if (branchCounter>0)
9.23 return getBranchNum (branchOffset);
9.24 @@ -269,7 +271,7 @@
9.25 return NULL;
9.26 }
9.27
9.28 -TreeItem* TreeItem::getLastBranch()
9.29 +BranchItem* TreeItem::getLastBranch()
9.30 {
9.31 if (branchCounter>0)
9.32 return getBranchNum (branchOffset + branchCounter-1);
9.33 @@ -278,14 +280,23 @@
9.34 }
9.35
9.36
9.37 -TreeItem* TreeItem::getBranchNum(const int &n)
9.38 +BranchItem* TreeItem::getBranchNum(const int &n)
9.39 {
9.40 if (branchCounter>0)
9.41 - return getChildNum (branchOffset + n);
9.42 + return (BranchItem*)getChildNum (branchOffset + n);
9.43 else
9.44 return NULL;
9.45 }
9.46
9.47 +BranchObj* TreeItem::getBranchObjNum(const int &n)
9.48 +{
9.49 + if (branchCounter>0)
9.50 + {
9.51 + return (BranchObj*)(getChildNum (branchOffset+n)->lmo);
9.52 + } else
9.53 + return NULL;
9.54 +}
9.55 +
9.56 void TreeItem::setLastSelectedBranch()
9.57 {
9.58 if (parentItem)
10.1 --- a/treeitem.h Wed Apr 01 15:06:57 2009 +0000
10.2 +++ b/treeitem.h Thu Apr 02 09:46:29 2009 +0000
10.3 @@ -8,6 +8,8 @@
10.4 #include "xmlobj.h"
10.5
10.6 class LinkableMapObj;
10.7 +class BranchObj;
10.8 +class BranchItem;
10.9 class VymModel;
10.10
10.11 class TreeItem:public XMLObj
10.12 @@ -70,9 +72,10 @@
10.13
10.14 // Navigation and selection
10.15 TreeItem* getChildNum(const int &n);
10.16 - TreeItem* getFirstBranch();
10.17 - TreeItem* getLastBranch();
10.18 - TreeItem* getBranchNum(const int &n);
10.19 + BranchItem* getFirstBranch();
10.20 + BranchItem* getLastBranch();
10.21 + BranchItem* getBranchNum(const int &n);
10.22 + BranchObj* getBranchObjNum(const int &n);
10.23 void setLastSelectedBranch();
10.24 TreeItem* getLastSelectedBranch();
10.25
11.1 --- a/treemodel.cpp Wed Apr 01 15:06:57 2009 +0000
11.2 +++ b/treemodel.cpp Thu Apr 02 09:46:29 2009 +0000
11.3 @@ -3,6 +3,7 @@
11.4 #include <iostream>
11.5 using namespace std;
11.6
11.7 +#include "branchitem.h"
11.8 #include "treeitem.h"
11.9 #include "treemodel.h"
11.10
11.11 @@ -108,11 +109,11 @@
11.12 return rootItem->columnCount();
11.13 }
11.14
11.15 -TreeItem* TreeModel::next(TreeItem* ¤t, TreeItem* &previous, int &d0)
11.16 +BranchItem* TreeModel::next(BranchItem* ¤t, BranchItem* &previous, int &d0)
11.17 {
11.18 // Walk through map beginning at current with previous==0
11.19 // Start at root, if current==NULL
11.20 - if (!current) current=rootItem;
11.21 + if (!current) current=(BranchItem*)rootItem;
11.22
11.23 // Are we just beginning to walk the map?
11.24 if (!previous)
11.25 @@ -143,7 +144,7 @@
11.26 // Coming from below,
11.27 // Trying to go down again to siblings
11.28
11.29 - TreeItem *sibling=current->getBranchNum (previous->num()+1);
11.30 + BranchItem *sibling=current->getBranchNum (previous->num()+1);
11.31
11.32 if (sibling)
11.33 {
11.34 @@ -155,7 +156,7 @@
11.35
11.36 // Go up and try to find siblings of current
11.37 previous=current;
11.38 - current=current->parent();
11.39 + current=(BranchItem*)current->parent();
11.40
11.41 // Check if we still can go somewhere
11.42 if (!current) return current;
12.1 --- a/treemodel.h Wed Apr 01 15:06:57 2009 +0000
12.2 +++ b/treemodel.h Thu Apr 02 09:46:29 2009 +0000
12.3 @@ -6,6 +6,7 @@
12.4 #include <QVariant>
12.5
12.6
12.7 +class BranchItem;
12.8 class TreeItem;
12.9 class LinkableMapObj;
12.10
12.11 @@ -27,7 +28,7 @@
12.12 int rowCount(const QModelIndex &parent = QModelIndex()) const;
12.13 int columnCount(const QModelIndex &parent = QModelIndex()) const;
12.14
12.15 - TreeItem* next(TreeItem* ¤t, TreeItem* &previous, int &d0);
12.16 + BranchItem* next(BranchItem* ¤t, BranchItem* &previous, int &d0);
12.17
12.18 bool insertRows ( int row, int count,
12.19 const QModelIndex & parent = QModelIndex() );
13.1 --- a/version.h Wed Apr 01 15:06:57 2009 +0000
13.2 +++ b/version.h Thu Apr 02 09:46:29 2009 +0000
13.3 @@ -7,7 +7,7 @@
13.4 #define __VYM_VERSION "1.13.0"
13.5 //#define __VYM_CODENAME "Codename: RC-1"
13.6 #define __VYM_CODENAME "Codename: development version"
13.7 -#define __VYM_BUILD_DATE "2009-03-31"
13.8 +#define __VYM_BUILD_DATE "2009-04-02"
13.9
13.10
13.11 bool checkVersion(const QString &);
14.1 --- a/vymmodel.cpp Wed Apr 01 15:06:57 2009 +0000
14.2 +++ b/vymmodel.cpp Thu Apr 02 09:46:29 2009 +0000
14.3 @@ -670,6 +670,7 @@
14.4
14.5 void VymModel::addMapInsertInt (const QString &path, int pos)
14.6 {
14.7 +/* FIXME-2 addMapInsertInt not ported yet
14.8 BranchObj *sel=getSelectedBranch();
14.9 if (sel)
14.10 {
14.11 @@ -702,6 +703,7 @@
14.12 } else
14.13 QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
14.14 }
14.15 +*/
14.16 }
14.17
14.18 FloatImageObj* VymModel::loadFloatImageInt (QString fn)
14.19 @@ -817,6 +819,7 @@
14.20
14.21 void VymModel::importDirInt(BranchObj *dst, QDir d)
14.22 {
14.23 +/* FIXME-2 importDirInt not ported yet
14.24 BranchObj *bo=getSelectedBranch();
14.25 if (bo)
14.26 {
14.27 @@ -861,6 +864,7 @@
14.28 bo->setVymLink (fi.filePath());
14.29 }
14.30 }
14.31 +*/
14.32 }
14.33
14.34 void VymModel::importDirInt (const QString &s)
14.35 @@ -1470,8 +1474,8 @@
14.36 int VymModel::branchCount() // FIXME-2 Optimize this: use internal counter instead of going through whole map each time...
14.37 {
14.38 int c=0;
14.39 - TreeItem *cur=NULL;
14.40 - TreeItem *prev=NULL;
14.41 + BranchItem *cur=NULL;
14.42 + BranchItem *prev=NULL;
14.43 int d;
14.44 next(cur,prev,d);
14.45 while (cur)
14.46 @@ -1981,10 +1985,10 @@
14.47 select (mco);
14.48 }
14.49
14.50 -void VymModel::createBranch()
14.51 -{
14.52 - addNewBranchInt (-2);
14.53 - return;
14.54 +BranchItem* VymModel::createBranch() // FIXME-2 switcht addNewBrancInt to BranchItem...
14.55 +{
14.56 + BranchObj* bo=addNewBranchInt (-2);
14.57 + return (BranchItem*)bo->getTreeItem();
14.58 }
14.59
14.60 TreeItem* VymModel::createImage()
14.61 @@ -2735,7 +2739,8 @@
14.62 void VymModel::parseAtom(const QString &atom)
14.63 {
14.64 BranchObj *selb=getSelectedBranch();
14.65 - BranchItem *bi=getSelectedBranchItem();
14.66 + TreeItem* selti=getSelectedItem();
14.67 + BranchItem *selbi=getSelectedBranchItem();
14.68 QString s,t;
14.69 double x,y;
14.70 int n;
14.71 @@ -2749,7 +2754,7 @@
14.72 /////////////////////////////////////////////////////////////////////
14.73 if (com=="addBranch")
14.74 {
14.75 - if (selection.isEmpty())
14.76 + if (!selti)
14.77 {
14.78 parser.setError (Aborted,"Nothing selected");
14.79 } else if (! selb )
14.80 @@ -2773,7 +2778,7 @@
14.81 /////////////////////////////////////////////////////////////////////
14.82 } else if (com=="addBranchBefore")
14.83 {
14.84 - if (selection.isEmpty())
14.85 + if (!selti)
14.86 {
14.87 parser.setError (Aborted,"Nothing selected");
14.88 } else if (! selb )
14.89 @@ -2801,7 +2806,7 @@
14.90 /////////////////////////////////////////////////////////////////////
14.91 } else if (com==QString("addMapReplace"))
14.92 {
14.93 - if (selection.isEmpty())
14.94 + if (!selti)
14.95 {
14.96 parser.setError (Aborted,"Nothing selected");
14.97 } else if (! selb )
14.98 @@ -2817,7 +2822,7 @@
14.99 /////////////////////////////////////////////////////////////////////
14.100 } else if (com==QString("addMapInsert"))
14.101 {
14.102 - if (selection.isEmpty())
14.103 + if (!selti)
14.104 {
14.105 parser.setError (Aborted,"Nothing selected");
14.106 } else if (! selb )
14.107 @@ -2836,7 +2841,7 @@
14.108 /////////////////////////////////////////////////////////////////////
14.109 } else if (com=="clearFlags")
14.110 {
14.111 - if (selection.isEmpty() )
14.112 + if (!selti )
14.113 {
14.114 parser.setError (Aborted,"Nothing selected");
14.115 } else if (! selb )
14.116 @@ -2850,7 +2855,7 @@
14.117 /////////////////////////////////////////////////////////////////////
14.118 } else if (com=="colorBranch")
14.119 {
14.120 - if (selection.isEmpty())
14.121 + if (!selti)
14.122 {
14.123 parser.setError (Aborted,"Nothing selected");
14.124 } else if (! selb )
14.125 @@ -2864,7 +2869,7 @@
14.126 /////////////////////////////////////////////////////////////////////
14.127 } else if (com=="colorSubtree")
14.128 {
14.129 - if (selection.isEmpty())
14.130 + if (!selti)
14.131 {
14.132 parser.setError (Aborted,"Nothing selected");
14.133 } else if (! selb )
14.134 @@ -2878,7 +2883,7 @@
14.135 /////////////////////////////////////////////////////////////////////
14.136 } else if (com=="copy")
14.137 {
14.138 - if (selection.isEmpty())
14.139 + if (!selti)
14.140 {
14.141 parser.setError (Aborted,"Nothing selected");
14.142 } else if (! selb )
14.143 @@ -2891,7 +2896,7 @@
14.144 /////////////////////////////////////////////////////////////////////
14.145 } else if (com=="cut")
14.146 {
14.147 - if (selection.isEmpty())
14.148 + if (!selti)
14.149 {
14.150 parser.setError (Aborted,"Nothing selected");
14.151 } else if ( selectionType()!=TreeItem::Branch &&
14.152 @@ -2906,7 +2911,7 @@
14.153 /////////////////////////////////////////////////////////////////////
14.154 } else if (com=="delete")
14.155 {
14.156 - if (selection.isEmpty())
14.157 + if (!selti)
14.158 {
14.159 parser.setError (Aborted,"Nothing selected");
14.160 }
14.161 @@ -2922,7 +2927,7 @@
14.162 /////////////////////////////////////////////////////////////////////
14.163 } else if (com=="deleteKeepChildren")
14.164 {
14.165 - if (selection.isEmpty())
14.166 + if (!selti)
14.167 {
14.168 parser.setError (Aborted,"Nothing selected");
14.169 } else if (! selb )
14.170 @@ -2935,7 +2940,7 @@
14.171 /////////////////////////////////////////////////////////////////////
14.172 } else if (com=="deleteChildren")
14.173 {
14.174 - if (selection.isEmpty())
14.175 + if (!selti)
14.176 {
14.177 parser.setError (Aborted,"Nothing selected");
14.178 } else if (! selb)
14.179 @@ -3013,7 +3018,7 @@
14.180 /////////////////////////////////////////////////////////////////////
14.181 } else if (com=="importDir")
14.182 {
14.183 - if (selection.isEmpty())
14.184 + if (!selti)
14.185 {
14.186 parser.setError (Aborted,"Nothing selected");
14.187 } else if (! selb )
14.188 @@ -3027,7 +3032,7 @@
14.189 /////////////////////////////////////////////////////////////////////
14.190 } else if (com=="linkTo")
14.191 {
14.192 - if (selection.isEmpty())
14.193 + if (!selti)
14.194 {
14.195 parser.setError (Aborted,"Nothing selected");
14.196 } else if ( selb)
14.197 @@ -3087,7 +3092,7 @@
14.198 /////////////////////////////////////////////////////////////////////
14.199 } else if (com=="loadImage")
14.200 {
14.201 - if (selection.isEmpty())
14.202 + if (!selti)
14.203 {
14.204 parser.setError (Aborted,"Nothing selected");
14.205 } else if (! selb )
14.206 @@ -3101,7 +3106,7 @@
14.207 /////////////////////////////////////////////////////////////////////
14.208 } else if (com=="moveBranchUp")
14.209 {
14.210 - if (selection.isEmpty() )
14.211 + if (!selti )
14.212 {
14.213 parser.setError (Aborted,"Nothing selected");
14.214 } else if (! selb )
14.215 @@ -3114,7 +3119,7 @@
14.216 /////////////////////////////////////////////////////////////////////
14.217 } else if (com=="moveBranchDown")
14.218 {
14.219 - if (selection.isEmpty() )
14.220 + if (!selti )
14.221 {
14.222 parser.setError (Aborted,"Nothing selected");
14.223 } else if (! selb )
14.224 @@ -3127,7 +3132,7 @@
14.225 /////////////////////////////////////////////////////////////////////
14.226 } else if (com=="move")
14.227 {
14.228 - if (selection.isEmpty() )
14.229 + if (!selti )
14.230 {
14.231 parser.setError (Aborted,"Nothing selected");
14.232 } else if ( selectionType()!=TreeItem::Branch &&
14.233 @@ -3147,7 +3152,7 @@
14.234 /////////////////////////////////////////////////////////////////////
14.235 } else if (com=="moveRel")
14.236 {
14.237 - if (selection.isEmpty() )
14.238 + if (!selti )
14.239 {
14.240 parser.setError (Aborted,"Nothing selected");
14.241 } else if ( selectionType()!=TreeItem::Branch &&
14.242 @@ -3170,7 +3175,7 @@
14.243 /////////////////////////////////////////////////////////////////////
14.244 } else if (com=="paste")
14.245 {
14.246 - if (selection.isEmpty() )
14.247 + if (!selti )
14.248 {
14.249 parser.setError (Aborted,"Nothing selected");
14.250 } else if (! selb )
14.251 @@ -3184,7 +3189,7 @@
14.252 /////////////////////////////////////////////////////////////////////
14.253 } else if (com=="qa")
14.254 {
14.255 - if (selection.isEmpty() )
14.256 + if (!selti )
14.257 {
14.258 parser.setError (Aborted,"Nothing selected");
14.259 } else if (! selb )
14.260 @@ -3266,15 +3271,15 @@
14.261 /////////////////////////////////////////////////////////////////////
14.262 } else if (com=="scroll")
14.263 {
14.264 - if (selection.isEmpty() )
14.265 + if (!selti)
14.266 {
14.267 parser.setError (Aborted,"Nothing selected");
14.268 - } else if (! selb )
14.269 + } else if (! selbi )
14.270 {
14.271 parser.setError (Aborted,"Type of selection is not a branch");
14.272 } else if (parser.checkParCount(0))
14.273 {
14.274 - if (!scrollBranch (bi))
14.275 + if (!scrollBranch (selbi))
14.276 parser.setError (Aborted,"Could not scroll branch");
14.277 }
14.278 /////////////////////////////////////////////////////////////////////
14.279 @@ -3288,7 +3293,7 @@
14.280 /////////////////////////////////////////////////////////////////////
14.281 } else if (com=="selectLastBranch")
14.282 {
14.283 - if (selection.isEmpty() )
14.284 + if (!selti )
14.285 {
14.286 parser.setError (Aborted,"Nothing selected");
14.287 } else if (! selb )
14.288 @@ -3296,16 +3301,16 @@
14.289 parser.setError (Aborted,"Type of selection is not a branch");
14.290 } else if (parser.checkParCount(0))
14.291 {
14.292 - BranchObj *bo=selb->getLastBranch();
14.293 - if (!bo)
14.294 + BranchItem *bi=selbi->getLastBranch();
14.295 + if (!bi)
14.296 parser.setError (Aborted,"Could not select last branch");
14.297 - selectInt (bo);
14.298 + select (bi); // FIXME-3 was selectInt
14.299
14.300 }
14.301 /////////////////////////////////////////////////////////////////////
14.302 } else if (com=="selectLastImage")
14.303 {
14.304 - if (selection.isEmpty() )
14.305 + if (!selti )
14.306 {
14.307 parser.setError (Aborted,"Nothing selected");
14.308 } else if (! selb )
14.309 @@ -3316,7 +3321,7 @@
14.310 FloatImageObj *fio=selb->getLastFloatImage();
14.311 if (!fio)
14.312 parser.setError (Aborted,"Could not select last image");
14.313 - selectInt (fio);
14.314 + select (fio); // FIXME-3 was selectInt
14.315
14.316 }
14.317 /////////////////////////////////////////////////////////////////////
14.318 @@ -3409,7 +3414,7 @@
14.319 /////////////////////////////////////////////////////////////////////
14.320 } else if (com=="setMapBackgroundColor")
14.321 {
14.322 - if (selection.isEmpty() )
14.323 + if (!selti )
14.324 {
14.325 parser.setError (Aborted,"Nothing selected");
14.326 } else if (! getSelectedBranch() )
14.327 @@ -3423,7 +3428,7 @@
14.328 /////////////////////////////////////////////////////////////////////
14.329 } else if (com=="setMapDefLinkColor")
14.330 {
14.331 - if (selection.isEmpty() )
14.332 + if (!selti )
14.333 {
14.334 parser.setError (Aborted,"Nothing selected");
14.335 } else if (! selb )
14.336 @@ -3445,7 +3450,7 @@
14.337 /////////////////////////////////////////////////////////////////////
14.338 } else if (com=="setHeading")
14.339 {
14.340 - if (selection.isEmpty() )
14.341 + if (!selti )
14.342 {
14.343 parser.setError (Aborted,"Nothing selected");
14.344 } else if (! selb )
14.345 @@ -3460,7 +3465,7 @@
14.346 /////////////////////////////////////////////////////////////////////
14.347 } else if (com=="setHideExport")
14.348 {
14.349 - if (selection.isEmpty() )
14.350 + if (!selti )
14.351 {
14.352 parser.setError (Aborted,"Nothing selected");
14.353 } else if (selectionType()!=TreeItem::Branch && selectionType() != TreeItem::MapCenter &&selectionType()!=TreeItem::Image)
14.354 @@ -3474,7 +3479,7 @@
14.355 /////////////////////////////////////////////////////////////////////
14.356 } else if (com=="setIncludeImagesHorizontally")
14.357 {
14.358 - if (selection.isEmpty() )
14.359 + if (!selti )
14.360 {
14.361 parser.setError (Aborted,"Nothing selected");
14.362 } else if (! selb)
14.363 @@ -3488,7 +3493,7 @@
14.364 /////////////////////////////////////////////////////////////////////
14.365 } else if (com=="setIncludeImagesVertically")
14.366 {
14.367 - if (selection.isEmpty() )
14.368 + if (!selti )
14.369 {
14.370 parser.setError (Aborted,"Nothing selected");
14.371 } else if (! selb)
14.372 @@ -3502,7 +3507,7 @@
14.373 /////////////////////////////////////////////////////////////////////
14.374 } else if (com=="setHideLinkUnselected")
14.375 {
14.376 - if (selection.isEmpty() )
14.377 + if (!selti )
14.378 {
14.379 parser.setError (Aborted,"Nothing selected");
14.380 } else if ( selectionType()!=TreeItem::Branch && selectionType()!= TreeItem::MapCenter && selectionType()!=TreeItem::Image)
14.381 @@ -3524,7 +3529,7 @@
14.382 /////////////////////////////////////////////////////////////////////
14.383 } else if (com=="setURL")
14.384 {
14.385 - if (selection.isEmpty() )
14.386 + if (!selti )
14.387 {
14.388 parser.setError (Aborted,"Nothing selected");
14.389 } else if (! selb )
14.390 @@ -3538,7 +3543,7 @@
14.391 /////////////////////////////////////////////////////////////////////
14.392 } else if (com=="setVymLink")
14.393 {
14.394 - if (selection.isEmpty() )
14.395 + if (!selti )
14.396 {
14.397 parser.setError (Aborted,"Nothing selected");
14.398 } else if (! selb )
14.399 @@ -3553,7 +3558,7 @@
14.400 /////////////////////////////////////////////////////////////////////
14.401 else if (com=="setFlag")
14.402 {
14.403 - if (selection.isEmpty() )
14.404 + if (!selti )
14.405 {
14.406 parser.setError (Aborted,"Nothing selected");
14.407 } else if (! selb )
14.408 @@ -3571,7 +3576,7 @@
14.409 /////////////////////////////////////////////////////////////////////
14.410 } else if (com=="setFrameType")
14.411 {
14.412 - if (selection.isEmpty() )
14.413 + if (!selti )
14.414 {
14.415 parser.setError (Aborted,"Nothing selected");
14.416 } else if (! selb )
14.417 @@ -3586,7 +3591,7 @@
14.418 /////////////////////////////////////////////////////////////////////
14.419 } else if (com=="sortChildren")
14.420 {
14.421 - if (selection.isEmpty() )
14.422 + if (!selti )
14.423 {
14.424 parser.setError (Aborted,"Nothing selected");
14.425 } else if (! selb )
14.426 @@ -3599,7 +3604,7 @@
14.427 /////////////////////////////////////////////////////////////////////
14.428 } else if (com=="toggleFlag")
14.429 {
14.430 - if (selection.isEmpty() )
14.431 + if (!selti )
14.432 {
14.433 parser.setError (Aborted,"Nothing selected");
14.434 } else if (! selb )
14.435 @@ -3617,7 +3622,7 @@
14.436 /////////////////////////////////////////////////////////////////////
14.437 } else if (com=="unscroll")
14.438 {
14.439 - if (selection.isEmpty() )
14.440 + if (!selti)
14.441 {
14.442 parser.setError (Aborted,"Nothing selected");
14.443 } else if (! selb )
14.444 @@ -3625,13 +3630,13 @@
14.445 parser.setError (Aborted,"Type of selection is not a branch");
14.446 } else if (parser.checkParCount(0))
14.447 {
14.448 - if (!unscrollBranch (bi))
14.449 + if (!unscrollBranch (selbi))
14.450 parser.setError (Aborted,"Could not unscroll branch");
14.451 }
14.452 /////////////////////////////////////////////////////////////////////
14.453 } else if (com=="unscrollChildren")
14.454 {
14.455 - if (selection.isEmpty() )
14.456 + if (!selti)
14.457 {
14.458 parser.setError (Aborted,"Nothing selected");
14.459 } else if (! selb )
14.460 @@ -4021,8 +4026,8 @@
14.461 else
14.462 linkstyle=LinkableMapObj::UndefinedStyle;
14.463
14.464 - TreeItem *cur=NULL;
14.465 - TreeItem *prev=NULL;
14.466 + BranchItem *cur=NULL;
14.467 + BranchItem *prev=NULL;
14.468 int d=0;
14.469 BranchObj *bo;
14.470 next (cur,prev,d);
14.471 @@ -4050,8 +4055,8 @@
14.472 );
14.473
14.474 defLinkColor=col;
14.475 - TreeItem *cur=NULL;
14.476 - TreeItem *prev=NULL;
14.477 + BranchItem *cur=NULL;
14.478 + BranchItem *prev=NULL;
14.479 int d=0;
14.480 BranchObj *bo;
14.481 cur=next(cur,prev,d);
14.482 @@ -4067,8 +4072,8 @@
14.483 void VymModel::setMapLinkColorHintInt()
14.484 {
14.485 // called from setMapLinkColorHint(lch) or at end of parse
14.486 - TreeItem *cur=NULL;
14.487 - TreeItem *prev=NULL;
14.488 + BranchItem *cur=NULL;
14.489 + BranchItem *prev=NULL;
14.490 int d=0;
14.491 BranchObj *bo;
14.492 cur=next(cur,prev,d);
14.493 @@ -4092,8 +4097,8 @@
14.494 linkcolorhint=LinkableMapObj::DefaultColor;
14.495 else
14.496 linkcolorhint=LinkableMapObj::HeadingColor;
14.497 - TreeItem *cur=NULL;
14.498 - TreeItem *prev=NULL;
14.499 + BranchItem *cur=NULL;
14.500 + BranchItem *prev=NULL;
14.501 int d=0;
14.502 BranchObj *bo;
14.503 cur=next(cur,prev,d);
14.504 @@ -4608,7 +4613,9 @@
14.505 emit (contentHasChanged (ix) );
14.506 }
14.507
14.508 -void VymModel::selectInt (LinkableMapObj *lmo)
14.509 +
14.510 +//void VymModel::selectInt (LinkableMapObj *lmo) // FIXME-3 still needed?
14.511 +/*
14.512 {
14.513 if (selection.select(lmo))
14.514 {
14.515 @@ -4617,6 +4624,15 @@
14.516 }
14.517 }
14.518
14.519 +void VymModel::selectInt (TreeItem *ti)
14.520 +{
14.521 + if (selection.select(lmo))
14.522 + {
14.523 + //selection.update();
14.524 + sendSelection (); // FIXME-4 VM use signal
14.525 + }
14.526 +}
14.527 +*/
14.528
14.529 void VymModel::selectNextBranchInt()
14.530 {
15.1 --- a/vymmodel.h Wed Apr 01 15:06:57 2009 +0000
15.2 +++ b/vymmodel.h Thu Apr 02 09:46:29 2009 +0000
15.3 @@ -240,8 +240,8 @@
15.4 // QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
15.5
15.6 private:
15.7 - TreeItem* findCurrent; // next object in find process
15.8 - TreeItem* findPrevious; // next object in find process
15.9 + BranchItem* findCurrent; // next object in find process
15.10 + BranchItem* findPrevious; // next object in find process
15.11 bool EOFind; // true, if search failed
15.12 public:
15.13 BranchObj* findText(QString,bool); // Find object
15.14 @@ -282,7 +282,7 @@
15.15
15.16 // The create methods are used to quickly parse a XML file
15.17 void createMapCenter(); //!< Create and select MapCenter
15.18 - void createBranch(); //!< Create and select Branch
15.19 + BranchItem* createBranch(); //!< Create and select Branch
15.20 TreeItem* createImage(); //!< Create and select image
15.21
15.22 /*! \brief Add new mapcenter
15.23 @@ -551,7 +551,7 @@
15.24
15.25 void ensureSelectionVisible(); //!< Show selection in all views
15.26
15.27 - void selectInt(LinkableMapObj*);
15.28 +// void selectInt(LinkableMapObj*);
15.29
15.30 private:
15.31 void selectNextBranchInt(); // Increment number of branch
16.1 --- a/xml-freemind.cpp Wed Apr 01 15:06:57 2009 +0000
16.2 +++ b/xml-freemind.cpp Thu Apr 02 09:46:29 2009 +0000
16.3 @@ -94,21 +94,21 @@
16.4 if (atts.value ("POSITION")=="left")
16.5 {
16.6 model->select ("bo:1");
16.7 - lastBranch=model->getSelectedBranch();
16.8 - if (lastBranch)
16.9 - {
16.10 - lastBranch->addBranch();
16.11 - lastBranch=lastBranch->getLastBranch();
16.12 + lastBranchItem=model->getSelectedBranchItem();
16.13 + if (lastBranchItem)
16.14 + {
16.15 + lastBranchItem=model->createBranch();
16.16 + lastBranch=lastBranchItem->getBranchObj();
16.17 readNodeAttr (atts);
16.18 }
16.19 } else if (atts.value ("POSITION")=="right")
16.20 {
16.21 model->select ("bo:0");
16.22 - lastBranch=model->getSelectedBranch();
16.23 - if (lastBranch)
16.24 - {
16.25 - lastBranch->addBranch();
16.26 - lastBranch=lastBranch->getLastBranch();
16.27 + lastBranchItem=model->getSelectedBranchItem();
16.28 + if (lastBranchItem)
16.29 + {
16.30 + lastBranchItem=model->createBranch();
16.31 + lastBranch=lastBranchItem->getBranchObj();
16.32 readNodeAttr (atts);
16.33 }
16.34 }
16.35 @@ -116,8 +116,8 @@
16.36 {
16.37 if (state!=StateMap)
16.38 {
16.39 - lastBranch->addBranch();
16.40 - lastBranch=lastBranch->getLastBranch();
16.41 + lastBranchItem=model->createBranch();
16.42 + lastBranch=lastBranchItem->getBranchObj();
16.43 }
16.44 readNodeAttr (atts);
16.45 }
17.1 --- a/xml-freemind.h Wed Apr 01 15:06:57 2009 +0000
17.2 +++ b/xml-freemind.h Thu Apr 02 09:46:29 2009 +0000
17.3 @@ -37,7 +37,7 @@
17.4 State state;
17.5 State laststate;
17.6 QList <State> stateStack;
17.7 + BranchObj *lastBranch;
17.8 BranchItem *lastBranchItem;
17.9 - BranchObj *lastBranch;
17.10 };
17.11 #endif