Skip to content

[MU4] Fix #9995: Double/halve note duration skips values in note entry mode #10668

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/framework/shortcuts/data/shortcuts-Mac.xml
Original file line number Diff line number Diff line change
Expand Up @@ -997,14 +997,6 @@
<seq>Shift+0</seq>
<seq>NumPad+0</seq>
</SC>
<SC>
<key>pad-note-increase-TAB</key>
<seq>W</seq>
</SC>
<SC>
<key>pad-note-decrease-TAB</key>
<seq>Q</seq>
</SC>
<SC>
<key>rest-TAB</key>
<seq>;</seq>
Expand Down
8 changes: 0 additions & 8 deletions src/framework/shortcuts/data/shortcuts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1021,14 +1021,6 @@
<seq>Shift+0</seq>
<seq>NumPad+0</seq>
</SC>
<SC>
<key>pad-note-increase-TAB</key>
<seq>W</seq>
</SC>
<SC>
<key>pad-note-decrease-TAB</key>
<seq>Q</seq>
</SC>
<SC>
<key>rest-TAB</key>
<seq>;</seq>
Expand Down
8 changes: 0 additions & 8 deletions src/framework/shortcuts/data/shortcuts_AZERTY.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1019,14 +1019,6 @@
<seq>0</seq> <!-- AZERTY for Shift+0 -->
<seq>NumPad+0</seq>
</SC>
<SC>
<key>pad-note-increase-TAB</key>
<seq>W</seq>
</SC>
<SC>
<key>pad-note-decrease-TAB</key>
<seq>Q</seq>
</SC>
<SC>
<key>rest-TAB</key>
<seq>;</seq>
Expand Down
1 change: 1 addition & 0 deletions src/notation/inotationnoteinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class INotationNoteInput
virtual void setArticulation(SymbolId articulationSymbolId) = 0;
virtual void setDrumNote(int note) = 0;
virtual void addTuplet(const TupletOptions& options) = 0;

virtual void doubleNoteInputDuration() = 0;
virtual void halveNoteInputDuration() = 0;

Expand Down
36 changes: 26 additions & 10 deletions src/notation/internal/notationactioncontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ void NotationActionController::init()
registerAction("pitch-down-octave", &Controller::move, MoveDirection::Down, true);
registerAction("up-chord", [this]() { moveWithinChord(MoveDirection::Up); }, &Controller::hasSelection);
registerAction("down-chord", [this]() { moveWithinChord(MoveDirection::Down); }, &Controller::hasSelection);
registerAction("double-duration", &Interaction::increaseDecreaseDuration, -1, false);
registerAction("half-duration", &Interaction::increaseDecreaseDuration, 1, false);

registerAction("double-duration", &Controller::doubleNoteInputDuration);
registerAction("half-duration", &Controller::halveNoteInputDuration);
registerAction("inc-duration-dotted", &Interaction::increaseDecreaseDuration, -1, true);
registerAction("dec-duration-dotted", &Interaction::increaseDecreaseDuration, 1, true);

Expand Down Expand Up @@ -398,10 +399,7 @@ void NotationActionController::init()
registerAction("transpose-up", &Interaction::transposeSemitone, 1, PlayMode::PlayNote);
registerAction("transpose-down", &Interaction::transposeSemitone, -1, PlayMode::PlayNote);
registerAction("toggle-insert-mode", &Interaction::toggleGlobalOrLocalInsert);
registerAction("pad-note-decrease", &Controller::halveNoteInputDuration, &Controller::isNoteInputMode);
registerAction("pad-note-increase", &Controller::doubleNoteInputDuration, &Controller::isNoteInputMode);
registerAction("pad-note-decrease-TAB", &Controller::halveNoteInputDuration, &Controller::isNoteInputMode);
registerAction("pad-note-increase-TAB", &Controller::doubleNoteInputDuration, &Controller::isNoteInputMode);

registerAction("get-location", &Interaction::getLocation, &Controller::isNotationPage);
registerAction("toggle-mmrest", &Interaction::execute, &Ms::Score::cmdToggleMmrest);
registerAction("toggle-hide-empty", &Interaction::execute, &Ms::Score::cmdToggleHideEmpty);
Expand Down Expand Up @@ -777,18 +775,36 @@ void NotationActionController::putTuplet(int tupletCount)
void NotationActionController::doubleNoteInputDuration()
{
TRACEFUNC;
auto noteInput = currentNotationNoteInput();
if (noteInput) {

INotationInteractionPtr interaction = currentNotationInteraction();
if (!interaction) {
return;
}

INotationNoteInputPtr noteInput = interaction->noteInput();

if (noteInput->isNoteInputMode()) {
noteInput->doubleNoteInputDuration();
} else {
interaction->increaseDecreaseDuration(-1, false);
}
}

void NotationActionController::halveNoteInputDuration()
{
TRACEFUNC;
auto noteInput = currentNotationNoteInput();
if (noteInput) {

INotationInteractionPtr interaction = currentNotationInteraction();
if (!interaction) {
return;
}

INotationNoteInputPtr noteInput = interaction->noteInput();

if (noteInput->isNoteInputMode()) {
noteInput->halveNoteInputDuration();
} else {
interaction->increaseDecreaseDuration(1, false);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/notation/internal/notationnoteinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,11 @@ void NotationNoteInput::doubleNoteInputDuration()
TRACEFUNC;

Ms::EditData editData(m_scoreCallbacks);

startEdit();
score()->cmdPadNoteIncreaseTAB(editData);
apply();

notifyAboutStateChanged();
}

Expand All @@ -531,6 +535,10 @@ void NotationNoteInput::halveNoteInputDuration()
TRACEFUNC;

Ms::EditData editData(m_scoreCallbacks);

startEdit();
score()->cmdPadNoteDecreaseTAB(editData);
apply();

notifyAboutStateChanged();
}
2 changes: 2 additions & 0 deletions src/notation/internal/notationnoteinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ class NotationNoteInput : public INotationNoteInput, public async::Asyncable
void addSlur(Ms::Slur* slur) override;
void resetSlur() override;
void addTie() override;

void doubleNoteInputDuration() override;
void halveNoteInputDuration() override;

void setCurrentVoiceIndex(int voiceIndex) override;

void resetInputPosition() override;
Expand Down
22 changes: 3 additions & 19 deletions src/notation/internal/notationuiactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ const UiActionList NotationUiActions::m_actions = {
),
UiAction("half-duration",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Half duration")
QT_TRANSLATE_NOOP("action", "Halve duration")
),
UiAction("inc-duration-dotted",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Increase duration dotted")
QT_TRANSLATE_NOOP("action", "Double selected duration (dotted)")
),
UiAction("dec-duration-dotted",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Decrease duration dotted")
QT_TRANSLATE_NOOP("action", "Halve selected duration (dotted)")
),
UiAction("notation-cut",
mu::context::UiCtxNotationOpened,
Expand Down Expand Up @@ -1675,22 +1675,6 @@ const UiActionList NotationUiActions::m_noteInputActions = {
QT_TRANSLATE_NOOP("action", "Note input: rest"),
IconCode::Code::REST
),
UiAction("pad-note-increase",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Note input: double duration")
),
UiAction("pad-note-decrease",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Note input: halve duration")
),
UiAction("pad-note-increase-TAB",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Note input: double duration (TAB)")
),
UiAction("pad-note-decrease-TAB",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Note input: halve duration (TAB)")
),
UiAction("next-segment-element",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Accessibility: Next segment element")
Expand Down