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

[MU4] fix #68431: Extra Default Zoom Preferences #5623

Closed
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
1 change: 1 addition & 0 deletions framework/preferencekeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions mscore/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand Down
8 changes: 8 additions & 0 deletions mscore/preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

//---------------------------------------------------------
Expand Down
13 changes: 13 additions & 0 deletions mscore/prefsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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>(zoomType->currentIndex()) != ZoomType::PERCENTAGE ? scale->setEnabled(false) : scale->setEnabled(true);
}

//---------------------------------------------------------
// selectStartWith
//---------------------------------------------------------
Expand Down Expand Up @@ -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());
Expand Down
1 change: 1 addition & 0 deletions mscore/prefsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private slots:
void selectPluginsDirectory();
void selectImagesDirectory();
void selectExtensionsDirectory();
void selectZoomType();
void printShortcutsClicked();
void filterShortcutsTextChanged(const QString&);
void filterAdvancedPreferences(const QString&);
Expand Down
71 changes: 53 additions & 18 deletions mscore/prefsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2429,8 +2429,24 @@
<string>View</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="1">
<item row="0" column="3">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QDoubleSpinBox" name="scale">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Default scale for new score views</string>
</property>
Expand Down Expand Up @@ -2460,31 +2476,51 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="showMidiControls">
<property name="text">
<string>Show MIDI controls in mixer</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_48">
<property name="text">
<string>Default zoom:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<item row="0" column="1">
<widget class="QComboBox" name="zoomType">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="showMidiControls">
<property name="text">
<string>Show MIDI controls in mixer</string>
<property name="currentIndex">
<number>3</number>
</property>
<item>
<property name="text">
<string>Page Width</string>
</property>
</item>
<item>
<property name="text">
<string>Whole Page</string>
</property>
</item>
<item>
<property name="text">
<string>Two Pages</string>
</property>
</item>
<item>
<property name="text">
<string>Percentage</string>
</property>
</item>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -4456,7 +4492,6 @@ Adjusting latency can help synchronize your MIDI hardware with MuseScore's inter
</tabstops>
<resources>
<include location="musescore.qrc"/>
<include location="musescore.qrc"/>
</resources>
<connections>
<connection>
Expand Down
21 changes: 20 additions & 1 deletion mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ZoomType>(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;
Expand Down
3 changes: 3 additions & 0 deletions mtest/testscript/scripts/ux_replace_slurs_on_copy.script
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down