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 #313195: Add Synalepha shortcut #6928

Merged
merged 1 commit into from Dec 14, 2020

Conversation

Asmatzaile
Copy link
Contributor

@Asmatzaile Asmatzaile commented Nov 24, 2020

Resolves: https://musescore.org/en/node/313195

Synalephas are common enough to have their own dedicated shortcut. As suggested by @jeetee , I added an action to the shortcut.cpp listing. I changed the textedit.cpp file.

  • I signed CLA
  • I made sure the code in the PR follows the coding rules
  • I made sure the code compiles on my machine
  • I made sure there are no unnecessary changes in the code
  • I made sure the title of the PR reflects the core meaning of the issue you are solving
  • I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
  • I made sure the commit message title starts with "fix #424242:" if there is a related issue
  • I created the test (mtest, vtest, script test) to verify the changes I made

@RobFog
Copy link

RobFog commented Nov 24, 2020

I guess it would make sense to use the pull request title as the commit message?

@Asmatzaile
Copy link
Contributor Author

I guess it would make sense to use the pull request title as the commit message?

Did I do it right?

@RobFog
Copy link

RobFog commented Nov 24, 2020

Looks like you ended up with four commits? @Jojo-Schmitz can probably assist.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 24, 2020

  • I made sure the commit message title starts with "fix #424242:"

This exactly what you did not do. You have the issue number in the PR title, not in the commit title.
And you have 4 commits rather than just one
3rd and 4th are really not needed nor wanted

Try git rebase -i HEAD~4, replace the 2nd-4th pick with just f, then git push -f

With this PR so far we have a shortcut, viaible and configurable, but not the command behind it, as far as I can tell. You need a "synalepha" command too (in cmd.cpp, IIRC) that then actually does the 'dirty work' of adding the synalepha

@Asmatzaile
Copy link
Contributor Author

  • I made sure the commit message title starts with "fix #424242:"

This exactly what you did not do. You have the issue number in the PR title, not in the commit title.
And you have 4 commits rather than just one
3rd and 4th are really not needed nor wanted

Try git rebase -i HEAD~4, replace the 2nd-4th pick with just f, then git push -f

With this PR so far we have a shortcut, but not the command behind it, as far as I can tell, you need a "synalepha" command in cmd.cpp that then actually does the dirty work of adding the synalepha

Oh, I misread commit for title.
I will try doing what you say, thanks :)

@Asmatzaile Asmatzaile force-pushed the synalepha-shortcut branch 2 times, most recently from 6eae851 to 642c372 Compare November 24, 2020 18:27
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 24, 2020

OK, good, just one commit now. And we now have a shortcut that we can set, change, save.
But still nothing happens when that shortcut actually gets used, i.e. no synalepha gets added.

@Asmatzaile
Copy link
Contributor Author

If I've done it right, now the shortcut should have the default of Ctrl+Alt+-, but I still have to edit cmd.cpp.
I don't know much of C++, so I hope to find a command that does something similar in that file.

@Jojo-Schmitz
Copy link
Contributor

May not be cmd.cpp. Just check how it is done for e.g. "lyrics"

@Asmatzaile
Copy link
Contributor Author

Now I'm completely lost.
For what I've read, I think I have to store the character in a variable like
char undertie = '‿';
and then somehow insert it

@Jojo-Schmitz
Copy link
Contributor

Probably. But you need a function doing that and registering that with MuseScore

@Asmatzaile Asmatzaile marked this pull request as draft November 24, 2020 20:40
@Asmatzaile Asmatzaile marked this pull request as ready for review November 25, 2020 18:02
@Asmatzaile
Copy link
Contributor Author

Tests failing, I must have done something wrong when simplifying

@@ -455,6 +456,11 @@ bool TextBase::edit(EditData& ed)
}
}
}
if (ctrlPressed && altPressed) {
if (ed.key == Qt::Key_hyphen) {
s = "\u203f"; // Unicode undertie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we'd better use "<sym>lyricsElision</sym>" here. This should take the SMuFL symbol from the scores's Musical Text Font (including fallback to Bravura Text if need be) rather than relying on a 'normal' text font to have that glyph (and disaplay a box with a ? if it does not)

Or even better:

      insertSym(ed, SymId::lyricsElision);
      return true;

Needs testing of course...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will test when you want, I have many scores with Elision, and if success, at least 2 issues could be fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried i.e. 'manually', i.e. hand-editing an mscx file, and it works.
But whether my code above works remains to be tested ;-)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good☺

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the last commit I changed the symbol from unicode to smufl. As I originally used unicode because flat, sharp and natural symbols were drawn from unicode, I wonder whether those symbols should be changed too.

@@ -455,6 +456,11 @@ bool TextBase::edit(EditData& ed)
}
}
}
if (ctrlPressed && altPressed) {
Copy link
Contributor

@ecstrema ecstrema Nov 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want the shortcut to be configurable, you could add a configurable shortcut in shortucut.cpp like you did in the beginning, and compare that shortcut with what's pressed here.
Same for your other PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ie in shortcut.h there is a Shortcut class, with a keys method. you could get the Shortcut for this action and compare the key sequences.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, a configurable shortcut would be nice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates @JLWALTENER?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vpereverzev It seems this PR is in Draft mode, the consensus seems to use the SMuFL symbols as preconised by @Jojo-Schmitz and I, for now the F2 palette present the SMuFL ones and the U+035C more availiable than the U+203F.
May be Asmatzaile will update his PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the PR to use the SMuFL symbol instead of the unicode one.

I think I understand how I should change the shortcut.h and shortcut.cpp files to make the shortcut configurable, but I don't know what I should write in the textedit.cpp file to let it know about those shortcuts and thus execute the action.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the SymID is mapped to the right unicode codepoint, could it be possible to have a test ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to test it. I tried compiling the code but I get an error (can't compile, install a generator) although I installed all the requirements specified on the developer's handbook

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't build, there's a missing closing brace

@RobFog
Copy link

RobFog commented Dec 9, 2020

The mtest failure is not your fault, by the way! See #7056.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Dec 10, 2020

Looks good now. Now please squash all those commits into one using git rebase -i HEAD~10, replace all but the first pick by f or fixup, then git push -f

@Asmatzaile
Copy link
Contributor Author

Asmatzaile commented Dec 10, 2020

The mtest failure is not your fault, by the way! See #7056.

Nice to know! Now that #7056 is merged the mtest failure should disappear after I squash my commits, right?

@RobFog
Copy link

RobFog commented Dec 10, 2020

The mtest failure is not your fault, by the way! See #7056.

Nice to know! Now that #7056 is merged the mtest failure should disappear after I squash my commits, right?

You should rebase. Then it should disappear.

@Asmatzaile
Copy link
Contributor Author

Looks good now. Now please squash all those commits into one using git rebase -i HEAD~10, replace all but the first pick by f or fixup, then git push -f

Done. Thanks for all your help! :)

@Asmatzaile
Copy link
Contributor Author

PR is ready to be merged

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.

None yet

6 participants