diff -r 2d4cc445a86a -r ee6b0f3a4c2f branchobj.cpp --- a/branchobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/branchobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -17,11 +17,7 @@ // BranchObj ///////////////////////////////////////////////////////////////// -BranchObj* BranchObj::itLast=NULL; -BranchObj* BranchObj::itFirst=NULL; - - -BranchObj::BranchObj () :OrnamentedObj() // FIXME needed at all? +BranchObj::BranchObj () :OrnamentedObj() // FIXME-3 needed at all? { // cout << "Const BranchObj ()\n"; setParObj (this); @@ -392,155 +388,6 @@ branch.at(i)->setColorSubtree(col); } -BranchObj* BranchObj::first() -{ - itLast=NULL; - itFirst=this; - return this; -} - -BranchObj* BranchObj::next() -{ - BranchObj *bo; - BranchObj *lmo; - BranchObj *po=(BranchObj*)parObj; - - if (branch.isEmpty()) - bo=NULL; - else - bo=branch.first(); - - if (!itLast) - { - // no itLast, we are just beginning - if (bo) - { - // we have children, return first one - itLast=this; - return bo; - } - else - { - // No children, so there is no next - itLast=this; - return NULL; - } - } - - // We have an itLast - if (itLast==po) - { // We come from parent - if (bo) - { - // there are children, go there - itLast=this; - return bo; - } - else - { // no children, try to go up again - if (po) - { - // go back to parent and try to find next there - itLast=this; - lmo=po->next(); - itLast=this; - return lmo; - - } - else - { - // can't go up, I am mapCenter, no next - itLast=NULL; - return NULL; - } - } - } - - // We don't come from parent, but from brother or children - - // Try to find last child, where we came from, in my own children - bool searching=true; - int i=0; - while (inext(); - itLast=this; - return lmo; - } - else - { - // can't go up, I am mapCenter - itLast=NULL; - return NULL; - } - } - } - - // couldn't find last child, it must be a nephew of mine - if (branch.size()>0) - { - // proceed with my first child - itLast=this; - return branch.first(); - } - else - { - // or go back to my parents - if (po) - { - // go up - itLast=this; - lmo=po->next(); - itLast=this; - return lmo; - } - else - { - // can't go up, I am mapCenter - itLast=NULL; - return NULL; - } - } -} - -BranchObj* BranchObj::getLastIterator() -{ - return itLast; -} - -void BranchObj::setLastIterator(BranchObj* it) -{ - itLast=it; -} - void BranchObj::positionContents() { for (int i=0; isaveToDir (tmpdir,prefix); // save note - if (!note.isEmpty() ) - s+=note.saveToDir(); + if (!treeItem->getNoteObj().isEmpty() ) + s+=treeItem->getNoteObj().saveToDir(); // Save branches for (int i=0; idepth=depth+1; bo->setDefAttr(MovedBranch); if (scrolled) tmpUnscroll(); - //setLastSelectedBranch (bo); //FIXME needed? + //setLastSelectedBranch (bo); //FIXME-3 needed? return bo; } @@ -1112,7 +959,7 @@ bo->depth=depth+1; bo->setDefAttr (MovedBranch); if (scrolled) tmpUnscroll(); - //setLastSelectedBranch (bo); //FIXME needed? + //setLastSelectedBranch (bo); //FIXME-3 needed? qSort (branch.begin(),branch.end(), isAbove); return bo; } @@ -1535,28 +1382,27 @@ bboxTotal.setHeight(max (r.height(), bbox.height())); } -void BranchObj::select() // FIXME try to get rid of this in BO completely +void BranchObj::select() // FIXME-2 try to get rid of this in BO completely { cout << "BO::select()\n"; - // update NoteEditor FIXME do this via VymView::changeSelection - textEditor->setText(note.getNote() ); - QString fnh=note.getFilenameHint(); + textEditor->setText(treeItem->getNoteObj().getNote() ); + QString fnh=treeItem->getNoteObj().getFilenameHint(); if (fnh!="") - textEditor->setFilenameHint(note.getFilenameHint() ); + textEditor->setFilenameHint(treeItem->getNoteObj().getFilenameHint() ); else textEditor->setFilenameHint(getHeading() ); - textEditor->setFontHint (note.getFontHint() ); - isNoteInEditor=true; + textEditor->setFontHint (treeItem->getNoteObj().getFontHint() ); + //isNoteInEditor=true; // set selected and visible LinkableMapObj::select(); - //if (po) po->setLastSelectedBranch(this); FIXME needed? + //if (po) po->setLastSelectedBranch(this); needed? // temporary unscroll, if we have scrolled parents somewhere if (parObj) ((BranchObj*)(parObj))->tmpUnscroll(); - /* FIXME moved to vymmodel or vymview... + /* moved to vymmodel or vymview... // Show URL and link in statusbar QString status; if (!url.isEmpty()) status+="URL: "+url+" "; @@ -1571,15 +1417,17 @@ */ } -void BranchObj::unselect() +void BranchObj::unselect() //FIXME-3 should not be needed { LinkableMapObj::unselect(); // Delete any messages like vymLink in StatusBar - mainWindow->statusMessage (""); //FIXME this causes segfault, when MainWindow is already gone in global destructor on quitting vym + mainWindow->statusMessage (""); //this causes segfault, when MainWindow is already gone in global destructor on quitting vym +/* // Save current note if (isNoteInEditor) getNoteFromTextEditor(); isNoteInEditor=false; +*/ // reset temporary unscroll, if we have scrolled parents somewhere if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll();