diff -r e0a3449f4458 -r fb74fa7bfb4c mapeditor.cpp --- a/mapeditor.cpp Mon Feb 12 09:28:46 2007 +0000 +++ b/mapeditor.cpp Mon Feb 12 09:28:47 2007 +0000 @@ -710,6 +710,19 @@ { paste(); } + } else if (com=="scroll") + { + if (xelection.isEmpty() ) + { + api.setError (Aborted,"Nothing selected"); + } else if (! selb ) + { + api.setError (Aborted,"Type of selection is not a branch"); + } else if (api.checkParamCount(0)) + { + if (!scrollBranch ()) + api.setError (Aborted,"Could not scroll branch"); + } } else if (com=="select") { if (api.checkParamCount(1)) @@ -835,8 +848,20 @@ selb->updateFlagsToolbar(); } } - } - else if (com=="unsetFlag") + } else if (com=="unscroll") + { + if (xelection.isEmpty() ) + { + api.setError (Aborted,"Nothing selected"); + } else if (! selb ) + { + api.setError (Aborted,"Type of selection is not a branch"); + } else if (api.checkParamCount(0)) + { + if (!unscrollBranch ()) + api.setError (Aborted,"Could not unscroll branch"); + } + } else if (com=="unsetFlag") { if (xelection.isEmpty() ) { @@ -2765,8 +2790,13 @@ void MapEditor::updateNoteFlag() { + setChanged(); BranchObj *bo=xelection.getBranch(); - if (bo) bo->updateNoteFlag(); + if (bo) + { + bo->updateNoteFlag(); + mainWindow->updateActions(); + } } void MapEditor::setMapAuthor (const QString &s) @@ -2911,24 +2941,17 @@ } -void MapEditor::toggleScroll() +bool MapEditor::scrollBranch() { BranchObj *bo=xelection.getBranch(); - if (xelection.type()==Branch ) + if (bo) { - if (bo->countBranches()==0) return; - if (bo->getDepth()==0) return; + if (bo->isScrolled()) return false; + if (bo->countBranches()==0) return false; + if (bo->getDepth()==0) return false; QString u,r; - if (bo->isScrolled()) - { - r="unscroll"; - u="scroll"; - } - else - { - u="scroll"; - r="unscroll"; - } + r="scroll"; + u="unscroll"; saveState( bo, QString ("%1 ()").arg(u), @@ -2938,6 +2961,45 @@ ); bo->toggleScroll(); scene()->update(); + return true; + } + return false; +} + +bool MapEditor::unscrollBranch() +{ + BranchObj *bo=xelection.getBranch(); + if (bo) + { + if (!bo->isScrolled()) return false; + if (bo->countBranches()==0) return false; + if (bo->getDepth()==0) return false; + QString u,r; + u="scroll"; + r="unscroll"; + saveState( + bo, + QString ("%1 ()").arg(u), + bo, + QString ("%1 ()").arg(r), + QString ("%1 %2").arg(r).arg(getName(bo)) + ); + bo->toggleScroll(); + scene()->update(); + return true; + } + return false; +} + +void MapEditor::toggleScroll() +{ + BranchObj *bo=xelection.getBranch(); + if (xelection.type()==Branch ) + { + if (bo->isScrolled()) + unscrollBranch (); + else + scrollBranch (); } }