Skip to content

Commit

Permalink
Implementation for issue humdrum-tools/verovio-humdrum-viewer#872
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsapp committed Jan 20, 2024
1 parent 5d6cf49 commit 80ec72d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/vrv/iohumdrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ class HumdrumInput : public vrv::Input {
int getKeySignatureNumber(const std::string &humkeysig);
int getStaffNumForSpine(hum::HTp token);
bool checkIfReversedSpineOrder(std::vector<hum::HTp> &staffstarts);
bool hasOmdText(int startline, int endline);

// header related functions: ///////////////////////////////////////////
void createHeader();
Expand Down
31 changes: 31 additions & 0 deletions src/iohumdrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9684,6 +9684,15 @@ void HumdrumInput::checkForOmd(int startline, int endline)
}
}

bool omdTextQ = hasOmdText(startline, endline);

if (omdTextQ) {
// Do not print the !!!OMD: reference record since there is an
// alternate !!LO:TX:omd: entry that will be printed (expected
// to be attached to a time signature for now).
return;
}

if (!value.empty()) {
Tempo *tempo = new Tempo();
hum::HTp token = infile.token(index, 0);
Expand Down Expand Up @@ -9714,6 +9723,28 @@ void HumdrumInput::checkForOmd(int startline, int endline)
}
}

//////////////////////////////
//
// HumdrumInput::hasOmdText -- Check for global layout text that should
// be used instead of any OMD reference record.
//

bool HumdrumInput::hasOmdText(int startline, int endline)
{
hum::HumdrumFile &infile = m_infiles[0];
hum::HumRegex hre;
for (int i = startline; i <= endline; i++) {
if (infile[i].hasSpines()) {
continue;
}
hum::HTp token = infile.token(i, 0);
if (hre.search(token, "^!!LO:TX.*:omd(:|$)")) {
return true;
}
}
return false;
}

//////////////////////////////
//
// HumdrumInput::addChildBackMeasureOrSection -- Add to the current measure, or add to section
Expand Down

0 comments on commit 80ec72d

Please sign in to comment.