{"action":"created","issue":{"url":"https://api.github.com/repos/musescore/MuseScore/issues/2210","labels_url":"https://api.github.com/repos/musescore/MuseScore/issues/2210/labels{/name}","comments_url":"https://api.github.com/repos/musescore/MuseScore/issues/2210/comments","events_url":"https://api.github.com/repos/musescore/MuseScore/issues/2210/events","html_url":"https://github.com/musescore/MuseScore/pull/2210","id":105089273,"number":2210,"title":"fix #76001 fix #76006 insert clef to measure","user":{"login":"ericfont","id":6502474,"avatar_url":"https://avatars.githubusercontent.com/u/6502474?v=3","gravatar_id":"","url":"https://api.github.com/users/ericfont","html_url":"https://github.com/ericfont","followers_url":"https://api.github.com/users/ericfont/followers","following_url":"https://api.github.com/users/ericfont/following{/other_user}","gists_url":"https://api.github.com/users/ericfont/gists{/gist_id}","starred_url":"https://api.github.com/users/ericfont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericfont/subscriptions","organizations_url":"https://api.github.com/users/ericfont/orgs","repos_url":"https://api.github.com/users/ericfont/repos","events_url":"https://api.github.com/users/ericfont/events{/privacy}","received_events_url":"https://api.github.com/users/ericfont/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-09-06T11:41:46Z","updated_at":"2015-09-07T10:23:43Z","closed_at":"2015-09-07T09:35:28Z","pull_request":{"url":"https://api.github.com/repos/musescore/MuseScore/pulls/2210","html_url":"https://github.com/musescore/MuseScore/pull/2210","diff_url":"https://github.com/musescore/MuseScore/pull/2210.diff","patch_url":"https://github.com/musescore/MuseScore/pull/2210.patch"},"body":"fix #76001 delete clef at start of measure before adding new clef:\r\nIf user drags a clef onto a measure, then Score::undoChangeClef will be called.  The old behavior did not remove any clef at beginning of the measure if the segment to add to was at start of measure, before actually adding the clef to the end of the previous measure.  I've fixed this case by first checking for existing clef at start of measure and deleting it before proceeding with the rest of the function which adds the new clef to end of previous measure (or modifies current one if exists).  (Note: Segment::remove(Clef*) already check to make sure clef is not a \"generated\" clef, so unnecessary for me to add that test.)\r\n\r\nfix #76006 insert clef to meas after section break will insert at meas start:\r\nPreviously, if insert clef to a measure, then clef will be inserted to end of previous measure, except for case that is start of score in which case the new clef is added to beginning of the measure.  This commit changes behavior so that if measure is at start of section, then the new clef will be inserted at beginning of measure, for same behavior as if was at beginning of score."},"comment":{"url":"https://api.github.com/repos/musescore/MuseScore/issues/comments/138263107","html_url":"https://github.com/musescore/MuseScore/pull/2210#issuecomment-138263107","issue_url":"https://api.github.com/repos/musescore/MuseScore/issues/2210","id":138263107,"user":{"login":"mgavioli","id":1420743,"avatar_url":"https://avatars.githubusercontent.com/u/1420743?v=3","gravatar_id":"","url":"https://api.github.com/users/mgavioli","html_url":"https://github.com/mgavioli","followers_url":"https://api.github.com/users/mgavioli/followers","following_url":"https://api.github.com/users/mgavioli/following{/other_user}","gists_url":"https://api.github.com/users/mgavioli/gists{/gist_id}","starred_url":"https://api.github.com/users/mgavioli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgavioli/subscriptions","organizations_url":"https://api.github.com/users/mgavioli/orgs","repos_url":"https://api.github.com/users/mgavioli/repos","events_url":"https://api.github.com/users/mgavioli/events{/privacy}","received_events_url":"https://api.github.com/users/mgavioli/received_events","type":"User","site_admin":false},"created_at":"2015-09-07T10:23:43Z","updated_at":"2015-09-07T10:23:43Z","body":"The PR has been closed but still a few remarks for completeness.\r\n\r\n- On the last measure of the system the second line on your screen shot\r\n`(meas->system() && meas != meas->system()->lastMeasure())`\r\nshould be false, not true, as `meas` is not different from the last measure of the system; so the first OR term is false.\r\n- `(clefSeg->tick() != meas->endTick())` is also false (as shown in your screen shot), as this clef is (or should be) at the end of the measure; so, the second OR term is false.\r\n- The third OR term (which is a group of ANDed terms) is also false, as `!( (meas->repeatFlags() & Repeat::END) || meas->sectionBreak() )` is false.\r\n\r\nSo, `showClef` should end up being false and the courtesy clef not shown.\r\n____________________________\r\n__However__, I made a test (using ver. 2.0.2 for easier repeatability) setting up a score as: just one Flute part, and then accepting the defaults of all other wizard pages. I get a two-system score, with the first system ending at measure 19.\r\n\r\nThen I tried placing the section break at the first measure, at the second measure, at the third measure and so on up to the 19th measure (well, I skipped some in the middle...) and adding a clef change after the section break. Results:\r\n- With section break at the first system measure, the clef change creates a courtesy clef.\r\n- With section break at the last system measure (19th), the clef change creates a courtesy clef, which forces the 19th measure to 'spill over' in a following system; the new system is made of a single measure and then the section break is again at the first system measure.\r\n- In all other cases, the clef change __does not__ create a courtesy clef.\r\n\r\nSo, it looks like the issue is connected with the section break being at the first measure system and/or at systems made of a single measure.\r\n\r\nI hope this help."}}