# HG changeset patch # User insilmaril # Date 1241173829 0 # Node ID 8c028a5d90835d21bb6e6b33c0941fe38fbb0fb8 # Parent ffb95cd03156bfc672bd38a4b32300e978e4d661 add above/below diff -r ffb95cd03156 -r 8c028a5d9083 branchitem.cpp --- a/branchitem.cpp Thu Apr 30 11:52:49 2009 +0000 +++ b/branchitem.cpp Fri May 01 10:30:29 2009 +0000 @@ -204,29 +204,36 @@ void BranchItem::toggleScroll() { + BranchItem *bi=getFirstBranch(); + + BranchObj *bo=NULL; if (scrolled) { scrolled=false; //FIXME-1 systemFlags->deactivate("scrolledright"); - /* - for (int i=0; isetVisibility(true); - */ + while (bi) + { + bo=(BranchObj*)(bi->getLMO()); + if (bo) bo->setVisibility(true); + bi=getNextBranch(bi); + } } else { scrolled=true; - /* //FIXME-1 systemFlags->activate("scrolledright"); - for (int i=0; isetVisibility(false); - */ + while (bi) + { + bo=(BranchObj*)(bi->getLMO()); + if (bo) bo->setVisibility(false); + bi=getNextBranch(bi); + } } - /* - calcBBoxSize(); - positionBBox(); - move (absPos.x(), absPos.y() ); - forceReposition(); - */ + if (bo) + { + bo->calcBBoxSize(); + bo->positionBBox(); + bo->forceReposition(); + } } bool BranchItem::isScrolled() diff -r ffb95cd03156 -r 8c028a5d9083 flagobj.cpp --- a/flagobj.cpp Thu Apr 30 11:52:49 2009 +0000 +++ b/flagobj.cpp Fri May 01 10:30:29 2009 +0000 @@ -174,8 +174,6 @@ if (visible) { icon->setVisibility (true); - //icon->setPos (100,100); - //icon->setPos (rand()%100,rand()%130); calcBBoxSize(); } } @@ -216,14 +214,11 @@ void FlagObj::calcBBoxSize() { if (visible && state) - { bbox.setSize ( QSizeF( icon->boundingRect().width(), icon->boundingRect().height() ) ); - } else - { + else bbox.setSize (QSizeF(0,0)); - } clickBox.setSize (bbox.size()); } diff -r ffb95cd03156 -r 8c028a5d9083 mainwindow.cpp --- a/mainwindow.cpp Thu Apr 30 11:52:49 2009 +0000 +++ b/mainwindow.cpp Fri May 01 10:30:29 2009 +0000 @@ -689,11 +689,6 @@ editMenu->addAction (a); actionSortChildren=a; - a = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ),this); - a->setShortcut ( Qt::Key_ScrollLock ); - a->setStatusTip (tr( "Scroll branch" ) ); - connect( a, SIGNAL( triggered() ), this, SLOT( editToggleScroll() ) ); - alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ), this); alt->setShortcut ( Qt::Key_S ); // Scroll branch alt->setStatusTip (tr( "Scroll branch" )); @@ -712,6 +707,19 @@ addAction (alt); actionListBranches.append(actionToggleScroll); + a = new QAction( QPixmap(), tr( "Expand all branches","Edit menu" ), this); + a->setShortcut ( Qt::SHIFT + Qt::Key_X ); // Expand all branches + a->setStatusTip (tr( "Expand all branches" )); + connect( a, SIGNAL( triggered() ), this, SLOT( editExpandAll() ) ); + actionExpandAll=a; + actionExpandAll->setEnabled (false); + actionExpandAll->setToggleAction(false); + //tb->addAction (actionExpandAll); + editMenu->addAction ( actionExpandAll); + addAction (a); + actionListBranches.append(actionExpandAll); + + a = new QAction( tr( "Unscroll children","Edit menu" ), this); a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" )); editMenu->addAction (a); @@ -1773,7 +1781,6 @@ VymView *Main::createView (VymModel *model) { VymView *vm=new VymView (model); - return vm; } @@ -1784,8 +1791,7 @@ //MapEditor* me = new MapEditor (m); //me->setObjectName ("MapEditor"); - VymView *view=createView (m); - tabWidget->addTab (view,tr("unnamed","MainWindow: name for new and empty file")); + tabWidget->addTab (createView (m),tr("unnamed","MainWindow: name for new and empty file")); tabWidget->setCurrentIndex (tabModel.count() ); // For the very first map we do not have flagrows yet... @@ -1867,8 +1873,7 @@ { vm=new VymModel; tabModel.append (vm); - VymView *view=createView (vm); - tabWidget->addTab (view,fn); + tabWidget->addTab (createView (vm),fn); tabIndex=tabWidget->count()-1; tabWidget->setCurrentPage (tabIndex); } @@ -2928,6 +2933,12 @@ if (m) m->toggleScroll(); } +void Main::editExpandAll() +{ + VymModel *m=currentModel(); + if (m) m->emitExpandAll(); +} + void Main::editUnscrollChildren() { VymModel *m=currentModel(); @@ -2995,7 +3006,7 @@ VymModel *m=currentModel(); if ( m) { - BranchItem *bi=m->createBranch(); //FIXME-1 missing: m->addNewBranch (-1); + BranchItem *bi=m->addNewBranch (-1); if (bi) @@ -3017,7 +3028,7 @@ VymModel *m=currentModel(); if (m) { - BranchItem *bi=m->createBranch();//FIXME-1 *newbo=m->addNewBranch (1); + BranchItem *bi=m->addNewBranch (1); if (bi) m->select (bi); @@ -3286,7 +3297,7 @@ void Main::viewCenter() { VymModel *m=currentModel(); - if (m) m->ensureSelectionVisible(); + if (m) m->emitShowSelection(); } void Main::networkStartServer() diff -r ffb95cd03156 -r 8c028a5d9083 mainwindow.h --- a/mainwindow.h Thu Apr 30 11:52:49 2009 +0000 +++ b/mainwindow.h Fri May 01 10:30:29 2009 +0000 @@ -147,6 +147,7 @@ void editMoveDown(); void editSortChildren(); void editToggleScroll(); + void editExpandAll(); void editUnscrollChildren(); void editAddMapCenter(); void editNewBranch(); @@ -287,6 +288,7 @@ QAction *actionMoveDown; QAction *actionSortChildren; QAction *actionToggleScroll; + QAction *actionExpandAll; QAction* actionOpenURL; QAction* actionOpenURLTab; QAction* actionOpenMultipleURLTabs; diff -r ffb95cd03156 -r 8c028a5d9083 mapeditor.cpp --- a/mapeditor.cpp Thu Apr 30 11:52:49 2009 +0000 +++ b/mapeditor.cpp Fri May 01 10:30:29 2009 +0000 @@ -662,9 +662,9 @@ setCursor (Qt::ArrowCursor); // To avoid jumping of the sceneView, only - // ensureSelectionVisible, if not tmp linked + // show selection, if not tmp linked if (!lmosel->hasParObjTmp()) - model->ensureSelectionVisible (); + model->emitShowSelection(); // Now move the selection, but add relative position // (movingObj_start) where selection was chosen with diff -r ffb95cd03156 -r 8c028a5d9083 tex/vym.tex --- a/tex/vym.tex Thu Apr 30 11:52:49 2009 +0000 +++ b/tex/vym.tex Fri May 01 10:30:29 2009 +0000 @@ -368,7 +368,7 @@ To scroll or unscroll a branch and its children, \begin{itemize} - \item press either the \key{Scroll Lock} key or the \key{S} + \item press the \key{S} \item press the middle-mouse button or \item choose the scroll icon from the toolbar. \end{itemize} diff -r ffb95cd03156 -r 8c028a5d9083 treeitem.cpp --- a/treeitem.cpp Thu Apr 30 11:52:49 2009 +0000 +++ b/treeitem.cpp Fri May 01 10:30:29 2009 +0000 @@ -52,6 +52,9 @@ branchCounter=0; lastSelectedBranchNum=-1; + imageOffset=0; + imageCounter=0; + note.setNote(""); // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2 // isNoteInEditor=false; @@ -198,7 +201,7 @@ case Undefined: return -1; case MapCenter: return parentItem->childItems.indexOf (this) - branchOffset; case Branch: return parentItem->childItems.indexOf (this) - branchOffset; - case Image: return -1; // FIXME-2 + case Image: return parentItem->childItems.indexOf (this) - imageOffset; default: return -1; } } @@ -209,9 +212,9 @@ switch (item->getType()) { case Undefined: return -1; - case MapCenter: return childItems.indexOf (this) - branchOffset; - case Branch: return childItems.indexOf (this) - branchOffset; - case Image: return -1; // FIXME-2 + case MapCenter: return childItems.indexOf (item) - branchOffset; + case Branch: return childItems.indexOf (item) - branchOffset; + case Image: return parentItem->childItems.indexOf (item) - imageOffset; default: return -1; } } @@ -351,6 +354,16 @@ return NULL; } +BranchItem* TreeItem::getNextBranch(BranchItem *currentBranch) +{ + if (!currentBranch) return NULL; + int n=num (currentBranch)+1; + if (n