LCOV - code coverage report
Current view: top level - src/notationscene/widgets - editstyle.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 1571 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #include "editstyle.h"
      24              : 
      25              : #include <QAnyStringView>
      26              : #include <QButtonGroup>
      27              : #include <QQmlContext>
      28              : #include <QQuickItem>
      29              : #include <QQuickView>
      30              : #include <QSignalMapper>
      31              : #include <QStringBuilder>
      32              : #include <QStringLiteral>
      33              : 
      34              : #include "translation.h"
      35              : #include "types/translatablestring.h"
      36              : 
      37              : #include "alignSelect.h"
      38              : #include "colorlabel.h"
      39              : #include "fontStyleSelect.h"
      40              : #include "offsetSelect.h"
      41              : 
      42              : #include "engraving/dom/figuredbass.h"
      43              : #include "engraving/dom/masterscore.h"
      44              : #include "engraving/dom/stafftype.h"
      45              : #include "engraving/style/textstyle.h"
      46              : #include "engraving/types/symnames.h"
      47              : #include "engraving/types/types.h"
      48              : #include "engraving/types/typesconv.h"
      49              : 
      50              : #include "notation/inotation.h"
      51              : #include "notation/inotationelements.h" // IWYU pragma: keep
      52              : #include "notation/inotationstyle.h" // IWYU pragma: keep
      53              : #include "notation/inotationundostack.h" // IWYU pragma: keep
      54              : #include "notation/inotationviewstate.h" // IWYU pragma: keep
      55              : #include "notation/utilities/offsetutilities.h"
      56              : 
      57              : #include "ui/view/widgetstatestore.h"
      58              : #include "ui/view/widgetutils.h"
      59              : 
      60              : #include "defer.h"
      61              : #include "log.h"
      62              : 
      63              : using namespace mu;
      64              : using namespace mu::notation;
      65              : using namespace mu::engraving;
      66              : using namespace muse::ui;
      67              : 
      68              : static const QStringList ALL_PAGE_CODES {
      69              :     "score",
      70              :     "spacing",
      71              :     "sizes",
      72              :     "header-and-footer",
      73              :     "measure-number",
      74              :     "system",
      75              :     "instrument-names",
      76              :     "stave-sharing",
      77              :     "clefs-key-and-time-signatures",
      78              :     "accidentals",
      79              :     "barlines",
      80              :     "notes",
      81              :     "rests",
      82              :     "repeats",
      83              :     "beams",
      84              :     "tuplets",
      85              :     "arpeggios",
      86              :     "chord-brackets",
      87              :     "slurs-and-ties",
      88              :     "dynamics-hairpins",
      89              :     "volta",
      90              :     "ottava",
      91              :     "pedal",
      92              :     "trill",
      93              :     "vibrato",
      94              :     "glissando-note-line",
      95              :     "bend",
      96              :     "text-line",
      97              :     "system-text-line",
      98              :     "articulations-and-ornaments",
      99              :     "hammer-ons-pull-offs-and-tapping",
     100              :     "fermatas",
     101              :     "staff-text",
     102              :     "tempo-text",
     103              :     "lyrics",
     104              :     "expression",
     105              :     "rehearsal-marks",
     106              :     "figured-bass",
     107              :     "chord-symbols",
     108              :     "fretboard-diagrams",
     109              :     "tablature-styles",
     110              :     "text-styles"
     111              : };
     112              : 
     113              : static const QStringList ALL_TEXT_STYLE_SUBPAGE_CODES {
     114              :     "title",
     115              :     "subtitle",
     116              :     "composer",
     117              :     "poet",
     118              :     "translator",
     119              :     "frame",
     120              :     "instrument-name-part",
     121              :     "instrument-name-long",
     122              :     "instrument-name-short",
     123              :     "instrument-change",
     124              :     "group-bracket",
     125              :     "header",
     126              :     "footer",
     127              :     "copyright",
     128              :     "page-number",
     129              :     "measure-number",
     130              :     "measure-number-alternate",
     131              :     "multimeasure-rest-range",
     132              :     "tempo",
     133              :     "tempo-change",
     134              :     "metronome",
     135              :     "repeat-play-count",
     136              :     "repeat-text-left",
     137              :     "repeat-text-right",
     138              :     "rehearsal-mark",
     139              :     "system",
     140              :     "staff",
     141              :     "stave-sharing",
     142              :     "expression",
     143              :     "hairpin",
     144              :     "lyrics-odd-lines",
     145              :     "lyrics-even-lines",
     146              :     "chord-symbols",
     147              :     "chord-symbols-alternate",
     148              :     "roman-numeral-analysis",
     149              :     "nashville-number",
     150              :     "tuplet",
     151              :     "articulation",
     152              :     "sticking",
     153              :     "fingering",
     154              :     "tab-fret-number",
     155              :     "lh-guitar-fingering",
     156              :     "rh-guitar-fingering",
     157              :     "hammer-ons-pull-offs-and-tapping",
     158              :     "string-number",
     159              :     "string-tunings",
     160              :     "fretboard-diagram-fingering",
     161              :     "fretboard-diagram-fret-number",
     162              :     "harp-pedal-diagram",
     163              :     "harp-pedal-text-diagram",
     164              :     "text-line",
     165              :     "system-text-line",
     166              :     "note-line",
     167              :     "volta",
     168              :     "ottava",
     169              :     "glissando",
     170              :     "pedal",
     171              :     "bend",
     172              :     "let-ring",
     173              :     "whammy-bar",
     174              :     "palm-mute",
     175              :     "user1",
     176              :     "user2",
     177              :     "user3",
     178              :     "user4",
     179              :     "user5",
     180              :     "user6",
     181              :     "user7",
     182              :     "user8",
     183              :     "user9",
     184              :     "user10",
     185              :     "user11",
     186              :     "user12"
     187              : };
     188              : 
     189              : class EditStyle::LineStyleSelect : public QObject
     190              : {
     191              : public:
     192            0 :     LineStyleSelect(QObject* parent, QComboBox* lineStyleComboBox, const QList<QWidget*>& dashSpecificWidgets)
     193            0 :         : QObject(parent), lineStyleComboBox(lineStyleComboBox), dashSpecificWidgets(dashSpecificWidgets)
     194              :     {
     195            0 :         connect(lineStyleComboBox, &QComboBox::currentIndexChanged, this, &LineStyleSelect::update);
     196            0 :     }
     197              : 
     198            0 :     void update() const
     199              :     {
     200            0 :         bool isDash = lineStyleComboBox->currentIndex() == int(LineType::DASHED);
     201              : 
     202            0 :         for (QWidget* w : dashSpecificWidgets) {
     203            0 :             w->setVisible(isDash);
     204              :         }
     205            0 :     }
     206              : 
     207              :     QComboBox* lineStyleComboBox = nullptr;
     208              :     QList<QWidget*> dashSpecificWidgets;
     209              : };
     210              : 
     211              : static const muse::TranslatableString lineStyles[] = {
     212              :     //: line style
     213              :     muse::TranslatableString("notation/editstyle", "Continuous"),
     214              :     //: line style
     215              :     muse::TranslatableString("notation/editstyle", "Dashed"),
     216              :     //: line style
     217              :     muse::TranslatableString("notation/editstyle", "Dotted"),
     218              : };
     219              : 
     220            0 : static void fillDirectionComboBox(QComboBox* comboBox)
     221              : {
     222            0 :     comboBox->clear();
     223            0 :     comboBox->addItem(TConv::translatedUserName(DirectionV::AUTO), static_cast<int>(DirectionV::AUTO));
     224            0 :     comboBox->addItem(TConv::translatedUserName(DirectionV::UP),   static_cast<int>(DirectionV::UP));
     225            0 :     comboBox->addItem(TConv::translatedUserName(DirectionV::DOWN), static_cast<int>(DirectionV::DOWN));
     226            0 : }
     227              : 
     228            0 : static void fillDynamicHairpinComboBox(QComboBox* comboBox)
     229              : {
     230            0 :     comboBox->clear();
     231            0 :     comboBox->addItem(muse::qtrc("notation/editstyle", "Based on voice"), int(DirectionV::AUTO));
     232            0 :     comboBox->addItem(muse::qtrc("notation/editstyle", "Above"), int(DirectionV::UP));
     233            0 :     comboBox->addItem(muse::qtrc("notation/editstyle", "Below"), int(DirectionV::DOWN));
     234            0 : }
     235              : 
     236              : //---------------------------------------------------------
     237              : //   EditStyle
     238              : //---------------------------------------------------------
     239              : 
     240            0 : EditStyle::EditStyle(QWidget* parent)
     241            0 :     : muse::ui::WidgetDialog(parent)
     242              : {
     243            0 : }
     244              : 
     245            0 : void EditStyle::classBegin()
     246              : {
     247              :     //! NOTE: suppress all accessibility events causing a long delay when opening the dialog (massive spam from setupUi)
     248            0 :     accessibilityController()->setIgnoreQtAccessibilityEvents(true);
     249            0 :     DEFER {
     250            0 :         accessibilityController()->setIgnoreQtAccessibilityEvents(false);
     251            0 :     };
     252              : 
     253            0 :     setObjectName("EditStyle");
     254            0 :     setupUi(this);
     255            0 :     setWindowFlag(Qt::WindowContextHelpButtonHint, false);
     256            0 :     setModal(true);
     257              : 
     258            0 :     buttonApplyToAllParts = buttonBox->addButton(muse::qtrc("notation/editstyle", "Apply to all parts"), QDialogButtonBox::ApplyRole);
     259            0 :     WidgetUtils::setWidgetIcon(buttonTogglePagelist, IconCode::Code::ARROW_RIGHT);
     260              : 
     261              :     // ====================================================
     262              :     // Button Groups
     263              :     // ====================================================
     264              : 
     265              :     // create button groups for every set of radio button widgets
     266              :     // use this group widgets in list styleWidgets
     267              :     // This works for groups which represent an int enumeration.
     268              : 
     269            0 :     QButtonGroup* ksbl = new QButtonGroup(this);
     270            0 :     ksbl->addButton(radioKeySigCourtesyBarlineAlwaysSingle, int(CourtesyBarlineMode::ALWAYS_SINGLE));
     271            0 :     ksbl->addButton(radioKeySigCourtesyBarlineAlwaysDouble, int(CourtesyBarlineMode::ALWAYS_DOUBLE));
     272            0 :     ksbl->addButton(radioKeySigCourtesyBarlineDoubleBeforeNewSystem, int(CourtesyBarlineMode::DOUBLE_BEFORE_COURTESY));
     273              : 
     274            0 :     QButtonGroup* tsbl = new QButtonGroup(this);
     275            0 :     tsbl->addButton(radioTimeSigCourtesyBarlineAlwaysSingle, int(CourtesyBarlineMode::ALWAYS_SINGLE));
     276            0 :     tsbl->addButton(radioTimeSigCourtesyBarlineAlwaysDouble, int(CourtesyBarlineMode::ALWAYS_DOUBLE));
     277            0 :     tsbl->addButton(radioTimeSigCourtesyBarlineDoubleBeforeNewSystem, int(CourtesyBarlineMode::DOUBLE_BEFORE_COURTESY));
     278              : 
     279            0 :     QButtonGroup* fbAlign = new QButtonGroup(this);
     280            0 :     fbAlign->addButton(radioFBTop, 0);
     281            0 :     fbAlign->addButton(radioFBBottom, 1);
     282              : 
     283            0 :     QButtonGroup* fbStyle = new QButtonGroup(this);
     284            0 :     fbStyle->addButton(radioFBModern, 0);
     285            0 :     fbStyle->addButton(radioFBHistoric, 1);
     286              : 
     287            0 :     QButtonGroup* articulationStemSide = new QButtonGroup(this);
     288            0 :     articulationStemSide->addButton(radioArticAlignStem, int(ArticulationStemSideAlign::STEM));
     289            0 :     articulationStemSide->addButton(radioArticAlignNoteHead, int(ArticulationStemSideAlign::NOTEHEAD));
     290            0 :     articulationStemSide->addButton(radioArticAlignCenter, int(ArticulationStemSideAlign::AVERAGE));
     291              : 
     292            0 :     QButtonGroup* articulationKeepTogether = new QButtonGroup(this);
     293            0 :     articulationKeepTogether->addButton(radioArticKeepTogether, 1);
     294            0 :     articulationKeepTogether->addButton(radioArticAllowSeparate, 0);
     295              : 
     296            0 :     QButtonGroup* trillAlwaysShowCueNote = new QButtonGroup(this);
     297            0 :     trillAlwaysShowCueNote->addButton(ornamentShowCueNoteAlways, 1);
     298            0 :     trillAlwaysShowCueNote->addButton(ornamentShowCueNoteOnlyNonSeconds, 0);
     299              : 
     300            0 :     QButtonGroup* tabShowTiedFrets = new QButtonGroup(this);
     301            0 :     tabShowTiedFrets->addButton(tabShowTiesAndFret, int(ShowTiedFret::TIE_AND_FRET));
     302            0 :     tabShowTiedFrets->addButton(tabShowTies, int(ShowTiedFret::TIE));
     303            0 :     tabShowTiedFrets->addButton(tabShowNone, int(ShowTiedFret::NONE));
     304              : 
     305            0 :     QButtonGroup* tabParenthFrets = new QButtonGroup(this);
     306            0 :     tabParenthFrets->addButton(tabParenthSystem, int(ParenthesizeTiedFret::START_OF_SYSTEM));
     307            0 :     tabParenthFrets->addButton(tabParenthMeasure, int(ParenthesizeTiedFret::START_OF_MEASURE));
     308            0 :     tabParenthFrets->addButton(tabParenthNone, int(ParenthesizeTiedFret::NEVER));
     309              : 
     310            0 :     void (QButtonGroup::* tabShowTiedFretsButtonClicked)(QAbstractButton*) = &QButtonGroup::buttonClicked;
     311            0 :     connect(tabShowTiedFrets, tabShowTiedFretsButtonClicked, this, [this](QAbstractButton*){
     312            0 :         updateParenthesisIndicatingTiesGroupState();
     313            0 :     });
     314              : 
     315            0 :     QButtonGroup* firstSysLabels = new QButtonGroup(this);
     316            0 :     firstSysLabels->addButton(firstLongBtn, int(InstrumentLabelVisibility::LONG));
     317            0 :     firstSysLabels->addButton(firstShortBtn, int(InstrumentLabelVisibility::SHORT));
     318            0 :     firstSysLabels->addButton(firstHideBtn, int(InstrumentLabelVisibility::HIDE));
     319              : 
     320            0 :     QButtonGroup* subsSysLabels = new QButtonGroup(this);
     321            0 :     subsSysLabels->addButton(subsLongBtn, int(InstrumentLabelVisibility::LONG));
     322            0 :     subsSysLabels->addButton(subsShortBtn, int(InstrumentLabelVisibility::SHORT));
     323            0 :     subsSysLabels->addButton(subsHideBtn, int(InstrumentLabelVisibility::HIDE));
     324              : 
     325            0 :     QButtonGroup* singleMeasureMMRest = new QButtonGroup(this);
     326            0 :     singleMeasureMMRest->addButton(mmRestSingleUseHBar, 0);
     327            0 :     singleMeasureMMRest->addButton(mmRestSingleUseNormalRest, 1);
     328              : 
     329            0 :     QButtonGroup* mmRestConstantWidth = new QButtonGroup(this);
     330            0 :     mmRestConstantWidth->addButton(mmRestWidthProportional, 0);
     331            0 :     mmRestConstantWidth->addButton(mmRestWidthConstant, 1);
     332              : 
     333            0 :     QButtonGroup* dividerLeftAlignToSystemBarline = new QButtonGroup(this);
     334            0 :     dividerLeftAlignToSystemBarline->addButton(leftDividerAlignToSystemBarline, 1);
     335            0 :     dividerLeftAlignToSystemBarline->addButton(leftDividerAlignToMargin, 0);
     336              : 
     337            0 :     QButtonGroup* dividerRightAlignToSystemBarline = new QButtonGroup(this);
     338            0 :     dividerRightAlignToSystemBarline->addButton(rightDividerAlignToSystemBarline, 1);
     339            0 :     dividerRightAlignToSystemBarline->addButton(rightDividerAlignToPageMargin, 0);
     340              : 
     341            0 :     QButtonGroup* groupBracketTextAlign = new QButtonGroup(this);
     342            0 :     groupBracketTextAlign->addButton(groupBracketTextLeft, 1);
     343            0 :     groupBracketTextAlign->addButton(groupBracketTextCenter, 0);
     344            0 :     groupBracketTextAlign->addButton(groupBracketTextRight, 2);
     345              : 
     346            0 :     QButtonGroup* groupBracketOrientation = new QButtonGroup(this);
     347            0 :     groupBracketOrientation->addButton(groupBracketTextVertical, 0);
     348            0 :     groupBracketOrientation->addButton(groupBracketTextHorizontal, 1);
     349              : 
     350            0 :     auto updateHangIntoMarginEnabled = [&]() {
     351            0 :         bool rightAlign = groupBracketTextRight->isChecked();
     352            0 :         bool vertical = groupBracketTextVertical->isChecked();
     353            0 :         groupBracketHangIntoMargin->setEnabled(vertical && !rightAlign);
     354            0 :     };
     355              : 
     356            0 :     connect(groupBracketTextAlign, &QButtonGroup::buttonClicked, this, updateHangIntoMarginEnabled);
     357            0 :     connect(groupBracketOrientation, &QButtonGroup::buttonClicked, this, updateHangIntoMarginEnabled);
     358              : 
     359              :     // ====================================================
     360              :     // Style widgets
     361              :     // ====================================================
     362              : 
     363            0 :     styleWidgets = {
     364              :         //   idx                --- showPercent      --- widget          --- resetButton
     365              :         { StyleId::figuredBassAlignment,    false, fbAlign,                 0 },
     366              :         { StyleId::figuredBassStyle,        false, fbStyle,                 0 },
     367            0 :         { StyleId::figuredBassFontSize,     false, doubleSpinFBSize,        0 },
     368            0 :         { StyleId::figuredBassYOffset,      false, doubleSpinFBVertPos,     0 },
     369            0 :         { StyleId::figuredBassLineHeight,   true,  spinFBLineHeight,        0 },
     370            0 :         { StyleId::ottavaLineStyle,         false, ottavaLineStyle,         resetOttavaLineStyle },
     371            0 :         { StyleId::ottavaDashLineLen,       false, ottavaLineStyleDashSize, resetOttavaLineStyleDashSize },
     372            0 :         { StyleId::ottavaDashGapLen,        false, ottavaLineStyleGapSize,  resetOttavaLineStyleGapSize },
     373            0 :         { StyleId::pedalLineStyle,          false, pedalLineStyle,          resetPedalLineStyle },
     374            0 :         { StyleId::pedalDashLineLen,        false, pedalLineStyleDashSize,  resetPedalLineStyleDashSize },
     375            0 :         { StyleId::pedalDashGapLen,         false, pedalLineStyleGapSize,   resetPedalLineStyleGapSize },
     376            0 :         { StyleId::textLineLineStyle,         false, textLineLineStyle,               resetTextLineLineStyle },
     377            0 :         { StyleId::textLineDashLineLen,       false, textLineLineStyleDashSize,       resetTextLineLineStyleDashSize },
     378            0 :         { StyleId::textLineDashGapLen,        false, textLineLineStyleGapSize,        resetTextLineLineStyleGapSize },
     379            0 :         { StyleId::systemTextLineLineStyle,   false, systemTextLineLineStyle,         resetSystemTextLineLineStyle },
     380            0 :         { StyleId::systemTextLineDashLineLen, false, systemTextLineLineStyleDashSize, resetSystemTextLineLineStyleDashSize },
     381            0 :         { StyleId::systemTextLineDashGapLen,  false, systemTextLineLineStyleGapSize,  resetSystemTextLineLineStyleGapSize },
     382              : 
     383            0 :         { StyleId::staffUpperBorder,        false, staffUpperBorder,        resetStaffUpperBorder },
     384            0 :         { StyleId::staffLowerBorder,        false, staffLowerBorder,        resetStaffLowerBorder },
     385            0 :         { StyleId::staffDistance,           false, staffDistance,           resetStaffDistance },
     386            0 :         { StyleId::akkoladeDistance,        false, akkoladeDistance,        resetAkkoladeDistance },
     387            0 :         { StyleId::enableVerticalSpread,    false, enableVerticalSpread,    0 },
     388            0 :         { StyleId::minSystemDistance,       false, minSystemDistance,       resetMinSystemDistance },
     389            0 :         { StyleId::maxSystemDistance,       false, maxSystemDistance,       resetMaxSystemDistance },
     390            0 :         { StyleId::spreadSystem,            false, spreadSystem,            resetSpreadSystem },
     391            0 :         { StyleId::spreadSquareBracket,     false, spreadSquareBracket,     resetSpreadSquareBracket },
     392            0 :         { StyleId::spreadCurlyBracket,      false, spreadCurlyBracket,      resetSpreadCurlyBracket },
     393            0 :         { StyleId::minSystemSpread,         false, minSystemSpread,         resetMinSystemSpread },
     394            0 :         { StyleId::maxSystemSpread,         false, maxSystemSpread,         resetMaxSystemSpread },
     395            0 :         { StyleId::minStaffSpread,          false, minStaffSpread,          resetMinStaffSpread },
     396            0 :         { StyleId::maxStaffSpread,          false, maxStaffSpread,          resetMaxStaffSpread },
     397            0 :         { StyleId::maxAkkoladeDistance,     false, maxAkkoladeDistance,     resetMaxAkkoladeDistance },
     398            0 :         { StyleId::maxPageFillSpread,       false, maxPageFillSpread,       resetMaxPageFillSpread },
     399              : 
     400            0 :         { StyleId::lyricsPlacement,         false, lyricsPlacement,         resetLyricsPlacement },
     401            0 :         { StyleId::lyricsPosAbove,          false, yLyricsPosAbove,         resetLyricsPosAbove },
     402            0 :         { StyleId::lyricsPosBelow,          false, yLyricsPosBelow,         resetLyricsPosBelow },
     403            0 :         { StyleId::lyricsMinTopDistance,    false, lyricsMinTopDistance,    resetLyricsMinTopDistance },
     404            0 :         { StyleId::lyricsMinBottomDistance, false, lyricsMinBottomDistance, resetLyricsMinBottomDistance },
     405            0 :         { StyleId::lyricsMinDistance,       false, lyricsMinDistance,       resetLyricsMinDistance },
     406            0 :         { StyleId::lyricsLineHeight,        true,  lyricsLineHeight,        resetLyricsLineHeight },
     407            0 :         { StyleId::lyricsDashMinLength,     false, lyricsDashMinLength,     resetLyricsDashMinLength },
     408            0 :         { StyleId::lyricsDashMaxLength,     false, lyricsDashMaxLength,     resetLyricsDashMaxLength },
     409            0 :         { StyleId::lyricsDashMaxDistance,   false, lyricsDashMaxDistance,   resetLyricsDashMaxDistance },
     410            0 :         { StyleId::lyricsDashForce,         false, lyricsDashForce,         resetLyricsDashForce },
     411            0 :         { StyleId::lyricsAlignVerseNumber,  false, lyricsAlignVerseNumber,  resetLyricsAlignVerseNumber },
     412            0 :         { StyleId::lyricsLineThickness,     false, lyricsLineThickness,     resetLyricsLineThickness },
     413            0 :         { StyleId::lyricsMelismaPad,        false, lyricsMelismaPad,        resetLyricsMelismaPad },
     414            0 :         { StyleId::lyricsDashPad,           false, lyricsDashPad,           resetLyricsDashPad },
     415            0 :         { StyleId::lyricsDashLineThickness, false, lyricsDashLineThickness, resetLyricsDashLineThickness },
     416            0 :         { StyleId::lyricsDashYposRatio,     false, lyricsDashYposRatio,     resetLyricsDashYposRatio },
     417            0 :         { StyleId::lyricsShowDashIfSyllableOnFirstNote, false, lyricsShowDashIfSyllableOnFirstNote,
     418            0 :           resetLyricsShowDashIfSyllableOnFirstNote },
     419            0 :         { StyleId::lyricsMelismaMinLength,  false, minMelismaLength,     resetMinMelismaLength },
     420            0 :         { StyleId::lyricsMelismaForce,      false, lyricsMelismaForce,   resetLyricsMelismaForce },
     421            0 :         { StyleId::lyricsDashPosAtStartOfSystem, false, lyricsDashStartSystemPlacement, resetLyricsDashStartSystemPlacement },
     422            0 :         { StyleId::lyricsAvoidBarlines, false, lyricsAvoidBarlines, resetLyricsAvoidBarlines },
     423            0 :         { StyleId::lyricsAutoCenterOnGrandStaff, false, lyricsAutoCenterOnGrandStaff, resetLyricsAutoCenterOnGrandStaff },
     424            0 :         { StyleId::lyricsAutoCenterOnVocalStaves, false, lyricsAutoCenterOnVocalStaves, resetLyricsAutoCenterOnVocalStaves },
     425            0 :         { StyleId::lyricsStackingOrder,    false, lyricsUseLegacyStackingOrder, resetLyricsStackingOrder },
     426            0 :         { StyleId::lyricsLimitDashCount, false, limitDashCount, 0 },
     427            0 :         { StyleId::lyricsMaxDashCount, false, lyricsMaxDashCount, resetLyricsMaxDashCount },
     428            0 :         { StyleId::lyricsCenterDashedSyllables, false, lyricsCenterDashedSyllables, lyricsResetCenterDashedSyllables },
     429              : 
     430            0 :         { StyleId::systemFrameDistance,     false, systemFrameDistance,     resetSystemFrameDistance },
     431            0 :         { StyleId::frameSystemDistance,     false, frameSystemDistance,     resetFrameSystemDistance },
     432            0 :         { StyleId::spacingDensity,          true,  spacingDensity,          resetSpacingDensity },
     433            0 :         { StyleId::minMeasureWidth,         false, minMeasureWidth_2,       resetMinMeasureWidth },
     434            0 :         { StyleId::measureSpacing,          false, measureSpacing,          resetMeasureSpacing },
     435              : 
     436            0 :         { StyleId::barWidth,                false, barWidth,                resetBarWidth },
     437            0 :         { StyleId::endBarWidth,             false, endBarWidth,             resetEndBarWidth },
     438            0 :         { StyleId::dashBarWidth,            false, dashBarWidth,            resetDashBarWidth },
     439            0 :         { StyleId::dashBarDash,             false, dashBarDash,             resetDashBarDash },
     440            0 :         { StyleId::dashBarGap,              false, dashBarGap,              resetDashBarGap },
     441            0 :         { StyleId::endBarDistance,          false, endBarDistance,          resetEndBarDistance },
     442            0 :         { StyleId::doubleBarWidth,          false, doubleBarWidth,          resetDoubleBarWidth },
     443            0 :         { StyleId::doubleBarDistance,       false, doubleBarDistance,       resetDoubleBarDistance },
     444            0 :         { StyleId::repeatBarlineDotSeparation, false, repeatBarlineDotSeparation, resetRepeatBarlineDotSeparation },
     445              : 
     446            0 :         { StyleId::barGraceDistance,        false, barGraceDistance,        resetBarGraceDistance },
     447            0 :         { StyleId::concertPitch,            false, concertPitch,            0 },
     448            0 :         { StyleId::createMultiMeasureRests, false, multiMeasureRests,       0 },
     449            0 :         { StyleId::minEmptyMeasures,        false, minEmptyMeasures,        0 },
     450              :         { StyleId::singleMeasureMMRestUseNormalRest, false, singleMeasureMMRest, 0 },
     451            0 :         { StyleId::singleMeasureMMRestShowNumber,    false, singleMMRestShowNumber, 0 },
     452              :         { StyleId::mmRestConstantWidth,     false, mmRestConstantWidth, 0 },
     453            0 :         { StyleId::mmRestReferenceWidth,    false, mmRestRefDuration, resetMMRestRefDuration },
     454            0 :         { StyleId::mmRestMaxWidthIncrease,  false, mmRestMaxMeasures, mmRestMaxMeasuresReset },
     455            0 :         { StyleId::minMMRestWidth,          false, minMeasureWidth,         resetMinMMRestWidth },
     456            0 :         { StyleId::mmRestNumberPos,         false, mmRestNumberPos,         resetMMRestNumberPos },
     457            0 :         { StyleId::mmRestBetweenStaves,     false, placeBetweenStaves,      resetPlaceBetweenStaves },
     458            0 :         { StyleId::mmRestNumberMaskHBar,    false, mmRestNumberMaskHBar,    resetMMRestNumberMaskHBar },
     459            0 :         { StyleId::mmRestHBarThickness,     false, mmRestHBarThickness,     resetMMRestHBarThickness },
     460            0 :         { StyleId::multiMeasureRestMargin,  false, multiMeasureRestMargin,  resetMultiMeasureRestMargin },
     461            0 :         { StyleId::mmRestHBarVStrokeThickness, false, mmRestHBarVStrokeThickness, resetMMRestHBarVStrokeThickness },
     462            0 :         { StyleId::mmRestHBarVStrokeHeight, false, mmRestHBarVStrokeHeight, resetMMRestHBarVStrokeHeight },
     463            0 :         { StyleId::oldStyleMultiMeasureRests, false, oldStyleMultiMeasureRests, 0 },
     464            0 :         { StyleId::mmRestOldStyleMaxMeasures, false, mmRestOldStyleMaxMeasures, resetMMRestOldStyleMaxMeasures },
     465            0 :         { StyleId::mmRestOldStyleSpacing,   false, mmRestOldStyleSpacing,   resetMMRestOldStyleSpacing },
     466            0 :         { StyleId::hideEmptyStaves,         false, hideEmptyStaves,         0 },
     467            0 :         { StyleId::dontHideStavesInFirstSystem, false, dontHideStavesInFirstSystem, 0 },
     468            0 :         { StyleId::enableIndentationOnFirstSystem, false, enableIndentationOnFirstSystem, 0 },
     469            0 :         { StyleId::firstSystemIndentationValue, false, indentationValue, resetFirstSystemIndentation },
     470            0 :         { StyleId::alwaysShowBracketsWhenEmptyStavesAreHidden, false, alwaysShowBrackets, 0 },
     471            0 :         { StyleId::hideInstrumentNameIfOneInstrument, false, hideInstrumentNameIfOneInstrument, 0 },
     472            0 :         { StyleId::firstSystemInstNameVisibility, false, firstSysLabels, resetFirstSystemLabel },
     473            0 :         { StyleId::subsSystemInstNameVisibility, false, subsSysLabels, resetSubsSystemLabel },
     474            0 :         { StyleId::accidentalNoteDistance,  false, accidentalNoteDistance,  0 },
     475            0 :         { StyleId::accidentalDistance,      false, accidentalDistance,      0 },
     476            0 :         { StyleId::minNoteDistance,         false, minNoteDistance,         resetMinNoteDistance },
     477            0 :         { StyleId::barNoteDistance,         false, barNoteDistance,         resetBarNoteDistance },
     478            0 :         { StyleId::barAccidentalDistance,   false, barAccidentalDistance,   resetBarAccidentalDistance },
     479            0 :         { StyleId::noteBarDistance,         false, noteBarDistance,         resetNoteBarDistance },
     480            0 :         { StyleId::clefLeftMargin,          false, clefLeftMargin,          resetClefLeftMargin },
     481            0 :         { StyleId::keysigLeftMargin,        false, keysigLeftMargin,        resetKeysigLeftMargin },
     482            0 :         { StyleId::timesigLeftMargin,       false, timesigLeftMargin,       resetTimesigLeftMargin },
     483            0 :         { StyleId::clefKeyRightMargin,      false, clefKeyRightMargin,      resetClefKeyRightMargin },
     484            0 :         { StyleId::clefKeyDistance,         false, clefKeyDistance,         resetClefKeyDistance },
     485            0 :         { StyleId::clefTimesigDistance,     false, clefTimesigDistance,     resetClefTimesigDistance },
     486            0 :         { StyleId::keyTimesigDistance,      false, keyTimesigDistance,      resetKeyTimesigDistance },
     487            0 :         { StyleId::keyBarlineDistance,      false, keyBarlineDistance,      resetKeyBarlineDistance },
     488            0 :         { StyleId::systemHeaderDistance,    false, systemHeaderDistance,    resetSystemHeaderDistance },
     489            0 :         { StyleId::systemHeaderTimeSigDistance, false, systemHeaderTimeSigDistance, resetSystemHeaderTimeSigDistance },
     490            0 :         { StyleId::systemHeaderMinStartOfSystemDistance, false, systemHeaderMinStartOfSystemDistance,
     491            0 :           resetSystemHeaderMinStartOfSystemDistance },
     492              : 
     493            0 :         { StyleId::clefBarlineDistance,     false, clefBarlineDistance,     resetClefBarlineDistance },
     494            0 :         { StyleId::timesigBarlineDistance,  false, timesigBarlineDistance,  resetTimesigBarlineDistance },
     495            0 :         { StyleId::staffLineWidth,          false, staffLineWidth,          resetStaffLineWidth },
     496              : 
     497            0 :         { StyleId::hairpinPosAbove,         false, hairpinPosAbove,         resetHairpinPosAbove },
     498            0 :         { StyleId::hairpinPosBelow,         false, hairpinPosBelow,         resetHairpinPosBelow },
     499            0 :         { StyleId::hairpinLineWidth,        false, hairpinLineWidth,        resetHairpinLineWidth },
     500            0 :         { StyleId::hairpinHeight,           false, hairpinHeight,           resetHairpinHeight },
     501            0 :         { StyleId::hairpinContHeight,       false, hairpinContinueHeight,   resetHairpinContinueHeight },
     502              : 
     503            0 :         { StyleId::dotNoteDistance,         false, noteDotDistance,         0 },
     504            0 :         { StyleId::dotDotDistance,          false, dotDotDistance,          0 },
     505            0 :         { StyleId::stemWidth,               false, stemWidth,               0 },
     506            0 :         { StyleId::ledgerLineWidth,         false, ledgerLineWidth,         0 },
     507            0 :         { StyleId::ledgerLineLength,        false, ledgerLineLength,        0 },
     508            0 :         { StyleId::shortestStem,            false, shortestStem,            0 },
     509            0 :         { StyleId::combineVoice,            false, combineVoices,           resetCombineVoices },
     510              : 
     511            0 :         { StyleId::arpeggioNoteDistance,    false, arpeggioNoteDistance,    arpeggioNoteDistanceReset },
     512            0 :         { StyleId::arpeggioLineWidth,       false, arpeggioLineWidth,       arpeggioLineWidthReset },
     513            0 :         { StyleId::arpeggioHiddenInStdIfTab, false, arpeggioHiddenInStdIfTab, 0 },
     514              : 
     515            0 :         { StyleId::chordBracketNoteDistance, false, chordBracketNoteDistance, chordBracketNoteDistanceReset },
     516            0 :         { StyleId::chordBracketLineWidth,    false, chordBracketLineWidth,    chordBracketLineWidthReset },
     517            0 :         { StyleId::chordBracketHookLen,      false, chordBracketHookLen,      chordBracketHookLenReset },
     518              : 
     519            0 :         { StyleId::bracketWidth,            false, bracketWidth,            resetBracketThickness },
     520            0 :         { StyleId::bracketDistance,         false, bracketDistance,         resetBracketDistance },
     521            0 :         { StyleId::akkoladeWidth,           false, akkoladeWidth,           resetBraceThickness },
     522            0 :         { StyleId::akkoladeBarDistance,     false, akkoladeBarDistance,     resetBraceDistance },
     523            0 :         { StyleId::groupBracketLineWidth,   false, groupBracketLineThick,   groupBracketLineThickReset },
     524            0 :         { StyleId::groupBracketHookLen,     false, groupBracketHookLen,     groupBracketHookLenReset },
     525              :         { StyleId::groupBracketTextAlign,   false, groupBracketTextAlign,   0 },
     526            0 :         { StyleId::groupBracketHangTextIntoMargin, false, groupBracketHangIntoMargin, 0 },
     527            0 :         { StyleId::groupBracketDistanceToNames, false, groupBracketDistanceToNames, groupBracketDistanceToNamesReset },
     528            0 :         { StyleId::groupBracketDistanceToGroupBracket, false, groupBracketDistanceToBrackets, groupBracketDistanceToBracketsReset },
     529              :         { StyleId::groupBracketTextOrientation, false, groupBracketOrientation },
     530              : 
     531            0 :         { StyleId::dividerLeft,             false, dividerLeft,             0 },
     532            0 :         { StyleId::dividerLeftX,            false, dividerLeftX,            dividerLeftXReset },
     533            0 :         { StyleId::dividerLeftY,            false, dividerLeftY,            dividerLeftYReset },
     534            0 :         { StyleId::dividerRight,            false, dividerRight,            0 },
     535            0 :         { StyleId::dividerRightX,           false, dividerRightX,           dividerRightXReset },
     536            0 :         { StyleId::dividerRightY,           false, dividerRightY,           dividerRightYReset },
     537            0 :         { StyleId::dividerLeftSize,         true,  dividerLeftSize,         dividerLeftSizeReset },
     538            0 :         { StyleId::dividerRightSize,        true,  dividerRightSize,        dividerRightSizeReset },
     539              :         { StyleId::dividerLeftAlignToSystemBarline, true, dividerLeftAlignToSystemBarline, 0 },
     540              :         { StyleId::dividerRightAlignToSystemBarline, false, dividerRightAlignToSystemBarline, 0 },
     541            0 :         { StyleId::articulationMinDistance, false, articMinVerticalDist,    resetArticMinVerticalDist },
     542            0 :         { StyleId::propertyDistanceHead,    false, articNoteHeadDist,       resetArticNoteHeadDist },
     543            0 :         { StyleId::propertyDistanceStem,    false, articStemDist,           resetArticStemDist },
     544            0 :         { StyleId::propertyDistance,        false, articStaffDist,          resetArticStaffDist },
     545              :         { StyleId::articulationStemHAlign,  false, articulationStemSide,    0 },
     546              :         { StyleId::articulationKeepTogether, false, articulationKeepTogether, 0 },
     547              :         { StyleId::trillAlwaysShowCueNote, false, trillAlwaysShowCueNote, 0 },
     548              : 
     549            0 :         { StyleId::ottavaPosAbove,          false, ottavaPosAbove,          resetOttavaPosAbove },
     550            0 :         { StyleId::ottavaPosBelow,          false, ottavaPosBelow,          resetOttavaPosBelow },
     551            0 :         { StyleId::ottavaHookAbove,         false, ottavaHookAbove,         resetOttavaHookAbove },
     552            0 :         { StyleId::ottavaHookBelow,         false, ottavaHookBelow,         resetOttavaHookBelow },
     553            0 :         { StyleId::ottavaLineWidth,         false, ottavaLineWidth,         resetOttavaLineWidth },
     554              : 
     555            0 :         { StyleId::pedalPlacement,          false, pedalLinePlacement,      resetPedalLinePlacement },
     556            0 :         { StyleId::pedalPosAbove,           false, pedalLinePosAbove,       resetPedalLinePosAbove },
     557            0 :         { StyleId::pedalPosBelow,           false, pedalLinePosBelow,       resetPedalLinePosBelow },
     558            0 :         { StyleId::pedalLineWidth,          false, pedalLineWidth,          resetPedalLineWidth },
     559              : 
     560            0 :         { StyleId::trillPlacement,          false, trillLinePlacement,      resetTrillLinePlacement },
     561            0 :         { StyleId::trillPosAbove,           false, trillLinePosAbove,       resetTrillLinePosAbove },
     562            0 :         { StyleId::trillPosBelow,           false, trillLinePosBelow,       resetTrillLinePosBelow },
     563              : 
     564            0 :         { StyleId::vibratoPlacement,        false, vibratoLinePlacement,    resetVibratoLinePlacement },
     565            0 :         { StyleId::vibratoPosAbove,         false, vibratoLinePosAbove,     resetVibratoLinePosAbove },
     566            0 :         { StyleId::vibratoPosBelow,         false, vibratoLinePosBelow,     resetVibratoLinePosBelow },
     567              : 
     568              :         // { StyleId::harmonyFretDist,         false, harmonyFretDist,         0 },
     569              :         // { StyleId::minHarmonyDistance,      false, minHarmonyDistance,      0 },
     570              :         // { StyleId::maxHarmonyBarDistance,   false, maxHarmonyBarDistance,   0 },
     571              :         // { StyleId::maxChordShiftAbove,      false, maxChordShiftAbove,      resetMaxChordShiftAbove },
     572              :         // { StyleId::maxChordShiftBelow,      false, maxChordShiftBelow,      resetMaxChordShiftBelow },
     573              :         // { StyleId::harmonyVoiceLiteral,     false, voicingSelectWidget->interpretBox, 0 },
     574              :         // { StyleId::harmonyVoicing,          false, voicingSelectWidget->voicingBox, 0 },
     575              :         // { StyleId::harmonyDuration,         false, voicingSelectWidget->durationBox, 0 },
     576              : 
     577            0 :         { StyleId::tupletVHeadDistance,     false, tupletVHeadDistance,     resetTupletVHeadDistance },
     578            0 :         { StyleId::tupletVStemDistance,     false, tupletVStemDistance,     resetTupletVStemDistance },
     579            0 :         { StyleId::tupletStemLeftDistance,  false, tupletStemLeftDistance,  resetTupletStemLeftDistance },
     580            0 :         { StyleId::tupletStemRightDistance, false, tupletStemRightDistance, resetTupletStemRightDistance },
     581            0 :         { StyleId::tupletNoteLeftDistance,  false, tupletNoteLeftDistance,  resetTupletNoteLeftDistance },
     582            0 :         { StyleId::tupletNoteRightDistance, false, tupletNoteRightDistance, resetTupletNoteRightDistance },
     583            0 :         { StyleId::tupletBracketWidth,      false, tupletBracketWidth,      resetTupletBracketWidth },
     584            0 :         { StyleId::tupletBracketHookHeight, false, tupletBracketHookHeight, resetTupletBracketHookHeight },
     585            0 :         { StyleId::tupletDirection,         false, tupletDirection,         resetTupletDirection },
     586            0 :         { StyleId::tupletNumberType,        false, tupletNumberType,        resetTupletNumberType },
     587            0 :         { StyleId::tupletBracketType,       false, tupletBracketType,       resetTupletBracketType },
     588            0 :         { StyleId::tupletMaxSlope,          true,  tupletMaxSlope,          resetTupletMaxSlope },
     589            0 :         { StyleId::tupletOutOfStaff,        false, tupletOutOfStaff,        0 },
     590            0 :         { StyleId::tupletUseSymbols,        false, tupletUseSymbols,        resetTupletUseSymbols },
     591            0 :         { StyleId::tupletExtendToEndOfDuration, false, tupletExtendToEndOfDuration, 0 },
     592              : 
     593            0 :         { StyleId::repeatBarTips,            false, showRepeatBarTips,            resetShowRepeatBarTips },
     594            0 :         { StyleId::startBarlineSingle,       false, showStartBarlineSingle,       resetShowStartBarlineSingle },
     595            0 :         { StyleId::startBarlineMultiple,     false, showStartBarlineMultiple,     resetShowStartBarlineMultiple },
     596            0 :         { StyleId::maskBarlinesForText,      false, maskBarlines,                 resetMaskBarlines },
     597            0 :         { StyleId::dividerLeftSym,           false, dividerLeftSym,               dividerLeftSymReset },
     598            0 :         { StyleId::dividerRightSym,          false, dividerRightSym,              dividerRightSymReset },
     599              : 
     600            0 :         { StyleId::graceNoteMag,             true,  graceNoteSize,                resetGraceNoteSize },
     601            0 :         { StyleId::smallStaffMag,            true,  smallStaffSize,               resetSmallStaffSize },
     602            0 :         { StyleId::smallNoteMag,             true,  smallNoteSize,                resetSmallNoteSize },
     603            0 :         { StyleId::scaleRythmicSpacingForSmallNotes, true, reduceRythmicSpacing, 0 },
     604            0 :         { StyleId::smallClefMag,             true,  smallClefSize,                resetSmallClefSize },
     605            0 :         { StyleId::lastSystemFillLimit,      true,  lastSystemFillThreshold,      resetLastSystemFillThreshold },
     606              :         { StyleId::keySigCourtesyBarlineMode, false, ksbl,                        0 },
     607              :         { StyleId::timeSigCourtesyBarlineMode, false, tsbl,                       0 },
     608            0 :         { StyleId::swingRatio,               false, swingBox,                     0 },
     609              :         // { StyleId::chordsXmlFile,            false, chordsXmlFile,                0 },
     610            0 :         { StyleId::dotMag,                   true,  dotMag,                       0 },
     611            0 :         { StyleId::articulationMag,          true,  articulationMag,              resetArticulationMag },
     612            0 :         { StyleId::shortenStem,              false, shortenStem,                  0 },
     613            0 :         { StyleId::showHeader,               false, showHeader,                   0 },
     614            0 :         { StyleId::headerFirstPage,          false, showHeaderFirstPage,          0 },
     615            0 :         { StyleId::headerOddEven,            false, headerOddEven,                0 },
     616            0 :         { StyleId::evenHeaderL,              false, evenHeaderL,                  0 },
     617            0 :         { StyleId::evenHeaderC,              false, evenHeaderC,                  0 },
     618            0 :         { StyleId::evenHeaderR,              false, evenHeaderR,                  0 },
     619            0 :         { StyleId::oddHeaderL,               false, oddHeaderL,                   0 },
     620            0 :         { StyleId::oddHeaderC,               false, oddHeaderC,                   0 },
     621            0 :         { StyleId::oddHeaderR,               false, oddHeaderR,                   0 },
     622            0 :         { StyleId::showFooter,               false, showFooter,                   0 },
     623            0 :         { StyleId::footerFirstPage,          false, showFooterFirstPage,          0 },
     624            0 :         { StyleId::footerOddEven,            false, footerOddEven,                0 },
     625            0 :         { StyleId::evenFooterL,              false, evenFooterL,                  0 },
     626            0 :         { StyleId::evenFooterC,              false, evenFooterC,                  0 },
     627            0 :         { StyleId::evenFooterR,              false, evenFooterR,                  0 },
     628            0 :         { StyleId::oddFooterL,               false, oddFooterL,                   0 },
     629            0 :         { StyleId::oddFooterC,               false, oddFooterC,                   0 },
     630            0 :         { StyleId::oddFooterR,               false, oddFooterR,                   0 },
     631              : 
     632            0 :         { StyleId::ottavaNumbersOnly,        false, ottavaNumbersOnly,            resetOttavaNumbersOnly },
     633              :         // { StyleId::capoPosition,             false, capoPosition,                 0 },
     634            0 :         { StyleId::scaleBarlines,            false, scaleBarlines,                resetScaleBarlines },
     635            0 :         { StyleId::crossMeasureValues,       false, crossMeasureValues,           0 },
     636              : 
     637            0 :         { StyleId::musicalSymbolFont,        false, musicalSymbolFont,            0 },
     638            0 :         { StyleId::musicalTextFont,          false, musicalTextFont,              0 },
     639            0 :         { StyleId::autoplaceHairpinDynamicsDistance, false, autoplaceHairpinDynamicsDistance,
     640            0 :           resetAutoplaceHairpinDynamicsDistance },
     641              : 
     642            0 :         { StyleId::dynamicsPosAbove,        false, dynamicsPosAbove,           resetDynamicsPosAbove },
     643            0 :         { StyleId::dynamicsPosBelow,        false, dynamicsPosBelow,           resetDynamicsPosBelow },
     644            0 :         { StyleId::dynamicsMinDistance,     false, dynamicsMinDistance,        resetDynamicsMinDistance },
     645            0 :         { StyleId::avoidBarLines,           false, avoidBarLines,              resetAvoidBarLines },
     646            0 :         { StyleId::snapToDynamics,          false, snapExpression,             resetSnapExpression },
     647            0 :         { StyleId::dynamicsSize,            true,  dynamicsSize,               resetDynamicsSize },
     648            0 :         { StyleId::dynamicsOverrideFont,    false, dynamicsOverrideFont,       0 },
     649            0 :         { StyleId::dynamicsFont,            false, dynamicsFont,               0 },
     650              : 
     651            0 :         { StyleId::dynamicsHairpinVoiceBasedPlacement, false, dynamicsAndHairpinPos, resetDynamicsAndHairpinPos },
     652            0 :         { StyleId::dynamicsHairpinsAutoCenterOnGrandStaff, false, dynamicsAndHairpinsCenterOnGrandStaff, 0 },
     653            0 :         { StyleId::dynamicsHairpinsAutoCenterOnVocalStaves, false, dynamicsAndHairpinsCenterOnVocalStaves, 0 },
     654            0 :         { StyleId::dynamicsHairpinsAboveForVocalStaves, false, dynamicsAndHairpinsAboveOnVocalStaves, 0 },
     655              : 
     656            0 :         { StyleId::tempoPlacement,          false, tempoTextPlacement,          resetTempoTextPlacement },
     657            0 :         { StyleId::tempoPosAbove,           false, tempoTextPosAbove,           resetTempoTextPosAbove },
     658            0 :         { StyleId::tempoPosBelow,           false, tempoTextPosBelow,           resetTempoTextPosBelow },
     659            0 :         { StyleId::tempoMinDistance,        false, tempoTextMinDistance,        resetTempoTextMinDistance },
     660              : 
     661            0 :         { StyleId::rehearsalMarkPlacement,   false, rehearsalMarkPlacement,     resetRehearsalMarkPlacement },
     662            0 :         { StyleId::rehearsalMarkPosAbove,    false, rehearsalMarkPosAbove,      resetRehearsalMarkPosAbove },
     663            0 :         { StyleId::rehearsalMarkPosBelow,    false, rehearsalMarkPosBelow,      resetRehearsalMarkPosBelow },
     664            0 :         { StyleId::rehearsalMarkMinDistance, false, rehearsalMarkMinDistance,   resetRehearsalMarkMinDistance },
     665              : 
     666            0 :         { StyleId::minVerticalDistance,         false, minVerticalDistance,         resetMinVerticalDistance },
     667              : 
     668            0 :         { StyleId::textLinePlacement,           false, textLinePlacement,           resetTextLinePlacement },
     669            0 :         { StyleId::textLinePosAbove,            false, textLinePosAbove,            resetTextLinePosAbove },
     670            0 :         { StyleId::textLinePosBelow,            false, textLinePosBelow,            resetTextLinePosBelow },
     671            0 :         { StyleId::textLineLineWidth,           false, textLineLineWidth,           resetTextLineLineWidth },
     672              : 
     673            0 :         { StyleId::systemTextLinePlacement,     false, systemTextLinePlacement,     resetSystemTextLinePlacement },
     674            0 :         { StyleId::systemTextLinePosAbove,      false, systemTextLinePosAbove,      resetSystemTextLinePosAbove },
     675            0 :         { StyleId::systemTextLinePosBelow,      false, systemTextLinePosBelow,      resetSystemTextLinePosBelow },
     676            0 :         { StyleId::systemTextLineLineWidth,     false, systemTextLineLineWidth,     resetSystemTextLineLineWidth },
     677              : 
     678            0 :         { StyleId::fermataPosAbove,         false, fermataPosAbove,       resetFermataPosAbove },
     679            0 :         { StyleId::fermataPosBelow,         false, fermataPosBelow,       resetFermataPosBelow },
     680            0 :         { StyleId::fermataMinDistance,      false, fermataMinDistance,    resetFermataMinDistance },
     681              : 
     682            0 :         { StyleId::staffTextPlacement,      false, staffTextPlacement,    resetStaffTextPlacement },
     683            0 :         { StyleId::staffTextPosAbove,       false, staffTextPosAbove,     resetStaffTextPosAbove },
     684            0 :         { StyleId::staffTextPosBelow,       false, staffTextPosBelow,     resetStaffTextPosBelow },
     685            0 :         { StyleId::staffTextMinDistance,    false, staffTextMinDistance,  resetStaffTextMinDistance },
     686              : 
     687              :         /// Tablature styles
     688              : 
     689            0 :         { StyleId::slurShowTabSimple, false, slurShowTabSimple, 0 },
     690            0 :         { StyleId::slurShowTabCommon, false, slurShowTabCommon, 0 },
     691            0 :         { StyleId::fermataShowTabSimple, false, fermataShowTabSimple, 0 },
     692            0 :         { StyleId::fermataShowTabCommon, false, fermataShowTabCommon, 0 },
     693            0 :         { StyleId::dynamicsShowTabSimple, false, dynamicsShowTabSimple, 0 },
     694            0 :         { StyleId::dynamicsShowTabCommon, false, dynamicsShowTabCommon, 0 },
     695            0 :         { StyleId::hairpinShowTabSimple, false, hairpinShowTabSimple, 0 },
     696            0 :         { StyleId::hairpinShowTabCommon, false, hairpinShowTabCommon, 0 },
     697            0 :         { StyleId::accentShowTabSimple, false, accentShowTabSimple, 0 },
     698            0 :         { StyleId::accentShowTabCommon, false, accentShowTabCommon, 0 },
     699            0 :         { StyleId::staccatoShowTabSimple, false, staccatoShowTabSimple, 0 },
     700            0 :         { StyleId::staccatoShowTabCommon, false, staccatoShowTabCommon, 0 },
     701            0 :         { StyleId::harmonicMarkShowTabSimple, false, harmonicMarkShowTabSimple, 0 },
     702            0 :         { StyleId::harmonicMarkShowTabCommon, false, harmonicMarkShowTabCommon, 0 },
     703            0 :         { StyleId::letRingShowTabSimple, false, letRingShowTabSimple, 0 },
     704            0 :         { StyleId::letRingShowTabCommon, false, letRingShowTabCommon, 0 },
     705            0 :         { StyleId::palmMuteShowTabSimple, false, palmMuteShowTabSimple, 0 },
     706            0 :         { StyleId::palmMuteShowTabCommon, false, palmMuteShowTabCommon, 0 },
     707            0 :         { StyleId::rasgueadoShowTabSimple, false, rasgueadoShowTabSimple, 0 },
     708            0 :         { StyleId::rasgueadoShowTabCommon, false, rasgueadoShowTabCommon, 0 },
     709            0 :         { StyleId::mordentShowTabSimple, false, mordentShowTabSimple, 0 },
     710            0 :         { StyleId::mordentShowTabCommon, false, mordentShowTabCommon, 0 },
     711            0 :         { StyleId::turnShowTabSimple, false, turnShowTabSimple, 0 },
     712            0 :         { StyleId::turnShowTabCommon, false, turnShowTabCommon, 0 },
     713            0 :         { StyleId::wahShowTabSimple, false, wahShowTabSimple, 0 },
     714            0 :         { StyleId::wahShowTabCommon, false, wahShowTabCommon, 0 },
     715            0 :         { StyleId::golpeShowTabSimple, false, golpeShowTabSimple, 0 },
     716            0 :         { StyleId::golpeShowTabCommon, false, golpeShowTabCommon, 0 },
     717              : 
     718              :         { StyleId::tabShowTiedFret, false, tabShowTiedFrets, 0 },
     719              :         { StyleId::tabParenthesizeTiedFret, false, tabParenthFrets, 0 },
     720            0 :         { StyleId::parenthesizeTiedFretIfArticulation, false, tabParenthArticulation, 0 },
     721            0 :     };
     722              : 
     723              :     // ====================================================
     724              :     // Combo Boxes
     725              :     // ====================================================
     726              : 
     727            0 :     m_lineStyleSelects = {
     728              :         new LineStyleSelect(this, ottavaLineStyle, {
     729            0 :             label_ottava_lineStyle_dashSize,
     730            0 :             ottavaLineStyleDashSize,
     731            0 :             resetOttavaLineStyleDashSize,
     732            0 :             label_ottava_lineStyle_gapSize,
     733            0 :             ottavaLineStyleGapSize,
     734            0 :             resetOttavaLineStyleGapSize
     735            0 :         }),
     736              : 
     737              :         new LineStyleSelect(this, pedalLineStyle, {
     738            0 :             label_pedalLine_lineStyle_dashSize,
     739            0 :             pedalLineStyleDashSize,
     740            0 :             resetPedalLineStyleDashSize,
     741            0 :             label_pedalLine_lineStyle_gapSize,
     742            0 :             pedalLineStyleGapSize,
     743            0 :             resetPedalLineStyleGapSize
     744            0 :         }),
     745              : 
     746              :         new LineStyleSelect(this, textLineLineStyle, {
     747            0 :             label_textLineLine_lineStyle_dashSize,
     748            0 :             textLineLineStyleDashSize,
     749            0 :             resetTextLineLineStyleDashSize,
     750            0 :             label_textLineLine_lineStyle_gapSize,
     751            0 :             textLineLineStyleGapSize,
     752            0 :             resetTextLineLineStyleGapSize
     753            0 :         }),
     754              : 
     755              :         new LineStyleSelect(this, systemTextLineLineStyle, {
     756            0 :             label_systemTextLineLine_lineStyle_dashSize,
     757            0 :             systemTextLineLineStyleDashSize,
     758            0 :             resetSystemTextLineLineStyleDashSize,
     759            0 :             label_systemTextLineLine_lineStyle_gapSize,
     760            0 :             systemTextLineLineStyleGapSize,
     761            0 :             resetSystemTextLineLineStyleGapSize
     762            0 :         })
     763            0 :     };
     764              : 
     765            0 :     for (const LineStyleSelect* lineStyleSelect : m_lineStyleSelects) {
     766            0 :         lineStyleSelect->lineStyleComboBox->clear();
     767              : 
     768            0 :         int idx = 0;
     769            0 :         for (const muse::TranslatableString& lineStyle : lineStyles) {
     770            0 :             lineStyleSelect->lineStyleComboBox->addItem(lineStyle.qTranslated(), idx);
     771            0 :             ++idx;
     772              :         }
     773              :     }
     774              : 
     775            0 :     verticalPlacementComboBoxes = {
     776            0 :         lyricsPlacement,
     777            0 :         textLinePlacement,
     778            0 :         systemTextLinePlacement,
     779            0 :         pedalLinePlacement,
     780            0 :         trillLinePlacement,
     781            0 :         vibratoLinePlacement,
     782            0 :         tempoTextPlacement,
     783            0 :         staffTextPlacement,
     784            0 :         rehearsalMarkPlacement,
     785            0 :     };
     786              : 
     787            0 :     for (QComboBox* cb : verticalPlacementComboBoxes) {
     788            0 :         cb->clear();
     789            0 :         cb->addItem(muse::qtrc("notation/editstyle", "Above"), int(PlacementV::ABOVE));
     790            0 :         cb->addItem(muse::qtrc("notation/editstyle", "Below"), int(PlacementV::BELOW));
     791              :     }
     792              : 
     793            0 :     tupletNumberType->clear();
     794            0 :     tupletNumberType->addItem(muse::qtrc("notation/editstyle", "Number"), int(TupletNumberType::SHOW_NUMBER));
     795            0 :     tupletNumberType->addItem(muse::qtrc("notation/editstyle", "Ratio"), int(TupletNumberType::SHOW_RELATION));
     796            0 :     tupletNumberType->addItem(muse::qtrc("notation/editstyle", "None", "no tuplet number type"), int(TupletNumberType::NO_TEXT));
     797              : 
     798            0 :     tupletBracketType->clear();
     799            0 :     tupletBracketType->addItem(muse::qtrc("notation/editstyle", "Automatic"), int(TupletBracketType::AUTO_BRACKET));
     800            0 :     tupletBracketType->addItem(muse::qtrc("notation/editstyle", "Bracket"), int(TupletBracketType::SHOW_BRACKET));
     801            0 :     tupletBracketType->addItem(muse::qtrc("notation/editstyle", "None", "no tuplet bracket type"), int(TupletBracketType::SHOW_NO_BRACKET));
     802              : 
     803            0 :     lyricsDashStartSystemPlacement->clear();
     804            0 :     lyricsDashStartSystemPlacement->addItem(muse::qtrc("notation/editstyle", "Standard"), int(LyricsDashSystemStart::STANDARD));
     805            0 :     lyricsDashStartSystemPlacement->addItem(muse::qtrc("notation/editstyle", "Inside the header"),
     806              :                                             int(LyricsDashSystemStart::UNDER_HEADER));
     807            0 :     lyricsDashStartSystemPlacement->addItem(muse::qtrc("notation/editstyle", "Under the first note"),
     808              :                                             int(LyricsDashSystemStart::UNDER_FIRST_NOTE));
     809              : 
     810            0 :     musicalSymbolFont->clear();
     811            0 :     dynamicsFont->clear();
     812            0 :     musicalTextFont->clear();
     813            0 :     for (const auto& i : engravingFonts()->fonts()) {
     814            0 :         QString fontDisplayName = QString::fromStdString(i->name());
     815            0 :         QString fontFamilyName = QString::fromStdString(i->family());
     816            0 :         musicalSymbolFont->addItem(fontDisplayName, fontDisplayName);
     817            0 :         dynamicsFont->addItem(fontDisplayName, fontDisplayName);
     818              :         // musicalTextFont must be a font family name!
     819            0 :         musicalTextFont->addItem(fontDisplayName + " Text", fontFamilyName + " Text");
     820            0 :     }
     821              : 
     822              :     static const SymId ids[] = {
     823              :         SymId::systemDivider, SymId::systemDividerLong, SymId::systemDividerExtraLong
     824              :     };
     825              :     static const TranslatableString names [] {
     826              :         TranslatableString("engraving", "Normal"),
     827              :         TranslatableString("engraving", "Long"),
     828              :         TranslatableString("engraving", "Extra long"),
     829            0 :     };
     830            0 :     for (size_t i = 0; i < 3; ++i) {
     831            0 :         AsciiStringView n = SymNames::nameForSymId(ids[i]);
     832            0 :         dividerLeftSym->addItem(names[i].qTranslated(),  QVariant(QString(n.toQLatin1String())));
     833            0 :         dividerRightSym->addItem(names[i].qTranslated(), QVariant(QString(n.toQLatin1String())));
     834              :     }
     835              : 
     836              :     // ====================================================
     837              :     // Notes (QML)
     838              :     // ====================================================
     839              : 
     840            0 :     auto noteFlagsTypeSelector = createQmlWidget(
     841            0 :         groupBox_noteFlags,
     842            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/NoteFlagsTypeSelector.qml")));
     843            0 :     noteFlagsTypeSelector.widget->setMinimumSize(224, 70);
     844            0 :     groupBox_noteFlags->layout()->addWidget(noteFlagsTypeSelector.widget);
     845              : 
     846              :     // ====================================================
     847              :     // Rests (QML)
     848              :     // ====================================================
     849              : 
     850            0 :     auto restOffsetSelector = createQmlWidget(
     851            0 :         groupBox_rests,
     852            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/RestOffsetSelector.qml")));
     853            0 :     restOffsetSelector.widget->setMinimumSize(224, 70);
     854            0 :     groupBox_rests->layout()->addWidget(restOffsetSelector.widget);
     855              : 
     856              :     // ====================================================
     857              :     // Measure repeats / (Multimeasure) rests
     858              :     // ====================================================
     859              : 
     860              :     // Define string here instead of in the .ui file to avoid MSVC compiler warning C4125, which would
     861              :     // be triggered by the decimal digit immediately following a non-ASCII character (curly quote).
     862            0 :     singleMMRestShowNumber->setText(muse::qtrc("EditStyleBase", "Show number ‘1’"));
     863              : 
     864              :     // ====================================================
     865              :     // BEAMS (QML)
     866              :     // ====================================================
     867              : 
     868            0 :     auto beamsPage = createQmlWidget(
     869            0 :         groupBox_beams,
     870            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/BeamsPage.qml")));
     871            0 :     beamsPage.widget->setMinimumSize(224, 418);
     872            0 :     groupBox_beams->layout()->addWidget(beamsPage.widget);
     873              : 
     874              :     // ====================================================
     875              :     // BENDS (QML)
     876              :     // ====================================================
     877              : 
     878            0 :     auto bendsPage = createQmlWidget(
     879              :         PageBend,
     880            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/BendsPage.qml")));
     881            0 :     bendsPage.widget->setMinimumSize(224, 60);
     882            0 :     connect(bendsPage.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
     883            0 :     PageBend->layout()->addWidget(bendsPage.widget);
     884              : 
     885              :     // ====================================================
     886              :     //  SLURS AND TIES (QML)
     887              :     // ====================================================
     888              : 
     889            0 :     auto slursAndTiesPage = createQmlWidget(
     890              :         PageSlursTies,
     891            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/SlursAndTiesPage.qml")));
     892            0 :     PageSlursTies->layout()->addWidget(slursAndTiesPage.widget);
     893              : 
     894              :     // ====================================================
     895              :     // ACCIDENTALS (QML)
     896              :     // ====================================================
     897              : 
     898            0 :     auto accidentalsPage = createQmlWidget(
     899              :         PageAccidentals,
     900            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/AccidentalsPage.qml")));
     901            0 :     PageAccidentals->layout()->addWidget(accidentalsPage.widget);
     902              : 
     903              :     // ====================================================
     904              :     // FRETBOARDS STYLE PAGE (QML)
     905              :     // ====================================================
     906              : 
     907            0 :     auto fretboardsPage = createQmlWidget(
     908              :         PageFretboardDiagrams,
     909            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/FretboardsPage.qml")));
     910            0 :     connect(fretboardsPage.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
     911            0 :     PageFretboardDiagrams->layout()->addWidget(fretboardsPage.widget);
     912              : 
     913              :     // ====================================================
     914              :     // Hammer-on/pull-off and tapping STYLE PAGE (QML)
     915              :     // ====================================================
     916              : 
     917            0 :     auto hoposTappingPage = createQmlWidget(
     918              :         hoposPageWidget,
     919            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/HammerOnPullOffTappingPage.qml")));
     920            0 :     hoposTappingPage.widget->setMinimumSize(224, 400);
     921            0 :     connect(hoposTappingPage.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
     922            0 :     hoposPageWidget->layout()->addWidget(hoposTappingPage.widget);
     923              : 
     924              :     // ====================================================
     925              :     // GLISSANDO STYLE SECTION (QML)
     926              :     // ====================================================
     927              : 
     928            0 :     auto glissandoSection = createQmlWidget(
     929            0 :         groupBox_glissando,
     930            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/GlissandoSection.qml")));
     931            0 :     glissandoSection.widget->setMinimumSize(224, 284);
     932            0 :     connect(glissandoSection.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
     933            0 :     groupBox_glissando->layout()->addWidget(glissandoSection.widget);
     934              : 
     935              :     // ====================================================
     936              :     // NOTE LINE STYLE SECTION (QML)
     937              :     // ====================================================
     938              : 
     939            0 :     auto noteLineSection = createQmlWidget(
     940            0 :         groupBox_noteline,
     941            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/NoteLineSection.qml")));
     942            0 :     noteLineSection.widget->setMinimumSize(224, 200);
     943            0 :     connect(noteLineSection.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
     944            0 :     groupBox_noteline->layout()->addWidget(noteLineSection.widget);
     945              : 
     946              :     // ====================================================
     947              :     // CLEF, KEY & TIME SIG PAGE (QML)
     948              :     // ====================================================
     949              : 
     950            0 :     auto clefKeyTimeSigPage = createQmlWidget(
     951              :         clefTimeKeySigPage,
     952            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/ClefKeyTimeSigPage.qml")));
     953            0 :     clefKeyTimeSigPage.widget->setMinimumSize(224, 400);
     954            0 :     clefTimeKeySigPage->layout()->addWidget(clefKeyTimeSigPage.widget);
     955              : 
     956              :     // ====================================================
     957              :     // REPEAT BARLINES STYLE SECTION (QML)
     958              :     // ====================================================
     959              : 
     960            0 :     auto repeatBarlinesSection = createQmlWidget(
     961            0 :         repeatBarlinesGroupBox,
     962            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/RepeatBarlinesSection.qml")));
     963            0 :     repeatBarlinesSection.widget->setMinimumSize(224, 90);
     964            0 :     repeatBarlinesGroupBox->layout()->addWidget(repeatBarlinesSection.widget);
     965              : 
     966              :     // ====================================================
     967              :     // CHORD SYMBOLS PAGE (QML)
     968              :     // ====================================================
     969              : 
     970            0 :     auto chordSymbolsPageWidget = createQmlWidget(
     971              :         chordSymbolsPage,
     972            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/ChordSymbolsPage.qml")));
     973            0 :     chordSymbolsPageWidget.widget->setMinimumSize(224, 400);
     974            0 :     connect(chordSymbolsPageWidget.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
     975            0 :     chordSymbolsPage->layout()->addWidget(chordSymbolsPageWidget.widget);
     976              : 
     977              :     // ====================================================
     978              :     // Voltas STYLE PAGE (QML)
     979              :     // ====================================================
     980              : 
     981            0 :     auto voltasPage = createQmlWidget(
     982              :         voltasPageWidget,
     983            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/VoltasPage.qml")));
     984            0 :     voltasPage.widget->setMinimumSize(504, 400);
     985            0 :     voltasPageWidget->layout()->addWidget(voltasPage.widget);
     986              : 
     987              :     // ====================================================
     988              :     // Bar Numbers STYLE PAGE (QML)
     989              :     // ====================================================
     990              : 
     991            0 :     auto barNumbersPage = createQmlWidget(
     992              :         pageMeasureNumbers,
     993            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/MeasureNumbersPage.qml")));
     994            0 :     barNumbersPage.widget->setMinimumSize(224, 400);
     995            0 :     pageMeasureNumbers->layout()->addWidget(barNumbersPage.widget);
     996            0 :     connect(barNumbersPage.view->rootObject(), SIGNAL(goToTextStylePage(int)), this, SLOT(goToTextStylePage(int)));
     997              : 
     998              :     // ====================================================
     999              :     // Tuplet centering selector (QML)
    1000              :     // ====================================================
    1001              : 
    1002            0 :     auto tupletCenteringSelector = createQmlWidget(
    1003            0 :         groupBox_tuplets_properties,
    1004            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/TupletCenteringSelector.qml")));
    1005            0 :     tupletCenteringSelector.widget->setMinimumSize(288, 88);
    1006            0 :     groupBox_tuplets_properties->layout()->addWidget(tupletCenteringSelector.widget);
    1007              : 
    1008              :     // ====================================================
    1009              :     // REPEAT PLAY COUNT SECTION (QML)
    1010              :     // ====================================================
    1011              : 
    1012            0 :     auto repeatPlayCountSection = createQmlWidget(
    1013              :         PageRepeats,
    1014            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/RepeatPage.qml")));
    1015            0 :     repeatPlayCountSection.widget->setMinimumSize(224, 500);
    1016            0 :     connect(repeatPlayCountSection.view->rootObject(), SIGNAL(goToTextStylePage(QString)), this, SLOT(goToTextStylePage(QString)));
    1017            0 :     PageRepeats->layout()->addWidget(repeatPlayCountSection.widget);
    1018              : 
    1019              :     // ====================================================
    1020              :     // Instrument names page (QML)
    1021              :     // ====================================================
    1022              : 
    1023            0 :     auto instrNamesPage = createQmlWidget(
    1024              :         pageInstrumentNames,
    1025            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/InstrumentNamesPage.qml")));
    1026            0 :     instrNamesPage.widget->setMinimumSize(224, 400);
    1027            0 :     pageInstrumentNames->layout()->addWidget(instrNamesPage.widget);
    1028              : 
    1029              :     // ====================================================
    1030              :     // Stave sharing page (QML)
    1031              :     // ====================================================
    1032              : 
    1033            0 :     auto staveSharingPage = createQmlWidget(
    1034              :         PageStaveSharing,
    1035            0 :         QUrl(QString::fromUtf8("qrc:/qt/qml/MuseScore/NotationScene/styledialog/StaveSharingPage.qml")));
    1036            0 :     staveSharingPage.widget->setMinimumSize(224, 400);
    1037            0 :     PageStaveSharing->layout()->addWidget(staveSharingPage.widget);
    1038              : 
    1039              :     // ====================================================
    1040              :     // Figured Bass
    1041              :     // ====================================================
    1042              : 
    1043            0 :     const std::vector<String> fbFontNames = FiguredBass::fontNames();
    1044            0 :     for (const String& family : fbFontNames) {
    1045            0 :         comboFBFont->addItem(family);
    1046              :     }
    1047            0 :     comboFBFont->setCurrentIndex(0);
    1048            0 :     connect(comboFBFont, &QComboBox::currentIndexChanged, this, &EditStyle::on_comboFBFont_currentIndexChanged);
    1049              : 
    1050              :     // ====================================================
    1051              :     // Miscellaneous
    1052              :     // ====================================================
    1053              : 
    1054            0 :     setHeaderFooterMacroInfoText();
    1055              : 
    1056            0 :     connect(buttonBox,             &QDialogButtonBox::clicked,  this, &EditStyle::buttonClicked);
    1057            0 :     connect(enableVerticalSpread,  &QGroupBox::clicked,         this, &EditStyle::enableVerticalSpreadClicked);
    1058            0 :     connect(disableVerticalSpread, &QGroupBox::clicked,         this, &EditStyle::disableVerticalSpreadClicked);
    1059            0 :     connect(headerOddEven,         &QCheckBox::toggled,         this, &EditStyle::toggleHeaderOddEven);
    1060            0 :     connect(footerOddEven,         &QCheckBox::toggled,         this, &EditStyle::toggleFooterOddEven);
    1061              : 
    1062            0 :     connect(swingOff,       &QRadioButton::toggled, this, &EditStyle::setSwingParams);
    1063            0 :     connect(swingEighth,    &QRadioButton::toggled, this, &EditStyle::setSwingParams);
    1064            0 :     connect(swingSixteenth, &QRadioButton::toggled, this, &EditStyle::setSwingParams);
    1065              : 
    1066            0 :     connect(concertPitch,        &QCheckBox::toggled, this, &EditStyle::concertPitchToggled);
    1067            0 :     connect(lyricsDashMinLength, &QDoubleSpinBox::valueChanged, this, &EditStyle::lyricsDashMinLengthValueChanged);
    1068            0 :     connect(lyricsDashMaxLength, &QDoubleSpinBox::valueChanged, this, &EditStyle::lyricsDashMaxLengthValueChanged);
    1069            0 :     connect(minSystemDistance,   &QDoubleSpinBox::valueChanged, this, &EditStyle::systemMinDistanceValueChanged);
    1070            0 :     connect(maxSystemDistance,   &QDoubleSpinBox::valueChanged, this, &EditStyle::systemMaxDistanceValueChanged);
    1071              : 
    1072              :     // ====================================================
    1073              :     // Signal Mappers
    1074              :     // ====================================================
    1075              : 
    1076            0 :     QSignalMapper* setSignalMapper = new QSignalMapper(this);     // value change signals
    1077            0 :     QSignalMapper* resetSignalMapper = new QSignalMapper(this);     // reset style signals
    1078              : 
    1079            0 :     const auto mapFunction = QOverload<>::of(&QSignalMapper::map);
    1080              : 
    1081            0 :     for (const StyleWidget& sw : styleWidgets) {
    1082            0 :         P_TYPE type = MStyle::valueType(sw.idx);
    1083              : 
    1084            0 :         if (P_TYPE::DIRECTION_V == type) {
    1085            0 :             QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    1086            0 :             if (sw.idx == StyleId::dynamicsHairpinVoiceBasedPlacement) {
    1087            0 :                 fillDynamicHairpinComboBox(cb);
    1088              :             } else {
    1089            0 :                 fillDirectionComboBox(cb);
    1090              :             }
    1091              :         }
    1092              : 
    1093            0 :         if (sw.reset) {
    1094            0 :             WidgetUtils::setWidgetIcon(sw.reset, IconCode::Code::UNDO);
    1095            0 :             connect(sw.reset, &QToolButton::clicked, resetSignalMapper, mapFunction);
    1096            0 :             resetSignalMapper->setMapping(sw.reset, static_cast<int>(sw.idx));
    1097              :         }
    1098              : 
    1099            0 :         if (auto spinBox = qobject_cast<QSpinBox*>(sw.widget)) {
    1100            0 :             connect(spinBox, &QSpinBox::valueChanged, setSignalMapper, mapFunction);
    1101            0 :         } else if (auto doubleSpinBox = qobject_cast<QDoubleSpinBox*>(sw.widget)) {
    1102            0 :             connect(doubleSpinBox, &QDoubleSpinBox::valueChanged, setSignalMapper, mapFunction);
    1103            0 :         } else if (auto fontComboBox = qobject_cast<QFontComboBox*>(sw.widget)) {
    1104            0 :             connect(fontComboBox, &QFontComboBox::currentFontChanged, setSignalMapper, mapFunction);
    1105            0 :         } else if (auto comboBox = qobject_cast<QComboBox*>(sw.widget)) {
    1106            0 :             connect(comboBox, &QComboBox::currentIndexChanged, setSignalMapper, mapFunction);
    1107            0 :         } else if (auto radioButton = qobject_cast<QRadioButton*>(sw.widget)) {
    1108            0 :             connect(radioButton, &QRadioButton::toggled, setSignalMapper, mapFunction);
    1109            0 :         } else if (auto checkBox = qobject_cast<QCheckBox*>(sw.widget)) {
    1110            0 :             connect(checkBox, &QCheckBox::checkStateChanged, setSignalMapper, mapFunction);
    1111            0 :         } else if (auto button = qobject_cast<QAbstractButton*>(sw.widget)) {
    1112            0 :             connect(button, &QAbstractButton::toggled, setSignalMapper, mapFunction);
    1113            0 :         } else if (auto groupBox = qobject_cast<QGroupBox*>(sw.widget)) {
    1114            0 :             connect(groupBox, &QGroupBox::toggled, setSignalMapper, mapFunction);
    1115            0 :         } else if (auto textEdit = qobject_cast<QTextEdit*>(sw.widget)) {
    1116            0 :             connect(textEdit, &QTextEdit::textChanged, setSignalMapper, mapFunction);
    1117            0 :         } else if (auto buttonGroup = qobject_cast<QButtonGroup*>(sw.widget)) {
    1118            0 :             connect(buttonGroup, &QButtonGroup::buttonClicked, setSignalMapper, mapFunction);
    1119            0 :         } else if (auto alignSelect = qobject_cast<AlignSelect*>(sw.widget)) {
    1120            0 :             connect(alignSelect, &AlignSelect::alignChanged, setSignalMapper, mapFunction);
    1121            0 :             connect(alignSelect, &AlignSelect::positionChanged, setSignalMapper, mapFunction);
    1122            0 :         } else if (auto offsetSelect = qobject_cast<OffsetSelect*>(sw.widget)) {
    1123            0 :             connect(offsetSelect, &OffsetSelect::offsetChanged, setSignalMapper, mapFunction);
    1124            0 :         } else if (auto fontStyle = qobject_cast<FontStyleSelect*>(sw.widget)) {
    1125            0 :             connect(fontStyle, &FontStyleSelect::fontStyleChanged, setSignalMapper, mapFunction);
    1126              :         }
    1127              : 
    1128            0 :         setSignalMapper->setMapping(sw.widget, static_cast<int>(sw.idx));
    1129              :     }
    1130              : 
    1131            0 :     connect(setSignalMapper, &QSignalMapper::mappedInt, this, &EditStyle::valueChanged);
    1132            0 :     connect(resetSignalMapper, &QSignalMapper::mappedInt, this, &EditStyle::resetStyleValue);
    1133              : 
    1134            0 :     const INotationPtr notation = projectSession()->currentNotation();
    1135            0 :     IF_ASSERT_FAILED(notation) {
    1136            0 :         return;
    1137              :     }
    1138            0 :     const Score* score = notation->elements()->msScore();
    1139            0 :     IF_ASSERT_FAILED(score) {
    1140            0 :         return;
    1141              :     }
    1142              : 
    1143            0 :     textStyles->clear();
    1144            0 :     for (TextStyleType textStyleType : editableTextStyles()) {
    1145            0 :         QListWidgetItem* item = new QListWidgetItem(score->getTextStyleUserName(textStyleType).qTranslated());
    1146            0 :         item->setData(Qt::UserRole, int(textStyleType));
    1147            0 :         textStyles->addItem(item);
    1148              :     }
    1149              : 
    1150            0 :     textStyleFrameType->clear();
    1151            0 :     textStyleFrameType->addItem(muse::qtrc("notation/editstyle", "None", "no frame for text"), int(FrameType::NO_FRAME));
    1152            0 :     textStyleFrameType->addItem(muse::qtrc("notation/editstyle", "Rectangle"), int(FrameType::RECTANGLE));
    1153            0 :     textStyleFrameType->addItem(muse::qtrc("notation/editstyle", "Circle"), int(FrameType::CIRCLE));
    1154              : 
    1155            0 :     connect(dynamicsAndHairpinPos, &QComboBox::currentIndexChanged, dynamicsAndHairpinPosDescription, [this]() {
    1156            0 :         dynamicsAndHairpinPosDescription->setVisible(dynamicsAndHairpinPos->currentIndex() == int(DirectionV::AUTO));
    1157            0 :     });
    1158            0 :     connect(dynamicsAndHairpinPos, &QComboBox::currentIndexChanged, dynamicsAndHairpinsAboveOnVocalStaves, [this]() {
    1159            0 :         dynamicsAndHairpinsAboveOnVocalStaves->setEnabled(dynamicsAndHairpinPos->currentIndex() != int(DirectionV::UP));
    1160            0 :     });
    1161              : 
    1162            0 :     WidgetUtils::setWidgetIcon(resetTextStyleName, IconCode::Code::UNDO);
    1163              : 
    1164            0 :     connect(resetTextStyleName, &QToolButton::clicked, this, &EditStyle::resetUserStyleName);
    1165            0 :     connect(styleName, &QLineEdit::textEdited, this, &EditStyle::editUserStyleName);
    1166            0 :     connect(styleName, &QLineEdit::editingFinished, this, &EditStyle::endEditUserStyleName);
    1167              : 
    1168              :     // font face
    1169            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFontFace, IconCode::Code::UNDO);
    1170            0 :     connect(resetTextStyleFontFace, &QToolButton::clicked, this, [this]() {
    1171            0 :         resetTextStyle(TextStylePropertyType::FontFace);
    1172            0 :     });
    1173            0 :     connect(textStyleFontFace, &QFontComboBox::currentFontChanged, this, [this]() {
    1174            0 :         textStyleValueChanged(TextStylePropertyType::FontFace, textStyleFontFace->currentFont().family());
    1175            0 :     });
    1176              : 
    1177              :     // font size
    1178            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFontSize, IconCode::Code::UNDO);
    1179            0 :     connect(resetTextStyleFontSize, &QToolButton::clicked, this, [this]() {
    1180            0 :         resetTextStyle(TextStylePropertyType::FontSize);
    1181            0 :     });
    1182            0 :     connect(textStyleFontSize, &QDoubleSpinBox::valueChanged, this, [this]() {
    1183            0 :         textStyleValueChanged(TextStylePropertyType::FontSize, textStyleFontSize->value());
    1184            0 :     });
    1185              : 
    1186              :     // musical symbols scale
    1187            0 :     WidgetUtils::setWidgetIcon(resetTextStyleMusicalSymbolsScale, IconCode::Code::UNDO);
    1188            0 :     connect(resetTextStyleMusicalSymbolsScale, &QToolButton::clicked, this, [this]() {
    1189            0 :         resetTextStyle(TextStylePropertyType::MusicalSymbolsScale);
    1190            0 :     });
    1191            0 :     connect(textStyleMusicalSymbolsScale, &QDoubleSpinBox::valueChanged, this, [this]() {
    1192            0 :         textStyleValueChanged(TextStylePropertyType::MusicalSymbolsScale, textStyleMusicalSymbolsScale->value());
    1193            0 :     });
    1194              : 
    1195              :     // musical symbols size
    1196            0 :     WidgetUtils::setWidgetIcon(resetTextStyleMusicalSymbolsSize, IconCode::Code::UNDO);
    1197            0 :     connect(resetTextStyleMusicalSymbolsSize, &QToolButton::clicked, this, [this]() {
    1198            0 :         resetTextStyle(TextStylePropertyType::MusicalSymbolsSize);
    1199            0 :     });
    1200            0 :     connect(textStyleMusicalSymbolsSize, &QDoubleSpinBox::valueChanged, this, [this]() {
    1201            0 :         textStyleValueChanged(TextStylePropertyType::MusicalSymbolsSize, textStyleMusicalSymbolsSize->value());
    1202            0 :     });
    1203              : 
    1204              :     // line spacing
    1205            0 :     WidgetUtils::setWidgetIcon(resetTextStyleLineSpacing, IconCode::Code::UNDO);
    1206            0 :     connect(resetTextStyleLineSpacing, &QToolButton::clicked, this, [this]() {
    1207            0 :         resetTextStyle(TextStylePropertyType::LineSpacing);
    1208            0 :     });
    1209            0 :     connect(textStyleLineSpacing, &QDoubleSpinBox::valueChanged, this, [this]() {
    1210            0 :         textStyleValueChanged(TextStylePropertyType::LineSpacing, textStyleLineSpacing->value());
    1211            0 :     });
    1212              : 
    1213              :     // font style
    1214            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFontStyle, IconCode::Code::UNDO);
    1215            0 :     connect(resetTextStyleFontStyle, &QToolButton::clicked, this, [this]() {
    1216            0 :         resetTextStyle(TextStylePropertyType::FontStyle);
    1217            0 :     });
    1218            0 :     connect(textStyleFontStyle, &FontStyleSelect::fontStyleChanged, this, [this]() {
    1219            0 :         textStyleValueChanged(TextStylePropertyType::FontStyle, int(textStyleFontStyle->fontStyle()));
    1220            0 :     });
    1221              : 
    1222              :     // align
    1223            0 :     WidgetUtils::setWidgetIcon(resetTextStyleAlign, IconCode::Code::UNDO);
    1224            0 :     connect(resetTextStyleAlign, &QToolButton::clicked, this, [this]() {
    1225            0 :         resetTextStyle(TextStylePropertyType::TextAlign);
    1226            0 :         resetTextStyle(TextStylePropertyType::Position);
    1227            0 :     });
    1228            0 :     connect(textStyleAlign, &AlignSelect::alignChanged, this, [this]() {
    1229            0 :         textStyleValueChanged(TextStylePropertyType::TextAlign, textStyleAlign->align());
    1230            0 :     });
    1231              : 
    1232            0 :     connect(textStyleAlign, &AlignSelect::positionChanged, this, [this]() {
    1233            0 :         textStyleValueChanged(TextStylePropertyType::Position, textStyleAlign->position());
    1234            0 :     });
    1235              : 
    1236              :     // offset
    1237            0 :     WidgetUtils::setWidgetIcon(resetTextStyleOffset, IconCode::Code::UNDO);
    1238            0 :     connect(resetTextStyleOffset, &QToolButton::clicked, this, [this]() {
    1239            0 :         resetTextStyle(TextStylePropertyType::Offset);
    1240            0 :     });
    1241            0 :     connect(textStyleOffset, &OffsetSelect::offsetChanged, this, [this]() {
    1242            0 :         textStyleValueChanged(TextStylePropertyType::Offset, textStyleOffset->offset());
    1243            0 :     });
    1244              : 
    1245              :     // spatium dependent
    1246            0 :     WidgetUtils::setWidgetIcon(resetTextStyleSpatiumDependent, IconCode::Code::UNDO);
    1247            0 :     connect(resetTextStyleSpatiumDependent, &QToolButton::clicked, this, [this]() {
    1248            0 :         resetTextStyle(TextStylePropertyType::SizeSpatiumDependent);
    1249            0 :     });
    1250            0 :     connect(textStyleSpatiumDependent, &QCheckBox::toggled, this, [this]() {
    1251            0 :         textStyleValueChanged(TextStylePropertyType::SizeSpatiumDependent, textStyleSpatiumDependent->isChecked());
    1252            0 :     });
    1253              : 
    1254            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFrameType, IconCode::Code::UNDO);
    1255            0 :     connect(resetTextStyleFrameType, &QToolButton::clicked, this, [this]() {
    1256            0 :         resetTextStyle(TextStylePropertyType::FrameType);
    1257            0 :     });
    1258            0 :     connect(textStyleFrameType, &QComboBox::currentIndexChanged, this, [this]() {
    1259            0 :         textStyleValueChanged(TextStylePropertyType::FrameType, textStyleFrameType->currentIndex());
    1260            0 :     });
    1261              : 
    1262            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFramePadding, IconCode::Code::UNDO);
    1263            0 :     connect(resetTextStyleFramePadding, &QToolButton::clicked, this, [this]() {
    1264            0 :         resetTextStyle(TextStylePropertyType::FramePadding);
    1265            0 :     });
    1266            0 :     connect(textStyleFramePadding, &QDoubleSpinBox::valueChanged, this, [this]() {
    1267            0 :         textStyleValueChanged(TextStylePropertyType::FramePadding, textStyleFramePadding->value());
    1268            0 :     });
    1269              : 
    1270            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFrameBorder, IconCode::Code::UNDO);
    1271            0 :     connect(resetTextStyleFrameBorder, &QToolButton::clicked, this, [this]() {
    1272            0 :         resetTextStyle(TextStylePropertyType::FrameWidth);
    1273            0 :     });
    1274            0 :     connect(textStyleFrameBorder, &QDoubleSpinBox::valueChanged, this, [this]() {
    1275            0 :         textStyleValueChanged(TextStylePropertyType::FrameWidth, textStyleFrameBorder->value());
    1276            0 :     });
    1277              : 
    1278            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFrameBorderRadius, IconCode::Code::UNDO);
    1279            0 :     connect(resetTextStyleFrameBorderRadius, &QToolButton::clicked, this, [this]() {
    1280            0 :         resetTextStyle(TextStylePropertyType::FrameRound);
    1281            0 :     });
    1282            0 :     connect(textStyleFrameBorderRadius, &QDoubleSpinBox::valueChanged, this, [this]() {
    1283            0 :         textStyleValueChanged(TextStylePropertyType::FrameRound, textStyleFrameBorderRadius->value());
    1284            0 :     });
    1285              : 
    1286            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFrameForeground, IconCode::Code::UNDO);
    1287            0 :     connect(resetTextStyleFrameForeground, &QToolButton::clicked, this, [this]() {
    1288            0 :         resetTextStyle(TextStylePropertyType::FrameBorderColor);
    1289            0 :     });
    1290            0 :     connect(textStyleFrameForeground, &Awl::ColorLabel::colorChanged, this, [this]() {
    1291            0 :         textStyleValueChanged(TextStylePropertyType::FrameBorderColor, Color::fromQColor(textStyleFrameForeground->color()));
    1292            0 :     });
    1293              : 
    1294            0 :     WidgetUtils::setWidgetIcon(resetTextStyleFrameBackground, IconCode::Code::UNDO);
    1295            0 :     connect(resetTextStyleFrameBackground, &QToolButton::clicked, this, [this]() {
    1296            0 :         resetTextStyle(TextStylePropertyType::FrameFillColor);
    1297            0 :     });
    1298            0 :     connect(textStyleFrameBackground, &Awl::ColorLabel::colorChanged, this, [this]() {
    1299            0 :         textStyleValueChanged(TextStylePropertyType::FrameFillColor, Color::fromQColor(textStyleFrameBackground->color()));
    1300            0 :     });
    1301              : 
    1302            0 :     WidgetUtils::setWidgetIcon(resetTextStyleColor, IconCode::Code::UNDO);
    1303            0 :     connect(resetTextStyleColor, &QToolButton::clicked, this, [this]() {
    1304            0 :         resetTextStyle(TextStylePropertyType::Color);
    1305            0 :     });
    1306            0 :     connect(textStyleColor, &Awl::ColorLabel::colorChanged, this, [this]() {
    1307            0 :         textStyleValueChanged(TextStylePropertyType::Color, Color::fromQColor(textStyleColor->color()));
    1308            0 :     });
    1309              : 
    1310            0 :     connect(textStyles, &QListWidget::currentRowChanged, this, &EditStyle::textStyleChanged);
    1311            0 :     textStyles->setCurrentRow(notation->viewState()->styleDialogLastSubPageIndex());
    1312              : 
    1313            0 :     connect(pageList, &QListWidget::currentRowChanged, pageStack, &QStackedWidget::setCurrentIndex);
    1314            0 :     connect(pageList, &QListWidget::currentRowChanged, this, &EditStyle::on_pageRowSelectionChanged);
    1315            0 :     pageList->setCurrentRow(notation->viewState()->styleDialogLastPageIndex());
    1316              : 
    1317            0 :     editLyricsTextStyleButton->setChecked(false);
    1318            0 :     connect(editLyricsTextStyleButton, &QPushButton::clicked, pageList, [this](){
    1319            0 :         pageList->setCurrentRow(ALL_PAGE_CODES.indexOf("text-styles"));
    1320            0 :     });
    1321            0 :     connect(editLyricsTextStyleButton, &QPushButton::clicked, textStyles, [this](){
    1322            0 :         textStyles->setCurrentRow(ALL_TEXT_STYLE_SUBPAGE_CODES.indexOf("lyrics-odd-lines"));
    1323            0 :     });
    1324              : 
    1325            0 :     connect(resetLyricsMaxDashCount, &QCheckBox::clicked, this, [this] () {
    1326            0 :         resetStyleValue(int(StyleId::lyricsLimitDashCount));
    1327            0 :         resetStyleValue(int(StyleId::lyricsMaxDashCount));
    1328            0 :     });
    1329              : 
    1330            0 :     editGroupBracketTextStyleLink->setChecked(false);
    1331            0 :     connect(editGroupBracketTextStyleLink, &QPushButton::clicked, pageList, [this](){
    1332            0 :         pageList->setCurrentRow(ALL_PAGE_CODES.indexOf("text-styles"));
    1333            0 :     });
    1334            0 :     connect(editGroupBracketTextStyleLink, &QPushButton::clicked, textStyles, [this](){
    1335            0 :         textStyles->setCurrentRow(ALL_TEXT_STYLE_SUBPAGE_CODES.indexOf("group-bracket"));
    1336            0 :     });
    1337              : 
    1338            0 :     adjustPagesStackSize(0);
    1339              : 
    1340              :     // Consistency checks
    1341            0 :     qDebug() << "codes size:" << ALL_PAGE_CODES.size() << "pageList count:" << pageList->count();
    1342            0 :     assert(ALL_PAGE_CODES.size() == pageList->count());
    1343            0 :     assert(ALL_TEXT_STYLE_SUBPAGE_CODES.size() == textStyles->count());
    1344            0 : }
    1345              : 
    1346              : //---------------------------------------------------------
    1347              : //   showEvent
    1348              : //---------------------------------------------------------
    1349              : 
    1350            0 : void EditStyle::showEvent(QShowEvent* ev)
    1351              : {
    1352            0 :     setValues();
    1353            0 :     pageList->setFocus();
    1354            0 :     projectSession()->currentNotation()->undoStack()->prepareChanges(muse::TranslatableString("undoableAction", "Edit style"));
    1355            0 :     buttonApplyToAllParts->setEnabled(projectSession()->currentNotation()->style()->canApplyToAllParts());
    1356              : 
    1357            0 :     WidgetStateStore::restoreGeometry(this);
    1358            0 :     QWidget::showEvent(ev);
    1359            0 : }
    1360              : 
    1361              : //---------------------------------------------------------
    1362              : //   hideEvent
    1363              : //---------------------------------------------------------
    1364              : 
    1365            0 : void EditStyle::hideEvent(QHideEvent* ev)
    1366              : {
    1367            0 :     WidgetStateStore::saveGeometry(this);
    1368            0 :     QWidget::hideEvent(ev);
    1369            0 : }
    1370              : 
    1371              : //---------------------------------------------------------
    1372              : //   changeEvent
    1373              : //---------------------------------------------------------
    1374              : 
    1375            0 : void EditStyle::changeEvent(QEvent* event)
    1376              : {
    1377            0 :     QDialog::changeEvent(event);
    1378            0 :     if (event->type() == QEvent::LanguageChange) {
    1379            0 :         retranslate();
    1380              :     }
    1381            0 : }
    1382              : 
    1383              : //---------------------------------------------------------
    1384              : //   retranslate
    1385              : ///   NOTE: keep in sync with constructor.
    1386              : //---------------------------------------------------------
    1387              : 
    1388            0 : void EditStyle::retranslate()
    1389              : {
    1390            0 :     retranslateUi(this);
    1391              : 
    1392            0 :     buttonApplyToAllParts->setText(muse::qtrc("notation/editstyle", "Apply to all parts"));
    1393              : 
    1394            0 :     for (const LineStyleSelect* lineStyleSelect : m_lineStyleSelects) {
    1395            0 :         int idx = 0;
    1396            0 :         for (const muse::TranslatableString& lineStyle : lineStyles) {
    1397            0 :             lineStyleSelect->lineStyleComboBox->setItemText(idx, lineStyle.qTranslated());
    1398            0 :             ++idx;
    1399              :         }
    1400              :     }
    1401              : 
    1402            0 :     for (QComboBox* cb : verticalPlacementComboBoxes) {
    1403            0 :         cb->setItemText(0, muse::qtrc("notation/editstyle", "Above"));
    1404            0 :         cb->setItemText(1, muse::qtrc("notation/editstyle", "Below"));
    1405              :     }
    1406              : 
    1407            0 :     tupletNumberType->setItemText(0, muse::qtrc("notation/editstyle", "Number"));
    1408            0 :     tupletNumberType->setItemText(1, muse::qtrc("notation/editstyle", "Ratio"));
    1409            0 :     tupletNumberType->setItemText(2, muse::qtrc("notation/editstyle", "None", "no tuplet number type"));
    1410              : 
    1411            0 :     tupletBracketType->setItemText(0, muse::qtrc("notation/editstyle", "Automatic"));
    1412            0 :     tupletBracketType->setItemText(1, muse::qtrc("notation/editstyle", "Bracket"));
    1413            0 :     tupletBracketType->setItemText(2, muse::qtrc("notation/editstyle", "None", "no tuplet bracket type"));
    1414              : 
    1415              :     // voicingSelectWidget->interpretBox->setItemText(0, muse::qtrc("notation/editstyle", "Jazz"));
    1416              :     // voicingSelectWidget->interpretBox->setItemText(1, muse::qtrc("notation/editstyle", "Literal"));
    1417              : 
    1418              :     // voicingSelectWidget->voicingBox->setItemText(0, muse::qtrc("notation/editstyle", "Automatic"));
    1419              :     // voicingSelectWidget->voicingBox->setItemText(1, muse::qtrc("notation/editstyle", "Root only"));
    1420              :     // voicingSelectWidget->voicingBox->setItemText(2, muse::qtrc("notation/editstyle", "Close"));
    1421              :     // voicingSelectWidget->voicingBox->setItemText(3, muse::qtrc("notation/editstyle", "Drop two"));
    1422              :     // voicingSelectWidget->voicingBox->setItemText(4, muse::qtrc("notation/editstyle", "Six note"));
    1423              :     // voicingSelectWidget->voicingBox->setItemText(5, muse::qtrc("notation/editstyle", "Four note"));
    1424              :     // voicingSelectWidget->voicingBox->setItemText(6, muse::qtrc("notation/editstyle", "Three note"));
    1425              : 
    1426              :     // voicingSelectWidget->durationBox->setItemText(0, muse::qtrc("notation/editstyle", "Until next chord symbol"));
    1427              :     // voicingSelectWidget->durationBox->setItemText(1, muse::qtrc("notation/editstyle", "Until end of measure"));
    1428              :     // voicingSelectWidget->durationBox->setItemText(2, muse::qtrc("notation/editstyle", "Chord/rest duration"));
    1429              : 
    1430            0 :     setHeaderFooterMacroInfoText();
    1431              : 
    1432            0 :     Score* score = projectSession()->currentNotation()->elements()->msScore();
    1433              : 
    1434            0 :     int idx = 0;
    1435            0 :     for (TextStyleType textStyleType : allTextStyles()) {
    1436            0 :         textStyles->item(idx)->setText(score->getTextStyleUserName(textStyleType).qTranslated());
    1437            0 :         ++idx;
    1438              :     }
    1439              : 
    1440            0 :     textStyleFrameType->setItemText(0, muse::qtrc("notation/editstyle", "None", "no frame for text"));
    1441            0 :     textStyleFrameType->setItemText(1, muse::qtrc("notation/editstyle", "Rectangle"));
    1442            0 :     textStyleFrameType->setItemText(2, muse::qtrc("notation/editstyle", "Circle"));
    1443            0 : }
    1444              : 
    1445              : //---------------------------------------------------------
    1446              : //   setHeaderFooterMacroInfoText
    1447              : //---------------------------------------------------------
    1448              : 
    1449            0 : void EditStyle::setHeaderFooterMacroInfoText()
    1450              : {
    1451              :     using namespace Qt::Literals::StringLiterals;
    1452              : 
    1453              :     // keep in sync with implementation in Page::replaceTextMacros (page.cpp)
    1454              :     // jumping thru hoops here to make the job of translators easier, yet have a nice display
    1455              :     QString toolTipHeaderFooter
    1456            0 :         = "<html><head></head><body><p><b>"_L1
    1457            0 :           % muse::qtrc("notation/editstyle", "Using variables in the header/footer")
    1458            0 :           % "</b><br/>"_L1
    1459            0 :           % muse::qtrc("notation/editstyle",
    1460            0 :                        "Type these special character combinations in the fields above to reference document data in the header/footer.")
    1461            0 :           % "<br/></p><table><tr><td>$p</td><td width=\"12\"/><td><i>"_L1
    1462            0 :           % muse::qtrc("notation/editstyle", "Page number, except on first page")
    1463            0 :           % "</i></td></tr><tr><td>$N</td><td width=\"12\"/><td><i>"_L1
    1464            0 :           % muse::qtrc("notation/editstyle", "Page number, if there is more than one page")
    1465            0 :           % "</i></td></tr><tr><td>$P</td><td width=\"12\"/><td><i>"_L1
    1466            0 :           % muse::qtrc("notation/editstyle", "Page number, on all pages")
    1467            0 :           % "</i></td></tr><tr><td>$n</td><td width=\"12\"/><td><i>"_L1
    1468            0 :           % muse::qtrc("notation/editstyle", "Number of pages")
    1469            0 :           % "</i></td></tr><tr><td>$f</td><td width=\"12\"/><td><i>"_L1
    1470            0 :           % muse::qtrc("notation/editstyle", "File name")
    1471            0 :           % "</i></td></tr><tr><td>$F</td><td width=\"12\"/><td><i>"_L1
    1472            0 :           % muse::qtrc("notation/editstyle", "File path+name")
    1473            0 :           % "</i></td></tr><tr><td>$i</td><td width=\"12\"/><td><i>"_L1
    1474            0 :           % muse::qtrc("notation/editstyle", "Part name, except on first page")
    1475            0 :           % "</i></td></tr><tr><td>$I</td><td width=\"12\"/><td><i>"_L1
    1476            0 :           % muse::qtrc("notation/editstyle", "Part name, on all pages")
    1477            0 :           % "</i></td></tr><tr><td>$d</td><td width=\"12\"/><td><i>"_L1
    1478            0 :           % muse::qtrc("notation/editstyle", "Current date")
    1479            0 :           % "</i></td></tr><tr><td>$D</td><td width=\"12\"/><td><i>"_L1
    1480            0 :           % muse::qtrc("notation/editstyle", "Creation date")
    1481            0 :           % "</i></td></tr><tr><td>$m</td><td width=\"12\"/><td><i>"_L1
    1482            0 :           % muse::qtrc("notation/editstyle", "Last modification time")
    1483            0 :           % "</i></td></tr><tr><td>$M</td><td width=\"12\"/><td><i>"_L1
    1484            0 :           % muse::qtrc("notation/editstyle", "Last modification date")
    1485            0 :           % "</i></td></tr><tr><td>$C</td><td width=\"12\"/><td><i>"_L1
    1486            0 :           % muse::qtrc("notation/editstyle", "Copyright, on first page only")
    1487            0 :           % "</i></td></tr><tr><td>$c</td><td width=\"12\"/><td><i>"_L1
    1488            0 :           % muse::qtrc("notation/editstyle", "Copyright, on all pages")
    1489            0 :           % "</i></td></tr><tr><td>$v</td><td width=\"12\"/><td><i>"_L1
    1490            0 :           % muse::qtrc("notation/editstyle", "MuseScore Studio version this score was last saved with")
    1491            0 :           % "</i></td></tr><tr><td>$r</td><td width=\"12\"/><td><i>"_L1
    1492            0 :           % muse::qtrc("notation/editstyle", "MuseScore Studio revision this score was last saved with")
    1493            0 :           % "</i></td></tr><tr><td>$$</td><td width=\"12\"/><td><i>"_L1
    1494            0 :           % muse::qtrc("notation/editstyle", "The $ sign itself")
    1495            0 :           % "</i></td></tr></table><p>"_L1
    1496            0 :           % muse::qtrc("notation/editstyle", "<b>Metadata tags and current values</b> (configured in <b>File > Project properties…</b>)")
    1497            0 :           % "<br>"_L1
    1498            0 :           % muse::qtrc("notation/editstyle",
    1499            0 :                        "Type $:tag: into a field above, replacing the word ‘tag’ with one of the labels below. Its associated metadata will be shown on your score.")
    1500            0 :           % "<br/></p><table>"_L1;
    1501              : 
    1502              :     // show all tags for current score/part
    1503            0 :     Score* score = projectSession()->currentNotation()->elements()->msScore();
    1504            0 :     if (!score->isMaster()) {
    1505            0 :         for (const auto& tag : score->masterScore()->metaTags()) {
    1506            0 :             toolTipHeaderFooter += "<tr><td>%1</td><td width=\"12\"/><td><i>%2</i></td></tr>"_L1
    1507            0 :                                    .arg(tag.first, tag.second.empty() ? u"-"_s : tag.second.toQString());
    1508              :         }
    1509              :     }
    1510            0 :     for (const auto& tag : score->metaTags()) {
    1511            0 :         toolTipHeaderFooter += "<tr><td>%1</td><td width=\"12\"/><td><i>%2</i></td></tr>"_L1
    1512            0 :                                .arg(tag.first, tag.second.empty() ? u"-"_s : tag.second.toQString());
    1513              :     }
    1514              : 
    1515            0 :     toolTipHeaderFooter += "</table></body></html>"_L1;
    1516              : 
    1517            0 :     headerFooterMacroInfo->setText(toolTipHeaderFooter);
    1518            0 : }
    1519              : 
    1520              : //---------------------------------------------------------
    1521              : //   adjustPagesStackSize
    1522              : //---------------------------------------------------------
    1523              : 
    1524            0 : void EditStyle::adjustPagesStackSize(int currentPageIndex)
    1525              : {
    1526            0 :     QSize preferredSize = pageStack->widget(currentPageIndex)->sizeHint();
    1527            0 :     pageStack->setMinimumSize(preferredSize);
    1528              : 
    1529            0 :     connect(pageStack, &QStackedWidget::currentChanged, this, [this](int currentIndex) {
    1530            0 :         QWidget* currentPage = pageStack->widget(currentIndex);
    1531            0 :         if (!currentPage) {
    1532            0 :             return;
    1533              :         }
    1534            0 :         pageStack->setMinimumSize(currentPage->sizeHint());
    1535              :     });
    1536            0 : }
    1537              : 
    1538            0 : EditStyle::WidgetAndView EditStyle::createQmlWidget(QWidget* parent, const QUrl& source)
    1539              : {
    1540            0 :     QQuickView* view = new QQuickView(uiEngine()->qmlEngine(), nullptr);
    1541            0 :     view->setResizeMode(QQuickView::SizeRootObjectToView);
    1542              : 
    1543            0 :     connect(view, &QQuickView::statusChanged, view, [source, view](QQuickView::Status status) {
    1544            0 :         if (status == QQuickView::Error) {
    1545            0 :             LOGE() << "Errors while loading QML file from " << source << ":";
    1546              : 
    1547            0 :             for (const QQmlError& error : view->errors()) {
    1548            0 :                 LOGE() << error.toString();
    1549            0 :             }
    1550              :         }
    1551            0 :     });
    1552              : 
    1553            0 :     connect(view, &QQuickView::sceneGraphError, view, [source](QQuickWindow::SceneGraphError error, const QString& message) {
    1554            0 :         LOGE() << "Scene graph error in QML file from " << source << ": [" << error << "] " << message;
    1555            0 :     });
    1556              : 
    1557            0 :     QString bgColorStr = uiConfiguration()->currentTheme().values.value(muse::ui::BACKGROUND_PRIMARY_COLOR).toString();
    1558            0 :     view->setColor(QColor(bgColorStr));
    1559              : 
    1560            0 :     view->setSource(source);
    1561              : 
    1562            0 :     QWidget* container = QWidget::createWindowContainer(view, parent);
    1563            0 :     container->setMinimumSize(view->rootObject()->implicitWidth(), view->rootObject()->implicitHeight());
    1564            0 :     container->setFocusPolicy(Qt::TabFocus);
    1565              : 
    1566            0 :     return { container, view };
    1567            0 : }
    1568              : 
    1569            0 : QString EditStyle::currentPageCode() const
    1570              : {
    1571            0 :     return m_currentPageCode;
    1572              : }
    1573              : 
    1574            0 : QString EditStyle::currentSubPageCode() const
    1575              : {
    1576            0 :     return m_currentSubPageCode;
    1577              : }
    1578              : 
    1579            0 : void EditStyle::setCurrentPageCode(const QString& code)
    1580              : {
    1581            0 :     if (m_currentPageCode == code) {
    1582            0 :         return;
    1583              :     }
    1584              : 
    1585            0 :     int index = ALL_PAGE_CODES.indexOf(code);
    1586            0 :     IF_ASSERT_FAILED(index >= 0) {
    1587            0 :         return;
    1588              :     }
    1589              : 
    1590            0 :     pageList->setCurrentRow(index);
    1591              : 
    1592            0 :     m_currentPageCode = code;
    1593            0 :     emit currentPageChanged();
    1594              : }
    1595              : 
    1596            0 : void EditStyle::setCurrentSubPageCode(const QString& code)
    1597              : {
    1598            0 :     if (m_currentSubPageCode == code) {
    1599            0 :         return;
    1600              :     }
    1601              : 
    1602            0 :     IF_ASSERT_FAILED(m_currentPageCode == "text-styles") {
    1603            0 :         return;
    1604              :     }
    1605              : 
    1606            0 :     int index = ALL_TEXT_STYLE_SUBPAGE_CODES.indexOf(code);
    1607            0 :     IF_ASSERT_FAILED(index >= 0) {
    1608            0 :         return;
    1609              :     }
    1610              : 
    1611            0 :     textStyles->setCurrentRow(index);
    1612              : 
    1613            0 :     m_currentSubPageCode = code;
    1614            0 :     emit currentSubPageChanged();
    1615              : }
    1616              : 
    1617            0 : void EditStyle::goToTextStylePage(const QString& code)
    1618              : {
    1619            0 :     int index = ALL_PAGE_CODES.indexOf("text-styles");
    1620              : 
    1621            0 :     int subIndex = ALL_TEXT_STYLE_SUBPAGE_CODES.indexOf(code);
    1622            0 :     IF_ASSERT_FAILED(index >= 0) {
    1623            0 :         return;
    1624              :     }
    1625              : 
    1626            0 :     pageList->setCurrentRow(index);
    1627            0 :     m_currentPageCode = "text-styles";
    1628              : 
    1629            0 :     textStyles->setCurrentRow(subIndex);
    1630            0 :     m_currentSubPageCode = code;
    1631              : 
    1632            0 :     emit currentPageChanged();
    1633            0 :     emit currentSubPageChanged();
    1634              : }
    1635              : 
    1636            0 : void EditStyle::goToTextStylePage(int index)
    1637              : {
    1638            0 :     pageList->setCurrentRow(ALL_PAGE_CODES.indexOf("text-styles"));
    1639            0 :     m_currentPageCode = "text-styles";
    1640              : 
    1641            0 :     textStyles->setCurrentRow(index);
    1642            0 :     m_currentSubPageCode = ALL_TEXT_STYLE_SUBPAGE_CODES[index];
    1643              : 
    1644            0 :     emit currentPageChanged();
    1645            0 :     emit currentSubPageChanged();
    1646            0 : }
    1647              : 
    1648              : //---------------------------------------------------------
    1649              : //   keyPressEvent
    1650              : //---------------------------------------------------------
    1651              : 
    1652            0 : void EditStyle::keyPressEvent(QKeyEvent* event)
    1653              : {
    1654            0 :     if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
    1655            0 :         return;
    1656              :     }
    1657            0 :     QDialog::keyPressEvent(event);
    1658              : }
    1659              : 
    1660              : //---------------------------------------------------------
    1661              : //   buttonClicked
    1662              : //---------------------------------------------------------
    1663              : 
    1664            0 : void EditStyle::buttonClicked(QAbstractButton* b)
    1665              : {
    1666            0 :     switch (buttonBox->standardButton(b)) {
    1667            0 :     case QDialogButtonBox::Ok:
    1668            0 :         accept();
    1669            0 :         break;
    1670            0 :     case QDialogButtonBox::Cancel:
    1671            0 :         reject();
    1672            0 :         break;
    1673            0 :     default:
    1674            0 :         if (b == buttonApplyToAllParts) {
    1675            0 :             projectSession()->currentNotation()->style()->applyToAllParts();
    1676              :         }
    1677            0 :         break;
    1678              :     }
    1679            0 : }
    1680              : 
    1681              : //---------------------------------------------------------
    1682              : //   accept
    1683              : //---------------------------------------------------------
    1684              : 
    1685            0 : void EditStyle::accept()
    1686              : {
    1687            0 :     projectSession()->currentNotation()->undoStack()->commitChanges();
    1688            0 :     projectSession()->currentNotation()->style()->styleChanged().notify();
    1689              : 
    1690            0 :     QDialog::accept();
    1691            0 : }
    1692              : 
    1693              : //---------------------------------------------------------
    1694              : //   reject
    1695              : //---------------------------------------------------------
    1696              : 
    1697            0 : void EditStyle::reject()
    1698              : {
    1699            0 :     projectSession()->currentNotation()->undoStack()->rollbackChanges();
    1700            0 :     projectSession()->currentNotation()->style()->styleChanged().notify();
    1701              : 
    1702            0 :     QDialog::reject();
    1703            0 : }
    1704              : 
    1705              : //---------------------------------------------------------
    1706              : //   On comboFBFont currentIndex changed
    1707              : //---------------------------------------------------------
    1708              : 
    1709            0 : void EditStyle::on_comboFBFont_currentIndexChanged(int index)
    1710              : {
    1711              :     qreal size, lineHeight;
    1712              : 
    1713            0 :     if (FiguredBass::fontData(index, 0, 0, &size, &lineHeight)) {
    1714            0 :         doubleSpinFBSize->setValue(size);
    1715            0 :         spinFBLineHeight->setValue(static_cast<int>(lineHeight * 100.0));
    1716              :     }
    1717            0 : }
    1718              : 
    1719              : //---------------------------------------------------------
    1720              : //    On buttonTogglePagelist clicked
    1721              : //---------------------------------------------------------
    1722              : 
    1723            0 : void EditStyle::on_buttonTogglePagelist_clicked()
    1724              : {
    1725            0 :     bool isVis = !pageList->isVisible();   // toggle it
    1726              : 
    1727            0 :     pageList->setVisible(isVis);
    1728            0 :     WidgetUtils::setWidgetIcon(buttonTogglePagelist, isVis ? IconCode::Code::ARROW_RIGHT : IconCode::Code::ARROW_LEFT);
    1729            0 : }
    1730              : 
    1731              : //---------------------------------------------------------
    1732              : //    On resetStylesButton clicked
    1733              : //---------------------------------------------------------
    1734              : 
    1735            0 : void EditStyle::on_resetStylesButton_clicked()
    1736              : {
    1737              :     StyleIdSet dontResetTheseStyles {
    1738              :         Sid::pageWidth,
    1739              :         Sid::pageHeight,
    1740              :         Sid::pagePrintableWidth,
    1741              :         Sid::pageEvenTopMargin,
    1742              :         Sid::pageEvenBottomMargin,
    1743              :         Sid::pageEvenLeftMargin,
    1744              :         Sid::pageOddTopMargin,
    1745              :         Sid::pageOddBottomMargin,
    1746              :         Sid::pageOddLeftMargin,
    1747              :         Sid::pageTwosided,
    1748              :         Sid::spatium,
    1749              :         Sid::concertPitch,
    1750              :         Sid::createMultiMeasureRests
    1751            0 :     };
    1752              : 
    1753            0 :     projectSession()->currentNotation()->style()->resetAllStyleValues(dontResetTheseStyles);
    1754            0 :     setValues();
    1755            0 : }
    1756              : 
    1757              : //---------------------------------------------------------
    1758              : //    On pageRowSelectionChanged
    1759              : //---------------------------------------------------------
    1760              : 
    1761            0 : void EditStyle::on_pageRowSelectionChanged()
    1762              : {
    1763            0 :     IF_ASSERT_FAILED(projectSession()->currentNotation()) {
    1764            0 :         return;
    1765              :     }
    1766            0 :     projectSession()->currentNotation()->viewState()->setStyleDialogLastPageIndex(pageList->currentRow());
    1767              : }
    1768              : 
    1769              : //---------------------------------------------------------
    1770              : //   unhandledType
    1771              : //---------------------------------------------------------
    1772              : 
    1773            0 : void EditStyle::unhandledType(const StyleWidget sw)
    1774              : {
    1775            0 :     P_TYPE type = MStyle::valueType(sw.idx);
    1776            0 :     ASSERT_X(QString::asprintf("%d <%s>: widget: %s\n", int(type), MStyle::valueName(sw.idx),
    1777              :                                sw.widget->metaObject()->className()));
    1778              : }
    1779              : 
    1780            0 : bool EditStyle::isBoolStyleRepresentedByButtonGroup(StyleId id)
    1781              : {
    1782            0 :     switch (id) {
    1783            0 :     case StyleId::articulationKeepTogether:
    1784              :     case StyleId::trillAlwaysShowCueNote:
    1785              :     case StyleId::genClef:
    1786              :     case StyleId::genKeysig:
    1787              :     case StyleId::singleMeasureMMRestUseNormalRest:
    1788              :     case StyleId::mmRestConstantWidth:
    1789              :     case StyleId::angleHangingSlursAwayFromStaff:
    1790              :     case StyleId::dividerLeftAlignToSystemBarline:
    1791              :     case StyleId::dividerRightAlignToSystemBarline:
    1792            0 :         return true;
    1793            0 :     default:
    1794            0 :         return false;
    1795              :     }
    1796              : }
    1797              : 
    1798              : //---------------------------------------------------------
    1799              : //   getValue
    1800              : //    return current gui value
    1801              : //---------------------------------------------------------
    1802              : 
    1803            0 : PropertyValue EditStyle::getValue(StyleId idx)
    1804              : {
    1805            0 :     const StyleWidget& sw = styleWidget(idx);
    1806            0 :     P_TYPE type = MStyle::valueType(idx);
    1807            0 :     switch (type) {
    1808            0 :     case P_TYPE::SPATIUM: {
    1809            0 :         QDoubleSpinBox* sb = qobject_cast<QDoubleSpinBox*>(sw.widget);
    1810            0 :         if (idx == StyleId::mmRestNumberPos) {
    1811              :             // Displayed: positive = up, negative = down
    1812              :             // Internal:  negative = up, positive = down
    1813            0 :             return Spatium(OffsetUtils::flipSign(sb->value()));
    1814              :         }
    1815            0 :         return Spatium(sb->value() * (sw.showPercent ? 0.01 : 1.0));
    1816              :     } break;
    1817            0 :     case P_TYPE::REAL: {
    1818            0 :         QVariant v = sw.widget->property("value");
    1819            0 :         if (!v.isValid()) {
    1820            0 :             unhandledType(sw);
    1821            0 :             return PropertyValue();
    1822              :         }
    1823            0 :         qreal value = v.toReal();
    1824            0 :         if (sw.showPercent) {
    1825            0 :             value = value * 0.01;
    1826              :         }
    1827            0 :         if (idx == StyleId::figuredBassYOffset) {
    1828              :             // Displayed: positive = up, negative = down
    1829              :             // Internal:  negative = up, positive = down
    1830            0 :             value = OffsetUtils::flipSign(value);
    1831              :         }
    1832            0 :         return value;
    1833            0 :     } break;
    1834            0 :     case P_TYPE::BOOL: {
    1835            0 :         QVariant v;
    1836            0 :         if (sw.idx == StyleId::harmonyVoiceLiteral) { // special case for bool represented by a two-item combobox
    1837            0 :             QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    1838            0 :             v = cb->currentIndex();
    1839            0 :         } else if (isBoolStyleRepresentedByButtonGroup(idx)) { // special case for bool represented by a two-item buttonGroup
    1840            0 :             QButtonGroup* bg = qobject_cast<QButtonGroup*>(sw.widget);
    1841            0 :             v = bool(bg->checkedId());
    1842            0 :         } else if (sw.idx == StyleId::lyricsDashForce || sw.idx == StyleId::lyricsMelismaForce) { // special case where UI is presented with opposite wording
    1843            0 :             v = sw.widget->property("checked");
    1844            0 :             return !v.toBool();
    1845              :         } else {
    1846            0 :             v = sw.widget->property("checked");
    1847            0 :             if (!v.isValid()) {
    1848            0 :                 unhandledType(sw);
    1849            0 :                 return PropertyValue();
    1850              :             }
    1851              :         }
    1852            0 :         return v.toBool();
    1853            0 :     } break;
    1854            0 :     case P_TYPE::PLACEMENT_H:
    1855              :     case P_TYPE::PLACEMENT_V:
    1856              :     case P_TYPE::DIRECTION_H:
    1857              :     case P_TYPE::ORIENTATION:
    1858              :     case P_TYPE::LINE_TYPE:
    1859              :     case P_TYPE::TIMESIG_PLACEMENT:
    1860              :     case P_TYPE::TIMESIG_STYLE:
    1861              :     case P_TYPE::TIMESIG_MARGIN:
    1862              :     case P_TYPE::INT: {
    1863            0 :         if (sw.idx == StyleId::lyricsStackingOrder) { // special case for enum represented by a checkbox
    1864            0 :             return int(sw.widget->property("checked").toBool()
    1865              :                        ? LyricsStackingOrder::LYRICS_AFTER_PEDALS
    1866            0 :                        : LyricsStackingOrder::LYRICS_BEFORE_DYNAMICS);
    1867            0 :         } else if (qobject_cast<QComboBox*>(sw.widget)) {
    1868            0 :             QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    1869            0 :             return cb->currentData().toInt();
    1870            0 :         } else if (qobject_cast<QSpinBox*>(sw.widget)) {
    1871            0 :             return qobject_cast<QSpinBox*>(sw.widget)->value() / (sw.showPercent ? 100 : 1);
    1872            0 :         } else if (qobject_cast<QButtonGroup*>(sw.widget)) {
    1873            0 :             QButtonGroup* bg = qobject_cast<QButtonGroup*>(sw.widget);
    1874            0 :             return bg->checkedId();
    1875            0 :         } else if (FontStyleSelect* fontStyle = qobject_cast<FontStyleSelect*>(sw.widget)) {
    1876            0 :             return int(fontStyle->fontStyle());
    1877              :         } else {
    1878            0 :             ASSERT_X("unhandled int");
    1879              :         }
    1880              :     } break;
    1881            0 :     case P_TYPE::STRING: {
    1882            0 :         if (qobject_cast<QFontComboBox*>(sw.widget)) {
    1883            0 :             return static_cast<QFontComboBox*>(sw.widget)->currentFont().family();
    1884              :         }
    1885            0 :         if (qobject_cast<QComboBox*>(sw.widget)) {
    1886            0 :             QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    1887            0 :             return cb->currentData().toString();
    1888              :         }
    1889            0 :         if (qobject_cast<QTextEdit*>(sw.widget)) {
    1890            0 :             QTextEdit* te = qobject_cast<QTextEdit*>(sw.widget);
    1891            0 :             return te->toPlainText();
    1892              :         }
    1893            0 :     } break;
    1894            0 :     case P_TYPE::POINT: {
    1895              :         // Displayed: positive = up, negative = down
    1896              :         // Internal:  negative = up, positive = down
    1897            0 :         if (idx == StyleId::lyricsPosAbove || idx == StyleId::lyricsPosBelow) {
    1898            0 :             QDoubleSpinBox* dsb = qobject_cast<QDoubleSpinBox*>(sw.widget);
    1899            0 :             return PointF(0.0, OffsetUtils::flipSign(dsb->value()));
    1900              :         }
    1901            0 :         if (OffsetSelect* cb = qobject_cast<OffsetSelect*>(sw.widget)) {
    1902            0 :             return OffsetUtils::flipYSign(cb->offset());
    1903              :         } else {
    1904            0 :             ASSERT_X("unhandled muse::PointF");
    1905              :         }
    1906              :     } break;
    1907            0 :     case P_TYPE::DIRECTION_V: {
    1908            0 :         QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    1909            0 :         if (cb) {
    1910            0 :             return DirectionV(cb->currentIndex());
    1911              :         } else {
    1912            0 :             ASSERT_X("unhandled Direction");
    1913              :         }
    1914              :     } break;
    1915            0 :     case P_TYPE::ALIGN: {
    1916            0 :         AlignSelect* as = qobject_cast<AlignSelect*>(sw.widget);
    1917            0 :         return as->align();
    1918              :     } break;
    1919            0 :     case P_TYPE::TIE_PLACEMENT: {
    1920            0 :         QButtonGroup* bg = qobject_cast<QButtonGroup*>(sw.widget);
    1921            0 :         return TiePlacement(bg->checkedId());
    1922              :     } break;
    1923            0 :     default: {
    1924            0 :         ASSERT_X(QString::asprintf("EditStyle::getValue: unhandled type <%d>", static_cast<int>(type)));
    1925              :     } break;
    1926              :     }
    1927              : 
    1928            0 :     return PropertyValue();
    1929              : }
    1930              : 
    1931              : //---------------------------------------------------------
    1932              : //   setValues
    1933              : //---------------------------------------------------------
    1934              : 
    1935            0 : void EditStyle::setValues()
    1936              : {
    1937            0 :     for (const StyleWidget& sw : styleWidgets) {
    1938            0 :         if (sw.widget) {
    1939            0 :             sw.widget->blockSignals(true);
    1940              :         }
    1941              :         // Displayed: positive = up, negative = down
    1942              :         // Internal:  negative = up, positive = down
    1943            0 :         PropertyValue val = sw.idx == StyleId::lyricsPosAbove || sw.idx == StyleId::lyricsPosBelow
    1944            0 :                             ? Spatium(OffsetUtils::flipSign(styleValue(sw.idx).value<PointF>().y()))
    1945            0 :                             : sw.idx == StyleId::mmRestNumberPos
    1946            0 :                             ? Spatium(OffsetUtils::flipSign(styleValue(sw.idx).value<Spatium>().val()))
    1947            0 :                             : styleValue(sw.idx);
    1948            0 :         if (sw.reset) {
    1949            0 :             sw.reset->setEnabled(!hasDefaultStyleValue(sw.idx));
    1950              :         }
    1951              : 
    1952            0 :         switch (val.type()) {
    1953            0 :         case P_TYPE::SPATIUM: {
    1954            0 :             qreal value = val.value<Spatium>().val();
    1955            0 :             if (sw.showPercent) {
    1956            0 :                 qobject_cast<QSpinBox*>(sw.widget)->setValue(int(value * 100.0));
    1957              :             } else {
    1958            0 :                 sw.widget->setProperty("value", value);
    1959              :             }
    1960            0 :         } break;
    1961            0 :         case P_TYPE::REAL: {
    1962            0 :             qreal value = val.toReal();
    1963            0 :             if (sw.showPercent) {
    1964            0 :                 value = value * 100;
    1965              :             }
    1966            0 :             if (sw.idx == StyleId::figuredBassYOffset) {
    1967              :                 // Displayed: positive = up, negative = down
    1968              :                 // Internal:  negative = up, positive = down
    1969            0 :                 value = OffsetUtils::flipSign(value);
    1970              :             }
    1971            0 :             if (!sw.widget->setProperty("value", value)) {
    1972            0 :                 unhandledType(sw);
    1973              :             }
    1974            0 :         } break;
    1975            0 :         case P_TYPE::BOOL: {
    1976            0 :             bool value = val.toBool();
    1977            0 :             if (sw.idx == StyleId::harmonyVoiceLiteral) { // special case for bool represented by a two-item combobox
    1978              :                 // voicingSelectWidget->interpretBox->setCurrentIndex(value);
    1979            0 :             } else if (isBoolStyleRepresentedByButtonGroup(sw.idx)) { // special case for bool represented by a two-item buttonGroup
    1980            0 :                 qobject_cast<QButtonGroup*>(sw.widget)->button(1)->setChecked(value);
    1981            0 :                 qobject_cast<QButtonGroup*>(sw.widget)->button(0)->setChecked(!value);
    1982            0 :             } else if (sw.idx == StyleId::lyricsDashForce || sw.idx == StyleId::lyricsMelismaForce) { // special case where UI is presented with opposite wording
    1983            0 :                 sw.widget->setProperty("checked", !value);
    1984              :             } else {
    1985            0 :                 if (!sw.widget->setProperty("checked", value)) {
    1986            0 :                     unhandledType(sw);
    1987              :                 }
    1988              :             }
    1989            0 :         } break;
    1990            0 :         case P_TYPE::PLACEMENT_H:
    1991              :         case P_TYPE::PLACEMENT_V:
    1992              :         case P_TYPE::DIRECTION_H:
    1993              :         case P_TYPE::ORIENTATION:
    1994              :         case P_TYPE::BARLINE_TYPE:
    1995              :         case P_TYPE::LINE_TYPE:
    1996              :         case P_TYPE::HOOK_TYPE:
    1997              :         case P_TYPE::DYNAMIC_TYPE:
    1998              :         case P_TYPE::ACCIDENTAL_ROLE:
    1999              :         case P_TYPE::TIE_PLACEMENT:
    2000              :         case P_TYPE::TIMESIG_PLACEMENT:
    2001              :         case P_TYPE::TIMESIG_STYLE:
    2002              :         case P_TYPE::TIMESIG_MARGIN:
    2003              :         case P_TYPE::INT: {
    2004            0 :             int value = val.toInt();
    2005            0 :             if (sw.idx == StyleId::lyricsStackingOrder) { // special case for enum represented by a checkbox
    2006            0 :                 sw.widget->setProperty("checked", value == int(LyricsStackingOrder::LYRICS_AFTER_PEDALS));
    2007            0 :             } else if (qobject_cast<QComboBox*>(sw.widget)) {
    2008            0 :                 QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    2009            0 :                 cb->setCurrentIndex(cb->findData(value));
    2010            0 :             } else if (qobject_cast<QSpinBox*>(sw.widget)) {
    2011            0 :                 qobject_cast<QSpinBox*>(sw.widget)->setValue(value * (sw.showPercent ? 100 : 1));
    2012            0 :             } else if (qobject_cast<QButtonGroup*>(sw.widget)) {
    2013            0 :                 QButtonGroup* bg = qobject_cast<QButtonGroup*>(sw.widget);
    2014            0 :                 for (auto a : bg->buttons()) {
    2015            0 :                     if (bg->id(a) == val.toInt()) {
    2016            0 :                         a->setChecked(true);
    2017            0 :                         break;
    2018              :                     }
    2019            0 :                 }
    2020            0 :             } else if (FontStyleSelect* fontStyle = qobject_cast<FontStyleSelect*>(sw.widget)) {
    2021            0 :                 fontStyle->setFontStyle(FontStyle(value));
    2022              :             } else {
    2023            0 :                 unhandledType(sw);
    2024              :             }
    2025            0 :         } break;
    2026            0 :         case P_TYPE::STRING: {
    2027            0 :             QString value = val.value<String>();
    2028            0 :             if (qobject_cast<QFontComboBox*>(sw.widget)) {
    2029            0 :                 static_cast<QFontComboBox*>(sw.widget)->setCurrentFont(QFont(value));
    2030            0 :             } else if (qobject_cast<QComboBox*>(sw.widget)) {
    2031            0 :                 QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    2032            0 :                 for (int i = 0; i < cb->count(); ++i) {
    2033            0 :                     if (cb->itemData(i) == value) {
    2034            0 :                         cb->setCurrentIndex(i);
    2035            0 :                         break;
    2036              :                     }
    2037              :                 }
    2038            0 :             } else if (qobject_cast<QTextEdit*>(sw.widget)) {
    2039            0 :                 static_cast<QTextEdit*>(sw.widget)->setPlainText(value);
    2040              :             } else {
    2041            0 :                 unhandledType(sw);
    2042              :             }
    2043            0 :         } break;
    2044            0 :         case P_TYPE::DIRECTION_V: {
    2045            0 :             QComboBox* cb = qobject_cast<QComboBox*>(sw.widget);
    2046            0 :             if (cb) {
    2047            0 :                 cb->setCurrentIndex(int(val.value<DirectionV>()));
    2048              :             } else {
    2049            0 :                 unhandledType(sw);
    2050              :             }
    2051            0 :         } break;
    2052            0 :         case P_TYPE::ALIGN: {
    2053            0 :             AlignSelect* as = qobject_cast<AlignSelect*>(sw.widget);
    2054            0 :             as->setAlign(val.value<Align>());
    2055            0 :         } break;
    2056            0 :         case P_TYPE::POINT: {
    2057            0 :             OffsetSelect* as = qobject_cast<OffsetSelect*>(sw.widget);
    2058            0 :             if (as) {
    2059              :                 // Displayed: positive = up, negative = down
    2060              :                 // Internal:  negative = up, positive = down
    2061            0 :                 as->setOffset(OffsetUtils::flipYSign(val.value<muse::PointF>()));
    2062              :             }
    2063            0 :         } break;
    2064            0 :         default: {
    2065            0 :             unhandledType(sw);
    2066            0 :         } break;
    2067              :         }
    2068              : 
    2069            0 :         if (sw.widget) {
    2070            0 :             sw.widget->blockSignals(false);
    2071              :         }
    2072            0 :     }
    2073              : 
    2074            0 :     textStyleChanged(textStyles->currentRow());
    2075              : 
    2076            0 :     emit dynamicsAndHairpinPos->currentIndexChanged(dynamicsAndHairpinPos->currentIndex());
    2077            0 :     resetDynamicsAndHairpinPos->setEnabled(!dynamicsAndHairpinPosPropertiesHaveDefaultStyleValue());
    2078              : 
    2079              :     //TODO: convert the rest:
    2080              : 
    2081            0 :     muse::ByteArray ba = styleValue(StyleId::swingUnit).value<String>().toAscii();
    2082            0 :     DurationType unit = TConv::fromXml(ba.constChar(), DurationType::V_INVALID);
    2083              : 
    2084            0 :     if (unit == DurationType::V_EIGHTH) {
    2085            0 :         swingEighth->setChecked(true);
    2086            0 :         swingBox->setEnabled(true);
    2087            0 :     } else if (unit == DurationType::V_16TH) {
    2088            0 :         swingSixteenth->setChecked(true);
    2089            0 :         swingBox->setEnabled(true);
    2090            0 :     } else if (unit == DurationType::V_ZERO) {
    2091            0 :         swingOff->setChecked(true);
    2092            0 :         swingBox->setEnabled(false);
    2093              :     }
    2094              : 
    2095              :     // figured bass
    2096            0 :     for (int i = 0; i < comboFBFont->count(); i++) {
    2097            0 :         if (comboFBFont->itemText(i) == styleValue(StyleId::figuredBassFontFamily).value<String>()) {
    2098            0 :             comboFBFont->setCurrentIndex(i);
    2099            0 :             break;
    2100              :         }
    2101              :     }
    2102            0 :     doubleSpinFBSize->setValue(styleValue(StyleId::figuredBassFontSize).toDouble());
    2103              :     // Displayed: positive = up, negative = down
    2104              :     // Internal:  negative = up, positive = down
    2105            0 :     doubleSpinFBVertPos->setValue(OffsetUtils::flipSign(styleValue(StyleId::figuredBassYOffset).toDouble()));
    2106            0 :     spinFBLineHeight->setValue(styleValue(StyleId::figuredBassLineHeight).toDouble() * 100.0);
    2107              : 
    2108            0 :     QString mfont(styleValue(StyleId::musicalSymbolFont).value<String>());
    2109            0 :     QString dynFont(styleValue(StyleId::dynamicsFont).value<String>());
    2110            0 :     QString tfont(styleValue(StyleId::musicalTextFont).value<String>());
    2111            0 :     int idx = 0;
    2112            0 :     for (const auto& i : engravingFonts()->fonts()) {
    2113            0 :         if (QString::fromStdString(i->name()).toLower() == mfont.toLower()) {
    2114            0 :             musicalSymbolFont->setCurrentIndex(idx);
    2115              :         }
    2116            0 :         if (QString::fromStdString(i->name()).toLower() == dynFont.toLower()) {
    2117            0 :             dynamicsFont->setCurrentIndex(idx);
    2118              :         }
    2119            0 :         if ((QString::fromStdString(i->family()) + " Text").toLower() == tfont.toLower()) {
    2120            0 :             musicalTextFont->setCurrentIndex(idx);
    2121              :         }
    2122            0 :         ++idx;
    2123            0 :     }
    2124              : 
    2125            0 :     toggleHeaderOddEven(styleValue(StyleId::headerOddEven).toBool());
    2126            0 :     toggleFooterOddEven(styleValue(StyleId::footerOddEven).toBool());
    2127            0 :     disableVerticalSpread->setChecked(!styleValue(StyleId::enableVerticalSpread).toBool());
    2128              : 
    2129            0 :     for (const LineStyleSelect* lineStyleSelect : m_lineStyleSelects) {
    2130            0 :         lineStyleSelect->update();
    2131              :     }
    2132              : 
    2133            0 :     singleMeasureMMRestOption->setEnabled(styleValue(StyleId::minEmptyMeasures).toInt() == 1);
    2134            0 :     singleMMRestShowNumber->setEnabled(styleValue(StyleId::singleMeasureMMRestUseNormalRest).toBool());
    2135            0 :     mmRestSingleUseHBar->setEnabled(!styleValue(StyleId::oldStyleMultiMeasureRests).toBool());
    2136            0 :     mmRestRefDuration->setEnabled(styleValue(StyleId::mmRestConstantWidth).toBool());
    2137              : 
    2138            0 :     lyricsMaxDashCount->setEnabled(styleValue(StyleId::lyricsLimitDashCount).toBool());
    2139            0 :     resetLyricsMaxDashCount->setEnabled(styleValue(StyleId::lyricsLimitDashCount) != defaultStyleValue(StyleId::lyricsLimitDashCount)
    2140            0 :                                         || styleValue(StyleId::lyricsMaxDashCount) != defaultStyleValue(StyleId::lyricsMaxDashCount));
    2141            0 :     lyricsDashMaxDistance->setEnabled(!styleValue(StyleId::lyricsLimitDashCount).toBool()
    2142            0 :                                       || styleValue(StyleId::lyricsMaxDashCount).toInt() > 1);
    2143            0 :     resetLyricsDashMaxDistance->setEnabled(lyricsDashMaxDistance->isEnabled() && styleValue(StyleId::lyricsDashMaxDistance)
    2144            0 :                                            != defaultStyleValue(StyleId::lyricsDashMaxDistance));
    2145              : 
    2146            0 :     updateParenthesisIndicatingTiesGroupState();
    2147              : 
    2148            0 :     bool textBracketRight = styleValue(StyleId::groupBracketTextAlign).value<DirectionH>() == DirectionH::RIGHT;
    2149            0 :     bool vertical = styleValue(StyleId::groupBracketTextOrientation).value<mu::engraving::Orientation>()
    2150            0 :                     == mu::engraving::Orientation::VERTICAL;
    2151            0 :     groupBracketHangIntoMargin->setEnabled(vertical && !textBracketRight);
    2152            0 : }
    2153              : 
    2154              : //---------------------------------------------------------
    2155              : //   setSwingParams
    2156              : //---------------------------------------------------------
    2157              : 
    2158            0 : void EditStyle::setSwingParams(bool checked)
    2159              : {
    2160            0 :     if (!checked) {
    2161            0 :         return;
    2162              :     }
    2163            0 :     QString val;
    2164            0 :     if (swingOff->isChecked()) {
    2165            0 :         val = TConv::toXml(DurationType::V_ZERO).ascii();
    2166            0 :         swingBox->setEnabled(false);
    2167            0 :     } else if (swingEighth->isChecked()) {
    2168            0 :         val = TConv::toXml(DurationType::V_EIGHTH).ascii();
    2169            0 :         swingBox->setEnabled(true);
    2170            0 :     } else if (swingSixteenth->isChecked()) {
    2171            0 :         val = TConv::toXml(DurationType::V_16TH).ascii();
    2172            0 :         swingBox->setEnabled(true);
    2173              :     }
    2174              : 
    2175            0 :     setStyleQVariantValue(StyleId::swingUnit, val);
    2176            0 : }
    2177              : 
    2178            0 : const PropertyValue& EditStyle::styleValue(StyleId id) const
    2179              : {
    2180            0 :     return projectSession()->currentNotation()->style()->styleValue(id);
    2181              : }
    2182              : 
    2183            0 : const PropertyValue& EditStyle::defaultStyleValue(StyleId id) const
    2184              : {
    2185            0 :     return projectSession()->currentNotation()->style()->defaultStyleValue(id);
    2186              : }
    2187              : 
    2188            0 : bool EditStyle::hasDefaultStyleValue(StyleId id) const
    2189              : {
    2190            0 :     return defaultStyleValue(id) == styleValue(id);
    2191              : }
    2192              : 
    2193            0 : bool EditStyle::dynamicsAndHairpinPosPropertiesHaveDefaultStyleValue() const
    2194              : {
    2195            0 :     return hasDefaultStyleValue(StyleId::dynamicsHairpinsAutoCenterOnGrandStaff)
    2196            0 :            && hasDefaultStyleValue(StyleId::dynamicsHairpinsAutoCenterOnVocalStaves)
    2197            0 :            && hasDefaultStyleValue(StyleId::dynamicsHairpinsAboveForVocalStaves)
    2198            0 :            && hasDefaultStyleValue(StyleId::dynamicsHairpinVoiceBasedPlacement);
    2199              : }
    2200              : 
    2201            0 : void EditStyle::setStyleQVariantValue(StyleId id, const QVariant& value)
    2202              : {
    2203            0 :     setStyleValue(id, PropertyValue::fromQVariant(value, MStyle::valueType(id)));
    2204            0 : }
    2205              : 
    2206            0 : void EditStyle::setStyleValue(StyleId id, const PropertyValue& value)
    2207              : {
    2208            0 :     projectSession()->currentNotation()->style()->setStyleValue(id, value);
    2209            0 : }
    2210              : 
    2211              : //---------------------------------------------------------
    2212              : //   concertPitchToggled
    2213              : //---------------------------------------------------------
    2214              : 
    2215            0 : void EditStyle::concertPitchToggled(bool checked)
    2216              : {
    2217            0 :     setStyleValue(StyleId::concertPitch, checked);
    2218            0 : }
    2219              : 
    2220              : //---------------------------------------------------------
    2221              : //   toggleHeaderOddEven
    2222              : //---------------------------------------------------------
    2223              : 
    2224            0 : void EditStyle::toggleHeaderOddEven(bool checked)
    2225              : {
    2226            0 :     if (!showHeader->isChecked()) {
    2227            0 :         return;
    2228              :     }
    2229            0 :     labelEvenHeader->setEnabled(checked);
    2230            0 :     evenHeaderL->setEnabled(checked);
    2231            0 :     evenHeaderC->setEnabled(checked);
    2232            0 :     evenHeaderR->setEnabled(checked);
    2233            0 :     static QString odd  = labelOddHeader->text();    // save on 1st round
    2234            0 :     static QString even = labelEvenHeader->text();   // save on 1st round
    2235            0 :     if (checked) {
    2236            0 :         labelOddHeader->setText(odd);     // restore
    2237              :     } else {
    2238            0 :         labelOddHeader->setText(odd + "\n" + even);     // replace
    2239              :     }
    2240            0 :     return;
    2241              : }
    2242              : 
    2243              : //---------------------------------------------------------
    2244              : //   enableStyleWidget
    2245              : //---------------------------------------------------------
    2246              : 
    2247            0 : void EditStyle::enableStyleWidget(const StyleId idx, bool enable)
    2248              : {
    2249            0 :     const StyleWidget& sw { styleWidget(idx) };
    2250            0 :     static_cast<QWidget*>(sw.widget)->setEnabled(enable);
    2251            0 :     if (sw.reset) {
    2252            0 :         sw.reset->setEnabled(enable && !hasDefaultStyleValue(idx));
    2253              :     }
    2254            0 : }
    2255              : 
    2256              : //---------------------------------------------------------
    2257              : //   enableVerticalSpreadClicked
    2258              : //---------------------------------------------------------
    2259              : 
    2260            0 : void EditStyle::enableVerticalSpreadClicked(bool checked)
    2261              : {
    2262            0 :     if (checked) {
    2263            0 :         setStyleValue(StyleId::enableVerticalSpread, true);
    2264            0 :         disableVerticalSpread->setChecked(false);
    2265              :     } else {
    2266            0 :         if (!disableVerticalSpread->isChecked()) {
    2267            0 :             setStyleValue(StyleId::enableVerticalSpread, true);
    2268            0 :             enableVerticalSpread->setChecked(true);
    2269              :         }
    2270              :     }
    2271            0 : }
    2272              : 
    2273              : //---------------------------------------------------------
    2274              : //   disableVerticalSpreadClicked
    2275              : //---------------------------------------------------------
    2276              : 
    2277            0 : void EditStyle::disableVerticalSpreadClicked(bool checked)
    2278              : {
    2279            0 :     if (checked) {
    2280            0 :         setStyleValue(StyleId::enableVerticalSpread, false);
    2281            0 :         enableVerticalSpread->setChecked(false);
    2282              :     } else {
    2283            0 :         if (!enableVerticalSpread->isChecked()) {
    2284            0 :             setStyleValue(StyleId::enableVerticalSpread, false);
    2285            0 :             disableVerticalSpread->setChecked(true);
    2286              :         }
    2287              :     }
    2288            0 : }
    2289              : 
    2290              : //---------------------------------------------------------
    2291              : //   toggleFooterOddEven
    2292              : //---------------------------------------------------------
    2293              : 
    2294            0 : void EditStyle::toggleFooterOddEven(bool checked)
    2295              : {
    2296            0 :     if (!showFooter->isChecked()) {
    2297            0 :         return;
    2298              :     }
    2299            0 :     labelEvenFooter->setEnabled(checked);
    2300            0 :     evenFooterL->setEnabled(checked);
    2301            0 :     evenFooterC->setEnabled(checked);
    2302            0 :     evenFooterR->setEnabled(checked);
    2303            0 :     static QString odd  = labelOddFooter->text();    // save on 1st round
    2304            0 :     static QString even = labelEvenFooter->text();   // save on 1st round
    2305            0 :     if (checked) {
    2306            0 :         labelOddFooter->setText(odd);     // restore
    2307              :     } else {
    2308            0 :         labelOddFooter->setText(odd + "\n" + even);     // replace
    2309              :     }
    2310            0 :     return;
    2311              : }
    2312              : 
    2313              : //---------------------------------------------------------
    2314              : //   lyricsDashMin/MaxLengthValueChanged
    2315              : ///   Ensure lyricsDashMinLength <= lyricsDashMaxLength
    2316              : //---------------------------------------------------------
    2317              : 
    2318            0 : void EditStyle::lyricsDashMaxLengthValueChanged(double val)
    2319              : {
    2320            0 :     double otherVal = lyricsDashMinLength->value();
    2321            0 :     if (otherVal > val) {
    2322            0 :         lyricsDashMaxLength->setValue(otherVal);
    2323              :     }
    2324            0 : }
    2325              : 
    2326            0 : void EditStyle::lyricsDashMinLengthValueChanged(double val)
    2327              : {
    2328            0 :     double otherVal = lyricsDashMaxLength->value();
    2329            0 :     if (otherVal < val) {
    2330            0 :         lyricsDashMinLength->setValue(otherVal);
    2331              :     }
    2332            0 : }
    2333              : 
    2334              : //---------------------------------------------------------
    2335              : //   systemMin/MaxDistanceValueChanged
    2336              : ///   Ensure minSystemDistance <= maxSystemDistance
    2337              : //---------------------------------------------------------
    2338              : 
    2339            0 : void EditStyle::systemMaxDistanceValueChanged(double val)
    2340              : {
    2341            0 :     double otherVal = minSystemDistance->value();
    2342            0 :     if (otherVal > val) {
    2343            0 :         maxSystemDistance->setValue(otherVal);
    2344              :     }
    2345            0 : }
    2346              : 
    2347            0 : void EditStyle::systemMinDistanceValueChanged(double val)
    2348              : {
    2349            0 :     double otherVal = maxSystemDistance->value();
    2350            0 :     if (otherVal < val) {
    2351            0 :         minSystemDistance->setValue(otherVal);
    2352              :     }
    2353            0 : }
    2354              : 
    2355              : //---------------------------------------------------------
    2356              : //   styleWidget
    2357              : //---------------------------------------------------------
    2358              : 
    2359            0 : const EditStyle::StyleWidget& EditStyle::styleWidget(StyleId idx) const
    2360              : {
    2361            0 :     for (const StyleWidget& sw : styleWidgets) {
    2362            0 :         if (sw.idx == idx) {
    2363            0 :             return sw;
    2364              :         }
    2365              :     }
    2366            0 :     UNREACHABLE;
    2367              :     static EditStyle::StyleWidget dummy;
    2368              :     return dummy;
    2369              : }
    2370              : 
    2371              : //---------------------------------------------------------
    2372              : //   valueChanged
    2373              : //---------------------------------------------------------
    2374              : 
    2375            0 : void EditStyle::valueChanged(int i)
    2376              : {
    2377            0 :     StyleId idx       = (StyleId)i;
    2378            0 :     PropertyValue val  = getValue(idx);
    2379            0 :     bool setValue = false;
    2380            0 :     if (idx == StyleId::musicalSymbolFont) {
    2381            0 :         bool overrideDynamicsFont = getValue(StyleId::dynamicsOverrideFont).toBool();
    2382            0 :         if (!overrideDynamicsFont) {
    2383            0 :             setStyleValue(StyleId::dynamicsFont, val); // Match dynamics font
    2384              :         }
    2385            0 :         if (optimizeStyleCheckbox->isChecked()) {
    2386            0 :             IEngravingFontPtr scoreFont = engravingFonts()->fontByName(val.value<String>().toStdString());
    2387            0 :             if (scoreFont) {
    2388            0 :                 for (auto j : scoreFont->engravingDefaults()) {
    2389            0 :                     setStyleValue(j.first, j.second);
    2390            0 :                 }
    2391              :             }
    2392            0 :             setValue = true;
    2393            0 :         }
    2394              :     }
    2395              : 
    2396            0 :     setStyleValue(idx, val);
    2397            0 :     if (setValue) {
    2398            0 :         setValues();
    2399              :     }
    2400            0 :     const StyleWidget& sw = styleWidget(idx);
    2401            0 :     if (sw.reset) {
    2402            0 :         sw.reset->setEnabled(!hasDefaultStyleValue(idx));
    2403              :     }
    2404              : 
    2405            0 :     if (idx == StyleId::dynamicsHairpinVoiceBasedPlacement || idx == StyleId::dynamicsHairpinsAutoCenterOnGrandStaff
    2406            0 :         || idx == StyleId::dynamicsHairpinsAutoCenterOnVocalStaves || idx == StyleId::dynamicsHairpinsAboveForVocalStaves) {
    2407            0 :         resetDynamicsAndHairpinPos->setEnabled(!dynamicsAndHairpinPosPropertiesHaveDefaultStyleValue());
    2408              :     }
    2409              : 
    2410            0 :     if (idx == StyleId::minEmptyMeasures) {
    2411            0 :         singleMeasureMMRestOption->setEnabled(styleValue(StyleId::minEmptyMeasures).toInt() == 1);
    2412              :     }
    2413            0 :     if (idx == StyleId::singleMeasureMMRestUseNormalRest) {
    2414            0 :         singleMMRestShowNumber->setEnabled(styleValue(StyleId::singleMeasureMMRestUseNormalRest).toBool());
    2415              :     }
    2416            0 :     if (idx == StyleId::mmRestConstantWidth) {
    2417            0 :         mmRestRefDuration->setEnabled(styleValue(StyleId::mmRestConstantWidth).toBool());
    2418              :     }
    2419            0 :     if (idx == StyleId::oldStyleMultiMeasureRests) {
    2420            0 :         bool useOldStyle = styleValue(StyleId::oldStyleMultiMeasureRests).toBool();
    2421            0 :         if (useOldStyle && !styleValue(StyleId::singleMeasureMMRestUseNormalRest).toBool()) {
    2422            0 :             setStyleValue(StyleId::singleMeasureMMRestUseNormalRest, true);
    2423            0 :             setValues();
    2424              :         }
    2425            0 :         mmRestSingleUseHBar->setEnabled(!useOldStyle);
    2426              :     }
    2427              : 
    2428            0 :     if (idx == StyleId::lyricsLimitDashCount || idx == StyleId::lyricsMaxDashCount) {
    2429            0 :         lyricsMaxDashCount->setEnabled(styleValue(StyleId::lyricsLimitDashCount).toBool());
    2430            0 :         resetLyricsMaxDashCount->setEnabled(styleValue(StyleId::lyricsLimitDashCount) != defaultStyleValue(StyleId::lyricsLimitDashCount)
    2431            0 :                                             || styleValue(StyleId::lyricsMaxDashCount) != defaultStyleValue(StyleId::lyricsMaxDashCount));
    2432            0 :         lyricsDashMaxDistance->setEnabled(!styleValue(StyleId::lyricsLimitDashCount).toBool()
    2433            0 :                                           || styleValue(StyleId::lyricsMaxDashCount).toInt() > 1);
    2434            0 :         resetLyricsDashMaxDistance->setEnabled(lyricsDashMaxDistance->isEnabled() && styleValue(StyleId::lyricsDashMaxDistance)
    2435            0 :                                                != defaultStyleValue(StyleId::lyricsDashMaxDistance));
    2436              :     }
    2437            0 : }
    2438              : 
    2439              : //---------------------------------------------------------
    2440              : //   resetStyleValue
    2441              : //---------------------------------------------------------
    2442              : 
    2443            0 : void EditStyle::resetStyleValue(int i)
    2444              : {
    2445            0 :     StyleId idx = (StyleId)i;
    2446              : 
    2447            0 :     setStyleValue(idx, defaultStyleValue(idx));
    2448            0 :     if (idx == StyleId::dynamicsHairpinVoiceBasedPlacement) {
    2449            0 :         for (StyleId id : { StyleId::dynamicsHairpinsAutoCenterOnGrandStaff,
    2450              :                             StyleId::dynamicsHairpinsAutoCenterOnVocalStaves,
    2451            0 :                             StyleId::dynamicsHairpinsAboveForVocalStaves }) {
    2452            0 :             setStyleValue(id, defaultStyleValue(id));
    2453              :         }
    2454              :     }
    2455            0 :     setValues();
    2456            0 : }
    2457              : 
    2458              : //---------------------------------------------------------
    2459              : //   textStyleChanged
    2460              : //---------------------------------------------------------
    2461              : 
    2462            0 : void EditStyle::textStyleChanged(int row)
    2463              : {
    2464            0 :     TextStyleType tid = TextStyleType(textStyles->item(row)->data(Qt::UserRole).toInt());
    2465            0 :     const TextStyle* ts = textStyle(tid);
    2466              : 
    2467            0 :     for (const auto& a : *ts) {
    2468            0 :         switch (a.type) {
    2469            0 :         case TextStylePropertyType::FontFace: {
    2470            0 :             PropertyValue val = styleValue(a.sid);
    2471            0 :             textStyleFontFace->setCurrentFont(QFont(val.value<String>()));
    2472            0 :             resetTextStyleFontFace->setEnabled(val != defaultStyleValue(a.sid));
    2473            0 :         }
    2474            0 :         break;
    2475              : 
    2476            0 :         case TextStylePropertyType::FontSize:
    2477            0 :             textStyleFontSize->setValue(styleValue(a.sid).toDouble());
    2478            0 :             resetTextStyleFontSize->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2479            0 :             break;
    2480              : 
    2481            0 :         case TextStylePropertyType::LineSpacing:
    2482            0 :             textStyleLineSpacing->setValue(styleValue(a.sid).toDouble());
    2483            0 :             resetTextStyleLineSpacing->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2484            0 :             break;
    2485              : 
    2486            0 :         case TextStylePropertyType::MusicalSymbolsScale:
    2487            0 :             textStyleMusicalSymbolsScale->setValue(styleValue(a.sid).toDouble() * 100);
    2488            0 :             resetTextStyleMusicalSymbolsScale->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2489            0 :             break;
    2490              : 
    2491            0 :         case TextStylePropertyType::MusicalSymbolsSize:
    2492            0 :             textStyleMusicalSymbolsSize->setValue(styleValue(a.sid).toDouble());
    2493            0 :             resetTextStyleMusicalSymbolsSize->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2494            0 :             break;
    2495              : 
    2496            0 :         case TextStylePropertyType::FontStyle:
    2497            0 :             textStyleFontStyle->setFontStyle(FontStyle(styleValue(a.sid).toInt()));
    2498            0 :             resetTextStyleFontStyle->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2499            0 :             break;
    2500              : 
    2501            0 :         case TextStylePropertyType::TextAlign:
    2502            0 :             textStyleAlign->setAlign(styleValue(a.sid).value<Align>());
    2503            0 :             resetTextStyleAlign->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2504            0 :             break;
    2505              : 
    2506            0 :         case TextStylePropertyType::Position:
    2507            0 :             textStyleAlign->setPosition(styleValue(a.sid).value<AlignH>());
    2508            0 :             resetTextStyleAlign->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2509            0 :             break;
    2510              : 
    2511            0 :         case TextStylePropertyType::SizeSpatiumDependent: {
    2512            0 :             PropertyValue val = styleValue(a.sid);
    2513            0 :             textStyleSpatiumDependent->setChecked(val.toBool());
    2514            0 :             resetTextStyleSpatiumDependent->setEnabled(val != defaultStyleValue(a.sid));
    2515            0 :             textStyleOffset->setSuffix(val.toBool() ? muse::qtrc("global", "sp") : muse::qtrc("global", "mm"));
    2516            0 :         }
    2517            0 :         break;
    2518              : 
    2519            0 :         case TextStylePropertyType::FrameType:
    2520            0 :             textStyleFrameType->setCurrentIndex(styleValue(a.sid).toInt());
    2521            0 :             resetTextStyleFrameType->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2522            0 :             frameWidget->setEnabled(styleValue(a.sid).toInt() != 0);             // disable if no frame
    2523            0 :             break;
    2524              : 
    2525            0 :         case TextStylePropertyType::FramePadding:
    2526            0 :             textStyleFramePadding->setValue(styleValue(a.sid).toDouble());
    2527            0 :             resetTextStyleFramePadding->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2528            0 :             break;
    2529              : 
    2530            0 :         case TextStylePropertyType::FrameWidth:
    2531            0 :             textStyleFrameBorder->setValue(styleValue(a.sid).toDouble());
    2532            0 :             resetTextStyleFrameBorder->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2533            0 :             break;
    2534              : 
    2535            0 :         case TextStylePropertyType::FrameRound:
    2536            0 :             textStyleFrameBorderRadius->setValue(styleValue(a.sid).toDouble());
    2537            0 :             resetTextStyleFrameBorderRadius->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2538            0 :             break;
    2539              : 
    2540            0 :         case TextStylePropertyType::FrameBorderColor:
    2541            0 :             textStyleFrameForeground->setColor(styleValue(a.sid).value<Color>().toQColor());
    2542            0 :             resetTextStyleFrameForeground->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2543            0 :             break;
    2544              : 
    2545            0 :         case TextStylePropertyType::FrameFillColor:
    2546            0 :             textStyleFrameBackground->setColor(styleValue(a.sid).value<Color>().toQColor());
    2547            0 :             resetTextStyleFrameBackground->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2548            0 :             break;
    2549              : 
    2550            0 :         case TextStylePropertyType::Color:
    2551            0 :             textStyleColor->setColor(styleValue(a.sid).value<Color>().toQColor());
    2552            0 :             resetTextStyleColor->setEnabled(styleValue(a.sid) != defaultStyleValue(a.sid));
    2553            0 :             break;
    2554              : 
    2555            0 :         default:
    2556            0 :             break;
    2557              :         }
    2558              :     }
    2559              : 
    2560              :     // Displayed: positive = up, negative = down
    2561              :     // Internal:  negative = up, positive = down
    2562            0 :     textStyleOffset->setOffset(OffsetUtils::flipYSign(styleValue(ts->offsetSids.above).value<PointF>()));
    2563            0 :     resetTextStyleOffset->setEnabled(styleValue(ts->offsetSids.above) != defaultStyleValue(ts->offsetSids.above));
    2564              : 
    2565            0 :     INotationPtr notation = projectSession()->currentNotation();
    2566            0 :     IF_ASSERT_FAILED(notation) {
    2567            0 :         return;
    2568              :     }
    2569            0 :     const Score* score = notation->elements()->msScore();
    2570            0 :     IF_ASSERT_FAILED(score) {
    2571            0 :         return;
    2572              :     }
    2573              : 
    2574            0 :     styleName->setText(score->getTextStyleUserName(tid).qTranslated());
    2575            0 :     styleName->setEnabled(int(tid) >= int(TextStyleType::USER1));
    2576            0 :     resetTextStyleName->setEnabled(styleName->text() != TConv::translatedUserName(tid));
    2577              : 
    2578            0 :     tupletUseSymbols->setVisible(tid == TextStyleType::TUPLET);
    2579            0 :     resetTupletUseSymbols->setVisible(tid == TextStyleType::TUPLET);
    2580              : 
    2581            0 :     notation->viewState()->setStyleDialogLastSubPageIndex(row);
    2582              : }
    2583              : 
    2584              : //---------------------------------------------------------
    2585              : //   textStyleValueChanged
    2586              : //---------------------------------------------------------
    2587              : 
    2588            0 : void EditStyle::textStyleValueChanged(TextStylePropertyType type, const PropertyValue& value)
    2589              : {
    2590            0 :     TextStyleType tid = TextStyleType(textStyles->currentItem()->data(Qt::UserRole).toInt());
    2591            0 :     const TextStyle* ts = textStyle(tid);
    2592              : 
    2593            0 :     if (type == TextStylePropertyType::Offset) {
    2594              :         // Displayed: positive = up, negative = down
    2595              :         // Internal:  negative = up, positive = down
    2596            0 :         setStyleValue(ts->offsetSids.above, OffsetUtils::flipYSign(value.value<PointF>()));
    2597              :     } else {
    2598            0 :         for (const auto& a : *ts) {
    2599            0 :             if (a.type == type) {
    2600            0 :                 if (type == TextStylePropertyType::MusicalSymbolsScale) {
    2601            0 :                     setStyleValue(a.sid, value.toDouble() / 100);
    2602              :                 } else {
    2603            0 :                     setStyleValue(a.sid, value);
    2604              :                 }
    2605            0 :                 break;
    2606              :             }
    2607              :         }
    2608              :     }
    2609            0 :     textStyleChanged(textStyles->currentRow()); // update GUI (reset buttons)
    2610            0 : }
    2611              : 
    2612              : //---------------------------------------------------------
    2613              : //   resetTextStyle
    2614              : //---------------------------------------------------------
    2615              : 
    2616            0 : void EditStyle::resetTextStyle(TextStylePropertyType type)
    2617              : {
    2618            0 :     TextStyleType tid = TextStyleType(textStyles->currentItem()->data(Qt::UserRole).toInt());
    2619            0 :     const TextStyle* ts = textStyle(tid);
    2620              : 
    2621            0 :     if (type == TextStylePropertyType::Offset) {
    2622            0 :         setStyleValue(ts->offsetSids.above, defaultStyleValue(ts->offsetSids.above));
    2623              :     } else {
    2624            0 :         for (const auto& a : *ts) {
    2625            0 :             if (a.type == type) {
    2626            0 :                 setStyleValue(a.sid, defaultStyleValue(a.sid));
    2627            0 :                 break;
    2628              :             }
    2629              :         }
    2630              :     }
    2631              : 
    2632            0 :     textStyleChanged(textStyles->currentRow()); // update GUI
    2633            0 : }
    2634              : 
    2635              : //---------------------------------------------------------
    2636              : //   editUserStyleName
    2637              : //---------------------------------------------------------
    2638              : 
    2639            0 : void EditStyle::editUserStyleName()
    2640              : {
    2641            0 :     int row = textStyles->currentRow();
    2642            0 :     TextStyleType tid = TextStyleType(textStyles->item(row)->data(Qt::UserRole).toInt());
    2643            0 :     textStyles->item(row)->setText(styleName->text());
    2644            0 :     resetTextStyleName->setEnabled(styleName->text() != TConv::translatedUserName(tid));
    2645            0 : }
    2646              : 
    2647              : //---------------------------------------------------------
    2648              : //   endEditUserStyleName
    2649              : //---------------------------------------------------------
    2650              : 
    2651            0 : void EditStyle::endEditUserStyleName()
    2652              : {
    2653            0 :     int row = textStyles->currentRow();
    2654            0 :     TextStyleType tid = TextStyleType(textStyles->item(row)->data(Qt::UserRole).toInt());
    2655            0 :     int idx = int(tid) - int(TextStyleType::USER1);
    2656            0 :     if (int(tid) < int(TextStyleType::USER1) || int(tid) > int(TextStyleType::USER12)) {
    2657            0 :         LOGD("User style index %d outside of range.", idx);
    2658            0 :         return;
    2659              :     }
    2660            0 :     StyleId sid[]
    2661              :         = { StyleId::user1Name, StyleId::user2Name, StyleId::user3Name, StyleId::user4Name, StyleId::user5Name, StyleId::user6Name,
    2662              :             StyleId::user7Name, StyleId::user8Name, StyleId::user9Name, StyleId::user10Name, StyleId::user11Name, StyleId::user12Name };
    2663            0 :     QString name = styleName->text();
    2664            0 :     setStyleValue(sid[idx], name);
    2665            0 :     if (name == "") {
    2666            0 :         name = TConv::translatedUserName(tid);
    2667            0 :         styleName->setText(name);
    2668            0 :         textStyles->item(row)->setText(name);
    2669            0 :         resetTextStyleName->setEnabled(false);
    2670              :     }
    2671            0 : }
    2672              : 
    2673              : //---------------------------------------------------------
    2674              : //   resetUserStyleName
    2675              : //---------------------------------------------------------
    2676              : 
    2677            0 : void EditStyle::resetUserStyleName()
    2678              : {
    2679            0 :     styleName->clear();
    2680            0 :     endEditUserStyleName();
    2681            0 : }
    2682              : 
    2683            0 : void EditStyle::updateParenthesisIndicatingTiesGroupState()
    2684              : {
    2685            0 :     tieParen->setEnabled(tabShowTies->isChecked() || tabShowNone->isChecked());
    2686            0 : }
        

Generated by: LCOV version 2.0-1