MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

Fix #15472: Deal with deleted system object staves

Open asattely opened this issue 2 years ago • 4 comments

Resolves: https://github.com/musescore/MuseScore/issues/15472

This PR does three things:

  1. When a system object staff is deleted, that staff is not saved to the file (and if there are no extra system object staves, the <SystemObjects> tag is not included in the file at all.
  2. When a file is loaded, invalid system object staves (i.e. idx < 2) are ignored
  3. When a system object is added to a score, it is not added to deleted system object staves.

asattely avatar Jan 05 '23 01:01 asattely

The code style failure is dead wrong, unless I'm doing something wildly incorrect here

asattely avatar Jan 05 '23 23:01 asattely

Well, you are correct, but Uncrustify is (pretty wildly) wrong! See https://github.com/musescore/MuseScore/actions/runs/3849233551/jobs/6557988913#step:3:2779 for what it wants you to do. Unfortunately, Uncrustify is the boss...

cbjeukendrup avatar Jan 05 '23 23:01 cbjeukendrup

Re: uncrustify: Okay, I'll see if I can revert that line of code. I didn't even change that line, it's just that my uncrustify seems to do it correctly for some reason so there are a few landmine code files that if I change anything in them uncrustify goes berserk. I'll just have to disable the hook for that particular commit.

asattely avatar Jan 06 '23 01:01 asattely

The code style check uses version 0.73 of Uncrustify, so you might want to make sure that your commit hook uses that too.

(We decided that it's the most convenient to use a fixed version, because each version behaves slightly differently, and on GitHub there's some delay before it uses updated versions, and it's inconvenient if every few weeks your local hook already has the update but the code style check not yet.)

cbjeukendrup avatar Jan 06 '23 01:01 cbjeukendrup

@asattely please rebase it

RomanPudashkin avatar Feb 22 '23 11:02 RomanPudashkin

I think part of this PR is still needed to deal with existing scores from 4.0.0 where it is wrong (i.e. scores that already contain

    <SystemObjects>
      <Instance staffId="0" barNumbers="false"/>
      </SystemObjects>

cbjeukendrup avatar Feb 24 '23 12:02 cbjeukendrup