diff --git a/framework/preferencekeys.h b/framework/preferencekeys.h index 29b551a5a3c8c..1320e069171f0 100644 --- a/framework/preferencekeys.h +++ b/framework/preferencekeys.h @@ -104,6 +104,7 @@ #define PREF_SCORE_HARMONY_PLAY "score/harmony/play" #define PREF_SCORE_HARMONY_PLAY_ONEDIT "score/harmony/play/onedit" #define PREF_SCORE_MAGNIFICATION "score/magnification" +#define PREF_SCORE_ZOOM_TYPE "score/zoomType" #define PREF_SCORE_NOTE_PLAYONCLICK "score/note/playOnClick" #define PREF_SCORE_NOTE_DEFAULTPLAYDURATION "score/note/defaultPlayDuration" #define PREF_SCORE_NOTE_WARNPITCHRANGE "score/note/warnPitchRange" diff --git a/mscore/preferences.cpp b/mscore/preferences.cpp index 2c8b4192ff4b9..9afc161ba7d7c 100644 --- a/mscore/preferences.cpp +++ b/mscore/preferences.cpp @@ -201,6 +201,7 @@ void Preferences::init(bool storeInMemoryOnly) { PREF_SCORE_HARMONY_PLAY, new BoolPreference(false, false) }, { PREF_SCORE_HARMONY_PLAY_ONEDIT, new BoolPreference(true, false) }, { PREF_SCORE_MAGNIFICATION, new DoublePreference(1.0, false) }, + { PREF_SCORE_ZOOM_TYPE, new IntPreference(0, false) }, { PREF_SCORE_NOTE_PLAYONCLICK, new BoolPreference(true, false) }, { PREF_SCORE_NOTE_DEFAULTPLAYDURATION, new IntPreference(300 /* ms */, false) }, { PREF_SCORE_NOTE_WARNPITCHRANGE, new BoolPreference(true, false) }, diff --git a/mscore/preferences.h b/mscore/preferences.h index 8259c8ac6c681..72c75713cc165 100644 --- a/mscore/preferences.h +++ b/mscore/preferences.h @@ -73,6 +73,14 @@ enum class MusicxmlExportBreaks : char { ALL, MANUAL, NO }; +// Default zoom options in score preferences +enum class ZoomType : int { + PAGE_WIDTH = 0, + WHOLE_PAGE, + DOUBLE_PAGE, + PERCENTAGE +}; + class PreferenceVisitor; //--------------------------------------------------------- diff --git a/mscore/prefsdialog.cpp b/mscore/prefsdialog.cpp index 259a9e27cbaa7..dd8c5436c6484 100644 --- a/mscore/prefsdialog.cpp +++ b/mscore/prefsdialog.cpp @@ -196,6 +196,7 @@ PreferenceDialog::PreferenceDialog(QWidget* parent) connect(resetToDefault, &QToolButton::clicked, this, &PreferenceDialog::resetAllValues); connect(filterShortcuts, &QLineEdit::textChanged, this, &PreferenceDialog::filterShortcutsTextChanged); connect(printShortcuts, &QToolButton::clicked, this, &PreferenceDialog::printShortcutsClicked); + connect(zoomType, &QComboBox::currentTextChanged, this, &PreferenceDialog::selectZoomType); recordButtons = new QButtonGroup(this); recordButtons->setExclusive(false); @@ -557,6 +558,7 @@ void PreferenceDialog::updateValues(bool useDefaultValues) // score settings // scale->setValue(preferences.getDouble(PREF_SCORE_MAGNIFICATION) * 100.0); + zoomType->setCurrentIndex(preferences.getInt(PREF_SCORE_ZOOM_TYPE)); showMidiControls->setChecked(preferences.getBool(PREF_IO_MIDI_SHOWCONTROLSINMIXER)); defaultPlayDuration->setValue(preferences.getInt(PREF_SCORE_NOTE_DEFAULTPLAYDURATION)); @@ -919,6 +921,16 @@ void PreferenceDialog::selectInstrumentList2() } } +//--------------------------------------------------------- +// selectZoomType +//--------------------------------------------------------- + +void PreferenceDialog::selectZoomType() +{ + // Only enable editing of [zoom-percentage spinner widget] if [Percentage] is selected + static_cast(zoomType->currentIndex()) != ZoomType::PERCENTAGE ? scale->setEnabled(false) : scale->setEnabled(true); +} + //--------------------------------------------------------- // selectStartWith //--------------------------------------------------------- @@ -1204,6 +1216,7 @@ void PreferenceDialog::apply() preferences.setPreference(PREF_UI_APP_LANGUAGE, l); preferences.setPreference(PREF_SCORE_MAGNIFICATION, scale->value() / 100.0); + preferences.setPreference(PREF_SCORE_ZOOM_TYPE, zoomType->currentIndex()); if (showMidiControls->isChecked() != preferences.getBool(PREF_IO_MIDI_SHOWCONTROLSINMIXER)) { preferences.setPreference(PREF_IO_MIDI_SHOWCONTROLSINMIXER, showMidiControls->isChecked()); diff --git a/mscore/prefsdialog.h b/mscore/prefsdialog.h index 6d14a00b96650..9bb746e1c50ca 100644 --- a/mscore/prefsdialog.h +++ b/mscore/prefsdialog.h @@ -76,6 +76,7 @@ private slots: void selectPluginsDirectory(); void selectImagesDirectory(); void selectExtensionsDirectory(); + void selectZoomType(); void printShortcutsClicked(); void filterShortcutsTextChanged(const QString&); void filterAdvancedPreferences(const QString&); diff --git a/mscore/prefsdialog.ui b/mscore/prefsdialog.ui index d8a518ed69aaa..a6a2aa162ae3c 100644 --- a/mscore/prefsdialog.ui +++ b/mscore/prefsdialog.ui @@ -2429,8 +2429,24 @@ View - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + true + Default scale for new score views @@ -2460,6 +2476,13 @@ + + + + Show MIDI controls in mixer + + + @@ -2467,24 +2490,37 @@ - - - - Qt::Horizontal - - - - 40 - 20 - + + + + + 0 + 0 + - - - - - - Show MIDI controls in mixer + + 3 + + + Page Width + + + + + Whole Page + + + + + Two Pages + + + + + Percentage + + @@ -4456,7 +4492,6 @@ Adjusting latency can help synchronize your MIDI hardware with MuseScore's inter - diff --git a/mscore/scoreview.cpp b/mscore/scoreview.cpp index f3fe9ce8b6fae..4e0e0b1d5ccb4 100644 --- a/mscore/scoreview.cpp +++ b/mscore/scoreview.cpp @@ -140,7 +140,26 @@ ScoreView::ScoreView(QWidget* parent) double mag = preferences.getDouble(PREF_SCORE_MAGNIFICATION) * (mscore->physicalDotsPerInch() / DPI); _matrix = QTransform(mag, 0.0, 0.0, mag, 0.0, 0.0); imatrix = _matrix.inverted(); - _magIdx = preferences.getDouble(PREF_SCORE_MAGNIFICATION) == 1.0 ? MagIdx::MAG_100 : MagIdx::MAG_FREE; + + switch (static_cast(preferences.getInt(PREF_SCORE_ZOOM_TYPE))) { + // The following cases correspond to zoomType's index value within prefsdialog.ui, + // wherein lies zoomType's translatable strings + case ZoomType::WHOLE_PAGE: + _magIdx = MagIdx::MAG_PAGE; + break; + case ZoomType::DOUBLE_PAGE: + _magIdx = MagIdx::MAG_DBL_PAGE; + break; + case ZoomType::PERCENTAGE: + _magIdx = preferences.getDouble(PREF_SCORE_MAGNIFICATION) == 1.0 ? MagIdx::MAG_100 : MagIdx::MAG_FREE; + break; + case ZoomType::PAGE_WIDTH: + Q_FALLTHROUGH(); + default: + _magIdx = MagIdx::MAG_PAGE_WIDTH; + break; + } + focusFrame = 0; _bgColor = Qt::darkBlue; _fgColor = Qt::white; diff --git a/mtest/testscript/scripts/ux_replace_slurs_on_copy.script b/mtest/testscript/scripts/ux_replace_slurs_on_copy.script index 076ef3cb79575..6f2520dddc6ca 100644 --- a/mtest/testscript/scripts/ux_replace_slurs_on_copy.script +++ b/mtest/testscript/scripts/ux_replace_slurs_on_copy.script @@ -14,6 +14,9 @@ cmd note-c cmd note-d cmd escape cmd del-empty-measures +cmd note-input +cmd escape +cmd prev-measure cmd prev-measure cmd note-input cmd escape