Skip to content

Commit

Permalink
line style options for text lines
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoMigros committed Apr 29, 2024
1 parent 28e2c27 commit 6c52b26
Show file tree
Hide file tree
Showing 5 changed files with 485 additions and 20 deletions.
40 changes: 33 additions & 7 deletions src/engraving/dom/textline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ static const ElementStyle textLineStyle {
{ Sid::textLineTextAlign, Pid::BEGIN_TEXT_ALIGN },
{ Sid::textLineTextAlign, Pid::CONTINUE_TEXT_ALIGN },
{ Sid::textLineTextAlign, Pid::END_TEXT_ALIGN },
{ Sid::textLineHookHeight, Pid::BEGIN_HOOK_HEIGHT },
{ Sid::textLineHookHeight, Pid::END_HOOK_HEIGHT },
{ Sid::textLineLineWidth, Pid::LINE_WIDTH },
{ Sid::textLineDashLineLen, Pid::DASH_LINE_LEN },
{ Sid::textLineDashGapLen, Pid::DASH_GAP_LEN },
{ Sid::textLinePlacement, Pid::PLACEMENT },
{ Sid::textLineLineStyle, Pid::LINE_STYLE },
{ Sid::textLinePosAbove, Pid::OFFSET },
{ Sid::textLineFontSpatiumDependent, Pid::TEXT_SIZE_SPATIUM_DEPENDENT },
};
Expand All @@ -89,7 +95,13 @@ static const ElementStyle systemTextLineStyle {
{ Sid::systemTextLineTextAlign, Pid::BEGIN_TEXT_ALIGN },
{ Sid::systemTextLineTextAlign, Pid::CONTINUE_TEXT_ALIGN },
{ Sid::systemTextLineTextAlign, Pid::END_TEXT_ALIGN },
{ Sid::systemTextLineHookHeight, Pid::BEGIN_HOOK_HEIGHT },
{ Sid::systemTextLineHookHeight, Pid::END_HOOK_HEIGHT },
{ Sid::systemTextLineLineWidth, Pid::LINE_WIDTH },
{ Sid::systemTextLineDashLineLen, Pid::DASH_LINE_LEN },
{ Sid::systemTextLineDashGapLen, Pid::DASH_GAP_LEN },
{ Sid::systemTextLinePlacement, Pid::PLACEMENT },
{ Sid::systemTextLineLineStyle, Pid::LINE_STYLE },
{ Sid::systemTextLinePosAbove, Pid::OFFSET },
};

Expand Down Expand Up @@ -129,8 +141,6 @@ TextLine::TextLine(EngravingItem* parent, bool system)
{
setSystemFlag(system);

initStyle();

setBeginText(u"");
setContinueText(u"");
setEndText(u"");
Expand All @@ -145,11 +155,18 @@ TextLine::TextLine(EngravingItem* parent, bool system)
setEndHookHeight(Spatium(1.5));
setGapBetweenTextAndLine(Spatium(0.5));

initElementStyle(&textLineStyle);
initStyle();
/*initElementStyle(&textLineStyle);
resetProperty(Pid::LINE_WIDTH);
resetProperty(Pid::LINE_STYLE);
resetProperty(Pid::BEGIN_HOOK_TYPE);
resetProperty(Pid::END_HOOK_TYPE);
resetProperty(Pid::BEGIN_TEXT_PLACE);
resetProperty(Pid::CONTINUE_TEXT_PLACE);
resetProperty(Pid::END_TEXT_PLACE);
resetProperty(Pid::END_TEXT_PLACE);*/
}

