Skip to content

Commit d151c83

Browse files
committed
Introducing text settings for tempo change
1 parent 0bd5c09 commit d151c83

File tree

6 files changed

+95
-37
lines changed

6 files changed

+95
-37
lines changed

src/engraving/libmscore/gradualtempochange.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,41 @@ using namespace mu;
3333
using namespace mu::engraving;
3434

3535
static const ElementStyle tempoStyle {
36-
{ Sid::tempoSystemFlag, Pid::SYSTEM_FLAG },
37-
{ Sid::tempoPlacement, Pid::PLACEMENT },
38-
{ Sid::tempoMinDistance, Pid::MIN_DISTANCE },
39-
{ Sid::tempoLineSpacing, Pid::TEXT_LINE_SPACING },
36+
{ Sid::tempoChangeSystemFlag, Pid::SYSTEM_FLAG },
37+
{ Sid::tempoChangePlacement, Pid::PLACEMENT },
38+
{ Sid::tempoChangeMinDistance, Pid::MIN_DISTANCE },
39+
{ Sid::tempoChangeLineSpacing, Pid::TEXT_LINE_SPACING },
4040

41-
{ Sid::tempoColor, Pid::COLOR },
42-
{ Sid::tempoPosAbove, Pid::OFFSET },
41+
{ Sid::tempoChangeColor, Pid::COLOR },
42+
{ Sid::tempoChangePosAbove, Pid::OFFSET },
4343

44-
{ Sid::tempoFontFace, Pid::BEGIN_FONT_FACE },
45-
{ Sid::tempoFontFace, Pid::CONTINUE_FONT_FACE },
46-
{ Sid::tempoFontFace, Pid::END_FONT_FACE },
44+
{ Sid::tempoChangeFontFace, Pid::BEGIN_FONT_FACE },
45+
{ Sid::tempoChangeFontFace, Pid::CONTINUE_FONT_FACE },
46+
{ Sid::tempoChangeFontFace, Pid::END_FONT_FACE },
4747

48-
{ Sid::tempoFontSize, Pid::BEGIN_FONT_SIZE },
49-
{ Sid::tempoFontSize, Pid::CONTINUE_FONT_SIZE },
50-
{ Sid::tempoFontSize, Pid::END_FONT_SIZE },
48+
{ Sid::tempoChangeFontSize, Pid::BEGIN_FONT_SIZE },
49+
{ Sid::tempoChangeFontSize, Pid::CONTINUE_FONT_SIZE },
50+
{ Sid::tempoChangeFontSize, Pid::END_FONT_SIZE },
5151

52-
{ Sid::tempoFontStyle, Pid::BEGIN_FONT_STYLE },
53-
{ Sid::tempoFontStyle, Pid::CONTINUE_FONT_STYLE },
54-
{ Sid::tempoFontStyle, Pid::END_FONT_STYLE },
52+
{ Sid::tempoChangeFontStyle, Pid::BEGIN_FONT_STYLE },
53+
{ Sid::tempoChangeFontStyle, Pid::CONTINUE_FONT_STYLE },
54+
{ Sid::tempoChangeFontStyle, Pid::END_FONT_STYLE },
5555

56-
{ Sid::tempoAlign, Pid::BEGIN_TEXT_ALIGN },
57-
{ Sid::tempoAlign, Pid::CONTINUE_TEXT_ALIGN },
58-
{ Sid::tempoAlign, Pid::END_TEXT_ALIGN },
56+
{ Sid::tempoChangeAlign, Pid::BEGIN_TEXT_ALIGN },
57+
{ Sid::tempoChangeAlign, Pid::CONTINUE_TEXT_ALIGN },
58+
{ Sid::tempoChangeAlign, Pid::END_TEXT_ALIGN },
5959

60-
{ Sid::tempoFontSpatiumDependent, Pid::SIZE_SPATIUM_DEPENDENT },
60+
{ Sid::tempoChangeFontSpatiumDependent, Pid::SIZE_SPATIUM_DEPENDENT },
6161
{ Sid::tempoChangeLineWidth, Pid::LINE_WIDTH },
6262
{ Sid::tempoChangeLineStyle, Pid::LINE_STYLE },
6363
{ Sid::tempoChangeDashLineLen, Pid::DASH_LINE_LEN },
6464
{ Sid::tempoChangeDashGapLen, Pid::DASH_GAP_LEN },
65-
{ Sid::tempoFontSpatiumDependent, Pid::TEXT_SIZE_SPATIUM_DEPENDENT },
65+
{ Sid::tempoChangeFontSpatiumDependent, Pid::TEXT_SIZE_SPATIUM_DEPENDENT },
6666
};
6767

