Skip to content

Commit

Permalink
Fix staff removing and sorting
Browse files Browse the repository at this point in the history
Neon issue DDMAL/Neon#1212
  • Loading branch information
yinanazhou committed May 20, 2024
1 parent 035e27e commit 94bd6b1
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/editortoolkit_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2060,13 +2060,10 @@ bool EditorToolkitNeume::SortStaves()
Object *pbParent = pb->GetParent();
Object *milestoneEndParent = milestoneEnd->GetParent();
Object *sectionParent = section->GetParent();
int pbIdx = pbParent->GetChildIndex(pb);
int milestoneEndIdx = milestoneEndParent->GetChildIndex(milestoneEnd);
int sectionIdx = sectionParent->GetChildIndex(section);

pb = pbParent->DetachChild(pbIdx);
milestoneEnd = milestoneEndParent->DetachChild(milestoneEndIdx);
section = sectionParent->DetachChild(sectionIdx);
pb = pbParent->DetachChild(pb->GetIdx());
milestoneEnd = milestoneEndParent->DetachChild(milestoneEnd->GetIdx());
section = sectionParent->DetachChild(section->GetIdx());

Object *firstSystem = page->GetFirst(SYSTEM);
Object *lastSystem = page->GetLast(SYSTEM);
Expand Down Expand Up @@ -2322,10 +2319,8 @@ bool EditorToolkitNeume::Remove(std::string elementId)
assert(pb);
assert(section);

int sectionIdx = system->GetChildIndex(section);
int pbIdx = system->GetChildIndex(pb);
section = system->DetachChild(sectionIdx);
pb = system->DetachChild(pbIdx);
section = system->DetachChild(section->GetIdx());
pb = system->DetachChild(pb->GetIdx());

nextSystem->InsertChild(section, 0);
nextSystem->InsertChild(pb, 1);
Expand Down

0 comments on commit 94bd6b1

Please sign in to comment.