Skip to content

Commit

Permalink
Merge pull request #3691 from DDMAL/custos-octave-fix
Browse files Browse the repository at this point in the history
Update octaves for affected custodes
  • Loading branch information
lpugin authored May 22, 2024
2 parents 8fe00ed + de33c73 commit 765a124
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/editortoolkit_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1588,19 +1588,26 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d
clef->SetDisPlace(octaveDis > 0 ? STAFFREL_basic_above : STAFFREL_basic_below);
}

// Set new octaves for affected neume components
// Set new octaves for affected neume components and custodes
ClassIdComparison equalsClef(CLEF);
Clef *nextClef = dynamic_cast<Clef *>(page->FindNextChild(&equalsClef, clef));

ClassIdComparison equalsNcs(NC);
ListOfObjects ncs;
page->FindAllDescendantsBetween(&ncs, &equalsNcs, clef, nextClef);

std::for_each(ncs.begin(), ncs.end(), [&](Object *ncObj) {
Nc *nc = dynamic_cast<Nc *>(ncObj);
nc->SetOct(nc->GetOct() + move);
});

ClassIdComparison equalsCustodes(CUSTOS);
ListOfObjects custodes;
page->FindAllDescendantsBetween(&custodes, &equalsCustodes, clef, nextClef);
std::for_each(custodes.begin(), custodes.end(), [&](Object *custosObj) {
Custos *custos = dynamic_cast<Custos *>(custosObj);
custos->SetOct(custos->GetOct() + move);
});

m_editInfo.import("status", "OK");
m_editInfo.import("message", "");
return true;
Expand Down

0 comments on commit 765a124

Please sign in to comment.