From 2becb48187118facb43e699b0b704d4e1b594b75 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 20 May 2024 12:16:28 -0400 Subject: [PATCH] Fix staff removing and sorting Neon issue https://github.com/DDMAL/Neon/issues/1212 --- src/editortoolkit_neume.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 1882808daaf..a1891a25e2e 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -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); @@ -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);