# HG changeset patch # User insilmaril # Date 1238665589 0 # Node ID ff3b01ce09601786b46b2d163dbda265cf9b7e04 # Parent 9ff3329640157cef06c757000f0c6509f9c38e5b More moving from BranchObj to BranchItem diff -r 9ff332964015 -r ff3b01ce0960 branchitem.cpp --- a/branchitem.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/branchitem.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -205,4 +205,8 @@ } } +BranchObj* BranchItem::getBranchObj() // FIXME-3 only for transition BO->BI +{ + return (BranchObj*)lmo; +} diff -r 9ff332964015 -r ff3b01ce0960 branchitem.h --- a/branchitem.h Wed Apr 01 15:06:57 2009 +0000 +++ b/branchitem.h Thu Apr 02 09:46:29 2009 +0000 @@ -4,6 +4,7 @@ #include "treeitem.h" class QString; +class BranchObj; class BranchItem:public TreeItem { @@ -21,6 +22,7 @@ virtual void tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process virtual void resetTmpUnscroll(); // scroll all tmp scrolled parents again e.g. when unselecting + BranchObj* getBranchObj(); protected: bool scrolled; // true if all children are scrolled and thus invisible diff -r 9ff332964015 -r ff3b01ce0960 branchobj.cpp --- a/branchobj.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/branchobj.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -102,7 +102,7 @@ OrnamentedObj::copy(other); branch.clear(); - for (int i=0; ibranch.size(); ++i) + for (int i=0; itreeItem->branchCount(); ++i) // Make deep copy of b // Because addBranch again calls copy for the children, // Those will get a deep copy, too @@ -182,7 +182,7 @@ { // new parent is just a branch, link to it QRectF t=o->getBBoxSizeWithChildren(); - if (o->getLastBranch()) + if (o->getTreeItem()->getLastBranch()) y=t.y() + t.height() ; else y=t.y(); @@ -242,7 +242,7 @@ if (! bi->isScrolled() && (bi->depth() < toDepth)) { // Now go recursivly through all children - for (i=0; ibranchCount(); ++i) branch.at(i)->setVisibility (v,toDepth); } } // depth <= toDepth @@ -272,7 +272,7 @@ void BranchObj::setColorSubtree(QColor col) { setColor (col); - for (int i=0; ibranchCount(); ++i) branch.at(i)->setColorSubtree(col); } @@ -299,7 +299,7 @@ void BranchObj::moveBy (double x, double y) { OrnamentedObj::moveBy (x,y); - for (int i=0; ibranchCount(); ++i) branch.at(i)->moveBy (x,y); positionBBox(); } @@ -424,7 +424,7 @@ { // Search branches LinkableMapObj *lmo; - for (int i=0; ibranchCount(); ++i) { lmo=branch.at(i)->findMapObj(p, excludeLMO); if (lmo != NULL) return lmo; @@ -450,7 +450,7 @@ { // Search branches LinkableMapObj *lmo; - for (int i=0; ibranchCount(); ++i) { lmo=branch.at(i)->findID (sid); if (lmo != NULL) return lmo; @@ -498,7 +498,7 @@ } // And take care of my children - for (int i=0; ibranchCount(); ++i) branch.at(i)->setHideTmp (mode); } @@ -579,7 +579,7 @@ s+=treeItem->getNoteObj().saveToDir(); // Save branches - for (int i=0; ibranchCount(); ++i) s+=branch.at(i)->saveToDir(tmpdir,prefix,offset); // Save XLinks @@ -742,7 +742,7 @@ void BranchObj::savePosInAngle () { // Save position in angle - for (int i=0; ibranchCount(); ++i) branch.at(i)->angle=i; } @@ -898,9 +898,10 @@ requestReposition(); } +/* FIXME-1 not needed BranchObj* BranchObj::getFirstBranch () { - if (branch.size()>0) + if (treeItem->branchCount()>0) return branch.first(); else return NULL; @@ -908,7 +909,7 @@ BranchObj* BranchObj::getLastBranch () { - if (branch.size()>0) + if (treeItem->branchCount()>0) return branch.last(); else return NULL; @@ -916,20 +917,24 @@ BranchObj* BranchObj::getBranchNum (int i) { - if (i>=0 && i=0 && ibranchCount()) return branch.at(i); else return NULL; } +*/ bool BranchObj::canMoveBranchUp() { + /* FIXME-1 move to BranchItem if (!parObj || depth==1) return false; BranchObj* par=(BranchObj*)parObj; - if (this==par->getFirstBranch()) + if (this==par->getTreeItem()->getFirstBranch()) return false; else return true; + */ +return false; } BranchObj* BranchObj::moveBranchUp(BranchObj* bo1) // modify my childlist @@ -948,12 +953,15 @@ bool BranchObj::canMoveBranchDown() { + /* FIXME-1 move to BranchItem if (!parObj|| depth==1) return false; BranchObj* par=(BranchObj*)parObj; - if (this==par->getLastBranch()) + if (this==par->getTreeItem()->getLastBranch()) return false; else return true; + */ +return false; } BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist @@ -961,7 +969,7 @@ savePosInAngle(); int i=branch.indexOf(bo1); int j; - if (i branchCount()) { j = i+1; branch.at(i)->angle++; @@ -1111,7 +1119,7 @@ ref2.setY(ref.y() ); // Align the children depending on reference point - for (int i=0; ibranchCount(); ++i) { if (!branch.at(i)->isHidden()) { @@ -1160,7 +1168,7 @@ void BranchObj::unsetAllRepositionRequests() { repositionRequest=false; - for (int i=0; ibranchCount(); ++i) branch.at(i)->unsetAllRepositionRequests(); } @@ -1193,7 +1201,7 @@ if ( ((BranchItem*)treeItem)->isScrolled() ) return r; - for (int i=0; ibranchCount(); ++i) if (!branch.at(i)->isHidden()) r=addBBox(branch.at(i)->getTotalBBox(),r); @@ -1251,7 +1259,7 @@ // sum of heights // maximum of widths // minimum of y - for (int i=0; ibranchCount(); ++i) { if (!branch.at(i)->isHidden()) { diff -r 9ff332964015 -r ff3b01ce0960 branchobj.h --- a/branchobj.h Wed Apr 01 15:06:57 2009 +0000 +++ b/branchobj.h Thu Apr 02 09:46:29 2009 +0000 @@ -91,10 +91,6 @@ virtual void removeBranch(BranchObj*); virtual void removeBranchPtr (BranchObj*); - virtual BranchObj* getFirstBranch(); - virtual BranchObj* getLastBranch(); - virtual BranchObj* getBranchNum(int); - virtual bool canMoveBranchUp(); virtual BranchObj* moveBranchUp(BranchObj*); virtual bool canMoveBranchDown(); diff -r 9ff332964015 -r ff3b01ce0960 exports.cpp --- a/exports.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/exports.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -1,4 +1,6 @@ #include "exports.h" + +#include "branchitem.h" #include "file.h" #include "linkablemapobj.h" #include "misc.h" @@ -143,8 +145,8 @@ QString s; QString curIndent; int i; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d; BranchObj *bo; @@ -229,8 +231,8 @@ QString curIndent(""); int i; BranchObj *bo; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d; cur=model->next (cur,prev,d); while (cur) @@ -389,8 +391,8 @@ // QString curIndent(""); // int i; BranchObj *bo; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d; model->next(cur,prev,d); while (cur) @@ -439,32 +441,30 @@ { } -QString ExportOO::buildList (BranchObj *current) +QString ExportOO::buildList (TreeItem *current) { QString r; - BranchObj *bo; uint i=0; - bo=current->getFirstBranch(); - TreeItem *ti=bo->getTreeItem(); - if (bo) + BranchItem *bi=current->getFirstBranch(); + if (bi) { - if (!bo->hasHiddenExportParent() ) + if (true) //if (!bo->hasHiddenExportParent() ) // FIXME-2 use BranchItem... { // Start list r+="\n"; - while (bo) + while (bi) { r+=""; - r+=quotemeta(bo->getHeading()); + r+=quotemeta(bi->getHeading()); // If necessary, write note - if (!ti->getNoteObj().isEmpty()) - r+=ti->getNoteOpenDoc(); + if (!bi->getNoteObj().isEmpty()) + r+=bi->getNoteOpenDoc(); r+=""; - r+=buildList (bo); // recursivly add deeper branches + r+=buildList (bi); // recursivly add deeper branches r+="\n"; i++; - bo=current->getBranchNum(i); + bi=current->getBranchNum(i); } r+="\n"; } @@ -514,7 +514,7 @@ // Add page with list of items onePage=pageTemplate; onePage.replace ("", quotemeta (pagesBO->getHeading() ) ); - list=buildList (pagesBO); + list=buildList (pagesBO->getTreeItem() ); onePage.replace ("", list); allPages+=onePage; j++; diff -r 9ff332964015 -r ff3b01ce0960 exports.h --- a/exports.h Wed Apr 01 15:06:57 2009 +0000 +++ b/exports.h Thu Apr 02 09:46:29 2009 +0000 @@ -106,7 +106,7 @@ void exportPresentation(); bool setConfigFile (const QString &); private: - QString buildList (BranchObj*); + QString buildList (TreeItem *); bool useSections; QString configFile; QString configDir; diff -r 9ff332964015 -r ff3b01ce0960 linkablemapobj.cpp --- a/linkablemapobj.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/linkablemapobj.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -580,7 +580,7 @@ return parObj; } -LinkableMapObj* LinkableMapObj::findObjBySelect (QString s) +LinkableMapObj* LinkableMapObj::findObjBySelect (QString s) // FIXME-2 port to TreeItem... { LinkableMapObj *lmo=this; QString part; @@ -599,7 +599,7 @@ break; } else if (typ=="bo:") - lmo=((BranchObj*)lmo)->getBranchNum (num.toInt()); + lmo=lmo->getTreeItem()->getBranchObjNum (num.toInt()); else if (typ=="fi:") lmo=((BranchObj*)lmo)->getFloatImageNum (num.toUInt()); diff -r 9ff332964015 -r ff3b01ce0960 mapeditor.cpp --- a/mapeditor.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/mapeditor.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -6,6 +6,7 @@ #include +#include "branchitem.h" #include "mainwindow.h" #include "misc.h" #include "warningdialog.h" @@ -283,8 +284,8 @@ void MapEditor::testFunction1() { - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d; cout << "ME::testFunction1 starting to walk the map...\n"; while (model->next (cur,prev,d) ) @@ -496,7 +497,7 @@ if (!foname.isEmpty()) { // systemFlag clicked - model->selectInt (lmo); + model->select (lmo); // FIXME-3 was selectInt if (foname=="url") { if (e->state() & Qt::ControlModifier) @@ -585,13 +586,14 @@ if (mainWindow->getModMode()==Main::ModModeCopy && e->state() & Qt::ControlModifier) { - BranchObj *bo=model->getSelectedBranch(); - if (bo) + BranchItem *bi=model->getSelectedBranchItem(); + if (bi) { copyingObj=true; - bo->addBranch (model->getSelectedBranch()); + //FIXME-2 TreeItem::addBranch (BranchItem still missing) + //bi->addBranch (model->getSelectedBranchItem()); model->unselect(); - model->select(bo->getLastBranch()); + model->select(bi->getLastBranch()); model->reposition(); } } diff -r 9ff332964015 -r ff3b01ce0960 treeitem.cpp --- a/treeitem.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/treeitem.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -3,8 +3,10 @@ #include +#include "treeitem.h" + #include "branchobj.h" -#include "treeitem.h" +#include "branchitem.h" #include "vymmodel.h" TreeItem::TreeItem(const QList &data, TreeItem *parent) @@ -261,7 +263,7 @@ return NULL; } -TreeItem* TreeItem::getFirstBranch() +BranchItem* TreeItem::getFirstBranch() { if (branchCounter>0) return getBranchNum (branchOffset); @@ -269,7 +271,7 @@ return NULL; } -TreeItem* TreeItem::getLastBranch() +BranchItem* TreeItem::getLastBranch() { if (branchCounter>0) return getBranchNum (branchOffset + branchCounter-1); @@ -278,14 +280,23 @@ } -TreeItem* TreeItem::getBranchNum(const int &n) +BranchItem* TreeItem::getBranchNum(const int &n) { if (branchCounter>0) - return getChildNum (branchOffset + n); + return (BranchItem*)getChildNum (branchOffset + n); else return NULL; } +BranchObj* TreeItem::getBranchObjNum(const int &n) +{ + if (branchCounter>0) + { + return (BranchObj*)(getChildNum (branchOffset+n)->lmo); + } else + return NULL; +} + void TreeItem::setLastSelectedBranch() { if (parentItem) diff -r 9ff332964015 -r ff3b01ce0960 treeitem.h --- a/treeitem.h Wed Apr 01 15:06:57 2009 +0000 +++ b/treeitem.h Thu Apr 02 09:46:29 2009 +0000 @@ -8,6 +8,8 @@ #include "xmlobj.h" class LinkableMapObj; +class BranchObj; +class BranchItem; class VymModel; class TreeItem:public XMLObj @@ -70,9 +72,10 @@ // Navigation and selection TreeItem* getChildNum(const int &n); - TreeItem* getFirstBranch(); - TreeItem* getLastBranch(); - TreeItem* getBranchNum(const int &n); + BranchItem* getFirstBranch(); + BranchItem* getLastBranch(); + BranchItem* getBranchNum(const int &n); + BranchObj* getBranchObjNum(const int &n); void setLastSelectedBranch(); TreeItem* getLastSelectedBranch(); diff -r 9ff332964015 -r ff3b01ce0960 treemodel.cpp --- a/treemodel.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/treemodel.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -3,6 +3,7 @@ #include using namespace std; +#include "branchitem.h" #include "treeitem.h" #include "treemodel.h" @@ -108,11 +109,11 @@ return rootItem->columnCount(); } -TreeItem* TreeModel::next(TreeItem* ¤t, TreeItem* &previous, int &d0) +BranchItem* TreeModel::next(BranchItem* ¤t, BranchItem* &previous, int &d0) { // Walk through map beginning at current with previous==0 // Start at root, if current==NULL - if (!current) current=rootItem; + if (!current) current=(BranchItem*)rootItem; // Are we just beginning to walk the map? if (!previous) @@ -143,7 +144,7 @@ // Coming from below, // Trying to go down again to siblings - TreeItem *sibling=current->getBranchNum (previous->num()+1); + BranchItem *sibling=current->getBranchNum (previous->num()+1); if (sibling) { @@ -155,7 +156,7 @@ // Go up and try to find siblings of current previous=current; - current=current->parent(); + current=(BranchItem*)current->parent(); // Check if we still can go somewhere if (!current) return current; diff -r 9ff332964015 -r ff3b01ce0960 treemodel.h --- a/treemodel.h Wed Apr 01 15:06:57 2009 +0000 +++ b/treemodel.h Thu Apr 02 09:46:29 2009 +0000 @@ -6,6 +6,7 @@ #include +class BranchItem; class TreeItem; class LinkableMapObj; @@ -27,7 +28,7 @@ int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; - TreeItem* next(TreeItem* ¤t, TreeItem* &previous, int &d0); + BranchItem* next(BranchItem* ¤t, BranchItem* &previous, int &d0); bool insertRows ( int row, int count, const QModelIndex & parent = QModelIndex() ); diff -r 9ff332964015 -r ff3b01ce0960 version.h --- a/version.h Wed Apr 01 15:06:57 2009 +0000 +++ b/version.h Thu Apr 02 09:46:29 2009 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.13.0" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version" -#define __VYM_BUILD_DATE "2009-03-31" +#define __VYM_BUILD_DATE "2009-04-02" bool checkVersion(const QString &); diff -r 9ff332964015 -r ff3b01ce0960 vymmodel.cpp --- a/vymmodel.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/vymmodel.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -670,6 +670,7 @@ void VymModel::addMapInsertInt (const QString &path, int pos) { +/* FIXME-2 addMapInsertInt not ported yet BranchObj *sel=getSelectedBranch(); if (sel) { @@ -702,6 +703,7 @@ } else QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path)); } +*/ } FloatImageObj* VymModel::loadFloatImageInt (QString fn) @@ -817,6 +819,7 @@ void VymModel::importDirInt(BranchObj *dst, QDir d) { +/* FIXME-2 importDirInt not ported yet BranchObj *bo=getSelectedBranch(); if (bo) { @@ -861,6 +864,7 @@ bo->setVymLink (fi.filePath()); } } +*/ } void VymModel::importDirInt (const QString &s) @@ -1470,8 +1474,8 @@ int VymModel::branchCount() // FIXME-2 Optimize this: use internal counter instead of going through whole map each time... { int c=0; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d; next(cur,prev,d); while (cur) @@ -1981,10 +1985,10 @@ select (mco); } -void VymModel::createBranch() -{ - addNewBranchInt (-2); - return; +BranchItem* VymModel::createBranch() // FIXME-2 switcht addNewBrancInt to BranchItem... +{ + BranchObj* bo=addNewBranchInt (-2); + return (BranchItem*)bo->getTreeItem(); } TreeItem* VymModel::createImage() @@ -2735,7 +2739,8 @@ void VymModel::parseAtom(const QString &atom) { BranchObj *selb=getSelectedBranch(); - BranchItem *bi=getSelectedBranchItem(); + TreeItem* selti=getSelectedItem(); + BranchItem *selbi=getSelectedBranchItem(); QString s,t; double x,y; int n; @@ -2749,7 +2754,7 @@ ///////////////////////////////////////////////////////////////////// if (com=="addBranch") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2773,7 +2778,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="addBranchBefore") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2801,7 +2806,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com==QString("addMapReplace")) { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2817,7 +2822,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com==QString("addMapInsert")) { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2836,7 +2841,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="clearFlags") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2850,7 +2855,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="colorBranch") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2864,7 +2869,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="colorSubtree") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2878,7 +2883,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="copy") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2891,7 +2896,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="cut") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && @@ -2906,7 +2911,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="delete") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } @@ -2922,7 +2927,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="deleteKeepChildren") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2935,7 +2940,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="deleteChildren") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb) @@ -3013,7 +3018,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="importDir") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3027,7 +3032,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="linkTo") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if ( selb) @@ -3087,7 +3092,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="loadImage") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3101,7 +3106,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="moveBranchUp") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3114,7 +3119,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="moveBranchDown") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3127,7 +3132,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="move") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && @@ -3147,7 +3152,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="moveRel") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && @@ -3170,7 +3175,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="paste") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3184,7 +3189,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="qa") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3266,15 +3271,15 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="scroll") { - if (selection.isEmpty() ) + if (!selti) { parser.setError (Aborted,"Nothing selected"); - } else if (! selb ) + } else if (! selbi ) { parser.setError (Aborted,"Type of selection is not a branch"); } else if (parser.checkParCount(0)) { - if (!scrollBranch (bi)) + if (!scrollBranch (selbi)) parser.setError (Aborted,"Could not scroll branch"); } ///////////////////////////////////////////////////////////////////// @@ -3288,7 +3293,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="selectLastBranch") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3296,16 +3301,16 @@ parser.setError (Aborted,"Type of selection is not a branch"); } else if (parser.checkParCount(0)) { - BranchObj *bo=selb->getLastBranch(); - if (!bo) + BranchItem *bi=selbi->getLastBranch(); + if (!bi) parser.setError (Aborted,"Could not select last branch"); - selectInt (bo); + select (bi); // FIXME-3 was selectInt } ///////////////////////////////////////////////////////////////////// } else if (com=="selectLastImage") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3316,7 +3321,7 @@ FloatImageObj *fio=selb->getLastFloatImage(); if (!fio) parser.setError (Aborted,"Could not select last image"); - selectInt (fio); + select (fio); // FIXME-3 was selectInt } ///////////////////////////////////////////////////////////////////// @@ -3409,7 +3414,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setMapBackgroundColor") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! getSelectedBranch() ) @@ -3423,7 +3428,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setMapDefLinkColor") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3445,7 +3450,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setHeading") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3460,7 +3465,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setHideExport") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (selectionType()!=TreeItem::Branch && selectionType() != TreeItem::MapCenter &&selectionType()!=TreeItem::Image) @@ -3474,7 +3479,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setIncludeImagesHorizontally") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb) @@ -3488,7 +3493,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setIncludeImagesVertically") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb) @@ -3502,7 +3507,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setHideLinkUnselected") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && selectionType()!= TreeItem::MapCenter && selectionType()!=TreeItem::Image) @@ -3524,7 +3529,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setURL") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3538,7 +3543,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setVymLink") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3553,7 +3558,7 @@ ///////////////////////////////////////////////////////////////////// else if (com=="setFlag") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3571,7 +3576,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setFrameType") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3586,7 +3591,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="sortChildren") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3599,7 +3604,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="toggleFlag") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3617,7 +3622,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="unscroll") { - if (selection.isEmpty() ) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3625,13 +3630,13 @@ parser.setError (Aborted,"Type of selection is not a branch"); } else if (parser.checkParCount(0)) { - if (!unscrollBranch (bi)) + if (!unscrollBranch (selbi)) parser.setError (Aborted,"Could not unscroll branch"); } ///////////////////////////////////////////////////////////////////// } else if (com=="unscrollChildren") { - if (selection.isEmpty() ) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -4021,8 +4026,8 @@ else linkstyle=LinkableMapObj::UndefinedStyle; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; next (cur,prev,d); @@ -4050,8 +4055,8 @@ ); defLinkColor=col; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; cur=next(cur,prev,d); @@ -4067,8 +4072,8 @@ void VymModel::setMapLinkColorHintInt() { // called from setMapLinkColorHint(lch) or at end of parse - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; cur=next(cur,prev,d); @@ -4092,8 +4097,8 @@ linkcolorhint=LinkableMapObj::DefaultColor; else linkcolorhint=LinkableMapObj::HeadingColor; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; cur=next(cur,prev,d); @@ -4608,7 +4613,9 @@ emit (contentHasChanged (ix) ); } -void VymModel::selectInt (LinkableMapObj *lmo) + +//void VymModel::selectInt (LinkableMapObj *lmo) // FIXME-3 still needed? +/* { if (selection.select(lmo)) { @@ -4617,6 +4624,15 @@ } } +void VymModel::selectInt (TreeItem *ti) +{ + if (selection.select(lmo)) + { + //selection.update(); + sendSelection (); // FIXME-4 VM use signal + } +} +*/ void VymModel::selectNextBranchInt() { diff -r 9ff332964015 -r ff3b01ce0960 vymmodel.h --- a/vymmodel.h Wed Apr 01 15:06:57 2009 +0000 +++ b/vymmodel.h Thu Apr 02 09:46:29 2009 +0000 @@ -240,8 +240,8 @@ // QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch private: - TreeItem* findCurrent; // next object in find process - TreeItem* findPrevious; // next object in find process + BranchItem* findCurrent; // next object in find process + BranchItem* findPrevious; // next object in find process bool EOFind; // true, if search failed public: BranchObj* findText(QString,bool); // Find object @@ -282,7 +282,7 @@ // The create methods are used to quickly parse a XML file void createMapCenter(); //!< Create and select MapCenter - void createBranch(); //!< Create and select Branch + BranchItem* createBranch(); //!< Create and select Branch TreeItem* createImage(); //!< Create and select image /*! \brief Add new mapcenter @@ -551,7 +551,7 @@ void ensureSelectionVisible(); //!< Show selection in all views - void selectInt(LinkableMapObj*); +// void selectInt(LinkableMapObj*); private: void selectNextBranchInt(); // Increment number of branch diff -r 9ff332964015 -r ff3b01ce0960 xml-freemind.cpp --- a/xml-freemind.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/xml-freemind.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -94,21 +94,21 @@ if (atts.value ("POSITION")=="left") { model->select ("bo:1"); - lastBranch=model->getSelectedBranch(); - if (lastBranch) - { - lastBranch->addBranch(); - lastBranch=lastBranch->getLastBranch(); + lastBranchItem=model->getSelectedBranchItem(); + if (lastBranchItem) + { + lastBranchItem=model->createBranch(); + lastBranch=lastBranchItem->getBranchObj(); readNodeAttr (atts); } } else if (atts.value ("POSITION")=="right") { model->select ("bo:0"); - lastBranch=model->getSelectedBranch(); - if (lastBranch) - { - lastBranch->addBranch(); - lastBranch=lastBranch->getLastBranch(); + lastBranchItem=model->getSelectedBranchItem(); + if (lastBranchItem) + { + lastBranchItem=model->createBranch(); + lastBranch=lastBranchItem->getBranchObj(); readNodeAttr (atts); } } @@ -116,8 +116,8 @@ { if (state!=StateMap) { - lastBranch->addBranch(); - lastBranch=lastBranch->getLastBranch(); + lastBranchItem=model->createBranch(); + lastBranch=lastBranchItem->getBranchObj(); } readNodeAttr (atts); } diff -r 9ff332964015 -r ff3b01ce0960 xml-freemind.h --- a/xml-freemind.h Wed Apr 01 15:06:57 2009 +0000 +++ b/xml-freemind.h Thu Apr 02 09:46:29 2009 +0000 @@ -37,7 +37,7 @@ State state; State laststate; QList stateStack; + BranchObj *lastBranch; BranchItem *lastBranchItem; - BranchObj *lastBranch; }; #endif