Skip to content

Commit

Permalink
[Toggle Command] Enable/Disable playback while editing
Browse files Browse the repository at this point in the history
  • Loading branch information
worldwideweary authored and Jojo-Schmitz committed Apr 28, 2024
1 parent cb790f9 commit 71e480d
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 1 deletion.
50 changes: 50 additions & 0 deletions mscore/data/icons/edit-playback.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mscore/icons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ static const char* iconNames[] = {
"note-dot4.svg",
"stem-flip.svg",
"mouse-entry.svg",
"edit-playback.svg",
"edit-undo.svg",
"edit-redo.svg",
"edit-cut.svg",
Expand Down
2 changes: 1 addition & 1 deletion mscore/icons.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum class Icons : short { Invalid_ICON = -1,
note32_ICON, note64_ICON, note128_ICON, note256_ICON, note512_ICON, note1024_ICON,
natural_ICON, sharp_ICON, sharpsharp_ICON, flat_ICON, flatflat_ICON,
quartrest_ICON, dot_ICON, dotdot_ICON, dot3_ICON, dot4_ICON,
flip_ICON, mouseEntry_ICON,
flip_ICON, mouseEntry_ICON, editPlayback_ICON,
undo_ICON, redo_ICON, cut_ICON, copy_ICON, paste_ICON, swap_ICON, print_ICON, clef_ICON,
midiin_ICON, speaker_ICON, start_ICON, play_ICON, repeat_ICON, pan_ICON,
sbeam_ICON, mbeam_ICON, nbeam_ICON, beam32_ICON, beam64_ICON, abeam_ICON, fbeam1_ICON, fbeam2_ICON,
Expand Down
4 changes: 4 additions & 0 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ const std::list<const char*> MuseScore::_allNoteInputMenuEntries {
"flat2",
"flip",
"toggle-mouse-entry",
"toggle-edit-playback",
"",
"voice-1",
"voice-2",
Expand Down Expand Up @@ -481,6 +482,7 @@ void MuseScore::preferencesChanged(bool fromWorkspace, bool changeUI)
getAction("midi-on")->setChecked(preferences.getBool(PREF_IO_MIDI_ENABLEINPUT));
getAction("toggle-statusbar")->setChecked(preferences.getBool(PREF_UI_APP_SHOWSTATUSBAR));
getAction("show-tours")->setChecked(preferences.getBool(PREF_UI_APP_STARTUP_SHOWTOURS));
getAction("toggle-edit-playback")->setChecked(preferences.getBool(PREF_SCORE_NOTE_PLAYONCLICK));
_statusBar->setVisible(preferences.getBool(PREF_UI_APP_SHOWSTATUSBAR));

if (!cs)
Expand Down Expand Up @@ -1336,6 +1338,8 @@ MuseScore::MuseScore()

populateNoteInputMenu();

getAction("toggle-edit-playback")->setChecked(preferences.getBool(PREF_SCORE_NOTE_PLAYONCLICK));

//-------------------------------
// Workspaces Tool Bar
//-------------------------------
Expand Down
1 change: 1 addition & 0 deletions mscore/musescore.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,6 @@
<file>data/icons/png/dockwidget-float.png</file>
<file>data/icons/png/[email protected]</file>
<file>data/icons/mouse-entry.svg</file>
<file>data/icons/edit-playback.svg</file>
</qresource>
</RCC>
5 changes: 5 additions & 0 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2866,6 +2866,11 @@ void ScoreView::cmd(const char* s)
cv->score()->endCmd();
}
}},
{{"toggle-edit-playback"}, [](ScoreView* /*cv*/, const QByteArray&) {

bool value = preferences.getBool(PREF_SCORE_NOTE_PLAYONCLICK);
preferences.setPreference(PREF_SCORE_NOTE_PLAYONCLICK, !value);
}},
};

auto c = std::find_if(cmdList.begin(), cmdList.end(), [cmd](const ScoreViewCmd& cc) {
Expand Down
11 changes: 11 additions & 0 deletions mscore/shortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,17 @@ Shortcut Shortcut::_sc[] = {
Qt::WindowShortcut,
ShortcutFlags::A_CHECKABLE
},
{
MsWidget::SCORE_TAB,
STATE_NORMAL | STATE_NOTE_ENTRY,
"toggle-edit-playback",
QT_TRANSLATE_NOOP("action","Toggle editing sound playback"),
QT_TRANSLATE_NOOP("action","Toggle editing sound playback"),
0,
Icons::editPlayback_ICON,
Qt::WindowShortcut,
ShortcutFlags::A_CHECKABLE
},
{
MsWidget::MAIN_WINDOW,
STATE_NORMAL | STATE_NOTE_ENTRY,
Expand Down

0 comments on commit 71e480d

Please sign in to comment.