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

avoid dots for notes which may result in 256th notes/rests or shorter #544

Merged
merged 1 commit into from Mar 9, 2015

Conversation

AntonioBL
Copy link
Contributor

This is just a tentative implementation to avoid problems such as:
http://musescore.org/node/23473
http://musescore.org/en/node/9077
I don't know if there may be other possible extreme cases in which these short-notes-problems may arise.

@lasconic
Copy link
Contributor

What about disabling the dot and dotdot buttons (and actions) when a short note is selected instead?

@AntonioBL
Copy link
Contributor Author

Well... That's what I first wanted to do, but I couldn't find the right place where to disable the button.
After this PR, I tried a couple of experiments, but the results are not 100% satisfactory. The one that seems to work best is to replace lines 308 e 309 of mscore\keyb.cpp

      getAction("pad-dot")->setChecked(is.duration().dots() == 1);
      getAction("pad-dotdot")->setChecked(is.duration().dots() == 2);

with:

      if (is.duration() == TDuration::V_128TH) {
            getAction("pad-dot")->setChecked(false);
            getAction("pad-dot")->setEnabled(false);
            getAction("pad-dotdot")->setChecked(false);
            getAction("pad-dotdot")->setEnabled(false);
            }
      else if (is.duration() == TDuration::V_64TH) {
            getAction("pad-dotdot")->setChecked(false);
            getAction("pad-dotdot")->setEnabled(false);
            getAction("pad-dot")->setEnabled(true);
            getAction("pad-dot")->setChecked(is.duration().dots() == 1);
            }
      else {
            getAction("pad-dot")->setEnabled(true);
            getAction("pad-dotdot")->setEnabled(true);
            getAction("pad-dot")->setChecked(is.duration().dots() == 1);
            getAction("pad-dotdot")->setChecked(is.duration().dots() == 2);
            }

That is not a really elegant implementation, maybe the code can be written better.
Moreover, when a 128th (or 64th) note/rest is already present in the score, if it is selected before entering note-entry mode, the buttons become enabled (but not checked): clicking over them disables them [without checking them and therefore without creating a dotted 128th: that's the purpose of the setChecked(false) ].
I didn't check too much these lines of code: I don't know if there may be collateral strange effects.
Do you think it's worth a pull request for this code?

@AntonioBL
Copy link
Contributor Author

Just to precede @Jojo-Schmitz in asking: should be PR be closed? :-)
Did you try the alternative implementation proposed in the comment? Do you think it would be worth a PR by its own?
Ciao,
ABL

@Jojo-Schmitz
Copy link
Contributor

:-)

@AntonioBL
Copy link
Contributor Author

Updated and rebased the PR. It now seems to work as expected (i.e. it disables double dot for 1/64 and 1/128 notes and dot for 1/128 notes).

lasconic added a commit that referenced this pull request Mar 9, 2015
avoid dots for notes which may result in 256th notes/rests or shorter
@lasconic lasconic merged commit 1af29ba into musescore:master Mar 9, 2015
@lasconic
Copy link
Contributor

I merged but it doesn't work I expected. See http://musescore.org/en/node/50386
I'll revert.

Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 12, 2015
@AntonioBL AntonioBL deleted the dots_256th branch March 31, 2015 07:36
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Apr 16, 2015
lasconic pushed a commit that referenced this pull request Apr 16, 2015
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

3 participants