Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/engraving/rw/read114/read114.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ muse::Ret Read114::readScoreFile(Score* score, XmlReader& e, ReadInOutData* out)
}
} else if (tag == "Excerpt") {
Excerpt* ex = new Excerpt(masterScore);
read400::TRead::read(ex, e, ctx);
readExcerpt(ex, e, ctx);
masterScore->m_excerpts.push_back(ex);
} else if (tag == "Beam") {
Beam* beam = Factory::createBeam(masterScore->dummy()->system());
Expand Down Expand Up @@ -3178,6 +3178,26 @@ muse::Ret Read114::readScoreFile(Score* score, XmlReader& e, ReadInOutData* out)
return muse::make_ok();
}

void Read114::readExcerpt(Excerpt* item, XmlReader& e, ReadContext&)
{
const std::vector<Part*>& pl = item->masterScore()->parts();
std::vector<Part*> parts;
while (e.readNextStartElement()) {
const AsciiStringView tag = e.name();
if (tag == "name" || tag == "title") {
item->setName(e.readText().trimmed());
} else if (tag == "part") {
size_t partIdx = static_cast<size_t>(e.readInt());
if (partIdx >= pl.size()) {
LOGD("Excerpt::read: bad part index");
} else {
parts.push_back(pl.at(partIdx));
}
}
}
item->setParts(parts);
}

bool Read114::pasteStaff(XmlReader&, Segment*, staff_idx_t, Fraction)
{
UNREACHABLE;
Expand Down
6 changes: 6 additions & 0 deletions src/engraving/rw/read114/read114.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

#include "../ireader.h"

namespace mu::engraving {
class Excerpt;
}

namespace mu::engraving::read400 {
class ReadContext;
}
Expand All @@ -47,5 +51,7 @@ class Read114 : public rw::IReader

private:
void doReadItem(EngravingItem* item, XmlReader& xml) override;

void readExcerpt(Excerpt* ex, XmlReader& e, read400::ReadContext& ctx);
};
}
1 change: 1 addition & 0 deletions src/engraving/rw/read206/read206.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3480,6 +3480,7 @@ bool Read206::readScoreTag(Score* score, XmlReader& e, ReadContext& ctx)
ctx.setLastMeasure(nullptr);
ReadContext exCtx(s);

s->setIsOpen(true);
readScoreTag(s, e, exCtx);

ex->setTracksMapping(ctx.tracks());
Expand Down
1 change: 1 addition & 0 deletions src/engraving/rw/read302/read302.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ bool Read302::readScoreTag(Score* score, XmlReader& e, ReadContext& ctx)
Score* curScore = ctx.score();
ctx.setScore(s);

s->setIsOpen(true);
readScoreTag(s, e, ctx);

ctx.setScore(curScore);
Expand Down
20 changes: 0 additions & 20 deletions src/engraving/rw/read400/tread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1335,26 +1335,6 @@ void TRead::read(FiguredBassItem* i, XmlReader& e, ReadContext& ctx)
}
}

void TRead::read(Excerpt* item, XmlReader& e, ReadContext&)
{
const std::vector<Part*>& pl = item->masterScore()->parts();
std::vector<Part*> parts;
while (e.readNextStartElement()) {
const AsciiStringView tag = e.name();
if (tag == "name" || tag == "title") {
item->setName(e.readText().trimmed());
} else if (tag == "part") {
size_t partIdx = static_cast<size_t>(e.readInt());
if (partIdx >= pl.size()) {
LOGD("Excerpt::read: bad part index");
} else {
parts.push_back(pl.at(partIdx));
}
}
}
item->setParts(parts);
}