TextLine::TextLine(const TextLine& tl)
Expand Down Expand Up @@ -272,9 +289,18 @@ engraving::PropertyValue TextLine::propertyDefault(Pid propertyId) const
case Pid::CONTINUE_TEXT_PLACE:
case Pid::END_TEXT_PLACE:
return TextPlace::LEFT;
case Pid::BEGIN_HOOK_HEIGHT:
case Pid::END_HOOK_HEIGHT:
return Spatium(1.5);
case Pid::LINE_WIDTH:
if (systemFlag()) {
return style().styleMM(Sid::systemTextLineLineWidth);
} else {
return style().styleMM(Sid::textLineLineWidth);
}
case Pid::LINE_STYLE:
if (systemFlag()) {
return style().styleV(Sid::systemTextLineLineStyle);
} else {
return style().styleV(Sid::textLineLineStyle);
}
default:
return TextLineBase::propertyDefault(propertyId);
}
Expand Down
34 changes: 22 additions & 12 deletions src/engraving/style/styledef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,22 +669,32 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::textLinePlacement, "textLinePlacement", PlacementV::ABOVE },
{ Sid::textLinePosAbove, "textLinePosAbove", PointF(.0, -1.0) },
{ Sid::textLinePosBelow, "textLinePosBelow", PointF(.0, 1.0) },
{ Sid::textLineFrameType, "textLineFrameType", int(FrameType::NO_FRAME) },
{ Sid::textLineFramePadding, "textLineFramePadding", 0.2 },
{ Sid::textLineFrameWidth, "textLineFrameWidth", 0.1 },
{ Sid::textLineFrameRound, "textLineFrameRound", 0 },
{ Sid::textLineFrameFgColor, "textLineFrameFgColor", PropertyValue::fromValue(Color::BLACK) },
{ Sid::textLineFrameBgColor, "textLineFrameBgColor", PropertyValue::fromValue(Color::transparent) },
{ Sid::textLineLineWidth, "textLineLineWidth", Spatium(0.15) },
{ Sid::textLineLineStyle, "textLineLineStyle", PropertyValue(LineType::SOLID) },
{ Sid::textLineDashLineLen, "textLineDashLineLen", 4.0 },
{ Sid::textLineDashGapLen, "textLineDashGapLen", 4.0 },
{ Sid::textLineHookHeight, "textLineHookHeight", Spatium(1.5) },
{ Sid::textLineFrameType, "textLineFrameType", int(FrameType::NO_FRAME) },
{ Sid::textLineFramePadding, "textLineFramePadding", 0.2 },
{ Sid::textLineFrameWidth, "textLineFrameWidth", 0.1 },
{ Sid::textLineFrameRound, "textLineFrameRound", 0 },
{ Sid::textLineFrameFgColor, "textLineFrameFgColor", PropertyValue::fromValue(Color::BLACK) },
{ Sid::textLineFrameBgColor, "textLineFrameBgColor", PropertyValue::fromValue(Color::transparent) },

{ Sid::systemTextLinePlacement, "systemTextLinePlacement", PlacementV::ABOVE },
{ Sid::systemTextLinePosAbove, "systemTextLinePosAbove", PointF(.0, -1.0) },
{ Sid::systemTextLinePosBelow, "systemTextLinePosBelow", PointF(.0, 1.0) },
{ Sid::systemTextLineFrameType, "systemTextLineFrameType", int(FrameType::NO_FRAME) },
{ Sid::systemTextLineFramePadding, "systemTextLineFramePadding", 0.2 },
{ Sid::systemTextLineFrameWidth, "systemTextLineFrameWidth", 0.1 },
{ Sid::systemTextLineFrameRound, "systemTextLineFrameRound", 0 },
{ Sid::systemTextLineFrameFgColor, "systemTextLineFrameFgColor", PropertyValue::fromValue(Color::BLACK) },
{ Sid::systemTextLineFrameBgColor, "systemTextLineFrameBgColor", PropertyValue::fromValue(Color::transparent) },
{ Sid::systemTextLineLineWidth, "systemTextLineLineWidth", Spatium(0.15) },
{ Sid::systemTextLineLineStyle, "systemTextLineLineStyle", PropertyValue(LineType::SOLID) },
{ Sid::systemTextLineDashLineLen, "systemTextLineDashLineLen", 4.0 },
{ Sid::systemTextLineDashGapLen, "systemTextLineDashGapLen", 4.0 },
{ Sid::systemTextLineHookHeight, "systemTextLineHookHeight", Spatium(1.5) },
{ Sid::systemTextLineFrameType, "systemTextLineFrameType", int(FrameType::NO_FRAME) },
{ Sid::systemTextLineFramePadding, "systemTextLineFramePadding", 0.2 },
{ Sid::systemTextLineFrameWidth, "systemTextLineFrameWidth", 0.1 },
{ Sid::systemTextLineFrameRound, "systemTextLineFrameRound", 0 },
{ Sid::systemTextLineFrameFgColor, "systemTextLineFrameFgColor", PropertyValue::fromValue(Color::BLACK) },
{ Sid::systemTextLineFrameBgColor, "systemTextLineFrameBgColor", PropertyValue::fromValue(Color::transparent) },

