Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #232931 for 2.2 - allow break shortcut on selections #3528

Merged
merged 2 commits into from
Mar 10, 2018

Conversation

MarcSabatella
Copy link
Contributor

Been meaning to do this a while now - a 2.2 port of the code I added for master last fall to allow "Enter" to toggle line breaks with selections other than just barlines. All we were doing was finding the measure for the barline and toggling the break there; it was trivial to modify the code to find try to find the measure for any single selection. For range selections, I take the last chordrest, so hitting enter on with a measure selected toggle the break on that measure. With multiple measures selected, the last measure only is toggled.

@IsaacWeiss
Copy link
Contributor

Can you also include #3250?

@MarcSabatella
Copy link
Contributor Author

Not directly, no, since there is no cmdToggleLayoutBreak() function in 2.2. We'd have to duplicate the code in palette.cpp, and I'd rather not do that.

@IsaacWeiss
Copy link
Contributor

It's only a few lines of code...

@MarcSabatella
Copy link
Contributor Author

Duplicated code is code that eventually diverges, leading to bugs and yet more inconsistencies. It's to be avoided unless necessary, and I don't see the need here.

@IsaacWeiss
Copy link
Contributor

IsaacWeiss commented Mar 9, 2018

You're choosing to cause the code to diverge and create an inconsistency, and arguing against trying to keep it in sync because it might in the future diverge and create an inconsistency?

I argued at length for the need last time. If I didn't convince you then, I don't suppose there's any point trying to now. ;-)

@MarcSabatella
Copy link
Contributor Author

MarcSabatella commented Mar 9, 2018 via email

@MarcSabatella
Copy link
Contributor Author

Somehow while I slept last night you talked me into it :-). Well, the real key for me was realizing how much better the new shortcut behavior is than the palette behavior, also not liking 2.2 and master being out of sync here (another form of undesirable code duplication).

So I will replace the commit here with another that basically copies the implementation from master, cmdToggleLayoutBreak() and all. This is the best answer for maintainability as well as functionality.

@MarcSabatella
Copy link
Contributor Author

Re-factored so now this PR and master are in sync. Only difference is in the use of static_cast versus the new toMeasure() construct.

I do notice that the code to make palette double-click call cmdToggleLayoutBreak only works on range selectins. Should really have a similar clause for list selections. I will add a second commit for that, and this commit will be good for both 2.2 and master.

@MarcSabatella
Copy link
Contributor Author

Done. The second commit can be cherry-picked for master as well. The static_cast should not be an issue; there is no toLayoutBreak() function.

@lasconic lasconic merged commit ab27065 into musescore:2.2 Mar 10, 2018
@lasconic
Copy link
Contributor

Merged in 2.2. The second commit doesn't apply cleanly on master. I will have a look to resolve the conflicts.

@lasconic
Copy link
Contributor

Merged in master in d541fbc. Please have a look.

@MarcSabatella
Copy link
Contributor Author

MarcSabatella commented Mar 10, 2018

Looks good, thanks. Weird, though, I didn't see the definition for toLayoutBreak(). Not defined with all the other similar functions, I guess. So the static cast a bit further down (the one added in #3250) should probably be fixed too. And use isLayoutBreak() there too.

@MarcSabatella
Copy link
Contributor Author

OK, I see, it's done via a macro at the bottom of scoreElement.h. I guess some elements have these defined explicitly, others by macro. Working on getting my build of master back up after all the changes last few months. Will submit PR to update use of type check & cast for master when I can.

@MarcSabatella
Copy link
Contributor Author

Looks like there's a couple of dozen or so other old-style casts and/or uses of ElementType comparisons in this file alone. Maybe better to make another pass through the code cleaning this all up in a separate PR? Anyhow, I won't worry about it for now.

@lasconic
Copy link
Contributor

Yes, don't worry. We will change them along the way.

@Jojo-Schmitz
Copy link
Contributor

See a regression that just came up today, where these breaks can no longer get applied to frames via double click (in 2.2, or even not at all in master): https://musescore.org/en/node/271450
Also the toggle seems to only work for system break, not for page- or section break, I don't think that was the intention?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants