-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Conversation
I guess it would make sense to use the pull request title as the commit message? |
Did I do it right? |
Looks like you ended up with four commits? @Jojo-Schmitz can probably assist. |
This exactly what you did not do. You have the issue number in the PR title, not in the commit title. Try 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 |
Oh, I misread commit for title. |
6eae851
to
642c372
Compare
OK, good, just one commit now. And we now have a shortcut that we can set, change, save. |
If I've done it right, now the shortcut should have the default of Ctrl+Alt+-, but I still have to edit cmd.cpp. |
May not be cmd.cpp. Just check how it is done for e.g. "lyrics" |
Now I'm completely lost. |
Probably. But you need a function doing that and registering that with MuseScore |
7e497a9
to
cde8e3e
Compare
d7e8b8e
to
2e2870e
Compare
Tests failing, I must have done something wrong when simplifying |
libmscore/textedit.cpp
Outdated
@@ -455,6 +456,11 @@ bool TextBase::edit(EditData& ed) | |||
} | |||
} | |||
} | |||
if (ctrlPressed && altPressed) { | |||
if (ed.key == Qt::Key_hyphen) { | |||
s = "\u203f"; // Unicode undertie |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good☺
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any updates @JLWALTENER?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
57fea60
to
f7bf5f5
Compare
The mtest failure is not your fault, by the way! See #7056. |
Looks good now. Now please squash all those commits into one using |
f7bf5f5
to
45a6040
Compare
Done. Thanks for all your help! :) |
PR is ready to be merged |
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.