Skip to content

Commit 50e1f3b

Browse files
committed
allow <print-object> tags to apply to measures
1 parent 9037421 commit 50e1f3b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@ void MusicXMLParserPass2::attributes(const QString& partId, Measure* measure, co
23502350
} else if (_e.name() == "measure-style") {
23512351
measureStyle(measure);
23522352
} else if (_e.name() == "staff-details") {
2353-
staffDetails(partId);
2353+
staffDetails(partId, measure);
23542354
} else if (_e.name() == "time") {
23552355
time(partId, measure, tick);
23562356
} else if (_e.name() == "transpose") {
@@ -2383,7 +2383,7 @@ static void setStaffLines(Score* score, staff_idx_t staffIdx, int stafflines)
23832383
Parse the /score-partwise/part/measure/attributes/staff-details node.
23842384
*/
23852385

2386-
void MusicXMLParserPass2::staffDetails(const QString& partId)
2386+
void MusicXMLParserPass2::staffDetails(const QString& partId, Measure* measure)
23872387
{
23882388
//logDebugTrace("MusicXMLParserPass2::staffDetails");
23892389

@@ -2414,7 +2414,12 @@ void MusicXMLParserPass2::staffDetails(const QString& partId)
24142414

24152415
QString visible = _e.attributes().value("print-object").toString();
24162416
if (visible == "no") {
2417-
_score->staff(staffIdx)->setVisible(false);
2417+
if (measure) {
2418+
// if measure is supplied, print-object applies to the measure instead of the staff
2419+
measure->setStaffVisible(staffIdx, false);
2420+
} else {
2421+
_score->staff(staffIdx)->setVisible(false);
2422+
}
24182423
} else if (!visible.isEmpty() && visible != "yes") {
24192424
_logger->logError(QString("print-object should be \"yes\" or \"no\""));
24202425
}

src/importexport/musicxml/internal/musicxml/importmxmlpass2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class MusicXMLParserPass2
305305
void stem(DirectionV& sd, bool& nost);
306306
void doEnding(const QString& partId, Measure* measure, const QString& number, const QString& type, const QString& text,
307307
const bool print);
308-
void staffDetails(const QString& partId);
308+
void staffDetails(const QString& partId, Measure* measure = nullptr);
309309
void staffTuning(StringData* t);
310310
void skipLogCurrElem();
311311

0 commit comments

Comments
 (0)