{ Sid::tremoloBarLineWidth, "tremoloBarLineWidth", Spatium(0.12) },
{ Sid::jumpPosAbove, "jumpPosAbove", PointF(.0, -2.0) },
Expand Down
10 changes: 10 additions & 0 deletions src/engraving/style/styledef.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,11 @@ enum class Sid {
textLinePlacement,
textLinePosAbove,
textLinePosBelow,
textLineLineWidth,
textLineLineStyle,
textLineDashLineLen,
textLineDashGapLen,
textLineHookHeight,
textLineFrameType,
textLineFramePadding,
textLineFrameWidth,
Expand All @@ -692,6 +697,11 @@ enum class Sid {
systemTextLinePlacement,
systemTextLinePosAbove,
systemTextLinePosBelow,
systemTextLineLineWidth,
systemTextLineLineStyle,
systemTextLineDashLineLen,
systemTextLineDashGapLen,
systemTextLineHookHeight,
systemTextLineFrameType,
systemTextLineFramePadding,
systemTextLineFrameWidth,
Expand Down
27 changes: 27 additions & 0 deletions src/notation/view/widgets/editstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ EditStyle::EditStyle(QWidget* parent)
{ StyleId::pedalLineStyle, false, pedalLineStyle, resetPedalLineStyle },
{ StyleId::pedalDashLineLen, false, pedalLineStyleDashSize, resetPedalLineStyleDashSize },
{ StyleId::pedalDashGapLen, false, pedalLineStyleGapSize, resetPedalLineStyleGapSize },
{ StyleId::textLineLineStyle, false, textLineLineStyle, resetTextLineLineStyle },
{ StyleId::textLineDashLineLen, false, textLineLineStyleDashSize, resetTextLineLineStyleDashSize },
{ StyleId::textLineDashGapLen, false, textLineLineStyleGapSize, resetTextLineLineStyleGapSize },
{ StyleId::systemTextLineLineStyle, false, systemTextLineLineStyle, resetSystemTextLineLineStyle },
{ StyleId::systemTextLineDashLineLen, false, systemTextLineLineStyleDashSize, resetSystemTextLineLineStyleDashSize },
{ StyleId::systemTextLineDashGapLen, false, systemTextLineLineStyleGapSize, resetSystemTextLineLineStyleGapSize },

{ StyleId::staffUpperBorder, false, staffUpperBorder, resetStaffUpperBorder },
{ StyleId::staffLowerBorder, false, staffLowerBorder, resetStaffLowerBorder },
Expand Down Expand Up @@ -618,13 +624,16 @@ EditStyle::EditStyle(QWidget* parent)

{ StyleId::autoplaceVerticalAlignRange, false, autoplaceVerticalAlignRange, resetAutoplaceVerticalAlignRange },
{ StyleId::minVerticalDistance, false, minVerticalDistance, resetMinVerticalDistance },

{ StyleId::textLinePlacement, false, textLinePlacement, resetTextLinePlacement },
{ StyleId::textLinePosAbove, false, textLinePosAbove, resetTextLinePosAbove },
{ StyleId::textLinePosBelow, false, textLinePosBelow, resetTextLinePosBelow },
{ StyleId::textLineLineWidth, false, textLineLineWidth, resetTextLineLineWidth },

{ StyleId::systemTextLinePlacement, false, systemTextLinePlacement, resetSystemTextLinePlacement },
{ StyleId::systemTextLinePosAbove, false, systemTextLinePosAbove, resetSystemTextLinePosAbove },
{ StyleId::systemTextLinePosBelow, false, systemTextLinePosBelow, resetSystemTextLinePosBelow },
{ StyleId::systemTextLineLineWidth, false, systemTextLineLineWidth, resetSystemTextLineLineWidth },

{ StyleId::fermataPosAbove, false, fermataPosAbove, resetFermataPosAbove },
{ StyleId::fermataPosBelow, false, fermataPosBelow, resetFermataPosBelow },
Expand Down Expand Up @@ -707,6 +716,24 @@ EditStyle::EditStyle(QWidget* parent)
label_pedalLine_lineStyle_gapSize,
pedalLineStyleGapSize,
resetPedalLineStyleGapSize
}),

new LineStyleSelect(this, textLineLineStyle, {
label_textLineLine_lineStyle_dashSize,
textLineLineStyleDashSize,
resetTextLineLineStyleDashSize,
label_textLineLine_lineStyle_gapSize,
textLineLineStyleGapSize,
resetTextLineLineStyleGapSize
}),

new LineStyleSelect(this, systemTextLineLineStyle, {
label_systemTextLineLine_lineStyle_dashSize,
systemTextLineLineStyleDashSize,
resetSystemTextLineLineStyleDashSize,
label_systemTextLineLine_lineStyle_gapSize,
systemTextLineLineStyleGapSize,
resetSystemTextLineLineStyleGapSize
})
};

Expand Down
Loading

0 comments on commit 6c52b26

Please sign in to comment.