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

Remove score selection before initializing playback - restore it after stopping #2

Closed
wants to merge 1 commit into from
Closed
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
23 changes: 20 additions & 3 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2232,12 +2232,29 @@ void ScoreView::cmd(const char* s)
{{"mag"}, /*[](ScoreView* cv, const QByteArray&)*/ {
// ??
}},
{{"play"}, [](ScoreView* cv, const QByteArray&) {
{{"play"}, [&](ScoreView* cv, const QByteArray&) {
if (seq && seq->canStart()) {
if (cv->state == ViewState::NORMAL || cv->state == ViewState::NOTE_ENTRY)
auto cvScore = cv->score();
auto cvSel = cvScore->selection();
if (cv->state == ViewState::NORMAL || cv->state == ViewState::NOTE_ENTRY) {
if (cvSel.element() || !cvSel.elements().isEmpty()) {
originalSelection = cvScore->selection();
}
if (!cvSel.isNone()) {
cvScore->deselectAll();
}
cv->changeState(ViewState::PLAY);
else if (cv->state == ViewState::PLAY)
}
else if (cv->state == ViewState::PLAY) {
if (!cvSel.isNone()) {
cv->deselectAll();
}
bool validOriginalSelection = originalSelection.score();
if (validOriginalSelection) {
cvScore->setSelection(originalSelection);
}
cv->changeState(ViewState::NORMAL);
}
}
else
getAction("play")->setChecked(false);
Expand Down
2 changes: 2 additions & 0 deletions mscore/scoreview.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "libmscore/mscoreview.h"
#include "libmscore/pos.h"
#include "libmscore/property.h"
#include "libmscore/select.h"

namespace Ms {

Expand Down Expand Up @@ -210,6 +211,7 @@ class ScoreView : public QWidget, public MuseScoreView {
bool popupActive = false;
bool modifySelection = false;
Element* elementToSelect = nullptr;
Selection originalSelection;

// Loop In/Out marks in the score
PositionCursor* _curLoopIn;
Expand Down
Loading