Adding measures does not mark the file as changed

• Jan 29, 2015 - 14:51
Type
Functional
Severity
S4 - Minor
Status
closed
Project

GIT commit: 86e51ad
When you add new tabs (Alt Shift+B), the filename does not get an asterisk to mark it as changed. See attached picture before.gif and after.gif

Attachment Size
after.gif 13.04 KB
before.gif 9.91 KB

Comments

The "*" doesn't show right away but the flag is being updated. If I do this operation and click on some whitespace in the score the "*" will appear.

Title Adding new tabs does not mark the file as changed Append does not mark the file as changed

Apparently what marks a score "dirty" is the presence of actions on the undo stack since last save. So any action that is undoable should mark the score dirty; any action that is not won't. Not sure this is ideal, but in any case, I checked, and sure enough, there seems to be an issue with the commands to insert or append multiple measures. The first time you run either command after score creation, the score is not marked dirty, and the operation is not undoable. Then, if you do it again, the score is marked dirty, and it is undoable. What's weird is, the first operation then becomes undoable as well. That is:

1) new score
2) Alt+Shift+B, choose any number of measures

Result: measures are added, but score is not marked dirty

3) Undo

Result: nothing happens - the measures are not deleted

But then:

4) Alt+Shift+B, choose any number of measures

Result: measures are added, but this time, score *is* marked dirty

And then:

5) Undo
6) Undo

Result: both operations are successful; you are returned to your original score, no longer marked dirty.

So somehow the undo stack is being set up improperly on the insertion of multiple measures.

Title Append does not mark the file as changed Adding measures does not mark the file as changed

Cause is missing mscore->endCmd(). I can add one at the end of ScoreView::cmdAppendMeasures() and ScoreView::cmdInsertMeasures(), but that will result in it being called twice when adding just a single measure via Ctrl+B or Ins. If that's OK, then the fix is that easy. Otherwise, a little refactoring might be in order.

Calling mscore->endCmd() twice should not hurt. Every call to score->endCmd() should update the UI and call mscore->endCmd(). To ensure this mscore->endCmd() is now called at the end of score->endCmd().