From dae6d6ebff2df4b4308af031576041872bdeefd7 Mon Sep 17 00:00:00 2001 From: Roman Pudashkin Date: Tue, 13 Dec 2022 17:29:09 +0200 Subject: [PATCH] fix #13403 --- .../internal/notationactioncontroller.cpp | 17 ++++++++++++++++- .../internal/notationactioncontroller.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/notation/internal/notationactioncontroller.cpp b/src/notation/internal/notationactioncontroller.cpp index 5b30bded01..8f6d92f8d4 100644 --- a/src/notation/internal/notationactioncontroller.cpp +++ b/src/notation/internal/notationactioncontroller.cpp @@ -474,7 +474,7 @@ void NotationActionController::init() registerTabPadNoteAction("pad-note-1024-TAB", Pad::NOTE1024); for (int i = 0; i < MAX_FRET; ++i) { - registerAction("fret-" + std::to_string(i), &Interaction::addFret, i, &Controller::isTablatureStaff); + registerAction("fret-" + std::to_string(i), [i, this]() { addFret(i); }, &Controller::isTablatureStaff); } // listen on state changes @@ -1140,6 +1140,17 @@ void NotationActionController::addSlur() } } +void NotationActionController::addFret(int num) +{ + auto interaction = currentNotationInteraction(); + if (!interaction) { + return; + } + + interaction->addFret(num); + playSelectedElement(currentNotationElements()->msScore()->playChord()); +} + IInteractive::Result NotationActionController::showErrorMessage(const std::string& message) const { return interactive()->info(message, @@ -1843,6 +1854,10 @@ void NotationActionController::playSelectedElement(bool playChord) } playbackController()->playElements({ element }); + + mu::engraving::Score* score = currentNotationElements()->msScore(); + score->setPlayChord(false); + score->setPlayNote(false); } void NotationActionController::startNoteInputIfNeed() diff --git a/src/notation/internal/notationactioncontroller.h b/src/notation/internal/notationactioncontroller.h index f570a817dc..d6b3e64709 100644 --- a/src/notation/internal/notationactioncontroller.h +++ b/src/notation/internal/notationactioncontroller.h @@ -108,6 +108,7 @@ private: void addTie(); void chordTie(); void addSlur(); + void addFret(int num); framework::IInteractive::Result showErrorMessage(const std::string& message) const;