1.1 --- a/mapeditor.cpp Mon Feb 12 09:28:46 2007 +0000
1.2 +++ b/mapeditor.cpp Mon Feb 12 09:28:47 2007 +0000
1.3 @@ -710,6 +710,19 @@
1.4 {
1.5 paste();
1.6 }
1.7 + } else if (com=="scroll")
1.8 + {
1.9 + if (xelection.isEmpty() )
1.10 + {
1.11 + api.setError (Aborted,"Nothing selected");
1.12 + } else if (! selb )
1.13 + {
1.14 + api.setError (Aborted,"Type of selection is not a branch");
1.15 + } else if (api.checkParamCount(0))
1.16 + {
1.17 + if (!scrollBranch ())
1.18 + api.setError (Aborted,"Could not scroll branch");
1.19 + }
1.20 } else if (com=="select")
1.21 {
1.22 if (api.checkParamCount(1))
1.23 @@ -835,8 +848,20 @@
1.24 selb->updateFlagsToolbar();
1.25 }
1.26 }
1.27 - }
1.28 - else if (com=="unsetFlag")
1.29 + } else if (com=="unscroll")
1.30 + {
1.31 + if (xelection.isEmpty() )
1.32 + {
1.33 + api.setError (Aborted,"Nothing selected");
1.34 + } else if (! selb )
1.35 + {
1.36 + api.setError (Aborted,"Type of selection is not a branch");
1.37 + } else if (api.checkParamCount(0))
1.38 + {
1.39 + if (!unscrollBranch ())
1.40 + api.setError (Aborted,"Could not unscroll branch");
1.41 + }
1.42 + } else if (com=="unsetFlag")
1.43 {
1.44 if (xelection.isEmpty() )
1.45 {
1.46 @@ -2765,8 +2790,13 @@
1.47
1.48 void MapEditor::updateNoteFlag()
1.49 {
1.50 + setChanged();
1.51 BranchObj *bo=xelection.getBranch();
1.52 - if (bo) bo->updateNoteFlag();
1.53 + if (bo)
1.54 + {
1.55 + bo->updateNoteFlag();
1.56 + mainWindow->updateActions();
1.57 + }
1.58 }
1.59
1.60 void MapEditor::setMapAuthor (const QString &s)
1.61 @@ -2911,24 +2941,17 @@
1.62
1.63 }
1.64
1.65 -void MapEditor::toggleScroll()
1.66 +bool MapEditor::scrollBranch()
1.67 {
1.68 BranchObj *bo=xelection.getBranch();
1.69 - if (xelection.type()==Branch )
1.70 + if (bo)
1.71 {
1.72 - if (bo->countBranches()==0) return;
1.73 - if (bo->getDepth()==0) return;
1.74 + if (bo->isScrolled()) return false;
1.75 + if (bo->countBranches()==0) return false;
1.76 + if (bo->getDepth()==0) return false;
1.77 QString u,r;
1.78 - if (bo->isScrolled())
1.79 - {
1.80 - r="unscroll";
1.81 - u="scroll";
1.82 - }
1.83 - else
1.84 - {
1.85 - u="scroll";
1.86 - r="unscroll";
1.87 - }
1.88 + r="scroll";
1.89 + u="unscroll";
1.90 saveState(
1.91 bo,
1.92 QString ("%1 ()").arg(u),
1.93 @@ -2938,6 +2961,45 @@
1.94 );
1.95 bo->toggleScroll();
1.96 scene()->update();
1.97 + return true;
1.98 + }
1.99 + return false;
1.100 +}
1.101 +
1.102 +bool MapEditor::unscrollBranch()
1.103 +{
1.104 + BranchObj *bo=xelection.getBranch();
1.105 + if (bo)
1.106 + {
1.107 + if (!bo->isScrolled()) return false;
1.108 + if (bo->countBranches()==0) return false;
1.109 + if (bo->getDepth()==0) return false;
1.110 + QString u,r;
1.111 + u="scroll";
1.112 + r="unscroll";
1.113 + saveState(
1.114 + bo,
1.115 + QString ("%1 ()").arg(u),
1.116 + bo,
1.117 + QString ("%1 ()").arg(r),
1.118 + QString ("%1 %2").arg(r).arg(getName(bo))
1.119 + );
1.120 + bo->toggleScroll();
1.121 + scene()->update();
1.122 + return true;
1.123 + }
1.124 + return false;
1.125 +}
1.126 +
1.127 +void MapEditor::toggleScroll()
1.128 +{
1.129 + BranchObj *bo=xelection.getBranch();
1.130 + if (xelection.type()==Branch )
1.131 + {
1.132 + if (bo->isScrolled())
1.133 + unscrollBranch ();
1.134 + else
1.135 + scrollBranch ();
1.136 }
1.137 }
1.138