6868
static const ElementStyle tempoSegmentStyle {
69-
{ Sid::tempoPosAbove, Pid::OFFSET },
70-
{ Sid::tempoMinDistance, Pid::MIN_DISTANCE }
69+
{ Sid::tempoChangePosAbove, Pid::OFFSET },
70+
{ Sid::tempoChangeMinDistance, Pid::MIN_DISTANCE }
7171
};
7272

7373
static const std::unordered_map<GradualTempoChangeType, double> DEFAULT_FACTORS_MAP {
@@ -215,7 +215,7 @@ PropertyValue GradualTempoChange::propertyDefault(Pid propertyId) const
215215
{
216216
switch (propertyId) {
217217
case Pid::ALIGN:
218-
return score()->styleV(Sid::tempoAlign);
218+
return score()->styleV(Sid::tempoChangeAlign);
219219

220220
case Pid::LINE_WIDTH:
221221
return score()->styleV(Sid::tempoChangeLineWidth);
@@ -229,7 +229,7 @@ PropertyValue GradualTempoChange::propertyDefault(Pid propertyId) const
229229
return PropertyValue::fromValue(PointF(0, 0));
230230

231231
case Pid::BEGIN_FONT_STYLE:
232-
return score()->styleV(Sid::tempoFontStyle);
232+
return score()->styleV(Sid::tempoChangeFontStyle);
233233

234234
case Pid::BEGIN_TEXT:
235235
case Pid::CONTINUE_TEXT:
@@ -260,30 +260,30 @@ Sid GradualTempoChange::getPropertyStyle(Pid id) const
260260
{
261261
switch (id) {
262262
case Pid::PLACEMENT:
263-
return Sid::tempoPlacement;
263+
return Sid::tempoChangePlacement;
264264
case Pid::BEGIN_FONT_FACE:
265265
case Pid::CONTINUE_FONT_FACE:
266266
case Pid::END_FONT_FACE:
267-
return Sid::tempoFontFace;
267+
return Sid::tempoChangeFontFace;
268268
case Pid::BEGIN_FONT_SIZE:
269269
case Pid::CONTINUE_FONT_SIZE:
270270
case Pid::END_FONT_SIZE:
271-
return Sid::tempoFontSize;
271+
return Sid::tempoChangeFontSize;
272272
case Pid::BEGIN_FONT_STYLE:
273273
case Pid::CONTINUE_FONT_STYLE:
274274
case Pid::END_FONT_STYLE:
275-
return Sid::tempoFontStyle;
275+
return Sid::tempoChangeFontStyle;
276276
case Pid::BEGIN_TEXT_ALIGN:
277277
case Pid::CONTINUE_TEXT_ALIGN:
278278
case Pid::END_TEXT_ALIGN:
279-
return Sid::tempoAlign;
279+
return Sid::tempoChangeAlign;
280280
case Pid::BEGIN_TEXT:
281281
return Sid::letRingText;
282282
case Pid::OFFSET:
283283
if (placeAbove()) {
284-
return Sid::tempoPosAbove;
284+
return Sid::tempoChangePosAbove;
285285
} else {
286-
return Sid::tempoPosBelow;
286+
return Sid::tempoChangePosBelow;
287287
}
288288
default:
289289
break;

src/engraving/style/styledef.cpp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -890,12 +890,31 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
890890
{ Sid::tempoFramePadding, "tempoFramePadding", 0.2 },
891891
{ Sid::tempoFrameWidth, "tempoFrameWidth", 0.1 },
892892
{ Sid::tempoFrameRound, "tempoFrameRound", 0 },
893-
{ Sid::tempoFrameFgColor, "tempoFrameFgColor", PropertyValue::fromValue(Color::BLACK) },
894-
{ Sid::tempoFrameBgColor, "tempoFrameBgColor", PropertyValue::fromValue(Color::transparent) },
895-
{ Sid::tempoChangeLineWidth, "tempoChangeLineWidth", Spatium(0.15) },
896-
{ Sid::tempoChangeLineStyle, "tempoChangeLineStyle", PropertyValue(LineType::DASHED) },
897-
{ Sid::tempoChangeDashLineLen, "tempoChangeDashLineLen", 6.0 },
898-
{ Sid::tempoChangeDashGapLen, "tempoChangeDashGapLen", 9.0 },
893+
{ Sid::tempoFrameFgColor, "tempoFrameFgColor", PropertyValue::fromValue(draw::Color::BLACK) },
894+
{ Sid::tempoFrameBgColor, "tempoFrameBgColor", PropertyValue::fromValue(draw::Color::transparent) },
895+
896+
{ Sid::tempoChangeFontFace, "tempoChangeFontFace", "Edwin" },
897+
{ Sid::tempoChangeFontSize, "tempoChangeFontSize", 12.0 },
898+
{ Sid::tempoChangeLineSpacing, "tempoChangeLineSpacing", 1.0 },
899+
{ Sid::tempoChangeFontSpatiumDependent, "tempoChangeFontSpatiumDependent", true },
900+
{ Sid::tempoChangeFontStyle, "tempoChangeFontStyle", int(FontStyle::Bold) },
901+
{ Sid::tempoChangeColor, "tempoChangeColor", PropertyValue::fromValue(draw::Color::BLACK) },
902+
{ Sid::tempoChangeAlign, "tempoChangeAlign", Align(AlignH::LEFT, AlignV::BASELINE) },
903+
{ Sid::tempoChangeSystemFlag, "tempoChangeSystemFlag", true },
904+
{ Sid::tempoChangePlacement, "tempoChangePlacement", PlacementV::ABOVE },
905+
{ Sid::tempoChangePosAbove, "tempoChangePosAbove", PointF(.0, -2.0) },
906+
{ Sid::tempoChangePosBelow, "tempoChangePosBelow", PointF(.0, 3.0) },
907+
{ Sid::tempoChangeMinDistance, "tempoChangeMinDistance", Spatium(.5) },
908+
{ Sid::tempoChangeFrameType, "tempoChangeFrameType", int(FrameType::NO_FRAME) },
909+
{ Sid::tempoChangeFramePadding, "tempoChangeFramePadding", 0.2 },
910+
{ Sid::tempoChangeFrameWidth, "tempoChangeFrameWidth", 0.1 },
911+
{ Sid::tempoChangeFrameRound, "tempoChangeFrameRound", 0 },
912+
{ Sid::tempoChangeFrameFgColor, "tempoChangeFrameFgColor", PropertyValue::fromValue(draw::Color::BLACK) },
913+
{ Sid::tempoChangeFrameBgColor, "tempoChangeFrameBgColor", PropertyValue::fromValue(draw::Color::transparent) },
914+
{ Sid::tempoChangeLineWidth, "tempoChangeLineWidth", Spatium(0.15) },
915+
{ Sid::tempoChangeLineStyle, "tempoChangeLineStyle", PropertyValue(LineType::DASHED) },
916+
{ Sid::tempoChangeDashLineLen, "tempoChangeDashLineLen", 6.0 },
917+
{ Sid::tempoChangeDashGapLen, "tempoChangeDashGapLen", 9.0 },
899918

900919
{ Sid::metronomeFontFace, "metronomeFontFace", "Edwin" },
901920
{ Sid::metronomeFontSize, "metronomeFontSize", 12.0 },

src/engraving/style/styledef.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,25 @@ enum class Sid {
906906
tempoFrameRound,
907907
tempoFrameFgColor,
908908
tempoFrameBgColor,
909+
910+
tempoChangeFontFace,
911+
tempoChangeFontSize,
912+
tempoChangeLineSpacing,
913+
tempoChangeFontSpatiumDependent,
914+
tempoChangeFontStyle,
915+
tempoChangeColor,
916+
tempoChangeAlign,
917+
tempoChangeSystemFlag,
918+
tempoChangePlacement,
919+
tempoChangePosAbove,
920+
tempoChangePosBelow,
921+
tempoChangeMinDistance,
922+
tempoChangeFrameType,
923+
tempoChangeFramePadding,
924+
tempoChangeFrameWidth,
925+
tempoChangeFrameRound,
926+
tempoChangeFrameFgColor,
927+
tempoChangeFrameBgColor,
909928
tempoChangeLineWidth,
910929
tempoChangeLineStyle,
911930
tempoChangeDashLineLen,

src/engraving/style/textstyle.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,23 @@ const TextStyle tempoTextStyle { {
316316
{ TextStylePropertyType::FrameFillColor, Sid::tempoFrameBgColor, Pid::FRAME_BG_COLOR },
317317
} };
318318

319+
const TextStyle tempoChangeTextStyle { {
320+
{ TextStylePropertyType::FontFace, Sid::tempoChangeFontFace, Pid::FONT_FACE },
321+
{ TextStylePropertyType::FontSize, Sid::tempoChangeFontSize, Pid::FONT_SIZE },
322+
{ TextStylePropertyType::LineSpacing, Sid::tempoChangeLineSpacing, Pid::TEXT_LINE_SPACING },
323+
{ TextStylePropertyType::SizeSpatiumDependent, Sid::tempoChangeFontSpatiumDependent, Pid::SIZE_SPATIUM_DEPENDENT },
324+
{ TextStylePropertyType::FontStyle, Sid::tempoChangeFontStyle, Pid::FONT_STYLE },
325+
{ TextStylePropertyType::Color, Sid::tempoChangeColor, Pid::COLOR },
326+
{ TextStylePropertyType::TextAlign, Sid::tempoChangeAlign, Pid::ALIGN },
327+
{ TextStylePropertyType::Offset, Sid::tempoChangePosAbove, Pid::OFFSET },
328+
{ TextStylePropertyType::FrameType, Sid::tempoChangeFrameType, Pid::FRAME_TYPE },
329+
{ TextStylePropertyType::FramePadding, Sid::tempoChangeFramePadding, Pid::FRAME_PADDING },
330+
{ TextStylePropertyType::FrameWidth, Sid::tempoChangeFrameWidth, Pid::FRAME_WIDTH },
331+
{ TextStylePropertyType::FrameRound, Sid::tempoChangeFrameRound, Pid::FRAME_ROUND },
332+
{ TextStylePropertyType::FrameBorderColor, Sid::tempoChangeFrameFgColor, Pid::FRAME_FG_COLOR },
333+
{ TextStylePropertyType::FrameFillColor, Sid::tempoChangeFrameBgColor, Pid::FRAME_BG_COLOR },
334+
} };
335+
319336
const TextStyle metronomeTextStyle { {
320337
{ TextStylePropertyType::FontFace, Sid::metronomeFontFace, Pid::FONT_FACE },
321338
{ TextStylePropertyType::FontSize, Sid::metronomeFontSize, Pid::FONT_SIZE },
@@ -1017,6 +1034,7 @@ const TextStyle* textStyle(TextStyleType idx)
10171034
case TextStyleType::MMREST_RANGE: return &mmRestRangeTextStyle;
10181035

10191036
case TextStyleType::TEMPO: return &tempoTextStyle;
1037+
case TextStyleType::TEMPO_CHANGE: return &tempoChangeTextStyle;
10201038
case TextStyleType::METRONOME: return &metronomeTextStyle;
10211039
case TextStyleType::REPEAT_LEFT: return &repeatLeftTextStyle;
10221040
case TextStyleType::REPEAT_RIGHT: return &repeatRightTextStyle;

src/engraving/types/types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ enum class TextStyleType {
627627

628628
// System-level styles
629629
TEMPO,
630+
TEMPO_CHANGE,
630631
METRONOME,
631632
REPEAT_LEFT, // align to start of measure
632633
REPEAT_RIGHT, // align to end of measure

src/engraving/types/typesconv.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ static const std::vector<Item<TextStyleType> > TEXTSTYLE_TYPES = {
940940
{ TextStyleType::MMREST_RANGE, "mmrest_range", TranslatableString("engraving", "Multimeasure rest range") },
941941

942942
{ TextStyleType::TEMPO, "tempo", TranslatableString("engraving", "Tempo") },
943+
{ TextStyleType::TEMPO_CHANGE, "tempo change", TranslatableString("engraving", "Gradual tempo change") },
943944
{ TextStyleType::METRONOME, "metronome", TranslatableString("engraving", "Metronome") },
944945
{ TextStyleType::REPEAT_LEFT, "repeat_left", TranslatableString("engraving", "Repeat text left") },
945946
{ TextStyleType::REPEAT_RIGHT, "repeat_right", TranslatableString("engraving", "Repeat text right") },

0 commit comments

Comments
 (0)