Skip to content

Commit

Permalink
Merge pull request #115 from DDMAL/toggle-syllable-fix
Browse files Browse the repository at this point in the history
Add empty syl for follows syllable if precedes becomes empty
  • Loading branch information
yinanazhou authored Oct 30, 2023
2 parents 4e18f35 + 8330f3b commit d3d0f8f
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion src/editortoolkit_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,46 @@ bool EditorToolkitNeume::Remove(std::string elementId)
= dynamic_cast<Syllable *>(m_doc->GetDrawingPage()->FindDescendantByID(linkedID));
if (linkedSyllable != NULL) {
if (linkedSyllable->HasPrecedes()) linkedSyllable->SetPrecedes("");
if (linkedSyllable->HasFollows()) linkedSyllable->SetFollows("");
if (linkedSyllable->HasFollows()) {
linkedSyllable->SetFollows("");
// Create an empty syl for the second part
Syl *syl = new Syl();
Text *text = new Text();
std::u32string str = U"";
text->SetText(str);
syl->AddChild(text);
linkedSyllable->AddChild(syl);

// Create default bounding box if facs
if (m_doc->GetType() == Facs) {
Zone *zone = new Zone();

zone->SetUlx(linkedSyllable->GetFirst(NEUME)
->GetFirst(NC)
->GetFacsimileInterface()
->GetZone()
->GetUlx());
zone->SetUly(
linkedSyllable->GetAncestorStaff()->GetFacsimileInterface()->GetZone()->GetLry());
zone->SetLrx(linkedSyllable->GetLast(NEUME)
->GetLast(NC)
->GetFacsimileInterface()
->GetZone()
->GetLrx());
zone->SetLry(zone->GetUly() + 100);

// Make bbox larger if it has less than 2 ncs
if (linkedSyllable->GetChildCount(NC, 2) <= 2) {
zone->SetLrx(zone->GetLrx() + 50);
}

assert(m_doc->GetFacsimile());
m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone);
FacsimileInterface *fi = syl->GetFacsimileInterface();
assert(fi);
fi->AttachZone(zone);
}
};
}
}
// Delete the syllable empty of neumes
Expand Down

0 comments on commit d3d0f8f

Please sign in to comment.