Skip to content

Commit 8330f3b

Browse files
committed
Add empty syl for follows syllable if precedes becomes empty
1 parent 4e18f35 commit 8330f3b

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

src/editortoolkit_neume.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,46 @@ bool EditorToolkitNeume::Remove(std::string elementId)
21972197
= dynamic_cast<Syllable *>(m_doc->GetDrawingPage()->FindDescendantByID(linkedID));
21982198
if (linkedSyllable != NULL) {
21992199
if (linkedSyllable->HasPrecedes()) linkedSyllable->SetPrecedes("");
2200-
if (linkedSyllable->HasFollows()) linkedSyllable->SetFollows("");
2200+
if (linkedSyllable->HasFollows()) {
2201+
linkedSyllable->SetFollows("");
2202+
// Create an empty syl for the second part
2203+
Syl *syl = new Syl();
2204+
Text *text = new Text();
2205+
std::u32string str = U"";
2206+
text->SetText(str);
2207+
syl->AddChild(text);
2208+
linkedSyllable->AddChild(syl);
2209+
2210+
// Create default bounding box if facs
2211+
if (m_doc->GetType() == Facs) {
2212+
Zone *zone = new Zone();
2213+
2214+
zone->SetUlx(linkedSyllable->GetFirst(NEUME)
2215+
->GetFirst(NC)
2216+
->GetFacsimileInterface()
2217+
->GetZone()
2218+
->GetUlx());
2219+
zone->SetUly(
2220+
linkedSyllable->GetAncestorStaff()->GetFacsimileInterface()->GetZone()->GetLry());
2221+
zone->SetLrx(linkedSyllable->GetLast(NEUME)
2222+
->GetLast(NC)
2223+
->GetFacsimileInterface()
2224+
->GetZone()
2225+
->GetLrx());
2226+
zone->SetLry(zone->GetUly() + 100);
2227+
2228+
// Make bbox larger if it has less than 2 ncs
2229+
if (linkedSyllable->GetChildCount(NC, 2) <= 2) {
2230+
zone->SetLrx(zone->GetLrx() + 50);
2231+
}
2232+
2233+
assert(m_doc->GetFacsimile());
2234+
m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone);
2235+
FacsimileInterface *fi = syl->GetFacsimileInterface();
2236+
assert(fi);
2237+
fi->AttachZone(zone);
2238+
}
2239+
};
22012240
}
22022241
}
22032242
// Delete the syllable empty of neumes

0 commit comments

Comments
 (0)