void TRead::read(Fermata* f, XmlReader& e, ReadContext& ctx)
{
while (e.readNextStartElement()) {
Expand Down
3 changes: 0 additions & 3 deletions src/engraving/rw/read400/tread.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ class ChordRest;
class ChordLine;
class Clef;

class Excerpt;

class FiguredBass;
class FiguredBassItem;
class Fingering;
Expand Down Expand Up @@ -208,7 +206,6 @@ class TRead
static void read(ChordLine* l, XmlReader& xml, ReadContext& ctx);
static void read(Clef* c, XmlReader& xml, ReadContext& ctx);

static void read(Excerpt* item, XmlReader& xml, ReadContext& ctx);
static void read(Expression* item, XmlReader& xml, ReadContext& ctx);

static void read(Fermata* f, XmlReader& xml, ReadContext& ctx);
Expand Down
1 change: 1 addition & 0 deletions src/engraving/tests/chordsymbol_data/add-part-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<Part id="1">
<Staff>
<eid>P_P</eid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Piano</metaTag>
<Part id="1">
<Staff>
Expand Down
1 change: 1 addition & 0 deletions src/engraving/tests/compat206_data/hairpin-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Piano</metaTag>
<Part id="1">
<Staff>
Expand Down
1 change: 1 addition & 0 deletions src/engraving/tests/compat206_data/lidemptytext-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Bass</metaTag>
<Part id="2">
<Staff>
Expand Down
3 changes: 3 additions & 0 deletions src/engraving/tests/compat206_data/userstylesparts-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Piano</metaTag>
<Part id="1">
<Staff>
Expand Down Expand Up @@ -701,6 +702,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Flute 1</metaTag>
<Part id="2">
<Staff>
Expand Down Expand Up @@ -937,6 +939,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Flute 2</metaTag>
<Part id="3">
<Staff>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Piano</metaTag>
<Part id="1">
<Staff>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Piano</metaTag>
<Part id="1">
<Staff>
Expand Down
6 changes: 4 additions & 2 deletions src/engraving/tests/measure_data/measure-1-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
Expand Down Expand Up @@ -635,6 +636,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
Expand Down Expand Up @@ -731,8 +733,8 @@
</Rest>
</voice>
</Measure>
<Measure len="8/4">
<multiMeasureRest>4</multiMeasureRest>
<Measure len="10/4">
<multiMeasureRest>5</multiMeasureRest>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is slightly surprising at first sight, but it is because layout is not performed for parts that are not open.

<eid>bB_bB</eid>
<voice>
<TimeSig>
Expand Down
23 changes: 10 additions & 13 deletions src/engraving/tests/measure_data/measure-2-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
Expand Down Expand Up @@ -633,6 +634,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
Expand Down Expand Up @@ -743,52 +745,47 @@
<multiMeasureRest>4</multiMeasureRest>
<eid>dB_dB</eid>
<voice>
<TimeSig>
<eid>eB_eB</eid>
<sigN>2</sigN>
<sigD>4</sigD>
</TimeSig>
<Tempo>
<tempo>1.66667</tempo>
<eid>fB_fB</eid>
<eid>eB_eB</eid>
<linkedTo>bB_bB</linkedTo>
<text>𝅘𝅥 = 100</text>
</Tempo>
<Rest>
<eid>gB_gB</eid>
<eid>fB_fB</eid>
<placement>above</placement>
<durationType>measure</durationType>
<duration>8/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<eid>hB_hB</eid>
<eid>gB_gB</eid>
<voice>
<Rest>
<eid>iB_iB</eid>
<eid>hB_hB</eid>
<linkedTo>p_p</linkedTo>
<durationType>measure</durationType>
<duration>2/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<eid>jB_jB</eid>
<eid>iB_iB</eid>
<voice>
<Rest>
<eid>kB_kB</eid>
<eid>jB_jB</eid>
<linkedTo>q_q</linkedTo>
<durationType>measure</durationType>
<duration>2/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<eid>lB_lB</eid>
<eid>kB_kB</eid>
<voice>
<Rest>
<eid>mB_mB</eid>
<eid>lB_lB</eid>
<linkedTo>r_r</linkedTo>
<durationType>measure</durationType>
<duration>2/4</duration>
Expand Down
6 changes: 4 additions & 2 deletions src/engraving/tests/measure_data/measure-3-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
Expand Down Expand Up @@ -635,6 +636,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="copyright"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
Expand Down Expand Up @@ -731,8 +733,8 @@
</Rest>
</voice>
</Measure>
<Measure len="8/4">
<multiMeasureRest>4</multiMeasureRest>
<Measure len="10/4">
<multiMeasureRest>5</multiMeasureRest>
<eid>bB_bB</eid>
<voice>
<TimeSig>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<Part id="1">
<Staff>
<eid>r_r</eid>
Expand Down Expand Up @@ -552,6 +553,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<Part id="2">
<Staff>
<eid>JB_JB</eid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="partName">Flute</metaTag>
<Part id="1">
<Staff>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<Part id="1">
<Staff>
<eid>5_5</eid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<Part id="1">
<Staff>
<eid>5_5</eid>
Expand Down
Loading