Skip to content

Commit

Permalink
Merge pull request #4169 from dmitrio95/277797-figured-bass-undo
Browse files Browse the repository at this point in the history
fix #277797: fix undo figured bass on consecutive notes
  • Loading branch information
anatoly-os committed Nov 21, 2018
2 parents c775aad + ffbd1e2 commit f030976
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
10 changes: 10 additions & 0 deletions libmscore/figuredbass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,16 @@ void FiguredBass::layoutLines()
int sysIdx1 = systems.indexOf(s1);
int sysIdx2 = systems.indexOf(s2);

if (sysIdx2 < sysIdx1) {
sysIdx2 = sysIdx1;
nextSegm = segment()->next1();
// TODO
// During layout of figured bass next systems' numbers may be still
// undefined (then sysIdx2 == -1) or change in the future.
// A layoutSystem() approach similar to that for spanners should
// probably be implemented.
}

int i, len ,segIdx;
for (i = sysIdx1, segIdx = 0; i <= sysIdx2; ++i, ++segIdx) {
len = 0;
Expand Down
14 changes: 10 additions & 4 deletions mscore/editfiguredbass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ void ScoreView::figuredBassTab(bool bMeas, bool bBack)
bool bNew;
// add a (new) FB element, using chord duration as default duration
FiguredBass * fbNew = FiguredBass::addFiguredBassToSegment(nextSegm, track, 0, &bNew);
if (bNew)
if (bNew) {
_score->startCmd();
_score->undoAddElement(fbNew);
_score->endCmd();
}
_score->select(fbNew, SelectType::SINGLE, 0);
startEdit(fbNew, Grip::NO_GRIP);

_score->startCmd();
mscore->changeState(mscoreState());
adjustCanvasPosition(fbNew, false);
fbNew->cursor(editData)->moveCursorToEnd();
Expand Down Expand Up @@ -150,16 +152,20 @@ void ScoreView::figuredBassTicksTab(int ticks)
qDebug("figuredBassTicksTab: no next segment");
return;
}
_score->startCmd();
_score->undoAddElement(nextSegm);
_score->endCmd();
}

changeState(ViewState::NORMAL);

_score->startCmd();
bool bNew;
FiguredBass * fbNew = FiguredBass::addFiguredBassToSegment(nextSegm, track, ticks, &bNew);
if (bNew)
if (bNew) {
_score->startCmd();
_score->undoAddElement(fbNew);
_score->endCmd();
}
_score->select(fbNew, SelectType::SINGLE, 0);
startEdit(fbNew, Grip::NO_GRIP);
mscore->changeState(mscoreState());
Expand Down

0 comments on commit f030976

Please sign in to comment.