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