Skip to content

Commit

Permalink
ported musescore#5965 : Fix: 303027 - Add System lines
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Feb 8, 2021
1 parent 9fc9146 commit 47fe31f
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/importexport/musicxml/internal/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
#include "libmscore/fret.h"
#include "libmscore/tie.h"
#include "libmscore/undo.h"
#include "libmscore/textline.h"
#include "libmscore/textlinebase.h"
#include "libmscore/fermata.h"
#include "libmscore/textframe.h"
#include "libmscore/instrchange.h"
Expand Down Expand Up @@ -5450,7 +5450,7 @@ static void spannerStart(ExportMusicXml* exp, int strack, int etrack, int track,
exp->pedal(toPedal(e), sstaff, seg->tick());
break;
case ElementType::TEXTLINE:
exp->textLine(toTextLine(e), sstaff, seg->tick());
exp->textLine(toTextLineBase(e), sstaff, seg->tick());
break;
case ElementType::LET_RING:
exp->textLine(toLetRing(e), sstaff, seg->tick());
Expand Down Expand Up @@ -5506,7 +5506,7 @@ static void spannerStop(ExportMusicXml* exp, int strack, int etrack, const Fract
exp->pedal(toPedal(e), sstaff, Fraction(-1,1));
break;
case ElementType::TEXTLINE:
exp->textLine(toTextLine(e), sstaff, Fraction(-1,1));
exp->textLine(toTextLineBase(e), sstaff, Fraction(-1,1));
break;
case ElementType::LET_RING:
exp->textLine(toLetRing(e), sstaff, Fraction(-1,1));
Expand Down
21 changes: 14 additions & 7 deletions src/libmscore/excerpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "note.h"
#include "lyrics.h"
#include "segment.h"
#include "textline.h"
#include "tupletmap.h"
#include "tiemap.h"
#include "layoutbreak.h"
Expand Down Expand Up @@ -416,7 +417,7 @@ void MasterScore::initExcerpt(Excerpt* excerpt)
static void cloneSpanner(Spanner* s, Score* score, int dstTrack, int dstTrack2)
{
// don’t clone voltas for track != 0
if (s->type() == ElementType::VOLTA && s->track() != 0) {
if ((s->isVolta() || (s->isTextLine() && toTextLine(s)->systemFlag())) && s->track() != 0) {
return;
}
Spanner* ns = toSpanner(s->linkedClone());
Expand All @@ -425,7 +426,7 @@ static void cloneSpanner(Spanner* s, Score* score, int dstTrack, int dstTrack2)
ns->setTrack(dstTrack);
ns->setTrack2(dstTrack2);

if (ns->type() == ElementType::SLUR) {
if (ns->isSlur()) {
// set start/end element for slur
ChordRest* cr1 = s->startCR();
ChordRest* cr2 = s->endCR();
Expand Down Expand Up @@ -663,7 +664,7 @@ void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceS
}

ne->setScore(score);
if (oe->type() == ElementType::BAR_LINE && adjustedBarlineSpan) {
if (oe->isBarLine() && adjustedBarlineSpan) {
BarLine* nbl = toBarLine(ne);
nbl->setSpanStaff(adjustedBarlineSpan);
} else if (oe->isChordRest()) {
Expand Down Expand Up @@ -884,7 +885,7 @@ void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceS
int dstTrack = -1;
int dstTrack2 = -1;

if (s->type() == ElementType::VOLTA) {
if (s->isVolta() || (s->isTextLine() && toTextLine(s)->systemFlag())) {
//always export voltas to first staff in part
dstTrack = 0;
dstTrack2 = 0;
Expand Down Expand Up @@ -1031,6 +1032,9 @@ void Excerpt::cloneStaff(Staff* srcStaff, Staff* dstStaff)
continue;
}
default:
if (toTextLine(e)->systemFlag()) {
continue;
}
Element* ne1 = e->clone();
ne1->setTrack(dstTrack);
ne1->setParent(seg);
Expand Down Expand Up @@ -1110,7 +1114,7 @@ void Excerpt::cloneStaff(Staff* srcStaff, Staff* dstStaff)
int staffIdx = s->staffIdx();
int dstTrack = -1;
int dstTrack2 = -1;
if (s->type() != ElementType::VOLTA) {
if (!(s->isVolta() || (s->isTextLine() && toTextLine(s)->systemFlag()))) {
//export other spanner if staffidx matches
if (srcStaffIdx == staffIdx) {
dstTrack = dstStaffIdx * VOICES + s->voice();
Expand Down Expand Up @@ -1203,7 +1207,7 @@ void Excerpt::cloneStaff2(Staff* srcStaff, Staff* dstStaff, const Fraction& star
if (oe == 0 || oe->generated()) {
continue;
}
if (oe->type() == ElementType::TIMESIG) {
if (oe->isTimeSig()) {
continue;
}
Segment* ns = nm->getSegment(oseg->segmentType(), oseg->tick());
Expand Down Expand Up @@ -1249,6 +1253,9 @@ void Excerpt::cloneStaff2(Staff* srcStaff, Staff* dstStaff, const Fraction& star
case ElementType::LYRICS: // not normally segment-attached
continue;
default:
if (toTextLine(e)->systemFlag()) {
continue;
}
Element* ne1 = e->clone();
ne1->setTrack(dstTrack);
ne1->setParent(ns);
Expand Down Expand Up @@ -1296,7 +1303,7 @@ void Excerpt::cloneStaff2(Staff* srcStaff, Staff* dstStaff, const Fraction& star
int staffIdx = s->staffIdx();
int dstTrack = -1;
int dstTrack2 = -1;
if (s->type() != ElementType::VOLTA) {
if (!(s->isVolta() || (s->isTextLine() && s->systemFlag()))) {
//export other spanner if staffidx matches
if (srcStaffIdx == staffIdx) {
dstTrack = dstStaffIdx * VOICES + s->voice();
Expand Down
27 changes: 23 additions & 4 deletions src/libmscore/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,16 @@ static const StyleType styleTypes[] {
{ Sid::textLineFrameFgColor, "textLineFrameFgColor", QColor(0, 0, 0, 255) },
{ Sid::textLineFrameBgColor, "textLineFrameBgColor", QColor(255, 255, 255, 0) },

{ Sid::systemTextLinePlacement, "systemTextLinePlacement", int(Placement::ABOVE) },
{ Sid::systemTextLinePosAbove, "systemTextLinePosAbove", QPointF(.0, -1.0) },
{ Sid::systemTextLinePosBelow, "systemTextLinePosBelow", QPointF(.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", QColor(0, 0, 0, 255) },
{ Sid::systemTextLineFrameBgColor, "systemTextLineFrameBgColor", QColor(255, 255, 255, 0) },

{ Sid::tremoloBarLineWidth, "tremoloBarLineWidth", Spatium(0.12) },
{ Sid::jumpPosAbove, "jumpPosAbove", QPointF(.0, -2.0) },
{ Sid::markerPosAbove, "markerPosAbove", QPointF(.0, -2.0) },
Expand Down Expand Up @@ -1025,10 +1035,18 @@ static const StyleType styleTypes[] {
{ Sid::textLineFontSpatiumDependent, "textLineFontSpatiumDependent", true },
{ Sid::textLineFontStyle, "textLineFontStyle", int(FontStyle::Normal) },
{ Sid::textLineColor, "textLineColor", QColor(0, 0, 0, 255) },
{ Sid::textLineTextAlign, "textLineTextAlign", QVariant::fromValue(
Align::LEFT | Align::VCENTER) },

{ Sid::glissandoFontFace, "glissandoFontFace", "FreeSerif" },
{ Sid::textLineTextAlign, "textLineTextAlign", QVariant::fromValue(Align::LEFT | Align::VCENTER) },
{ Sid::textLineSystemFlag, "textLineSystemFlag", false },

{ Sid::systemTextLineFontFace, "systemTextLineFontFace", "Edwin" },
{ Sid::systemTextLineFontSize, "systemTextLineFontSize", 12.0 },
{ Sid::systemTextLineFontSpatiumDependent, "systemTextLineFontSpatiumDependent", true },
{ Sid::systemTextLineFontStyle, "systemTextLineFontStyle", int(FontStyle::Normal) },
{ Sid::systemTextLineColor, "systemTextLineColor", QColor(0, 0, 0, 255) },
{ Sid::systemTextLineTextAlign, "systemTextLineTextAlign", QVariant::fromValue(Align::LEFT | Align::VCENTER) },
{ Sid::systemTextLineSystemFlag, "systemTextLineSystemFlag", true },

{ Sid::glissandoFontFace, "glissandoFontFace", "Edwin" },
{ Sid::glissandoFontSize, "glissandoFontSize", QVariant(8.0) },
{ Sid::glissandoFontSpatiumDependent, "glissandoFontSpatiumDependent", true },
{ Sid::glissandoFontStyle, "glissandoFontStyle", int(FontStyle::Italic) },
Expand Down Expand Up @@ -1397,6 +1415,7 @@ static const StyleType styleTypes[] {
{ Sid::pedalMinDistance, "pedalMinDistance", Spatium(0.7) },
{ Sid::repeatMinDistance, "repeatMinDistance", Spatium(0.5) },
{ Sid::textLineMinDistance, "textLineMinDistance", Spatium(0.7) },
{ Sid::systemTextLineMinDistance, "systemTextLineMinDistance", Spatium(0.7) },
{ Sid::trillMinDistance, "trillMinDistance", Spatium(1.0) },
{ Sid::vibratoMinDistance, "vibratoMinDistance", Spatium(1.0) },
{ Sid::voltaMinDistance, "voltaMinDistance", Spatium(1.0) },
Expand Down
20 changes: 20 additions & 0 deletions src/libmscore/style.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,16 @@ enum class Sid {
textLineFrameFgColor,
textLineFrameBgColor,

systemTextLinePlacement,
systemTextLinePosAbove,
systemTextLinePosBelow,
systemTextLineFrameType,
systemTextLineFramePadding,
systemTextLineFrameWidth,
systemTextLineFrameRound,
systemTextLineFrameFgColor,
systemTextLineFrameBgColor,

tremoloBarLineWidth,
jumpPosAbove,
markerPosAbove,
Expand Down Expand Up @@ -988,6 +998,15 @@ enum class Sid {
textLineFontStyle,
textLineColor,
textLineTextAlign,
textLineSystemFlag,

systemTextLineFontFace,
systemTextLineFontSize,
systemTextLineFontSpatiumDependent,
systemTextLineFontStyle,
systemTextLineColor,
systemTextLineTextAlign,
systemTextLineSystemFlag,

glissandoFontFace,
glissandoFontSize,
Expand Down Expand Up @@ -1342,6 +1361,7 @@ enum class Sid {
pedalMinDistance,
repeatMinDistance,
textLineMinDistance,
systemTextLineMinDistance,
trillMinDistance,
vibratoMinDistance,
voltaMinDistance,
Expand Down
Loading

0 comments on commit 47fe31f

Please sign in to comment.