From faad0aa7799788eed6df7305df13c827106b566e Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 16 May 2023 14:23:47 -0400 Subject: [PATCH 001/144] pass neon path as command line argument --- emscripten/testNeon.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emscripten/testNeon.sh b/emscripten/testNeon.sh index 3bd16175df4..6e543fedf33 100755 --- a/emscripten/testNeon.sh +++ b/emscripten/testNeon.sh @@ -16,9 +16,9 @@ cd build # Moves the needed verovio.js into Neon cp verovio.js verovio_new.js -mv verovio_new.js [location_of_your_Neon]/Neon/verovio-util +mv verovio_new.js $1/verovio-util -cd [location_of_your_Neon]/Neon/verovio-util +cd $1/verovio-util rm verovio.js; mv verovio_new.js verovio.js From 0bbfe648e5488f90edd6f214385f7998e48c0fef Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 16 May 2023 14:23:47 -0400 Subject: [PATCH 002/144] pass neon path as command line argument --- emscripten/testNeon.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 emscripten/testNeon.sh diff --git a/emscripten/testNeon.sh b/emscripten/testNeon.sh new file mode 100644 index 00000000000..0158466bf4a --- /dev/null +++ b/emscripten/testNeon.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# This is a little script that compiles verovio using buildToolkit +# and moves the output, verovio.js, into Neon/verovio-util. +# It then starts up a local instance of Neon using yarn so the +# developer can see the changes as soon as possible. +# Please change [location_of_your_Neon] with the actual path. +# For example: ~/Desktop/DDMAL + + +# Builds verovio for Neon +./buildToolkit -x "Gootville,Petaluma" -DHPX + +cd build + +# Moves the needed verovio.js into Neon +cp verovio.js verovio_new.js + +mv verovio_new.js /Users/yinanzhou/SIMSSA/Neon/verovio-util + +cd /Users/yinanzhou/SIMSSA/Neon/verovio-util + +rm verovio.js; mv verovio_new.js verovio.js + +# Runs Neon +yarn build && yarn start \ No newline at end of file From 39c0099cec6ee9de627ee8b27aa92cc2422007b2 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Wed, 5 Jul 2023 16:30:52 -0400 Subject: [PATCH 003/144] Remove testNeon.sh from git --- emscripten/testNeon.sh | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 emscripten/testNeon.sh diff --git a/emscripten/testNeon.sh b/emscripten/testNeon.sh deleted file mode 100644 index 0158466bf4a..00000000000 --- a/emscripten/testNeon.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# This is a little script that compiles verovio using buildToolkit -# and moves the output, verovio.js, into Neon/verovio-util. -# It then starts up a local instance of Neon using yarn so the -# developer can see the changes as soon as possible. -# Please change [location_of_your_Neon] with the actual path. -# For example: ~/Desktop/DDMAL - - -# Builds verovio for Neon -./buildToolkit -x "Gootville,Petaluma" -DHPX - -cd build - -# Moves the needed verovio.js into Neon -cp verovio.js verovio_new.js - -mv verovio_new.js /Users/yinanzhou/SIMSSA/Neon/verovio-util - -cd /Users/yinanzhou/SIMSSA/Neon/verovio-util - -rm verovio.js; mv verovio_new.js verovio.js - -# Runs Neon -yarn build && yarn start \ No newline at end of file From 118eeb652f800536195a23e8c480219c04ed4bda Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 10 Jul 2023 11:49:20 -0400 Subject: [PATCH 004/144] MatchHeight editor action for bbox --- include/vrv/editortoolkit_neume.h | 2 + src/editortoolkit_neume.cpp | 80 +++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/include/vrv/editortoolkit_neume.h b/include/vrv/editortoolkit_neume.h index dfeb65043e5..a31242d2970 100644 --- a/include/vrv/editortoolkit_neume.h +++ b/include/vrv/editortoolkit_neume.h @@ -44,6 +44,7 @@ class EditorToolkitNeume : public EditorToolkit { bool Insert(std::string elementType, std::string staffId, int ulx, int uly, int lrx, int lry, std::vector> attributes); bool InsertToSyllable(std::string elementId); + bool MatchHeight(std::string elementId); bool Merge(std::vector elementIds); bool MoveOutsideSyllable(std::string elementId); bool Set(std::string elementId, std::string attrType, std::string attrValue); @@ -72,6 +73,7 @@ class EditorToolkitNeume : public EditorToolkit { bool ParseInsertAction(jsonxx::Object param, std::string *elementType, std::string *staffId, int *ulx, int *uly, int *lrx, int *lry, std::vector> *attributes); bool ParseInsertToSyllableAction(jsonxx::Object param, std::string *elementId); + bool ParseMatchHeightAction(jsonxx::Object param, std::string *elementId); bool ParseMergeAction(jsonxx::Object param, std::vector *elementIds); bool ParseMoveOutsideSyllableAction(jsonxx::Object param, std::string *elementId); bool ParseSetAction(jsonxx::Object param, std::string *elementId, std::string *attrType, std::string *attrValue); diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index aa60f6b3559..132b579e4d6 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -183,6 +183,13 @@ bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) return this->SplitNeume(elementId, ncId); } } + else if (action == "matchHeight") { + std::string elementId; + if (this->ParseMatchHeightAction(json.get("param"), &elementId)) { + return this->MatchHeight(elementId); + } + LogWarning("Could not parse the insert action"); + } else if (action == "merge") { std::vector elementIds; if (this->ParseMergeAction(json.get("param"), &elementIds)) { @@ -1596,6 +1603,72 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d return true; } +bool EditorToolkitNeume::MatchHeight(std::string elementId) +{ + if (!m_doc->GetDrawingPage()) { + LogError("Could not get drawing page"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "Could not get drawing page."); + return false; + } + if (m_doc->GetType() != Facs) { + LogError("Drawing page without facsimile"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + return false; + } + + Object *element = m_doc->GetDrawingPage()->FindDescendantByID(elementId); + assert(element); + Object *staffParent = element->GetFirstAncestor(STAFF); + if (element == NULL) { + LogError("No element exists with ID '%s'.", elementId.c_str()); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "No element exists with ID" + elementId + "."); + return false; + } + if (!element->Is(SYL)) { + LogError("Element is of type %s, but only element can match height.", element->GetClassName().c_str()); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import( + "message", "Element is of type " + element->GetClassName() + ", but only element can match height."); + return false; + } + + // get the position of the selected bbox + int uly; + int lry; + if (dynamic_cast(element)->HasFacs()) { + uly = element->GetFacsimileInterface()->GetZone()->GetUly(); + lry = element->GetFacsimileInterface()->GetZone()->GetLry(); + } + else { + LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); + return false; + } + + // find all syls in staff + ListOfObjects syls; + ClassIdComparison ac(SYL); + staffParent->FindAllDescendantsByComparison(&syls, &ac); + Syl *syl; + Zone *zone; + + for (auto it = syls.begin(); it != syls.end(); ++it) { + syl = dynamic_cast(*it); + zone = syl->GetFacsimileInterface()->GetZone(); + assert(zone); + zone->SetUly(uly); + zone->SetLry(lry); + } + + m_infoObject.import("status", "OK"); + m_infoObject.import("message", ""); + return true; +} + bool EditorToolkitNeume::Merge(std::vector elementIds) { if (!m_doc->GetDrawingPage()) return false; @@ -3777,6 +3850,13 @@ bool EditorToolkitNeume::ParseDisplaceClefAction(jsonxx::Object param, std::stri return true; } +bool EditorToolkitNeume::ParseMatchHeightAction(jsonxx::Object param, std::string *elementId) +{ + if (!param.has("elementId")) return false; + (*elementId) = param.get("elementId"); + return true; +} + bool EditorToolkitNeume::ParseMergeAction(jsonxx::Object param, std::vector *elementIds) { if (!param.has("elementIds")) return false; From 9e30b5428509ac320a70897b8da91b26b5ad73a1 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Wed, 12 Jul 2023 17:25:17 -0400 Subject: [PATCH 005/144] Add overlap correction on x-axis --- src/editortoolkit_neume.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 132b579e4d6..8054cf2780b 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1655,11 +1655,25 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) staffParent->FindAllDescendantsByComparison(&syls, &ac); Syl *syl; Zone *zone; + int rightMost = -1; + int itUlx; + int itLrx; for (auto it = syls.begin(); it != syls.end(); ++it) { syl = dynamic_cast(*it); zone = syl->GetFacsimileInterface()->GetZone(); assert(zone); + + // adjust x-axis first + itUlx = zone->GetUlx(); + itLrx = zone->GetLrx(); + if (itLrx > rightMost) { + // correct overlap + if (itUlx < rightMost) zone->SetUlx(rightMost); + // Update right most point if needed + rightMost = itLrx; + } + zone->SetUly(uly); zone->SetLry(lry); } From bd90014631971c2ae441eb960b8a354c2185cb40 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 13 Jul 2023 15:14:05 -0400 Subject: [PATCH 006/144] Add staff rotation offset --- src/editortoolkit_neume.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 8054cf2780b..9ff8db76b7e 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1636,11 +1636,15 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) } // get the position of the selected bbox + int ulx; int uly; - int lry; + int height; + int lrx; if (dynamic_cast(element)->HasFacs()) { + ulx = element->GetFacsimileInterface()->GetZone()->GetUlx(); uly = element->GetFacsimileInterface()->GetZone()->GetUly(); - lry = element->GetFacsimileInterface()->GetZone()->GetLry(); + lrx = element->GetFacsimileInterface()->GetZone()->GetLrx(); + height = element->GetFacsimileInterface()->GetZone()->GetLry() - uly; } else { LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); @@ -1655,9 +1659,11 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) staffParent->FindAllDescendantsByComparison(&syls, &ac); Syl *syl; Zone *zone; - int rightMost = -1; int itUlx; int itLrx; + int offsetY; + int rightMost = -1; + double theta = staffParent->GetFacsimileInterface()->GetZone()->GetRotate(); for (auto it = syls.begin(); it != syls.end(); ++it) { syl = dynamic_cast(*it); @@ -1674,8 +1680,14 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) rightMost = itLrx; } - zone->SetUly(uly); - zone->SetLry(lry); + offsetY = 0; + if (theta) { + double factor = 1.3; + offsetY = (int)((itUlx - ulx) * tan(theta * M_PI / 180.0) / factor); + } + + zone->SetUly(uly + offsetY); + zone->SetLry(uly + offsetY + height); } m_infoObject.import("status", "OK"); From 939be300897df2cd8aaebd323e0873c9ae028b93 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 13 Jul 2023 16:50:21 -0400 Subject: [PATCH 007/144] Adjust original bbox size for ungrouping --- src/editortoolkit_neume.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 9ff8db76b7e..bd17ef5b4f4 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2988,6 +2988,10 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // if the element is a syl then we want to keep it attached to the first node if (el->Is(SYL)) { + Zone *zone = dynamic_cast(el->GetFacsimileInterface()->GetZone()); + + zone->SetLrx(zone->GetUlx() + 100); + zone->SetLry(zone->GetUly() + 200); continue; } From 467e074b47a94ab53aeca31e038d3dab3ecf8297 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 14 Jul 2023 15:20:47 -0400 Subject: [PATCH 008/144] Fix ungroup when syllable start with layer element --- src/editortoolkit_neume.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index bd17ef5b4f4..88f2b5922a2 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2932,8 +2932,10 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector sparent->ReorderByXPos(); fparent->ClearRelinquishedChildren(); fparent->ReorderByXPos(); + uuidArray << (*it); + it = elementIds.erase(it); + el = m_doc->GetDrawingPage()->FindDescendantByID(*it); } - continue; } if (elementIds.begin() == it || firstIsSyl) { // if the element is a syl we want it to stay attached to the first element From 28efa4b0d3e247cda1401ae23ebfe8d8ba96ce3b Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 14 Jul 2023 16:12:22 -0400 Subject: [PATCH 009/144] Clean up comments --- src/editortoolkit_neume.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 88f2b5922a2..26ecf7e5af6 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2997,12 +2997,6 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector continue; } - // if (el->Is(DIVLINE) || el->Is(ACCID)) { - // el->MoveItselfTo(sparent); - // fparent->ClearRelinquishedChildren(); - // continue; - // } - if (groupType == "nc") { Nc *nc = dynamic_cast(el); assert(nc); @@ -3096,15 +3090,11 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector FacsimileInterface *fi = syl->GetFacsimileInterface(); assert(fi); fi->AttachZone(zone); - - // syl->ResetFacsimile(); - // syl->SetFacs(zone->GetID()); } } if (ligNum != 1) { // if not 1st nc in ligature, add child - uuidArray << newParent->GetID(); sparent->AddChild(newParent); From bad01cfb1dcc9885709bb41e7bf7f72f3ba149bd Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 24 Jul 2023 16:22:34 -0400 Subject: [PATCH 010/144] Refactor ungroup bbox --- src/editortoolkit_neume.cpp | 67 +++++++++---------------------------- 1 file changed, 15 insertions(+), 52 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 26ecf7e5af6..ee3d1f303f0 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2845,6 +2845,7 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector int ligNum = 0; // for ligature in ungroupNcs int firstIsLig = false; bool firstIsSyl = false; + Zone *oldSylZone = NULL; Clef *oldClef = NULL; ClassIdComparison ac(CLEF); ListOfObjects syllables; // List of syllables used. groupType=neume only. @@ -2977,6 +2978,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector if (oldClef == NULL) { oldClef = dynamic_cast(sparent)->GetCurrentClef(); } + + // Get orginal syl zone + oldSylZone = dynamic_cast(currentParent->GetFirst(SYL)->GetFacsimileInterface()->GetZone()); } else { @@ -2990,10 +2994,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // if the element is a syl then we want to keep it attached to the first node if (el->Is(SYL)) { - Zone *zone = dynamic_cast(el->GetFacsimileInterface()->GetZone()); - - zone->SetLrx(zone->GetUlx() + 100); - zone->SetLry(zone->GetUly() + 200); + if (oldSylZone) { + oldSylZone->SetLrx(oldSylZone->GetUlx() + 100); + } continue; } @@ -3035,55 +3038,15 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector if (m_doc->GetType() == Facs) { Zone *zone = new Zone(); - // Use syllable parent positions if possible - FacsimileInterface *syllableFi = NULL; - if (syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface()->HasFacs()) { - syllableFi = syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface(); - Zone *tempZone = dynamic_cast(syllableFi->GetZone()); - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - // otherwise get a boundingbox that comprises all the neumes in the syllable - else { - ListOfObjects children; - InterfaceComparison comp(INTERFACE_FACSIMILE); - syl->GetFirstAncestor(SYLLABLE)->FindAllDescendantsByComparison(&children, &comp); - for (auto iter2 = children.begin(); iter2 != children.end(); ++iter2) { - FacsimileInterface *temp = (*iter2)->GetFacsimileInterface(); - assert(temp); - Zone *tempZone = vrv_cast(temp->GetZone()); - assert(tempZone); - if (temp->HasFacs()) { - if (syllableFi == NULL) { - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - else { - if (tempZone->GetUlx() < zone->GetUlx()) { - zone->SetUlx(tempZone->GetUlx()); - } - if (tempZone->GetUly() < zone->GetUly()) { - zone->SetUly(tempZone->GetUly()); - } - if (tempZone->GetLrx() > zone->GetLrx()) { - zone->SetLrx(tempZone->GetLrx()); - } - if (tempZone->GetLry() > zone->GetLry()) { - zone->SetLry(tempZone->GetLry()); - } - } - } - } - } + zone->SetUlx(el->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); + zone->SetUly(oldSylZone->GetUly()); + zone->SetLrx(el->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); + zone->SetLry(oldSylZone->GetLry()); - // make the bounding box a little bigger and lower so it's easier to edit - zone->SetUly(zone->GetUly() + 100); - zone->SetLrx(zone->GetLrx() + 100); - zone->SetLry(zone->GetLry() + 200); + // Make bbox larger if it has less than 2 ncs + if (newParent->GetChildCount(NC, 2) <= 2) { + zone->SetLrx(zone->GetLrx() + 50); + } assert(m_doc->GetFacsimile()); m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone); From 5456a4cb645ff21460d4042f92195932a6df9d86 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 24 Jul 2023 16:23:34 -0400 Subject: [PATCH 011/144] Clean up --- src/editortoolkit_neume.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index ee3d1f303f0..15a2616f740 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2950,7 +2950,6 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector Nc *nc = dynamic_cast(el); assert(nc); if (nc->HasLigated() && nc->GetLigated() == BOOLEAN_true) { - // ligNum++; firstIsLig = true; } @@ -3003,7 +3002,6 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector if (groupType == "nc") { Nc *nc = dynamic_cast(el); assert(nc); - // if (nc->HasLigated()) continue; if (firstIsLig) { // if 1st is ligature, neglect 2nd, go to the next nc From d69ae9e353a3de2bdeeab075fa21ea4e89a3a452 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 25 Jul 2023 11:30:52 -0400 Subject: [PATCH 012/144] Remove x-axis adjustment --- src/editortoolkit_neume.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 15a2616f740..43f34d7f7fd 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1660,9 +1660,9 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) Syl *syl; Zone *zone; int itUlx; - int itLrx; + // int itLrx; int offsetY; - int rightMost = -1; + // int rightMost = -1; double theta = staffParent->GetFacsimileInterface()->GetZone()->GetRotate(); for (auto it = syls.begin(); it != syls.end(); ++it) { @@ -1670,17 +1670,18 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) zone = syl->GetFacsimileInterface()->GetZone(); assert(zone); - // adjust x-axis first - itUlx = zone->GetUlx(); - itLrx = zone->GetLrx(); - if (itLrx > rightMost) { - // correct overlap - if (itUlx < rightMost) zone->SetUlx(rightMost); - // Update right most point if needed - rightMost = itLrx; - } + // // adjust x-axis first + // itUlx = zone->GetUlx(); + // itLrx = zone->GetLrx(); + // if (itLrx > rightMost) { + // // correct overlap + // if (itUlx < rightMost) zone->SetUlx(rightMost); + // // Update right most point if needed + // rightMost = itLrx; + // } offsetY = 0; + itUlx = zone->GetUlx(); if (theta) { double factor = 1.3; offsetY = (int)((itUlx - ulx) * tan(theta * M_PI / 180.0) / factor); From 7c1dc57786a5ef333fc1d95ad5435ad5ec15a821 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 27 Jul 2023 16:57:47 -0400 Subject: [PATCH 013/144] Fix ungroup when firstIsSyl --- src/editortoolkit_neume.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 43f34d7f7fd..037591d462e 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2944,6 +2944,10 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // we'll still need to initialize all the parents, thus the bool if (el->Is(SYL)) { firstIsSyl = true; + oldSylZone = dynamic_cast(el->GetFacsimileInterface()->GetZone()); + if (oldSylZone) { + oldSylZone->SetLrx(oldSylZone->GetUlx() + 100); + } continue; } else if (groupType == "nc") { @@ -2980,7 +2984,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector } // Get orginal syl zone - oldSylZone = dynamic_cast(currentParent->GetFirst(SYL)->GetFacsimileInterface()->GetZone()); + if (!oldSylZone) { + oldSylZone = dynamic_cast(currentParent->GetFirst(SYL)->GetFacsimileInterface()->GetZone()); + } } else { From 4d66a78924e87caecb14c670b2a066d0a9646bb1 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 28 Jul 2023 17:17:43 -0400 Subject: [PATCH 014/144] Remove redundant new syl for insert action --- src/editortoolkit_neume.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 037591d462e..72745a2a16d 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -874,8 +874,6 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in if (m_doc->GetType() == Facs) { FacsimileInterface *fi = vrv_cast(syl->GetFacsimileInterface()); assert(fi); - Text *text = new Text(); - syl->AddChild(text); Zone *sylZone = new Zone(); // calculate bboxUlx and bboxUly wrt rotation using sine rule From 6769c821af488b36f30cbb6d8aca28bdc0bb7496 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:46:13 -0400 Subject: [PATCH 015/144] Remove unnecessary doubleParent check --- src/editortoolkit_neume.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 72745a2a16d..20f2af437d0 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2648,16 +2648,14 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e // also in this case we need to make sure that the facsimile of the resulting syl is correct else { if (elementClass == NC) { - if (doubleParent) { - parent = new Neume(); - for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { - (*it)->MoveItselfTo(parent); - parent->ReorderByXPos(); - } + parent = new Neume(); + for (auto it = elements.begin(); it != elements.end(); ++it) { + if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); + parent->ReorderByXPos(); } - doubleParent->AddChild(parent); } + doubleParent->AddChild(parent); Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); if (!layer) { From 599b28aae381503936d820183dc9039e9c41517d Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:50:29 -0400 Subject: [PATCH 016/144] Rename doubleParent to secondParent --- src/editortoolkit_neume.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 20f2af437d0..9573a407a8c 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2314,7 +2314,7 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx bool EditorToolkitNeume::Group(std::string groupType, std::vector elementIds) { - Object *parent = NULL, *doubleParent = NULL; + Object *parent = NULL, *secondParent = NULL; std::map parents; std::set elements; std::vector sortedElements; @@ -2441,9 +2441,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (doubleParent == NULL) { - doubleParent = par->GetParent(); - if (doubleParent == NULL) { + if (secondParent == NULL) { + secondParent = par->GetParent(); + if (secondParent == NULL) { LogError("No second level parent!"); m_infoObject.import("status", "FAILURE"); m_infoObject.import("message", "No second level parent."); @@ -2451,7 +2451,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } else { - if (par->GetParent() != doubleParent) { + if (par->GetParent() != secondParent) { LogError("No shared second level parent!"); m_infoObject.import("status", "FAILURE"); m_infoObject.import("message", "No shared second level parent."); @@ -2620,10 +2620,10 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } parent->ReorderByXPos(); - if (doubleParent == NULL) { + if (secondParent == NULL) { return false; } - doubleParent->AddChild(parent); + secondParent->AddChild(parent); Layer *layer = vrv_cast(parent->GetFirstAncestor(LAYER)); assert(layer); @@ -2655,7 +2655,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e parent->ReorderByXPos(); } } - doubleParent->AddChild(parent); + secondParent->AddChild(parent); Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); if (!layer) { @@ -2733,11 +2733,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (doubleParent == NULL) { + if (secondParent == NULL) { LogError("No second level parent!"); return false; } - doubleParent->AddChild(fullSyllable); + secondParent->AddChild(fullSyllable); Layer *layer = vrv_cast(fullSyllable->GetFirstAncestor(LAYER)); assert(layer); if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { @@ -2779,11 +2779,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *obj = (*it).first; obj->ClearRelinquishedChildren(); if (obj->GetChildCount() == 0) { - if (doubleParent == NULL) { + if (secondParent == NULL) { LogError("No second level parent!"); return false; } - doubleParent->DeleteChild(obj); + secondParent->DeleteChild(obj); } else if (obj->GetChildCount() == (obj->GetChildCount(SYL) + obj->GetChildCount(DIVLINE) + obj->GetChildCount(ACCID) @@ -2807,11 +2807,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } - if (doubleParent == NULL) { + if (secondParent == NULL) { LogError("No second level parent!"); return false; } - doubleParent->DeleteChild(obj); + secondParent->DeleteChild(obj); } } From cf6e7e8c6d049936c22c0e50e3ebf6d4144e0f99 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:57:04 -0400 Subject: [PATCH 017/144] Optimize parents counting --- src/editortoolkit_neume.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 9573a407a8c..108465c45c5 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2458,13 +2458,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } } - auto possibleEntry = parents.find(el->GetParent()); - if (possibleEntry == parents.end()) { - parents.emplace(el->GetParent(), 1); - } - else { - possibleEntry->second += 1; - } + parents[par]++; elements.insert(el); } From 1ce2b26d1aea740e6183c2bc2fd871a42c119524 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:59:10 -0400 Subject: [PATCH 018/144] Clean up --- src/editortoolkit_neume.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 108465c45c5..6686c8d4b77 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2475,16 +2475,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } - // auto it = elementIds.begin(); - // Object *el = m_doc->GetDrawingPage()->FindDescendantByID(*it); - // Layer *layer = dynamic_cast(el->GetFirstAncestor(LAYER)); - // if (!layer) { - // LogError("Elements does not have Layer parent. This should not happen."); - // m_infoObject.import("status", "FAILURE"); - // m_infoObject.import("message", "Elements does not have Layer parent."); - // return false; - // } - std::copy(elements.begin(), elements.end(), std::back_inserter(sortedElements)); std::stable_sort(sortedElements.begin(), sortedElements.end(), Object::sortByUlx); From d1070c804b7f90f723a56f37dfec9f0f87e76ce0 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 17:18:21 -0400 Subject: [PATCH 019/144] Remove unnecessary conversion --- src/editortoolkit_neume.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 6686c8d4b77..1498e8b6b38 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2316,8 +2316,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e { Object *parent = NULL, *secondParent = NULL; std::map parents; - std::set elements; - std::vector sortedElements; + ListOfObjects elements; std::vector fullParents; std::map clefsBefore; @@ -2459,7 +2458,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } parents[par]++; - elements.insert(el); + elements.push_back(el); } if (parents.size() == 0) { @@ -2475,34 +2474,29 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } - std::copy(elements.begin(), elements.end(), std::back_inserter(sortedElements)); - std::stable_sort(sortedElements.begin(), sortedElements.end(), Object::sortByUlx); - ListOfObjects clefs; - std::set syllables; - ListOfObjects sortedSyllables; + ListOfObjects syllables; ClassIdComparison clefComp(CLEF); InterfaceComparison pitchComp(INTERFACE_PITCH); Clef *newClef = NULL; - m_doc->GetDrawingPage()->FindAllDescendantsBetween(&clefs, &clefComp, - sortedElements.front()->GetFirstAncestor(SYLLABLE), sortedElements.back()->GetFirstAncestor(SYLLABLE)); + m_doc->GetDrawingPage()->FindAllDescendantsBetween( + &clefs, &clefComp, elements.front()->GetFirstAncestor(SYLLABLE), elements.back()->GetFirstAncestor(SYLLABLE)); // if there are clefs between the elements getting grouped // some elements will need their pitch adjusted for the new clef // clefsBefore maps the syllable parent to its clef before the group // so we can reassociate any pitched children from their old clef to the new one if (clefs.size() != 0) { - for (auto it = sortedElements.begin(); it != sortedElements.end(); ++it) { + for (auto it = elements.begin(); it != elements.end(); ++it) { if ((*it)->Is(SYLLABLE)) { - syllables.insert(dynamic_cast(*it)); + syllables.push_back(dynamic_cast(*it)); } else { - syllables.insert((*it)->GetFirstAncestor(SYLLABLE)); + syllables.push_back((*it)->GetFirstAncestor(SYLLABLE)); } } - std::copy(syllables.begin(), syllables.end(), std::back_inserter(sortedSyllables)); - for (auto it = sortedSyllables.begin(); it != sortedSyllables.end(); ++it) { + for (auto it = syllables.begin(); it != syllables.end(); ++it) { Clef *tempClef = dynamic_cast(m_doc->GetDrawingPage()->FindPreviousChild(&clefComp, (*it))); if (tempClef == NULL) { Layer *layer = vrv_cast((*it)->GetFirstAncestor(LAYER)); @@ -2510,7 +2504,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } clefsBefore.insert(std::pair(dynamic_cast(*it), tempClef)); } - newClef = clefsBefore[dynamic_cast(sortedSyllables.front())]; + newClef = clefsBefore[dynamic_cast(syllables.front())]; } // find parents where all of their children are being grouped @@ -2746,8 +2740,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e // change the pitch of any pitched elements whose clef may have changed assert(newClef); ListOfObjects pitchedChildren; - if (sortedSyllables.size()) { - for (auto it = sortedSyllables.begin(); it != sortedSyllables.end(); ++it) { + if (syllables.size()) { + for (auto it = syllables.begin(); it != syllables.end(); ++it) { Syllable *syllable = dynamic_cast(*it); if (clefsBefore[syllable] != newClef) { syllable->FindAllDescendantsByComparison(&pitchedChildren, &pitchComp); From 0e81f754152aa8ea79718c765a0b16e2fb5b21c1 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 11:28:45 -0400 Subject: [PATCH 020/144] Move second level parent check --- src/editortoolkit_neume.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 1498e8b6b38..a15438f63e0 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2440,23 +2440,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (secondParent == NULL) { - secondParent = par->GetParent(); - if (secondParent == NULL) { - LogError("No second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No second level parent."); - return false; - } - } - else { - if (par->GetParent() != secondParent) { - LogError("No shared second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No shared second level parent."); - return false; - } - } parents[par]++; elements.push_back(el); } @@ -2507,11 +2490,25 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e newClef = clefsBefore[dynamic_cast(syllables.front())]; } + // check if share second level parent + secondParent = (*parents.begin()).first->GetParent(); + if (secondParent == NULL) { + LogError("No second level parent!"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "No second level parent."); + return false; + } // find parents where all of their children are being grouped for (auto it = parents.begin(); it != parents.end(); ++it) { auto parentPair = *it; Object *par = parentPair.first; int expected; + if (par->GetParent() != secondParent) { + LogError("No shared second level parent!"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "No shared second level parent."); + return false; + } if (par->GetClassId() == SYLLABLE) { expected = par->GetChildCount(NEUME); } From 3b2c0daf1a6b7b1961e3a1c1e54020c23cbd2e0f Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 11:29:17 -0400 Subject: [PATCH 021/144] Clean up --- src/editortoolkit_neume.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index a15438f63e0..5ccba2b6447 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2588,9 +2588,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e FacsimileInterface *fi = vrv_cast((*syl).GetFacsimileInterface()); assert(fi); fi->AttachZone(zone); - - // syl->ResetFacsimile(); - // syl->SetFacs(zone->GetID()); } } From 4a1e0ea71499d6e12c4067f1ce6a17a602684683 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 11:30:22 -0400 Subject: [PATCH 022/144] Remove unnecessary second level parent check --- src/editortoolkit_neume.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 5ccba2b6447..e484b8fbd5b 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2592,9 +2592,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } parent->ReorderByXPos(); - if (secondParent == NULL) { - return false; - } secondParent->AddChild(parent); Layer *layer = vrv_cast(parent->GetFirstAncestor(LAYER)); From 5f8dfc243837d2d541afc3c41b2502c5dce0f918 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 13:14:45 -0400 Subject: [PATCH 023/144] Simplify syl zone calculation --- src/editortoolkit_neume.cpp | 57 +++++++++++++------------------------ 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index e484b8fbd5b..595b02139e6 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2519,6 +2519,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e fullParents.push_back(parentPair.first); } } + // if there are no full parents we need to make a new one to attach everything to if (fullParents.empty()) { if (elementClass == NC) { @@ -2526,10 +2527,18 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else if (elementClass == NEUME) { parent = new Syllable(); + int lry; + int uly; for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { - (*it)->MoveItselfTo(parent); + if ((*it)->GetParent() != parent) { + if (!(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); + } + else { + lry = (*it)->GetFacsimileInterface()->GetZone()->GetLry(); + uly = (*it)->GetFacsimileInterface()->GetZone()->GetUly(); + } } } @@ -2545,43 +2554,15 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e if (m_doc->GetType() == Facs) { Zone *zone = new Zone(); - // if it's syllable parent has position values just use those - FacsimileInterface *syllableFi = NULL; - if (syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface()->HasFacs()) { - syllableFi = syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface(); - Zone *tempZone = dynamic_cast(syllableFi->GetZone()); - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - // otherwise get a boundingbox that comprises all the neumes in the syllable - else { - ListOfObjects children; - InterfaceComparison comp(INTERFACE_FACSIMILE); - syl->GetFirstAncestor(SYLLABLE)->FindAllDescendantsByComparison(&children, &comp); - for (auto iter2 = children.begin(); iter2 != children.end(); ++iter2) { - FacsimileInterface *temp = (*iter2)->GetFacsimileInterface(); - assert(temp); - Zone *tempZone = vrv_cast(temp->GetZone()); - assert(tempZone); - if (temp->HasFacs()) { - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - } - } - - // make the bounding box a little bigger and lower so it's easier to edit - const int offSetUly = 100; - const int offSetLrx = 100; - const int offSetLry = 200; + zone->SetUlx(parent->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); + zone->SetUly(uly); + zone->SetLrx(parent->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); + zone->SetLry(lry); - zone->SetUly(zone->GetUly() + offSetUly); - zone->SetLrx(zone->GetLrx() + offSetLrx); - zone->SetLry(zone->GetLry() + offSetLry); + // Make bbox larger if it has less than 2 ncs + if (parent->GetChildCount(NC, 2) <= 2) { + zone->SetLrx(zone->GetLrx() + 50); + } assert(m_doc->GetFacsimile()); m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone); From 83a727666a20ae11c2342556de7e5bf356b266ea Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 13:30:20 -0400 Subject: [PATCH 024/144] Optimize reordering --- src/editortoolkit_neume.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 595b02139e6..cb920b9db20 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2572,12 +2572,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - parent->ReorderByXPos(); secondParent->AddChild(parent); - - Layer *layer = vrv_cast(parent->GetFirstAncestor(LAYER)); - assert(layer); - layer->ReorderByXPos(); } // if there's only one full parent we just add the other elements to it @@ -2590,7 +2585,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e (*it)->MoveItselfTo(parent); } } - parent->ReorderByXPos(); } // if there is more than 1 full parent we need to concat syl's @@ -2602,20 +2596,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e for (auto it = elements.begin(); it != elements.end(); ++it) { if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { (*it)->MoveItselfTo(parent); - parent->ReorderByXPos(); } } secondParent->AddChild(parent); - - Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); - if (!layer) { - LogError("Elements does not have Layer parent. This should not happen."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Elements does not have Layer parent."); - return false; - } - - layer->ReorderByXPos(); } else { std::sort(fullParents.begin(), fullParents.end(), Object::sortByUlx); @@ -2688,8 +2671,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } secondParent->AddChild(fullSyllable); - Layer *layer = vrv_cast(fullSyllable->GetFirstAncestor(LAYER)); - assert(layer); if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { FacsimileInterface *facsInter = vrv_cast(fullSyl->GetFacsimileInterface()); assert(facsInter); @@ -2704,7 +2685,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e assert(lry >= 0); zone->SetLry(lry); } - layer->ReorderByXPos(); parent = fullSyllable; } } @@ -2765,6 +2745,10 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } + Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); + assert(layer); + layer->ReorderByXPos(); + m_infoObject.import("uuid", parent->GetID()); m_infoObject.import("status", status); m_infoObject.import("message", message); From ecc5cbb9e0d5cbc9562f5111aa5133200fc19d2a Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 15:48:36 -0400 Subject: [PATCH 025/144] Rename fullSyllable to parent --- src/editortoolkit_neume.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index cb920b9db20..c82401bc2c0 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2602,7 +2602,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else { std::sort(fullParents.begin(), fullParents.end(), Object::sortByUlx); - Syllable *fullSyllable = new Syllable(); + Syllable *parent = new Syllable(); Syl *fullSyl = NULL; // construct concatenated string of all the syls @@ -2656,13 +2656,13 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Text *text = vrv_cast(fullSyl->FindDescendantByType(TEXT)); assert(text); text->SetText(fullString); - assert(fullSyllable); - fullSyllable->AddChild(fullSyl); + assert(parent); + parent->AddChild(fullSyl); // Move elements to the new group syllable for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != fullSyllable && !(*it)->Is(SYL)) { - (*it)->MoveItselfTo(fullSyllable); + if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); } } @@ -2670,7 +2670,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e LogError("No second level parent!"); return false; } - secondParent->AddChild(fullSyllable); + secondParent->AddChild(parent); if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { FacsimileInterface *facsInter = vrv_cast(fullSyl->GetFacsimileInterface()); assert(facsInter); @@ -2685,7 +2685,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e assert(lry >= 0); zone->SetLry(lry); } - parent = fullSyllable; } } From 8fe8581088aedf6fda37f3cffbd99a5820a297f5 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 16:15:37 -0400 Subject: [PATCH 026/144] Refactor multiple full parents --- src/editortoolkit_neume.cpp | 79 +++++++++++-------------------------- 1 file changed, 22 insertions(+), 57 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index c82401bc2c0..04d47a875c9 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2601,17 +2601,23 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent->AddChild(parent); } else { - std::sort(fullParents.begin(), fullParents.end(), Object::sortByUlx); Syllable *parent = new Syllable(); Syl *fullSyl = NULL; + int ulx, uly, lrx, lry; // construct concatenated string of all the syls std::u32string fullString = U""; for (auto it = fullParents.begin(); it != fullParents.end(); ++it) { Syl *syl = dynamic_cast((*it)->FindDescendantByType(SYL)); - if (syl != NULL) { + if (syl != NULL && m_doc->GetType() == Facs) { + Zone *zone = dynamic_cast(syl->GetFacsimileInterface()->GetZone()); + if (fullSyl == NULL) { fullSyl = syl; + ulx = zone->GetUlx(); + uly = zone->GetUly(); + lrx = zone->GetLrx(); + lry = zone->GetLry(); } Text *text = dynamic_cast(syl->FindDescendantByType(TEXT)); @@ -2619,46 +2625,13 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e std::u32string currentString = text->GetText(); fullString = fullString + currentString; } + + ulx = zone->GetUlx() < ulx ? zone->GetUlx() : ulx; + uly = zone->GetUly() < uly ? zone->GetUly() : uly; + lrx = zone->GetLrx() > lrx ? zone->GetLrx() : lrx; + lry = zone->GetLry() > lry ? zone->GetLry() : lry; } } - // find the new boundingbox comprising all of the text - int ulx = -1, uly = -1, lrx = -1, lry = -1; - for (auto it = fullParents.begin(); it != fullParents.end(); ++it) { - Object *par = vrv_cast(*it); - assert(par); - Syl *descSyl = vrv_cast(par->FindDescendantByType(SYL)); - assert(descSyl); - // FacsimileInterface *facsInter = dynamic_cast - // ((*it)->FindDescendantByType(SYL)->GetFacsimileInterface()); - if (descSyl != NULL) { - FacsimileInterface *facsInter - = dynamic_cast(descSyl->GetFacsimileInterface()); - - if (facsInter != NULL) { - if (ulx == -1 || ulx > facsInter->GetDrawingX()) { - ulx = facsInter->GetDrawingX(); - } - - if (lrx < facsInter->GetWidth() + facsInter->GetDrawingX()) { - lrx = facsInter->GetWidth() + facsInter->GetDrawingX(); - } - - if (uly == -1 || uly > facsInter->GetDrawingY()) { - uly = facsInter->GetDrawingY(); - } - if (lry < facsInter->GetHeight() + facsInter->GetDrawingY()) { - lry = facsInter->GetHeight() + facsInter->GetDrawingY(); - } - } - } - } - assert(fullSyl); - Text *text = vrv_cast(fullSyl->FindDescendantByType(TEXT)); - assert(text); - text->SetText(fullString); - assert(parent); - parent->AddChild(fullSyl); - // Move elements to the new group syllable for (auto it = elements.begin(); it != elements.end(); ++it) { if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { @@ -2666,25 +2639,19 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (secondParent == NULL) { - LogError("No second level parent!"); - return false; - } - secondParent->AddChild(parent); - if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { - FacsimileInterface *facsInter = vrv_cast(fullSyl->GetFacsimileInterface()); - assert(facsInter); - Zone *zone = vrv_cast(facsInter->GetZone()); - assert(zone); - assert(ulx >= 0); + Text *fullText = dynamic_cast(fullSyl->FindDescendantByType(TEXT)); + fullText->SetText(fullString); + parent->AddChild(fullSyl); + + if (m_doc->GetType() == Facs) { + Zone *zone = dynamic_cast(fullSyl->GetFacsimileInterface()->GetZone()); zone->SetUlx(ulx); - assert(uly >= 0); zone->SetUly(uly); - assert(lrx >= 0); zone->SetLrx(lrx); - assert(lry >= 0); zone->SetLry(lry); } + + secondParent->AddChild(parent); } } @@ -2744,9 +2711,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); - assert(layer); - layer->ReorderByXPos(); + secondParent->ReorderByXPos(); m_infoObject.import("uuid", parent->GetID()); m_infoObject.import("status", status); From c631643c099d739dfa6835d20fc3dfb393cdd687 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 18:05:45 -0400 Subject: [PATCH 027/144] Fix bbox calculation for empty full parent --- src/editortoolkit_neume.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 04d47a875c9..de6db9e906a 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2527,18 +2527,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else if (elementClass == NEUME) { parent = new Syllable(); - int lry; - int uly; + Object *oldSyl = (*elements.begin())->GetFirstAncestor(SYLLABLE)->GetFirst(SYL); for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != parent) { - if (!(*it)->Is(SYL)) { - (*it)->MoveItselfTo(parent); - } - else { - lry = (*it)->GetFacsimileInterface()->GetZone()->GetLry(); - uly = (*it)->GetFacsimileInterface()->GetZone()->GetUly(); - } + if (!(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); } } @@ -2554,10 +2547,10 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e if (m_doc->GetType() == Facs) { Zone *zone = new Zone(); - zone->SetUlx(parent->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); - zone->SetUly(uly); - zone->SetLrx(parent->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); - zone->SetLry(lry); + zone->SetUlx(parent->GetFirst(NEUME)->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); + zone->SetUly(oldSyl->GetFacsimileInterface()->GetZone()->GetUly()); + zone->SetLrx(parent->GetLast(NEUME)->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); + zone->SetLry(oldSyl->GetFacsimileInterface()->GetZone()->GetLry()); // Make bbox larger if it has less than 2 ncs if (parent->GetChildCount(NC, 2) <= 2) { @@ -2566,7 +2559,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e assert(m_doc->GetFacsimile()); m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone); - FacsimileInterface *fi = vrv_cast((*syl).GetFacsimileInterface()); + FacsimileInterface *fi = syl->GetFacsimileInterface(); assert(fi); fi->AttachZone(zone); } From 0b6f65492b7af2135018370d45729e378c6bde19 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 18:10:30 -0400 Subject: [PATCH 028/144] Remove unnecessary checks & reordering --- src/editortoolkit_neume.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index de6db9e906a..f137fada668 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2668,10 +2668,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *obj = (*it).first; obj->ClearRelinquishedChildren(); if (obj->GetChildCount() == 0) { - if (secondParent == NULL) { - LogError("No second level parent!"); - return false; - } secondParent->DeleteChild(obj); } else if (obj->GetChildCount() @@ -2683,23 +2679,16 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } while ((leftover = obj->FindDescendantByType(DIVLINE)) != NULL) { leftover->MoveItselfTo(parent); - parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } while ((leftover = obj->FindDescendantByType(ACCID)) != NULL) { leftover->MoveItselfTo(parent); - parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } while ((leftover = obj->FindDescendantByType(CLEF)) != NULL) { leftover->MoveItselfTo(parent); - parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } - if (secondParent == NULL) { - LogError("No second level parent!"); - return false; - } secondParent->DeleteChild(obj); } } From fabe667bf59430aa2216401b60241ec3c7762d68 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 18:14:44 -0400 Subject: [PATCH 029/144] Remove unused variable --- src/editortoolkit_neume.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index f137fada668..59fbe82b1f4 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1637,11 +1637,9 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) int ulx; int uly; int height; - int lrx; if (dynamic_cast(element)->HasFacs()) { ulx = element->GetFacsimileInterface()->GetZone()->GetUlx(); uly = element->GetFacsimileInterface()->GetZone()->GetUly(); - lrx = element->GetFacsimileInterface()->GetZone()->GetLrx(); height = element->GetFacsimileInterface()->GetZone()->GetLry() - uly; } else { From 926131e8f0365e8eb752f3654da35d26ff41c8ba Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Wed, 2 Aug 2023 16:12:11 -0400 Subject: [PATCH 030/144] Preserve ordering of multiple ligated nc in the same neume --- src/object.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/object.cpp b/src/object.cpp index 17b6f97426c..113358a8d69 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -1298,7 +1298,10 @@ bool Object::sortByUlx(Object *a, Object *b) if (a->Is(NC) && b->Is(NC)) { Nc *nca = dynamic_cast(a); Nc *ncb = dynamic_cast(b); - if (nca->HasLigated() && ncb->HasLigated() && (a->GetParent() == b->GetParent())) { + Zone *zonea = dynamic_cast(nca->GetFacsimileInterface()->GetZone()); + Zone *zoneb = dynamic_cast(ncb->GetFacsimileInterface()->GetZone()); + if (nca->HasLigated() && ncb->HasLigated() && (a->GetParent() == b->GetParent()) + && (zonea->GetUlx() == zoneb->GetUly())) { Object *parent = a->GetParent(); assert(parent); if (abs(parent->GetChildIndex(a) - parent->GetChildIndex(b)) == 1) { From 0fa95a9b6be39ac9512a8b2e9abe5f82a741f0f1 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 3 Aug 2023 10:41:03 -0400 Subject: [PATCH 031/144] Add validity check && correction --- src/object.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/object.cpp b/src/object.cpp index 113358a8d69..63e8fa0ca2d 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -1299,9 +1299,11 @@ bool Object::sortByUlx(Object *a, Object *b) Nc *nca = dynamic_cast(a); Nc *ncb = dynamic_cast(b); Zone *zonea = dynamic_cast(nca->GetFacsimileInterface()->GetZone()); + assert(zonea); Zone *zoneb = dynamic_cast(ncb->GetFacsimileInterface()->GetZone()); + assert(zoneb); if (nca->HasLigated() && ncb->HasLigated() && (a->GetParent() == b->GetParent()) - && (zonea->GetUlx() == zoneb->GetUly())) { + && (zonea->GetUlx() == zoneb->GetUlx())) { Object *parent = a->GetParent(); assert(parent); if (abs(parent->GetChildIndex(a) - parent->GetChildIndex(b)) == 1) { From 8f93fd319911cafe2301bebc3cdfe980f8f20c75 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 14:37:15 -0400 Subject: [PATCH 032/144] Convert m_infoObject to m_editInfo --- include/vrv/editortoolkit_neume.h | 7 +- src/editortoolkit_neume.cpp | 622 +++++++++++++++--------------- 2 files changed, 315 insertions(+), 314 deletions(-) diff --git a/include/vrv/editortoolkit_neume.h b/include/vrv/editortoolkit_neume.h index a31242d2970..108b50e5266 100644 --- a/include/vrv/editortoolkit_neume.h +++ b/include/vrv/editortoolkit_neume.h @@ -31,8 +31,8 @@ namespace vrv { class EditorToolkitNeume : public EditorToolkit { public: EditorToolkitNeume(Doc *doc, View *view) : EditorToolkit(doc, view) {} - bool ParseEditorAction(const std::string &json_editorAction); - virtual std::string EditInfo() { return m_infoObject.json(); }; + bool ParseEditorAction(const std::string &json_editorAction) override; + std::string EditInfo() override; /** * Experimental editor functions. @@ -100,9 +100,6 @@ class EditorToolkitNeume : public EditorToolkit { bool AdjustPitchFromPosition(Object *obj, Clef *clef = NULL); bool AdjustClefLineFromPosition(Clef *clef, Staff *staff = NULL); ///@} - -private: - jsonxx::Object m_infoObject; }; //-------------------------------------------------------------------------------- diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 59fbe82b1f4..38fde2bee57 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -40,25 +40,29 @@ //-------------------------------------------------------------------------------- namespace vrv { +std::string EditorToolkitNeume::EditInfo() +{ + return m_editInfo.json(); +} bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) { jsonxx::Object json; - m_infoObject.reset(); + // m_editInfo.reset(); // Read JSON actions if (!json.parse(json_editorAction)) { LogError("Cannot parse JSON std::string."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Cannot parse JSON from std::string " + json_editorAction); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Cannot parse JSON from std::string " + json_editorAction); return false; } if (!json.has("action") || (!json.has("param") && !json.has("param"))) { LogWarning("Incorrectly formatted JSON action"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "JSON action misformatted."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "JSON action misformatted."); return false; } @@ -66,8 +70,8 @@ bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) if (action != "chain" && json.has("param")) { LogWarning("Only 'chain' uses 'param' as an array."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "'param' can only be an array for a chain action."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "'param' can only be an array for a chain action."); return false; } @@ -238,8 +242,8 @@ bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) else { LogWarning("Unknown action type '%s'.", action.c_str()); } - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Action " + action + " could not be parsed or is unknown."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Action " + action + " could not be parsed or is unknown."); return false; } @@ -251,15 +255,15 @@ bool EditorToolkitNeume::Chain(jsonxx::Array actions) for (int i = 0; i < (int)actions.size(); i++) { if (!actions.has(0)) { LogError("Action %d was not an object", i); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Action " + std::to_string(i) + " was not an object."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Action " + std::to_string(i) + " was not an object."); return false; } status |= this->ParseEditorAction(actions.get(i).json()); - results.import(std::to_string(i), m_infoObject); + results.import(std::to_string(i), m_editInfo); } - m_infoObject = results; + m_editInfo = results; return status; } @@ -480,8 +484,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) std::string status = "OK", message = ""; if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } @@ -513,8 +517,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Layer *layer = dynamic_cast(element->GetFirstAncestor(LAYER)); if (!layer) { LogError("Element does not have Layer parent. This should not happen."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Element does not have Layer parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element does not have Layer parent."); return false; } @@ -593,8 +597,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Clef *clef = dynamic_cast(element); if (!clef->HasFacs()) { LogError("Clef dragging is only supported for clefs with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Clef dragging is only supported for clefs with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Clef dragging is only supported for clefs with facsimiles."); return false; } FacsimileInterface *fi = (*clef).GetFacsimileInterface(); @@ -645,8 +649,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Staff *staff = vrv_cast(element); if (!staff->HasFacs()) { LogError("Staff dragging is only supported for staves with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff dragging is only supported for staves with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff dragging is only supported for staves with facsimiles."); return false; } @@ -674,8 +678,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Syl *syl = dynamic_cast(element); if (!syl->HasFacs()) { LogError("Syl (boundingbox) dragging is only supported for syls with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Syl dragging is only supported for syls with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Syl dragging is only supported for syls with facsimiles."); return false; } FacsimileInterface *fi = (*syl).GetFacsimileInterface(); @@ -688,8 +692,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Accid *accid = dynamic_cast(element); if (!accid->HasFacs()) { LogError("Accid dragging is only supported for accid with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Accid dragging is only supported for accid with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Accid dragging is only supported for accid with facsimiles."); return false; } FacsimileInterface *fi = (*accid).GetFacsimileInterface(); @@ -705,8 +709,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) DivLine *divLine = dynamic_cast(element); if (!divLine->HasFacs()) { LogError("DivLine dragging is only supported for divLine with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "DivLine dragging is only supported for divLine with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "DivLine dragging is only supported for divLine with facsimiles."); return false; } FacsimileInterface *fi = (*divLine).GetFacsimileInterface(); @@ -720,14 +724,14 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) } else { LogWarning("Unsupported element for dragging."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported element for dragging."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported element for dragging."); return false; } Layer *layer = vrv_cast(element->GetFirstAncestor(LAYER)); layer->ReorderByXPos(); // Reflect position order of elements internally (and in the resulting output file) - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -736,14 +740,14 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -820,9 +824,9 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in parent->InsertChild(newStaff, i); parent->Modify(); - m_infoObject.import("uuid", newStaff->GetID()); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", newStaff->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -832,17 +836,17 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in parent->AddChild(newStaff); parent->Modify(); - m_infoObject.import("uuid", newStaff->GetID()); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", newStaff->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } if (staff == NULL) { LogError("A staff must exist in the page to add a non-staff element."); delete zone; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A staff must exist in the page to add a non-staff element."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A staff must exist in the page to add a non-staff element."); return false; } Layer *layer = vrv_cast(staff->FindDescendantByType(LAYER)); @@ -929,8 +933,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in delete nc; LogError("Failed to set pitch."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set pitch."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set pitch."); return false; } @@ -992,8 +996,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("Unsupported character in contour."); delete newNc; delete newZone; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported character in contour."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported character in contour."); return false; } @@ -1018,10 +1022,10 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in } } if (elementType == "nc") { - m_infoObject.import("uuid", nc->GetID()); + m_editInfo.import("uuid", nc->GetID()); } else { - m_infoObject.import("uuid", neume->GetID()); + m_editInfo.import("uuid", neume->GetID()); } } else if (elementType == "clef") { @@ -1046,8 +1050,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("A clef shape must be specified."); delete clef; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A clef shape must be specified."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A clef shape must be specified."); return false; } clef->SetShape(clefShape); @@ -1068,7 +1072,7 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in assert(surface); surface->AddChild(zone); layer->AddChild(clef); - m_infoObject.import("uuid", clef->GetID()); + m_editInfo.import("uuid", clef->GetID()); layer->ReorderByXPos(); // ensure pitched elements associated with this clef keep their x,y positions @@ -1119,11 +1123,11 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in if (!AdjustPitchFromPosition(custos)) { LogError("Failed to set pitch."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set pitch."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set pitch."); return false; } - m_infoObject.import("uuid", custos->GetID()); + m_editInfo.import("uuid", custos->GetID()); } else if (elementType == "accid") { Accid *accid = new Accid(); @@ -1144,8 +1148,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("A accid type must be specified."); delete accid; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A accid type must be specified."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A accid type must be specified."); return false; } @@ -1170,7 +1174,7 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in zone->SetLry(uly + noteHeight); layer->ReorderByXPos(); - m_infoObject.import("uuid", accid->GetID()); + m_editInfo.import("uuid", accid->GetID()); } else if (elementType == "divLine") { DivLine *divLine = new DivLine(); @@ -1208,8 +1212,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("A divLine type must be specified."); delete divLine; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A divLine type must be specified."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A divLine type must be specified."); return false; } @@ -1234,18 +1238,18 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in zone->SetLry(uly + noteHeight); layer->ReorderByXPos(); - m_infoObject.import("uuid", divLine->GetID()); + m_editInfo.import("uuid", divLine->GetID()); } else { delete zone; LogError("Unsupported type '%s' for insertion", elementType.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported type '" + elementType + "' for insertion."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported type '" + elementType + "' for insertion."); return false; } layer->ReorderByXPos(); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -1253,14 +1257,14 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -1271,23 +1275,23 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!(element->Is(DIVLINE) || element->Is(ACCID) || element->Is(CLEF))) { LogError("Element is of type %s, but only Divlines and Accids can be inserted into syllables.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only DivLines, Accids, and Clefs can be inserted into syllables."); return false; } if (!parent->Is(LAYER)) { LogError("The selected %s is not a child of layer.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected " + element->GetClassName() + "is not a child of layer."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected " + element->GetClassName() + "is not a child of layer."); return false; } @@ -1300,8 +1304,8 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) } else { LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); return false; } @@ -1325,8 +1329,8 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) } else { LogError("A syllable must exist in the staff to insert a '%s' into.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import( + m_editInfo.import("status", "FAILURE"); + m_editInfo.import( "message", "A syllable must exist in the staff to insert a '" + element->GetClassName() + "' into."); return false; } @@ -1396,8 +1400,8 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1405,14 +1409,14 @@ bool EditorToolkitNeume::MoveOutsideSyllable(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -1423,23 +1427,23 @@ bool EditorToolkitNeume::MoveOutsideSyllable(std::string elementId) if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!(element->Is(DIVLINE) || element->Is(ACCID) || element->Is(CLEF))) { LogError("Element is of type %s, but only Divlines, Accids, and Clefs can be moved out of syllables.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only DivLines and Accids can be inserted into syllables."); return false; } if (!parent->Is(SYLLABLE)) { LogError("The selected %s is not a child of syllable.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected " + element->GetClassName() + "is not a child of syllable."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected " + element->GetClassName() + "is not a child of syllable."); return false; } @@ -1519,8 +1523,8 @@ bool EditorToolkitNeume::MoveOutsideSyllable(std::string elementId) // INSIDE do nothing } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1528,15 +1532,15 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (direction != "above" && direction != "below") { LogError("Direction can only be either \"above\" or \"below\"."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Direction can only be either \"above\" or \"below\"."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Direction can only be either \"above\" or \"below\"."); return false; } @@ -1544,8 +1548,8 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d Object *obj = page->FindDescendantByID(elementId); if (obj == NULL || !obj->Is(CLEF)) { LogError("This action can only be done on clefs!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This action can only be done on clefs!"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This action can only be done on clefs!"); return false; } @@ -1560,8 +1564,8 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d if (octaveDis > 3 || octaveDis < -3) { LogError("Clefs can only be displaced 3 octaves."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Clefs can only be displaced 3 octaves."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Clefs can only be displaced 3 octaves."); return false; } @@ -1596,8 +1600,8 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d nc->SetOct(nc->GetOct() + move); }); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1605,14 +1609,14 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -1621,14 +1625,14 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) Object *staffParent = element->GetFirstAncestor(STAFF); if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!element->Is(SYL)) { LogError("Element is of type %s, but only element can match height.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import( + m_editInfo.import("status", "FAILURE"); + m_editInfo.import( "message", "Element is of type " + element->GetClassName() + ", but only element can match height."); return false; } @@ -1644,8 +1648,8 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) } else { LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); return false; } @@ -1687,8 +1691,8 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) zone->SetLry(uly + offsetY + height); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1705,15 +1709,15 @@ bool EditorToolkitNeume::Merge(std::vector elementIds) } else { LogError("Staff with ID '%s' does not exist!", it->c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff with ID '" + *it + "' does not exist."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff with ID '" + *it + "' does not exist."); return false; } } if (staves.size() < 2) { LogError("At least two staves must be provided."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "At least two staves must be provided."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "At least two staves must be provided."); return false; } @@ -1774,9 +1778,9 @@ bool EditorToolkitNeume::Merge(std::vector elementIds) fillLayer->ReorderByXPos(); - m_infoObject.import("uuid", fillStaff->GetID()); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("uuid", fillStaff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); // TODO change zones for staff children @@ -1818,8 +1822,8 @@ bool EditorToolkitNeume::Set(std::string elementId, std::string attrType, std::s m_doc->PrepareData(); m_doc->GetDrawingPage()->LayOut(true); } - m_infoObject.import("status", success ? "OK" : "FAILURE"); - m_infoObject.import("message", success ? "" : "Could not set attribute '" + attrType + "' to '" + attrValue + "'."); + m_editInfo.import("status", success ? "OK" : "FAILURE"); + m_editInfo.import("message", success ? "" : "Could not set attribute '" + attrType + "' to '" + attrValue + "'."); return success; } @@ -1829,15 +1833,15 @@ bool EditorToolkitNeume::SetText(std::string elementId, const std::string &text) std::string status = "OK", message = ""; const std::u32string wtext = UTF8to32(text); if (!m_doc->GetDrawingPage()) { - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not find drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not find drawing page."); return false; } Object *element = m_doc->GetDrawingPage()->FindDescendantByID(elementId); if (element == NULL) { LogWarning("No element with ID '%s' exists", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element with ID '" + elementId + "' exists."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element with ID '" + elementId + "' exists."); return false; } @@ -1921,12 +1925,12 @@ bool EditorToolkitNeume::SetText(std::string elementId, const std::string &text) } else { LogError("Element type '%s' is unsupported for SetText", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Element type '" + element->GetClassName() + "' is unsupported for SetText."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element type '" + element->GetClassName() + "' is unsupported for SetText."); return false; } - m_infoObject.import("status", success ? status : "FAILURE"); - m_infoObject.import("message", success ? message : "SetText method failed."); + m_editInfo.import("status", success ? status : "FAILURE"); + m_editInfo.import("message", success ? message : "SetText method failed."); return success; } @@ -1934,8 +1938,8 @@ bool EditorToolkitNeume::SetClef(std::string elementId, std::string shape) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } ListOfObjects objects; @@ -1958,8 +1962,8 @@ bool EditorToolkitNeume::SetClef(std::string elementId, std::string shape) success = AttModule::SetShared(clef, "shape", shape); if (!success) { LogError("Unable to set clef shape"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unable to set clef shape."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unable to set clef shape."); return false; } @@ -1986,8 +1990,8 @@ bool EditorToolkitNeume::SetClef(std::string elementId, std::string shape) m_doc->PrepareData(); m_doc->GetDrawingPage()->LayOut(true); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1995,23 +1999,23 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } Staff *staff = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(elementId)); // Validate parameters if (staff == NULL) { LogError("Either no element exists with ID '%s' or it is not a staff.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Either no element exists with ID '" + elementId + "' or it is not a staff."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Either no element exists with ID '" + elementId + "' or it is not a staff."); return false; } if (staff->GetZone()->GetUlx() > x || staff->GetZone()->GetLrx() < x) { LogError("The 'x' parameter is not within the bounds of the original staff."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The 'x' parameter is not within bounds of the original staff."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The 'x' parameter is not within bounds of the original staff."); return false; } @@ -2025,19 +2029,19 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) if (!this->Insert("staff", "auto", newUlx, newUly, newLrx, newLry, v)) { LogError("Failed to create a second staff."); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to create a second staff."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to create a second staff."); return false; } Staff *splitStaff - = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(m_infoObject.get("uuid"))); + = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(m_editInfo.get("uuid"))); assert(splitStaff); if (splitStaff == NULL) { LogError("Split staff is null"); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Split staff is null."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Split staff is null."); return false; } @@ -2079,9 +2083,9 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) } } layer->ClearRelinquishedChildren(); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("uuid", splitStaff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("uuid", splitStaff->GetID()); return true; } @@ -2089,8 +2093,8 @@ bool EditorToolkitNeume::Remove(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } Object *obj = m_doc->GetDrawingPage()->FindDescendantByID(elementId); @@ -2102,7 +2106,7 @@ bool EditorToolkitNeume::Remove(std::string elementId) isClef = obj->Is(CLEF); Object *parent = obj->GetParent(); assert(parent); - m_infoObject.import("uuid", elementId); + m_editInfo.import("uuid", elementId); // Remove Zone for element (if any) InterfaceComparison ic(INTERFACE_FACSIMILE); ListOfObjects fiChildren; @@ -2143,9 +2147,9 @@ bool EditorToolkitNeume::Remove(std::string elementId) if (!result) { LogError("Failed to delete the desired element (%s)", elementId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete the desired element (" + elementId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete the desired element (" + elementId + ")."); return false; } @@ -2163,9 +2167,9 @@ bool EditorToolkitNeume::Remove(std::string elementId) if (!result) { LogError("Failed to delete the desired element (%s)", elementId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete the desired element (" + elementId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete the desired element (" + elementId + ")."); return false; } // Check if this leaves any containers empty and delete them @@ -2179,9 +2183,9 @@ bool EditorToolkitNeume::Remove(std::string elementId) result &= parent->DeleteChild(obj); if (!result) { LogError("Failed to delete empty neume (%s)", neumeId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete empty neume (" + neumeId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete empty neume (" + neumeId + ")."); return false; } } @@ -2209,16 +2213,16 @@ bool EditorToolkitNeume::Remove(std::string elementId) result &= parent->DeleteChild(obj); if (!result) { LogError("Failed to delete empty syllable (%s)", syllableId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete empty syllable (" + syllableId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete empty syllable (" + syllableId + ")."); return false; } } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -2226,22 +2230,22 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (m_doc->GetType() != Facs) { LogWarning("Resizing is only available in facsimile mode."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Resizing is only available in facsimile mode."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Resizing is only available in facsimile mode."); return false; } Object *obj = m_doc->GetDrawingPage()->FindDescendantByID(elementId); if (obj == NULL) { LogError("Object with ID '%s' not found.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Object with ID '" + elementId + "' could not be found."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Object with ID '" + elementId + "' could not be found."); return false; } if (obj->Is(STAFF)) { @@ -2249,8 +2253,8 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx assert(staff); if (!staff->HasFacs()) { LogError("This staff does not have a facsimile."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This staff does not have a facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This staff does not have a facsimile."); return false; } Zone *zone = staff->GetZone(); @@ -2270,8 +2274,8 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx assert(syl); if (!syl->HasFacs()) { LogError("This syl (bounding box) does not have a facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This syl does not have a facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This syl does not have a facsimile."); return false; } Zone *zone = syl->GetZone(); @@ -2301,12 +2305,12 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx } else { LogError("Element of type '%s' is unsupported.", obj->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Element of type '" + obj->GetClassName() + "' is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element of type '" + obj->GetClassName() + "' is unsupported."); return false; } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -2323,16 +2327,16 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e // Get the current drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (elementIds.size() == 0) { LogWarning("No element IDs to group!"); status = "WARNING"; message = "No element IDs to group!"; - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } ClassId elementClass; @@ -2344,8 +2348,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else { LogError("Invalid groupType: %s", groupType.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Invalid groupType: " + groupType); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Invalid groupType: " + groupType); return false; } @@ -2355,15 +2359,15 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *el = m_doc->GetDrawingPage()->FindDescendantByID(*it); if (el == NULL) { LogError("Could not get element with ID %s", it->c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get element with ID " + *it); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get element with ID " + *it); return false; } if (el->GetClassId() != elementClass) { LogError("Element %s was of class %s. Expected class %s", el->GetID().c_str(), el->GetClassName().c_str(), groupType.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element " + el->GetID() + " was of class " + el->GetClassName() + " but expected class " + groupType + "."); return false; @@ -2373,8 +2377,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *par = el->GetParent(); if (par == NULL) { LogError("Parent of %s is null!", el->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Parent of " + el->GetID() + " is null."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Parent of " + el->GetID() + " is null."); return false; } @@ -2402,20 +2406,20 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e std::vector elementIds0 = { elementIds.begin(), elementIds.begin() + idx }; Group("neume", elementIds0); - if (m_infoObject.get("status") == "FAILURE") { + if (m_editInfo.get("status") == "FAILURE") { resultId0 = linkedID; } else { - resultId0 = m_infoObject.get("uuid"); + resultId0 = m_editInfo.get("uuid"); } std::vector elementIds1 = { elementIds.begin() + idx, elementIds.end() }; Group("neume", elementIds1); - if (m_infoObject.get("status") == "FAILURE") { + if (m_editInfo.get("status") == "FAILURE") { resultId1 = par->GetID(); } else { - resultId1 = m_infoObject.get("uuid"); + resultId1 = m_editInfo.get("uuid"); par = m_doc->GetDrawingPage()->FindDescendantByID(resultId1); } @@ -2431,9 +2435,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e uuidArray << resultId0; uuidArray << resultId1; - m_infoObject.import("uuid", uuidArray); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", uuidArray); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } } @@ -2444,14 +2448,14 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e if (parents.size() == 0) { LogError("Could not get the parent."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the parent."); return false; } else if (parents.size() == 1) { LogError("The selected elements are already grouped."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected elements are already grouped."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected elements are already grouped."); return false; } @@ -2492,8 +2496,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent = (*parents.begin()).first->GetParent(); if (secondParent == NULL) { LogError("No second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No second level parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No second level parent."); return false; } // find parents where all of their children are being grouped @@ -2503,8 +2507,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e int expected; if (par->GetParent() != secondParent) { LogError("No shared second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No shared second level parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No shared second level parent."); return false; } if (par->GetClassId() == SYLLABLE) { @@ -2693,9 +2697,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent->ReorderByXPos(); - m_infoObject.import("uuid", parent->GetID()); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", parent->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -2730,8 +2734,8 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } @@ -2793,8 +2797,8 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector } else { LogError("Unable to toggle ligature within ungroup ncs!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unable to toggle ligature within ungroup ncs."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unable to toggle ligature within ungroup ncs."); return false; } } @@ -2865,8 +2869,8 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector else { LogError("Invalid groupType for ungrouping"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Invalid groupType for ungrouping."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Invalid groupType for ungrouping."); return false; } } @@ -2968,9 +2972,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("uuid", uuidArray); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("uuid", uuidArray); return true; } @@ -2979,8 +2983,8 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } @@ -3002,8 +3006,8 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) int nLen = fparent->GetChildCount(); if (nLen == 0) { LogError("The selected neume has no children."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected neume has no children."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected neume has no children."); return false; } @@ -3011,8 +3015,8 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) int fIdx = fparent->GetChildIndex(elNc); if (fIdx == -1) { LogError("The selected neume component is not a child of the selected neume."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected neume component is not a child of the selected neume."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected neume component is not a child of the selected neume."); return false; } // if click on a ligature, ncId point to the second nc in the ligature, thus minus 1 @@ -3046,9 +3050,9 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) // insert newParent to sparent sparent->InsertAfter(fparent, newParent); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("uuid", uuidArray); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("uuid", uuidArray); return true; } @@ -3057,15 +3061,15 @@ bool EditorToolkitNeume::ChangeGroup(std::string elementId, std::string contour) // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } Neume *el = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(elementId)); if (el == NULL) { LogError("Unable to find neume with id %s", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unable to find neume with id " + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unable to find neume with id " + elementId + "."); return false; } Nc *firstChild = NULL; @@ -3129,8 +3133,8 @@ bool EditorToolkitNeume::ChangeGroup(std::string elementId, std::string contour) LogError("Unsupported character in contour."); delete newNc; delete zone; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported character in contour."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported character in contour."); return false; } zone->SetUlx(newUlx); @@ -3153,9 +3157,9 @@ bool EditorToolkitNeume::ChangeGroup(std::string elementId, std::string contour) initialLry = newLry; prevNc = newNc; } - m_infoObject.import("uuid", el->GetID()); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("uuid", el->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -3173,8 +3177,8 @@ bool EditorToolkitNeume::ToggleLigature(std::vector elementIds) // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } @@ -3188,8 +3192,8 @@ bool EditorToolkitNeume::ToggleLigature(std::vector elementIds) int secondIdx = secondNc->GetIdx(); if (std::abs(firstIdx - secondIdx) != 1) { LogError("The selected ncs are not adjacent."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected ncs are not adjacent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected ncs are not adjacent."); return false; } @@ -3247,20 +3251,20 @@ bool EditorToolkitNeume::ToggleLigature(std::vector elementIds) } // else { // LogError("isLigature is invalid!"); - // m_infoObject.import("status", "FAILURE"); - // m_infoObject.import("message", "isLigature value '" + isLigature + "' is invalid."); + // m_editInfo.import("status", "FAILURE"); + // m_editInfo.import("message", "isLigature value '" + isLigature + "' is invalid."); // return false; // } if (success1 && success2 && m_doc->GetType() != Facs) { m_doc->PrepareData(); m_doc->GetDrawingPage()->LayOut(true); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); if (!(success1 && success2)) { LogWarning("Unable to update ligature attribute"); - m_infoObject.import("message", "Unable to update ligature attribute."); - m_infoObject.import("status", "WARNING"); + m_editInfo.import("message", "Unable to update ligature attribute."); + m_editInfo.import("status", "WARNING"); } surface->AddChild(zone); @@ -3271,15 +3275,15 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (m_doc->GetType() != Facs) { LogWarning("Staff re-association is only available in facsimile mode."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff re-association is only available in facsimile mode."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff re-association is only available in facsimile mode."); return false; } @@ -3287,8 +3291,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) assert(element); if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } @@ -3296,8 +3300,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) || element->Is(ACCID))) { LogError("Element is of type %s, but only Syllables, Custos, Clefs, Divlines, and Accids can change staves.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only Syllables, Custos, Clefs, DivLines, and Accids can change staves."); return false; @@ -3318,8 +3322,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) LayerElement *layerElement = dynamic_cast(element); if (!layerElement->GenerateZoneBounds(&ulx, &uly, &lrx, &lry)) { LogError("Couldn't generate bounding box for syllable."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't generate bounding box for syllable."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't generate bounding box for syllable."); return false; } comp.x = (lrx + ulx) / 2; @@ -3327,8 +3331,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) } else { LogError("This element does not have a facsimile."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This element does not have a facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This element does not have a facsimile."); return false; } @@ -3341,8 +3345,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) } else { LogError("Could not find any staves. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not find any staves. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not find any staves. This should not happen"); return false; } @@ -3351,8 +3355,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) assert(parent); if (parent == NULL || sParent == NULL) { LogError("Couldn't find staff parent of element with id '%s'", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find staff parent of element with id " + elementId); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find staff parent of element with id " + elementId); return false; } @@ -3360,16 +3364,16 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) assert(LAYER); if (layer == NULL) { LogError("Couldn't find layer child of staff. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find layer child of staff. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find layer child of staff. This should not happen"); return false; } if (layer == parent) { - m_infoObject.import("status", "WARNING"); - m_infoObject.import("message", "Moving to the same staff as before."); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "WARNING"); + m_editInfo.import("message", "Moving to the same staff as before."); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } @@ -3427,8 +3431,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) // Adjust clefline if (!AdjustClefLineFromPosition(dynamic_cast(element), staff)) { LogError("Could not adjust clef line of %s", element->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set clef line from facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set clef line from facsimile."); return false; } @@ -3456,19 +3460,19 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) if (!(element->Is(ACCID) || element->Is(DIVLINE))) { if (!AdjustPitchFromPosition(element)) { LogError("Could not adjust pitch of %s", element->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to properly set pitch."); - m_infoObject.import("elementId", element->GetID()); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to properly set pitch."); + m_editInfo.import("elementId", element->GetID()); + m_editInfo.import("newStaffId", staff->GetID()); return false; } } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } @@ -3476,15 +3480,15 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (m_doc->GetType() != Facs) { LogWarning("Staff re-association is only available in facsimile mode."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff re-association is only available in facsimile mode."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff re-association is only available in facsimile mode."); return false; } @@ -3492,16 +3496,16 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI assert(element); if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!(element->Is(CLEF) || element->Is(DIVLINE) || element->Is(ACCID))) { LogError("Element is of type %s, but only Clefs, Divlines, and Accids can change to a specified staff.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only Clefs, Divlines, and Accids can change to a specified staff."); return false; @@ -3511,8 +3515,8 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI if (!staff) { LogError("Could not find any staves. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not find any staves. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not find any staves. This should not happen"); return false; } @@ -3521,8 +3525,8 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI assert(parent); if (parent == NULL || sParent == NULL) { LogError("Couldn't find staff parent of element with id '%s'", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find staff parent of element with id " + elementId); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find staff parent of element with id " + elementId); return false; } @@ -3530,16 +3534,16 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI assert(LAYER); if (layer == NULL) { LogError("Couldn't find layer child of staff. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find layer child of staff. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find layer child of staff. This should not happen"); return false; } if (layer == parent) { - m_infoObject.import("status", "WARNING"); - m_infoObject.import("message", "Moving to the same staff as before."); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "WARNING"); + m_editInfo.import("message", "Moving to the same staff as before."); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } @@ -3597,8 +3601,8 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI // Adjust clefline if (!AdjustClefLineFromPosition(dynamic_cast(element), staff)) { LogError("Could not adjust clef line of %s", element->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set clef line from facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set clef line from facsimile."); return false; } @@ -3625,10 +3629,10 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI parent->ReorderByXPos(); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } From 0a1727fbffb91a6384c4b66a4c9e075827a6c14a Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 14:48:46 -0400 Subject: [PATCH 033/144] Fix outer scope shadowing --- src/editortoolkit_neume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 38fde2bee57..29a811d4b0a 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2596,7 +2596,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent->AddChild(parent); } else { - Syllable *parent = new Syllable(); + parent = new Syllable(); Syl *fullSyl = NULL; int ulx, uly, lrx, lry; From ffcf15178a55895d221be5ee2ceece19488b8f38 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 14:49:21 -0400 Subject: [PATCH 034/144] Clean up comments --- src/editortoolkit_neume.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 29a811d4b0a..9e35505ccd3 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2401,9 +2401,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e std::string resultId0; std::string resultId1; - // LogMessage("%s", chainArray.get(0).json().c_str()); - // for_each(elementIds.begin(), elementIds.begin()+idx,[](std::string s){LogMessage("%s", s.c_str());}); - std::vector elementIds0 = { elementIds.begin(), elementIds.begin() + idx }; Group("neume", elementIds0); if (m_editInfo.get("status") == "FAILURE") { From 83ac0e7ab2e068e0e0894f6d96a08026fe9df13f Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 16:56:28 -0400 Subject: [PATCH 035/144] Break when last element --- src/editortoolkit_neume.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 9e35505ccd3..270ac94a86a 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2811,6 +2811,7 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector fparent->ReorderByXPos(); uuidArray << (*it); it = elementIds.erase(it); + if (it == elementIds.end()) break; el = m_doc->GetDrawingPage()->FindDescendantByID(*it); } } From 37232c1ce6c92c09870f8ecd7c14713004d6f050 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 15 Aug 2023 16:50:29 -0400 Subject: [PATCH 036/144] Reset m_editInfo for OOM error --- src/editortoolkit_neume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 270ac94a86a..cb1432194b4 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -48,7 +48,7 @@ std::string EditorToolkitNeume::EditInfo() bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) { jsonxx::Object json; - // m_editInfo.reset(); + m_editInfo.reset(); // Read JSON actions if (!json.parse(json_editorAction)) { From 12ea581cbcaa610c1f93c945830275d9490e41d1 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 17 Aug 2023 18:15:41 -0400 Subject: [PATCH 037/144] Refactor new bbox zone && add staff rotation offset --- src/editortoolkit_neume.cpp | 66 ++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index cb1432194b4..802668a5da2 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -857,12 +857,12 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in Syl *syl = new Syl(); Neume *neume = new Neume(); Nc *nc = new Nc(); + Zone *sylZone; std::string contour = ""; nc->AttachZone(zone); Surface *surface = vrv_cast(facsimile->FindDescendantByType(SURFACE)); surface->AddChild(zone); - zone->SetUlx(ulx); Text *text = new Text(); std::u32string str = U""; @@ -874,57 +874,48 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in syllable->AddChild(syl); layer->AddChild(syllable); + const int noteHeight + = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_HEIGHT_TO_STAFF_SIZE_RATIO); + const int noteWidth + = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_WIDTH_TO_STAFF_SIZE_RATIO); + ulx -= noteWidth / 2; + + // calculate staff rotation offset + double theta = staff->GetDrawingRotate(); + int offsetY = 0; + if (theta) { + double factor = 1.3; + offsetY = (int)((ulx - staff->GetFacsimileInterface()->GetZone()->GetUlx()) * tan(theta * M_PI / 180.0) + / factor); + } + + // Set up facsimile + zone->SetUlx(ulx); + zone->SetUly(uly + offsetY); + zone->SetLrx(ulx + noteWidth); + zone->SetLry(uly + offsetY + noteHeight); + // add syl bounding box if Facs if (m_doc->GetType() == Facs) { FacsimileInterface *fi = vrv_cast(syl->GetFacsimileInterface()); assert(fi); - Zone *sylZone = new Zone(); + sylZone = new Zone(); - // calculate bboxUlx and bboxUly wrt rotation using sine rule - int draw_w = staff->GetWidth(); int draw_h = staff->GetHeight(); - double theta = staff->GetDrawingRotate(); int staffUly = staff->GetDrawingY(); - int x = ulx - staff->GetDrawingX(); - int bboxUlx = ulx; - int bboxUly; - // if staff rotates downward to the right - if (theta > 0) { - int y = (int)((draw_w - x) * tan(theta * M_PI / 180.0)); - bboxUly = staffUly + draw_h - y; - } - // if staff rotates upwards to the right - else { - int y = (int)(x * tan(-theta * M_PI / 180.0)); - int h = (int)(draw_w * tan(-theta * M_PI / 180.0)); - bboxUly = staffUly + (draw_h - h) - y; - } // width height and offset can be adjusted - int bboxWidth = 225; int bboxHeight = 175; int bboxOffsetX = 50; - sylZone->SetUlx(bboxUlx - bboxOffsetX); - sylZone->SetUly(bboxUly); - sylZone->SetLrx(bboxUlx + bboxWidth - bboxOffsetX); - sylZone->SetLry(bboxUly + bboxHeight); + sylZone->SetUlx(ulx); + sylZone->SetUly(staffUly + draw_h + offsetY); + sylZone->SetLrx(ulx + noteWidth + bboxOffsetX); + sylZone->SetLry(staffUly + draw_h + offsetY + bboxHeight); surface->AddChild(sylZone); fi->AttachZone(sylZone); } - const int noteHeight - = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_HEIGHT_TO_STAFF_SIZE_RATIO); - const int noteWidth - = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_WIDTH_TO_STAFF_SIZE_RATIO); - ulx -= noteWidth / 2; - // uly -= noteHeight / 2; - // Set up facsimile - zone->SetUlx(ulx); - zone->SetUly(uly); - zone->SetLrx(ulx + noteWidth); - zone->SetLry(uly + noteHeight); - layer->ReorderByXPos(); if (!AdjustPitchFromPosition(syllable)) { @@ -1005,12 +996,13 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in newUly += (newUlx - ulx) * tan(-staff->GetDrawingRotate() * M_PI / 180.0); newZone->SetUlx(newUlx); newZone->SetUly(newUly); - ; newZone->SetLrx(newUlx + noteWidth); newZone->SetLry(newUly + noteHeight); newNc->AttachZone(newZone); + if (sylZone) sylZone->SetLrx(newUlx + noteWidth); + assert(surface); surface->AddChild(newZone); From 8330f3b6b51c92aed6642a9733881f5270d409bd Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 27 Oct 2023 16:32:50 -0400 Subject: [PATCH 038/144] Add empty syl for follows syllable if precedes becomes empty --- src/editortoolkit_neume.cpp | 41 ++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 802668a5da2..67f5dc19638 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2197,7 +2197,46 @@ bool EditorToolkitNeume::Remove(std::string elementId) = dynamic_cast(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 From a82d7518c910b5a705f25b9a98106acd343bba8d Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 1 Dec 2023 17:14:09 -0500 Subject: [PATCH 039/144] Set column value for newly inserted staff if has columns --- src/editortoolkit_neume.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 67f5dc19638..048d90eba4c 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -782,10 +782,12 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in if (elementType == "staff") { Object *parent; Staff *newStaff; + std::string columnValue; // Use closest existing staff (if there is one) if (staff) { parent = staff->GetParent(); assert(parent); + columnValue = staff->GetType(); int n = parent->GetChildCount() + 1; newStaff = new Staff(n); newStaff->m_drawingStaffDef = staff->m_drawingStaffDef; @@ -810,6 +812,7 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in assert(surface); surface->AddChild(zone); newStaff->AttachZone(zone); + if (columnValue.length()) newStaff->SetType(columnValue); Layer *newLayer = new Layer(); newStaff->AddChild(newLayer); From 3e5ba64599352a29bee3d05d260b007736469440 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 4 Dec 2023 20:38:54 -0500 Subject: [PATCH 040/144] Unlink syllable when removed --- include/vrv/editortoolkit_neume.h | 1 + src/editortoolkit_neume.cpp | 108 +++++++++++++++++------------- 2 files changed, 62 insertions(+), 47 deletions(-) diff --git a/include/vrv/editortoolkit_neume.h b/include/vrv/editortoolkit_neume.h index 108b50e5266..11828f083cb 100644 --- a/include/vrv/editortoolkit_neume.h +++ b/include/vrv/editortoolkit_neume.h @@ -55,6 +55,7 @@ class EditorToolkitNeume : public EditorToolkit { bool Remove(std::string elementId); bool Resize(std::string elementId, int ulx, int uly, int lrx, int lry, float resize = NAN); bool Group(std::string groupType, std::vector elementIds); + void UnlinkSyllable(Syllable *syllable); bool Ungroup(std::string groupType, std::vector elementIds); bool ChangeGroup(std::string elementId, std::string contour); bool ToggleLigature(std::vector elementIds); diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 048d90eba4c..3eb7ec10a7e 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2084,6 +2084,58 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) return true; } +void EditorToolkitNeume::UnlinkSyllable(Syllable *syllable) +{ + if (!m_doc->GetDrawingPage()) { + LogError("Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); + return; + } + + assert(syllable); + + std::string linkedID = (syllable->HasPrecedes() ? syllable->GetPrecedes() : syllable->GetFollows()); + if (linkedID.compare(0, 1, "#") == 0) linkedID.erase(0, 1); + Syllable *linkedSyllable = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(linkedID)); + if (linkedSyllable != NULL) { + if (linkedSyllable->HasPrecedes()) linkedSyllable->SetPrecedes(""); + 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); + } + } + } +} + bool EditorToolkitNeume::Remove(std::string elementId) { if (!m_doc->GetDrawingPage()) { @@ -2156,6 +2208,14 @@ bool EditorToolkitNeume::Remove(std::string elementId) } } + if (obj->Is(SYLLABLE)) { + Syllable *syllable = dynamic_cast(obj); + assert(syllable); + if (syllable->HasPrecedes() || syllable->HasFollows()) { + UnlinkSyllable(syllable); + } + } + if (!result) { result = parent->DeleteChild(obj); } @@ -2194,53 +2254,7 @@ bool EditorToolkitNeume::Remove(std::string elementId) Syllable *li = dynamic_cast(obj); assert(li); if (li->HasPrecedes() || li->HasFollows()) { - std::string linkedID = (li->HasPrecedes() ? li->GetPrecedes() : li->GetFollows()); - if (linkedID.compare(0, 1, "#") == 0) linkedID.erase(0, 1); - Syllable *linkedSyllable - = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(linkedID)); - if (linkedSyllable != NULL) { - if (linkedSyllable->HasPrecedes()) linkedSyllable->SetPrecedes(""); - 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); - } - }; - } + UnlinkSyllable(li); } // Delete the syllable empty of neumes std::string syllableId = obj->GetID(); From e847556a0aeb060f8c36621a54acafbaa7418d4d Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 11 Dec 2023 17:14:31 -0500 Subject: [PATCH 041/144] Handle empty staff when inserting new staff --- src/editortoolkit_neume.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 3eb7ec10a7e..bb0756c02cf 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -816,28 +816,27 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in Layer *newLayer = new Layer(); newStaff->AddChild(newLayer); - // Find index to insert new staff - ListOfObjects staves = parent->FindAllDescendantsByType(STAFF, false); - std::vector stavesVector(staves.begin(), staves.end()); - stavesVector.push_back(newStaff); - StaffSort staffSort; - std::stable_sort(stavesVector.begin(), stavesVector.end(), staffSort); - for (int i = 0; i < (int)staves.size(); ++i) { - if (stavesVector.at(i) == newStaff) { - parent->InsertChild(newStaff, i); - parent->Modify(); - - m_editInfo.import("uuid", newStaff->GetID()); - m_editInfo.import("status", status); - m_editInfo.import("message", message); - - return true; + if (staff) { + // Find index to insert new staff + ListOfObjects staves = parent->FindAllDescendantsByType(STAFF, false); + std::vector stavesVector(staves.begin(), staves.end()); + stavesVector.push_back(newStaff); + StaffSort staffSort; + std::stable_sort(stavesVector.begin(), stavesVector.end(), staffSort); + for (int i = 0; i < (int)staves.size(); ++i) { + if (stavesVector.at(i) == newStaff) { + parent->InsertChild(newStaff, i); + parent->Modify(); + + m_editInfo.import("uuid", newStaff->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); + + return true; + } } } - LogWarning("Failed to insert newStaff into staff"); - message += "Failed to insert newStaff into staves."; parent->AddChild(newStaff); - parent->Modify(); m_editInfo.import("uuid", newStaff->GetID()); m_editInfo.import("status", status); From fe3a0526d7fc8b84fe15b234edc022a14ee18224 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 12 Dec 2023 17:06:45 -0500 Subject: [PATCH 042/144] New for blank files in neume notation --- src/iomei.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/iomei.cpp b/src/iomei.cpp index ac3f89bde36..77b60e7a0d8 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -4467,6 +4467,13 @@ bool MEIInput::ReadSectionChildren(Object *parent, pugi::xml_node parentNode) LogWarning("Unsupported '<%s>' within
", current.name()); } } + + // New for blank files in neume notation + if (!unmeasured && parent->Is(SECTION) && (m_doc->m_notationType == NOTATIONTYPE_neume)) { + unmeasured = new Measure(false); + m_doc->SetMensuralMusicOnly(true); + parent->AddChild(unmeasured); + } return success; } From 39ba8dbfd4f2dc5fce748007cc3660b616a5dfac Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 18 Dec 2023 09:20:43 +0100 Subject: [PATCH 043/144] Add multiple page breaks if MusicXML encodes blank pages --- src/iomusxml.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index 7fa4fb31d3c..8bd7d0181b5 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -3694,7 +3694,12 @@ void MusicXmlInput::ReadMusicXmlPrint(pugi::xml_node node, Section *section) assert(node); assert(section); - if (node.attribute("new-page").as_bool()) { + int pageBreaks = node.attribute("blank-page").as_int(); + if (node.attribute("new-page").as_bool() || pageBreaks > 0) { + pageBreaks++; + } + + for (int i = 0; i < pageBreaks; i++) { Pb *pb = new Pb(); section->AddChild(pb); } From 65b544861ce10575273e2658a0c227f9f26e08c7 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 18 Dec 2023 11:52:36 +0100 Subject: [PATCH 044/144] Follow MusicXML specs: Only output blank pages if new-page="yes" --- src/iomusxml.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index 8bd7d0181b5..ffa16e0bd0b 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -3694,14 +3694,12 @@ void MusicXmlInput::ReadMusicXmlPrint(pugi::xml_node node, Section *section) assert(node); assert(section); - int pageBreaks = node.attribute("blank-page").as_int(); - if (node.attribute("new-page").as_bool() || pageBreaks > 0) { - pageBreaks++; - } - - for (int i = 0; i < pageBreaks; i++) { - Pb *pb = new Pb(); - section->AddChild(pb); + if (node.attribute("new-page").as_bool()) { + int pageBreaks = node.attribute("blank-page").as_int() + 1; + for (int i = 0; i < pageBreaks; ++i) { + Pb *pb = new Pb(); + section->AddChild(pb); + } } if (node.attribute("new-system").as_bool()) { From 5b73ba1ecffc30fa88132fadc883e73ab184fb94 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 19 Dec 2023 09:14:40 +0100 Subject: [PATCH 045/144] Make loop boundary a constant Co-authored-by: Laurent Pugin --- src/iomusxml.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index ffa16e0bd0b..e7501b40ae1 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -3695,7 +3695,7 @@ void MusicXmlInput::ReadMusicXmlPrint(pugi::xml_node node, Section *section) assert(section); if (node.attribute("new-page").as_bool()) { - int pageBreaks = node.attribute("blank-page").as_int() + 1; + const int pageBreaks = node.attribute("blank-page").as_int() + 1; for (int i = 0; i < pageBreaks; ++i) { Pb *pb = new Pb(); section->AddChild(pb); From 3ded68c67693dc7a80639aef3548751c1b2da016 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Tue, 19 Dec 2023 10:20:53 +0100 Subject: [PATCH 046/144] Fix crash when converting mensural notation from Humdrum --- src/doc.cpp | 3 +++ src/iohumdrum.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/src/doc.cpp b/src/doc.cpp index e79a92b74b0..e1dc8fb97de 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -1291,6 +1291,9 @@ void Doc::ConvertToCastOffMensuralDoc(bool castOff) m_isMensuralMusicOnly = false; } + // Calling Doc::PrepareData is expected to collect visible scores + assert(m_dataPreparationDone); + // Make sure the document is not cast-off this->UnCastOffDoc(); diff --git a/src/iohumdrum.cpp b/src/iohumdrum.cpp index 4353e83816a..be58d5bb7ca 100644 --- a/src/iohumdrum.cpp +++ b/src/iohumdrum.cpp @@ -31612,6 +31612,7 @@ void HumdrumInput::finalizeDocument(Doc *doc) if (m_mens) { doc->SetMensuralMusicOnly(true); doc->m_notationType = NOTATIONTYPE_mensural; + doc->PrepareData(); doc->ConvertToCastOffMensuralDoc(true); } } From 459b29399672c425e5257bec053e32d4badcf601 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 19 Dec 2023 16:37:58 -0500 Subject: [PATCH 047/144] Fix removing clef error --- src/editortoolkit_neume.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index bb0756c02cf..e793f336fdf 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2146,10 +2146,11 @@ bool EditorToolkitNeume::Remove(std::string elementId) Object *obj = m_doc->GetDrawingPage()->FindDescendantByID(elementId); assert(obj); bool result = false; - bool isNeumeOrNc, isNc, isClef; + bool isNeumeOrNc, isNc, isClef, isSyllable; isNeumeOrNc = (obj->Is(NC) || obj->Is(NEUME)); isNc = obj->Is(NC); isClef = obj->Is(CLEF); + isSyllable = obj->Is(SYLLABLE); Object *parent = obj->GetParent(); assert(parent); m_editInfo.import("uuid", elementId); @@ -2206,8 +2207,7 @@ bool EditorToolkitNeume::Remove(std::string elementId) pi->AdjustPitchForNewClef(clef, previousClef); } } - - if (obj->Is(SYLLABLE)) { + else if (isSyllable) { Syllable *syllable = dynamic_cast(obj); assert(syllable); if (syllable->HasPrecedes() || syllable->HasFollows()) { From 5a5cc737411a7d36a3544c54bb98442e354b288a Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 21 Dec 2023 16:07:26 -0500 Subject: [PATCH 048/144] Fix staff rotation offset for inserted syllables --- src/editortoolkit_neume.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index e793f336fdf..c4d60dd438d 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -880,22 +880,12 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_HEIGHT_TO_STAFF_SIZE_RATIO); const int noteWidth = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_WIDTH_TO_STAFF_SIZE_RATIO); - ulx -= noteWidth / 2; - - // calculate staff rotation offset - double theta = staff->GetDrawingRotate(); - int offsetY = 0; - if (theta) { - double factor = 1.3; - offsetY = (int)((ulx - staff->GetFacsimileInterface()->GetZone()->GetUlx()) * tan(theta * M_PI / 180.0) - / factor); - } // Set up facsimile zone->SetUlx(ulx); - zone->SetUly(uly + offsetY); + zone->SetUly(uly); zone->SetLrx(ulx + noteWidth); - zone->SetLry(uly + offsetY + noteHeight); + zone->SetLry(uly + noteHeight); // add syl bounding box if Facs if (m_doc->GetType() == Facs) { @@ -903,17 +893,25 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in assert(fi); sylZone = new Zone(); - int draw_h = staff->GetHeight(); - int staffUly = staff->GetDrawingY(); + int staffLry = staff->GetFacsimileInterface()->GetZone()->GetLry(); // width height and offset can be adjusted int bboxHeight = 175; int bboxOffsetX = 50; + // calculate staff rotation offset + double theta = staff->GetDrawingRotate(); + int offsetY = 0; + if (theta) { + double factor = 1.3; + offsetY = (int)((ulx - staff->GetFacsimileInterface()->GetZone()->GetUlx()) * tan(theta * M_PI / 180.0) + / factor); + } + sylZone->SetUlx(ulx); - sylZone->SetUly(staffUly + draw_h + offsetY); + sylZone->SetUly(staffLry + offsetY); sylZone->SetLrx(ulx + noteWidth + bboxOffsetX); - sylZone->SetLry(staffUly + draw_h + offsetY + bboxHeight); + sylZone->SetLry(staffLry + offsetY + bboxHeight); surface->AddChild(sylZone); fi->AttachZone(sylZone); } From 7d091c98511452bd0850c9fbd534a92f88d042d3 Mon Sep 17 00:00:00 2001 From: Andrew Hankinson Date: Fri, 22 Dec 2023 09:57:46 +0100 Subject: [PATCH 049/144] Fixed: Dependabot warning on scipy This should fix the scipy security warning by updating the dependencies for the "fonts" scripts. --- fonts/poetry.lock | 576 +++++++++++++++++++++++----------------------- 1 file changed, 287 insertions(+), 289 deletions(-) diff --git a/fonts/poetry.lock b/fonts/poetry.lock index 7c516f071b4..bd9153bf74d 100644 --- a/fonts/poetry.lock +++ b/fonts/poetry.lock @@ -1,25 +1,14 @@ # This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. -[[package]] -name = "appnope" -version = "0.1.3" -description = "Disable App Nap on macOS >= 10.9" -optional = false -python-versions = "*" -files = [ - {file = "appnope-0.1.3-py2.py3-none-any.whl", hash = "sha256:265a455292d0bd8a72453494fa24df5a11eb18373a60c7c0430889f22548605e"}, - {file = "appnope-0.1.3.tar.gz", hash = "sha256:02bd91c4de869fbb1e1c50aafc4098827a7a54ab2f39d9dcba6c9547ed920e24"}, -] - [[package]] name = "astroid" -version = "2.14.2" +version = "2.15.8" description = "An abstract syntax tree for Python with inference support." optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.14.2-py3-none-any.whl", hash = "sha256:0e0e3709d64fbffd3037e4ff403580550f14471fd3eaae9fa11cc9a5c7901153"}, - {file = "astroid-2.14.2.tar.gz", hash = "sha256:a3cf9f02c53dd259144a7e8f3ccd75d67c9a8c716ef183e0c1f291bc5d7bb3cf"}, + {file = "astroid-2.15.8-py3-none-any.whl", hash = "sha256:1aa149fc5c6589e3d0ece885b4491acd80af4f087baafa3fb5203b113e68cd3c"}, + {file = "astroid-2.15.8.tar.gz", hash = "sha256:6c107453dffee9055899705de3c9ead36e74119cee151e5a9aaf7f0b0e020a6a"}, ] [package.dependencies] @@ -32,31 +21,21 @@ wrapt = [ [[package]] name = "asttokens" -version = "2.2.1" +version = "2.4.1" description = "Annotate AST trees with source code positions" optional = false python-versions = "*" files = [ - {file = "asttokens-2.2.1-py2.py3-none-any.whl", hash = "sha256:6b0ac9e93fb0335014d382b8fa9b3afa7df546984258005da0b9e7095b3deb1c"}, - {file = "asttokens-2.2.1.tar.gz", hash = "sha256:4622110b2a6f30b77e1473affaa97e711bc2f07d3f10848420ff1898edbe94f3"}, + {file = "asttokens-2.4.1-py2.py3-none-any.whl", hash = "sha256:051ed49c3dcae8913ea7cd08e46a606dba30b79993209636c4875bc1d637bc24"}, + {file = "asttokens-2.4.1.tar.gz", hash = "sha256:b03869718ba9a6eb027e134bfdf69f38a236d681c83c160d510768af11254ba0"}, ] [package.dependencies] -six = "*" +six = ">=1.12.0" [package.extras] -test = ["astroid", "pytest"] - -[[package]] -name = "backcall" -version = "0.2.0" -description = "Specifications for callback functions passed in to an API" -optional = false -python-versions = "*" -files = [ - {file = "backcall-0.2.0-py2.py3-none-any.whl", hash = "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255"}, - {file = "backcall-0.2.0.tar.gz", hash = "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e"}, -] +astroid = ["astroid (>=1,<2)", "astroid (>=2,<4)"] +test = ["astroid (>=1,<2)", "astroid (>=2,<4)", "pytest"] [[package]] name = "black" @@ -95,13 +74,13 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "click" -version = "8.1.3" +version = "8.1.7" description = "Composable command line interface toolkit" optional = false python-versions = ">=3.7" files = [ - {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, - {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, + {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, + {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, ] [package.dependencies] @@ -131,149 +110,160 @@ files = [ [[package]] name = "dill" -version = "0.3.6" -description = "serialize all of python" +version = "0.3.7" +description = "serialize all of Python" optional = false python-versions = ">=3.7" files = [ - {file = "dill-0.3.6-py3-none-any.whl", hash = "sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0"}, - {file = "dill-0.3.6.tar.gz", hash = "sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373"}, + {file = "dill-0.3.7-py3-none-any.whl", hash = "sha256:76b122c08ef4ce2eedcd4d1abd8e641114bfc6c2867f49f3c41facf65bf19f5e"}, + {file = "dill-0.3.7.tar.gz", hash = "sha256:cc1c8b182eb3013e24bd475ff2e9295af86c1a38eb1aff128dac8962a9ce3c03"}, ] [package.extras] graph = ["objgraph (>=1.7.2)"] [[package]] -name = "executing" +name = "exceptiongroup" version = "1.2.0" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "executing" +version = "2.0.1" description = "Get the currently executing AST node of a frame, and other information" optional = false -python-versions = "*" +python-versions = ">=3.5" files = [ - {file = "executing-1.2.0-py2.py3-none-any.whl", hash = "sha256:0314a69e37426e3608aada02473b4161d4caf5a4b244d1d0c48072b8fee7bacc"}, - {file = "executing-1.2.0.tar.gz", hash = "sha256:19da64c18d2d851112f09c287f8d3dbbdf725ab0e569077efb6cdcbd3497c107"}, + {file = "executing-2.0.1-py2.py3-none-any.whl", hash = "sha256:eac49ca94516ccc753f9fb5ce82603156e590b27525a8bc32cce8ae302eb61bc"}, + {file = "executing-2.0.1.tar.gz", hash = "sha256:35afe2ce3affba8ee97f2d69927fa823b08b472b7b994e36a52a964b93d16147"}, ] [package.extras] -tests = ["asttokens", "littleutils", "pytest", "rich"] +tests = ["asttokens (>=2.1.0)", "coverage", "coverage-enable-subprocess", "ipython", "littleutils", "pytest", "rich"] [[package]] name = "ipython" -version = "8.10.0" +version = "8.18.1" description = "IPython: Productive Interactive Computing" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "ipython-8.10.0-py3-none-any.whl", hash = "sha256:b38c31e8fc7eff642fc7c597061fff462537cf2314e3225a19c906b7b0d8a345"}, - {file = "ipython-8.10.0.tar.gz", hash = "sha256:b13a1d6c1f5818bd388db53b7107d17454129a70de2b87481d555daede5eb49e"}, + {file = "ipython-8.18.1-py3-none-any.whl", hash = "sha256:e8267419d72d81955ec1177f8a29aaa90ac80ad647499201119e2f05e99aa397"}, + {file = "ipython-8.18.1.tar.gz", hash = "sha256:ca6f079bb33457c66e233e4580ebfc4128855b4cf6370dddd73842a9563e8a27"}, ] [package.dependencies] -appnope = {version = "*", markers = "sys_platform == \"darwin\""} -backcall = "*" colorama = {version = "*", markers = "sys_platform == \"win32\""} decorator = "*" +exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} jedi = ">=0.16" matplotlib-inline = "*" pexpect = {version = ">4.3", markers = "sys_platform != \"win32\""} -pickleshare = "*" -prompt-toolkit = ">=3.0.30,<3.1.0" +prompt-toolkit = ">=3.0.41,<3.1.0" pygments = ">=2.4.0" stack-data = "*" traitlets = ">=5" +typing-extensions = {version = "*", markers = "python_version < \"3.10\""} [package.extras] -all = ["black", "curio", "docrepr", "ipykernel", "ipyparallel", "ipywidgets", "matplotlib", "matplotlib (!=3.2.0)", "nbconvert", "nbformat", "notebook", "numpy (>=1.21)", "pandas", "pytest (<7)", "pytest (<7.1)", "pytest-asyncio", "qtconsole", "setuptools (>=18.5)", "sphinx (>=1.3)", "sphinx-rtd-theme", "stack-data", "testpath", "trio", "typing-extensions"] +all = ["black", "curio", "docrepr", "exceptiongroup", "ipykernel", "ipyparallel", "ipywidgets", "matplotlib", "matplotlib (!=3.2.0)", "nbconvert", "nbformat", "notebook", "numpy (>=1.22)", "pandas", "pickleshare", "pytest (<7)", "pytest (<7.1)", "pytest-asyncio (<0.22)", "qtconsole", "setuptools (>=18.5)", "sphinx (>=1.3)", "sphinx-rtd-theme", "stack-data", "testpath", "trio", "typing-extensions"] black = ["black"] -doc = ["docrepr", "ipykernel", "matplotlib", "pytest (<7)", "pytest (<7.1)", "pytest-asyncio", "setuptools (>=18.5)", "sphinx (>=1.3)", "sphinx-rtd-theme", "stack-data", "testpath", "typing-extensions"] +doc = ["docrepr", "exceptiongroup", "ipykernel", "matplotlib", "pickleshare", "pytest (<7)", "pytest (<7.1)", "pytest-asyncio (<0.22)", "setuptools (>=18.5)", "sphinx (>=1.3)", "sphinx-rtd-theme", "stack-data", "testpath", "typing-extensions"] kernel = ["ipykernel"] nbconvert = ["nbconvert"] nbformat = ["nbformat"] notebook = ["ipywidgets", "notebook"] parallel = ["ipyparallel"] qtconsole = ["qtconsole"] -test = ["pytest (<7.1)", "pytest-asyncio", "testpath"] -test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.21)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"] +test = ["pickleshare", "pytest (<7.1)", "pytest-asyncio (<0.22)", "testpath"] +test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.22)", "pandas", "pickleshare", "pytest (<7.1)", "pytest-asyncio (<0.22)", "testpath", "trio"] [[package]] name = "isort" -version = "5.12.0" +version = "5.13.2" description = "A Python utility / library to sort Python imports." optional = false python-versions = ">=3.8.0" files = [ - {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, - {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, ] [package.extras] -colors = ["colorama (>=0.4.3)"] -pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] -plugins = ["setuptools"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] +colors = ["colorama (>=0.4.6)"] [[package]] name = "jedi" -version = "0.18.2" +version = "0.19.1" description = "An autocompletion tool for Python that can be used for text editors." optional = false python-versions = ">=3.6" files = [ - {file = "jedi-0.18.2-py2.py3-none-any.whl", hash = "sha256:203c1fd9d969ab8f2119ec0a3342e0b49910045abe6af0a3ae83a5764d54639e"}, - {file = "jedi-0.18.2.tar.gz", hash = "sha256:bae794c30d07f6d910d32a7048af09b5a39ed740918da923c6b780790ebac612"}, + {file = "jedi-0.19.1-py2.py3-none-any.whl", hash = "sha256:e983c654fe5c02867aef4cdfce5a2fbb4a50adc0af145f70504238f18ef5e7e0"}, + {file = "jedi-0.19.1.tar.gz", hash = "sha256:cf0496f3651bc65d7174ac1b7d043eff454892c708a87d1b683e57b569927ffd"}, ] [package.dependencies] -parso = ">=0.8.0,<0.9.0" +parso = ">=0.8.3,<0.9.0" [package.extras] docs = ["Jinja2 (==2.11.3)", "MarkupSafe (==1.1.1)", "Pygments (==2.8.1)", "alabaster (==0.7.12)", "babel (==2.9.1)", "chardet (==4.0.0)", "commonmark (==0.8.1)", "docutils (==0.17.1)", "future (==0.18.2)", "idna (==2.10)", "imagesize (==1.2.0)", "mock (==1.0.1)", "packaging (==20.9)", "pyparsing (==2.4.7)", "pytz (==2021.1)", "readthedocs-sphinx-ext (==2.1.4)", "recommonmark (==0.5.0)", "requests (==2.25.1)", "six (==1.15.0)", "snowballstemmer (==2.1.0)", "sphinx (==1.8.5)", "sphinx-rtd-theme (==0.4.3)", "sphinxcontrib-serializinghtml (==1.1.4)", "sphinxcontrib-websupport (==1.2.4)", "urllib3 (==1.26.4)"] -qa = ["flake8 (==3.8.3)", "mypy (==0.782)"] -testing = ["Django (<3.1)", "attrs", "colorama", "docopt", "pytest (<7.0.0)"] +qa = ["flake8 (==5.0.4)", "mypy (==0.971)", "types-setuptools (==67.2.0.1)"] +testing = ["Django", "attrs", "colorama", "docopt", "pytest (<7.0.0)"] [[package]] name = "lazy-object-proxy" -version = "1.9.0" +version = "1.10.0" description = "A fast and thorough lazy object proxy." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "lazy-object-proxy-1.9.0.tar.gz", hash = "sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b40387277b0ed2d0602b8293b94d7257e17d1479e257b4de114ea11a8cb7f2d7"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8c6cfb338b133fbdbc5cfaa10fe3c6aeea827db80c978dbd13bc9dd8526b7d4"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:721532711daa7db0d8b779b0bb0318fa87af1c10d7fe5e52ef30f8eff254d0cd"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:66a3de4a3ec06cd8af3f61b8e1ec67614fbb7c995d02fa224813cb7afefee701"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:1aa3de4088c89a1b69f8ec0dcc169aa725b0ff017899ac568fe44ddc1396df46"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-win32.whl", hash = "sha256:f0705c376533ed2a9e5e97aacdbfe04cecd71e0aa84c7c0595d02ef93b6e4455"}, - {file = "lazy_object_proxy-1.9.0-cp310-cp310-win_amd64.whl", hash = "sha256:ea806fd4c37bf7e7ad82537b0757999264d5f70c45468447bb2b91afdbe73a6e"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-win32.whl", hash = "sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586"}, - {file = "lazy_object_proxy-1.9.0-cp311-cp311-win_amd64.whl", hash = "sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d9e25ef10a39e8afe59a5c348a4dbf29b4868ab76269f81ce1674494e2565a6e"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cbf9b082426036e19c6924a9ce90c740a9861e2bdc27a4834fd0a910742ac1e8"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f5fa4a61ce2438267163891961cfd5e32ec97a2c444e5b842d574251ade27d2"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:8fa02eaab317b1e9e03f69aab1f91e120e7899b392c4fc19807a8278a07a97e8"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e7c21c95cae3c05c14aafffe2865bbd5e377cfc1348c4f7751d9dc9a48ca4bda"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win32.whl", hash = "sha256:f12ad7126ae0c98d601a7ee504c1122bcef553d1d5e0c3bfa77b16b3968d2734"}, - {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win_amd64.whl", hash = "sha256:edd20c5a55acb67c7ed471fa2b5fb66cb17f61430b7a6b9c3b4a1e40293b1671"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2d0daa332786cf3bb49e10dc6a17a52f6a8f9601b4cf5c295a4f85854d61de63"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cd077f3d04a58e83d04b20e334f678c2b0ff9879b9375ed107d5d07ff160171"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:660c94ea760b3ce47d1855a30984c78327500493d396eac4dfd8bd82041b22be"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:212774e4dfa851e74d393a2370871e174d7ff0ebc980907723bb67d25c8a7c30"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:f0117049dd1d5635bbff65444496c90e0baa48ea405125c088e93d9cf4525b11"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-win32.whl", hash = "sha256:0a891e4e41b54fd5b8313b96399f8b0e173bbbfc03c7631f01efbe29bb0bcf82"}, - {file = "lazy_object_proxy-1.9.0-cp38-cp38-win_amd64.whl", hash = "sha256:9990d8e71b9f6488e91ad25f322898c136b008d87bf852ff65391b004da5e17b"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9e7551208b2aded9c1447453ee366f1c4070602b3d932ace044715d89666899b"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f83ac4d83ef0ab017683d715ed356e30dd48a93746309c8f3517e1287523ef4"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7322c3d6f1766d4ef1e51a465f47955f1e8123caee67dd641e67d539a534d006"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:18b78ec83edbbeb69efdc0e9c1cb41a3b1b1ed11ddd8ded602464c3fc6020494"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:09763491ce220c0299688940f8dc2c5d05fd1f45af1e42e636b2e8b2303e4382"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-win32.whl", hash = "sha256:9090d8e53235aa280fc9239a86ae3ea8ac58eff66a705fa6aa2ec4968b95c821"}, - {file = "lazy_object_proxy-1.9.0-cp39-cp39-win_amd64.whl", hash = "sha256:db1c1722726f47e10e0b5fdbf15ac3b8adb58c091d12b3ab713965795036985f"}, + {file = "lazy-object-proxy-1.10.0.tar.gz", hash = "sha256:78247b6d45f43a52ef35c25b5581459e85117225408a4128a3daf8bf9648ac69"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:855e068b0358ab916454464a884779c7ffa312b8925c6f7401e952dcf3b89977"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ab7004cf2e59f7c2e4345604a3e6ea0d92ac44e1c2375527d56492014e690c3"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc0d2fc424e54c70c4bc06787e4072c4f3b1aa2f897dfdc34ce1013cf3ceef05"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e2adb09778797da09d2b5ebdbceebf7dd32e2c96f79da9052b2e87b6ea495895"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b1f711e2c6dcd4edd372cf5dec5c5a30d23bba06ee012093267b3376c079ec83"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-win32.whl", hash = "sha256:76a095cfe6045c7d0ca77db9934e8f7b71b14645f0094ffcd842349ada5c5fb9"}, + {file = "lazy_object_proxy-1.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:b4f87d4ed9064b2628da63830986c3d2dca7501e6018347798313fcf028e2fd4"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fec03caabbc6b59ea4a638bee5fce7117be8e99a4103d9d5ad77f15d6f81020c"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:02c83f957782cbbe8136bee26416686a6ae998c7b6191711a04da776dc9e47d4"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:009e6bb1f1935a62889ddc8541514b6a9e1fcf302667dcb049a0be5c8f613e56"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:75fc59fc450050b1b3c203c35020bc41bd2695ed692a392924c6ce180c6f1dc9"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:782e2c9b2aab1708ffb07d4bf377d12901d7a1d99e5e410d648d892f8967ab1f"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-win32.whl", hash = "sha256:edb45bb8278574710e68a6b021599a10ce730d156e5b254941754a9cc0b17d03"}, + {file = "lazy_object_proxy-1.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:e271058822765ad5e3bca7f05f2ace0de58a3f4e62045a8c90a0dfd2f8ad8cc6"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e98c8af98d5707dcdecc9ab0863c0ea6e88545d42ca7c3feffb6b4d1e370c7ba"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:952c81d415b9b80ea261d2372d2a4a2332a3890c2b83e0535f263ddfe43f0d43"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80b39d3a151309efc8cc48675918891b865bdf742a8616a337cb0090791a0de9"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:e221060b701e2aa2ea991542900dd13907a5c90fa80e199dbf5a03359019e7a3"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:92f09ff65ecff3108e56526f9e2481b8116c0b9e1425325e13245abfd79bdb1b"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-win32.whl", hash = "sha256:3ad54b9ddbe20ae9f7c1b29e52f123120772b06dbb18ec6be9101369d63a4074"}, + {file = "lazy_object_proxy-1.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:127a789c75151db6af398b8972178afe6bda7d6f68730c057fbbc2e96b08d282"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9e4ed0518a14dd26092614412936920ad081a424bdcb54cc13349a8e2c6d106a"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ad9e6ed739285919aa9661a5bbed0aaf410aa60231373c5579c6b4801bd883c"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fc0a92c02fa1ca1e84fc60fa258458e5bf89d90a1ddaeb8ed9cc3147f417255"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:0aefc7591920bbd360d57ea03c995cebc204b424524a5bd78406f6e1b8b2a5d8"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5faf03a7d8942bb4476e3b62fd0f4cf94eaf4618e304a19865abf89a35c0bbee"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-win32.whl", hash = "sha256:e333e2324307a7b5d86adfa835bb500ee70bfcd1447384a822e96495796b0ca4"}, + {file = "lazy_object_proxy-1.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:cb73507defd385b7705c599a94474b1d5222a508e502553ef94114a143ec6696"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:366c32fe5355ef5fc8a232c5436f4cc66e9d3e8967c01fb2e6302fd6627e3d94"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2297f08f08a2bb0d32a4265e98a006643cd7233fb7983032bd61ac7a02956b3b"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:18dd842b49456aaa9a7cf535b04ca4571a302ff72ed8740d06b5adcd41fe0757"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:217138197c170a2a74ca0e05bddcd5f1796c735c37d0eee33e43259b192aa424"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9a3a87cf1e133e5b1994144c12ca4aa3d9698517fe1e2ca82977781b16955658"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-win32.whl", hash = "sha256:30b339b2a743c5288405aa79a69e706a06e02958eab31859f7f3c04980853b70"}, + {file = "lazy_object_proxy-1.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:a899b10e17743683b293a729d3a11f2f399e8a90c73b089e29f5d0fe3509f0dd"}, + {file = "lazy_object_proxy-1.10.0-pp310.pp311.pp312.pp38.pp39-none-any.whl", hash = "sha256:80fa48bd89c8f2f456fc0765c11c23bf5af827febacd2f523ca5bc1893fcc09d"}, ] [[package]] @@ -356,39 +346,47 @@ files = [ [[package]] name = "numpy" -version = "1.24.2" +version = "1.26.2" description = "Fundamental package for array computing in Python" optional = false -python-versions = ">=3.8" -files = [ - {file = "numpy-1.24.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eef70b4fc1e872ebddc38cddacc87c19a3709c0e3e5d20bf3954c147b1dd941d"}, - {file = "numpy-1.24.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e8d2859428712785e8a8b7d2b3ef0a1d1565892367b32f915c4a4df44d0e64f5"}, - {file = "numpy-1.24.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6524630f71631be2dabe0c541e7675db82651eb998496bbe16bc4f77f0772253"}, - {file = "numpy-1.24.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a51725a815a6188c662fb66fb32077709a9ca38053f0274640293a14fdd22978"}, - {file = "numpy-1.24.2-cp310-cp310-win32.whl", hash = "sha256:2620e8592136e073bd12ee4536149380695fbe9ebeae845b81237f986479ffc9"}, - {file = "numpy-1.24.2-cp310-cp310-win_amd64.whl", hash = "sha256:97cf27e51fa078078c649a51d7ade3c92d9e709ba2bfb97493007103c741f1d0"}, - {file = "numpy-1.24.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7de8fdde0003f4294655aa5d5f0a89c26b9f22c0a58790c38fae1ed392d44a5a"}, - {file = "numpy-1.24.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4173bde9fa2a005c2c6e2ea8ac1618e2ed2c1c6ec8a7657237854d42094123a0"}, - {file = "numpy-1.24.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4cecaed30dc14123020f77b03601559fff3e6cd0c048f8b5289f4eeabb0eb281"}, - {file = "numpy-1.24.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9a23f8440561a633204a67fb44617ce2a299beecf3295f0d13c495518908e910"}, - {file = "numpy-1.24.2-cp311-cp311-win32.whl", hash = "sha256:e428c4fbfa085f947b536706a2fc349245d7baa8334f0c5723c56a10595f9b95"}, - {file = "numpy-1.24.2-cp311-cp311-win_amd64.whl", hash = "sha256:557d42778a6869c2162deb40ad82612645e21d79e11c1dc62c6e82a2220ffb04"}, - {file = "numpy-1.24.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d0a2db9d20117bf523dde15858398e7c0858aadca7c0f088ac0d6edd360e9ad2"}, - {file = "numpy-1.24.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c72a6b2f4af1adfe193f7beb91ddf708ff867a3f977ef2ec53c0ffb8283ab9f5"}, - {file = "numpy-1.24.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c29e6bd0ec49a44d7690ecb623a8eac5ab8a923bce0bea6293953992edf3a76a"}, - {file = "numpy-1.24.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2eabd64ddb96a1239791da78fa5f4e1693ae2dadc82a76bc76a14cbb2b966e96"}, - {file = "numpy-1.24.2-cp38-cp38-win32.whl", hash = "sha256:e3ab5d32784e843fc0dd3ab6dcafc67ef806e6b6828dc6af2f689be0eb4d781d"}, - {file = "numpy-1.24.2-cp38-cp38-win_amd64.whl", hash = "sha256:76807b4063f0002c8532cfeac47a3068a69561e9c8715efdad3c642eb27c0756"}, - {file = "numpy-1.24.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4199e7cfc307a778f72d293372736223e39ec9ac096ff0a2e64853b866a8e18a"}, - {file = "numpy-1.24.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:adbdce121896fd3a17a77ab0b0b5eedf05a9834a18699db6829a64e1dfccca7f"}, - {file = "numpy-1.24.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:889b2cc88b837d86eda1b17008ebeb679d82875022200c6e8e4ce6cf549b7acb"}, - {file = "numpy-1.24.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f64bb98ac59b3ea3bf74b02f13836eb2e24e48e0ab0145bbda646295769bd780"}, - {file = "numpy-1.24.2-cp39-cp39-win32.whl", hash = "sha256:63e45511ee4d9d976637d11e6c9864eae50e12dc9598f531c035265991910468"}, - {file = "numpy-1.24.2-cp39-cp39-win_amd64.whl", hash = "sha256:a77d3e1163a7770164404607b7ba3967fb49b24782a6ef85d9b5f54126cc39e5"}, - {file = "numpy-1.24.2-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:92011118955724465fb6853def593cf397b4a1367495e0b59a7e69d40c4eb71d"}, - {file = "numpy-1.24.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9006288bcf4895917d02583cf3411f98631275bc67cce355a7f39f8c14338fa"}, - {file = "numpy-1.24.2-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:150947adbdfeceec4e5926d956a06865c1c690f2fd902efede4ca6fe2e657c3f"}, - {file = "numpy-1.24.2.tar.gz", hash = "sha256:003a9f530e880cb2cd177cba1af7220b9aa42def9c4afc2a2fc3ee6be7eb2b22"}, +python-versions = ">=3.9" +files = [ + {file = "numpy-1.26.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:3703fc9258a4a122d17043e57b35e5ef1c5a5837c3db8be396c82e04c1cf9b0f"}, + {file = "numpy-1.26.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cc392fdcbd21d4be6ae1bb4475a03ce3b025cd49a9be5345d76d7585aea69440"}, + {file = "numpy-1.26.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:36340109af8da8805d8851ef1d74761b3b88e81a9bd80b290bbfed61bd2b4f75"}, + {file = "numpy-1.26.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bcc008217145b3d77abd3e4d5ef586e3bdfba8fe17940769f8aa09b99e856c00"}, + {file = "numpy-1.26.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:3ced40d4e9e18242f70dd02d739e44698df3dcb010d31f495ff00a31ef6014fe"}, + {file = "numpy-1.26.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b272d4cecc32c9e19911891446b72e986157e6a1809b7b56518b4f3755267523"}, + {file = "numpy-1.26.2-cp310-cp310-win32.whl", hash = "sha256:22f8fc02fdbc829e7a8c578dd8d2e15a9074b630d4da29cda483337e300e3ee9"}, + {file = "numpy-1.26.2-cp310-cp310-win_amd64.whl", hash = "sha256:26c9d33f8e8b846d5a65dd068c14e04018d05533b348d9eaeef6c1bd787f9919"}, + {file = "numpy-1.26.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b96e7b9c624ef3ae2ae0e04fa9b460f6b9f17ad8b4bec6d7756510f1f6c0c841"}, + {file = "numpy-1.26.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aa18428111fb9a591d7a9cc1b48150097ba6a7e8299fb56bdf574df650e7d1f1"}, + {file = "numpy-1.26.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:06fa1ed84aa60ea6ef9f91ba57b5ed963c3729534e6e54055fc151fad0423f0a"}, + {file = "numpy-1.26.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:96ca5482c3dbdd051bcd1fce8034603d6ebfc125a7bd59f55b40d8f5d246832b"}, + {file = "numpy-1.26.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:854ab91a2906ef29dc3925a064fcd365c7b4da743f84b123002f6139bcb3f8a7"}, + {file = "numpy-1.26.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:f43740ab089277d403aa07567be138fc2a89d4d9892d113b76153e0e412409f8"}, + {file = "numpy-1.26.2-cp311-cp311-win32.whl", hash = "sha256:a2bbc29fcb1771cd7b7425f98b05307776a6baf43035d3b80c4b0f29e9545186"}, + {file = "numpy-1.26.2-cp311-cp311-win_amd64.whl", hash = "sha256:2b3fca8a5b00184828d12b073af4d0fc5fdd94b1632c2477526f6bd7842d700d"}, + {file = "numpy-1.26.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:a4cd6ed4a339c21f1d1b0fdf13426cb3b284555c27ac2f156dfdaaa7e16bfab0"}, + {file = "numpy-1.26.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5d5244aabd6ed7f312268b9247be47343a654ebea52a60f002dc70c769048e75"}, + {file = "numpy-1.26.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a3cdb4d9c70e6b8c0814239ead47da00934666f668426fc6e94cce869e13fd7"}, + {file = "numpy-1.26.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa317b2325f7aa0a9471663e6093c210cb2ae9c0ad824732b307d2c51983d5b6"}, + {file = "numpy-1.26.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:174a8880739c16c925799c018f3f55b8130c1f7c8e75ab0a6fa9d41cab092fd6"}, + {file = "numpy-1.26.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f79b231bf5c16b1f39c7f4875e1ded36abee1591e98742b05d8a0fb55d8a3eec"}, + {file = "numpy-1.26.2-cp312-cp312-win32.whl", hash = "sha256:4a06263321dfd3598cacb252f51e521a8cb4b6df471bb12a7ee5cbab20ea9167"}, + {file = "numpy-1.26.2-cp312-cp312-win_amd64.whl", hash = "sha256:b04f5dc6b3efdaab541f7857351aac359e6ae3c126e2edb376929bd3b7f92d7e"}, + {file = "numpy-1.26.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4eb8df4bf8d3d90d091e0146f6c28492b0be84da3e409ebef54349f71ed271ef"}, + {file = "numpy-1.26.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1a13860fdcd95de7cf58bd6f8bc5a5ef81c0b0625eb2c9a783948847abbef2c2"}, + {file = "numpy-1.26.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64308ebc366a8ed63fd0bf426b6a9468060962f1a4339ab1074c228fa6ade8e3"}, + {file = "numpy-1.26.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:baf8aab04a2c0e859da118f0b38617e5ee65d75b83795055fb66c0d5e9e9b818"}, + {file = "numpy-1.26.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d73a3abcac238250091b11caef9ad12413dab01669511779bc9b29261dd50210"}, + {file = "numpy-1.26.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:b361d369fc7e5e1714cf827b731ca32bff8d411212fccd29ad98ad622449cc36"}, + {file = "numpy-1.26.2-cp39-cp39-win32.whl", hash = "sha256:bd3f0091e845164a20bd5a326860c840fe2af79fa12e0469a12768a3ec578d80"}, + {file = "numpy-1.26.2-cp39-cp39-win_amd64.whl", hash = "sha256:2beef57fb031dcc0dc8fa4fe297a742027b954949cabb52a2a376c144e5e6060"}, + {file = "numpy-1.26.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:1cc3d5029a30fb5f06704ad6b23b35e11309491c999838c31f124fee32107c79"}, + {file = "numpy-1.26.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:94cc3c222bb9fb5a12e334d0479b97bb2df446fbe622b470928f5284ffca3f8d"}, + {file = "numpy-1.26.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:fe6b44fb8fcdf7eda4ef4461b97b3f63c466b27ab151bec2366db8b197387841"}, + {file = "numpy-1.26.2.tar.gz", hash = "sha256:f65738447676ab5777f11e6bbbdb8ce11b785e105f690bc45966574816b6d3ea"}, ] [[package]] @@ -408,64 +406,53 @@ testing = ["docopt", "pytest (<6.0.0)"] [[package]] name = "pathspec" -version = "0.11.0" +version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pathspec-0.11.0-py3-none-any.whl", hash = "sha256:3a66eb970cbac598f9e5ccb5b2cf58930cd8e3ed86d393d541eaf2d8b1705229"}, - {file = "pathspec-0.11.0.tar.gz", hash = "sha256:64d338d4e0914e91c1792321e6907b5a593f1ab1851de7fc269557a21b30ebbc"}, + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, ] [[package]] name = "pexpect" -version = "4.8.0" +version = "4.9.0" description = "Pexpect allows easy control of interactive console applications." optional = false python-versions = "*" files = [ - {file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"}, - {file = "pexpect-4.8.0.tar.gz", hash = "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"}, + {file = "pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523"}, + {file = "pexpect-4.9.0.tar.gz", hash = "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f"}, ] [package.dependencies] ptyprocess = ">=0.5" -[[package]] -name = "pickleshare" -version = "0.7.5" -description = "Tiny 'shelve'-like database with concurrency support" -optional = false -python-versions = "*" -files = [ - {file = "pickleshare-0.7.5-py2.py3-none-any.whl", hash = "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"}, - {file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"}, -] - [[package]] name = "platformdirs" -version = "3.0.0" +version = "4.1.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "platformdirs-3.0.0-py3-none-any.whl", hash = "sha256:b1d5eb14f221506f50d6604a561f4c5786d9e80355219694a1b244bcd96f4567"}, - {file = "platformdirs-3.0.0.tar.gz", hash = "sha256:8a1228abb1ef82d788f74139988b137e78692984ec7b08eaa6c65f1723af28f9"}, + {file = "platformdirs-4.1.0-py3-none-any.whl", hash = "sha256:11c8f37bcca40db96d8144522d925583bdb7a31f7b0e37e3ed4318400a8e2380"}, + {file = "platformdirs-4.1.0.tar.gz", hash = "sha256:906d548203468492d432bcb294d4bc2fff751bf84971fbb2c10918cc206ee420"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"] [[package]] name = "prompt-toolkit" -version = "3.0.36" +version = "3.0.43" description = "Library for building powerful interactive command lines in Python" optional = false -python-versions = ">=3.6.2" +python-versions = ">=3.7.0" files = [ - {file = "prompt_toolkit-3.0.36-py3-none-any.whl", hash = "sha256:aa64ad242a462c5ff0363a7b9cfe696c20d55d9fc60c11fd8e632d064804d305"}, - {file = "prompt_toolkit-3.0.36.tar.gz", hash = "sha256:3e163f254bef5a03b146397d7c1963bd3e2812f0964bb9a24e6ec761fd28db63"}, + {file = "prompt_toolkit-3.0.43-py3-none-any.whl", hash = "sha256:a11a29cb3bf0a28a387fe5122cdb649816a957cd9261dcedf8c9f1fef33eacf6"}, + {file = "prompt_toolkit-3.0.43.tar.gz", hash = "sha256:3527b7af26106cbc65a040bcc84839a3566ec1b051bb0bfe953631e704b0ff7d"}, ] [package.dependencies] @@ -498,31 +485,32 @@ tests = ["pytest"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.17.2" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "pygments-2.17.2-py3-none-any.whl", hash = "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c"}, + {file = "pygments-2.17.2.tar.gz", hash = "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"}, ] [package.extras] plugins = ["importlib-metadata"] +windows-terminal = ["colorama (>=0.4.6)"] [[package]] name = "pylint" -version = "2.16.2" +version = "2.17.7" description = "python code static checker" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.16.2-py3-none-any.whl", hash = "sha256:ff22dde9c2128cd257c145cfd51adeff0be7df4d80d669055f24a962b351bbe4"}, - {file = "pylint-2.16.2.tar.gz", hash = "sha256:13b2c805a404a9bf57d002cd5f054ca4d40b0b87542bdaba5e05321ae8262c84"}, + {file = "pylint-2.17.7-py3-none-any.whl", hash = "sha256:27a8d4c7ddc8c2f8c18aa0050148f89ffc09838142193fdbe98f172781a3ff87"}, + {file = "pylint-2.17.7.tar.gz", hash = "sha256:f4fcac7ae74cfe36bc8451e931d8438e4a476c20314b1101c458ad0f05191fad"}, ] [package.dependencies] -astroid = ">=2.14.2,<=2.16.0-dev0" +astroid = ">=2.15.8,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -541,41 +529,45 @@ testutils = ["gitpython (>3)"] [[package]] name = "scipy" -version = "1.9.3" +version = "1.11.4" description = "Fundamental algorithms for scientific computing in Python" optional = false -python-versions = ">=3.8" -files = [ - {file = "scipy-1.9.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1884b66a54887e21addf9c16fb588720a8309a57b2e258ae1c7986d4444d3bc0"}, - {file = "scipy-1.9.3-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:83b89e9586c62e787f5012e8475fbb12185bafb996a03257e9675cd73d3736dd"}, - {file = "scipy-1.9.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a72d885fa44247f92743fc20732ae55564ff2a519e8302fb7e18717c5355a8b"}, - {file = "scipy-1.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d01e1dd7b15bd2449c8bfc6b7cc67d630700ed655654f0dfcf121600bad205c9"}, - {file = "scipy-1.9.3-cp310-cp310-win_amd64.whl", hash = "sha256:68239b6aa6f9c593da8be1509a05cb7f9efe98b80f43a5861cd24c7557e98523"}, - {file = "scipy-1.9.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b41bc822679ad1c9a5f023bc93f6d0543129ca0f37c1ce294dd9d386f0a21096"}, - {file = "scipy-1.9.3-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:90453d2b93ea82a9f434e4e1cba043e779ff67b92f7a0e85d05d286a3625df3c"}, - {file = "scipy-1.9.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:83c06e62a390a9167da60bedd4575a14c1f58ca9dfde59830fc42e5197283dab"}, - {file = "scipy-1.9.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:abaf921531b5aeaafced90157db505e10345e45038c39e5d9b6c7922d68085cb"}, - {file = "scipy-1.9.3-cp311-cp311-win_amd64.whl", hash = "sha256:06d2e1b4c491dc7d8eacea139a1b0b295f74e1a1a0f704c375028f8320d16e31"}, - {file = "scipy-1.9.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5a04cd7d0d3eff6ea4719371cbc44df31411862b9646db617c99718ff68d4840"}, - {file = "scipy-1.9.3-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:545c83ffb518094d8c9d83cce216c0c32f8c04aaf28b92cc8283eda0685162d5"}, - {file = "scipy-1.9.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d54222d7a3ba6022fdf5773931b5d7c56efe41ede7f7128c7b1637700409108"}, - {file = "scipy-1.9.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cff3a5295234037e39500d35316a4c5794739433528310e117b8a9a0c76d20fc"}, - {file = "scipy-1.9.3-cp38-cp38-win_amd64.whl", hash = "sha256:2318bef588acc7a574f5bfdff9c172d0b1bf2c8143d9582e05f878e580a3781e"}, - {file = "scipy-1.9.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d644a64e174c16cb4b2e41dfea6af722053e83d066da7343f333a54dae9bc31c"}, - {file = "scipy-1.9.3-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:da8245491d73ed0a994ed9c2e380fd058ce2fa8a18da204681f2fe1f57f98f95"}, - {file = "scipy-1.9.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4db5b30849606a95dcf519763dd3ab6fe9bd91df49eba517359e450a7d80ce2e"}, - {file = "scipy-1.9.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c68db6b290cbd4049012990d7fe71a2abd9ffbe82c0056ebe0f01df8be5436b0"}, - {file = "scipy-1.9.3-cp39-cp39-win_amd64.whl", hash = "sha256:5b88e6d91ad9d59478fafe92a7c757d00c59e3bdc3331be8ada76a4f8d683f58"}, - {file = "scipy-1.9.3.tar.gz", hash = "sha256:fbc5c05c85c1a02be77b1ff591087c83bc44579c6d2bd9fb798bb64ea5e1a027"}, +python-versions = ">=3.9" +files = [ + {file = "scipy-1.11.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bc9a714581f561af0848e6b69947fda0614915f072dfd14142ed1bfe1b806710"}, + {file = "scipy-1.11.4-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:cf00bd2b1b0211888d4dc75656c0412213a8b25e80d73898083f402b50f47e41"}, + {file = "scipy-1.11.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9999c008ccf00e8fbcce1236f85ade5c569d13144f77a1946bef8863e8f6eb4"}, + {file = "scipy-1.11.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:933baf588daa8dc9a92c20a0be32f56d43faf3d1a60ab11b3f08c356430f6e56"}, + {file = "scipy-1.11.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8fce70f39076a5aa62e92e69a7f62349f9574d8405c0a5de6ed3ef72de07f446"}, + {file = "scipy-1.11.4-cp310-cp310-win_amd64.whl", hash = "sha256:6550466fbeec7453d7465e74d4f4b19f905642c89a7525571ee91dd7adabb5a3"}, + {file = "scipy-1.11.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f313b39a7e94f296025e3cffc2c567618174c0b1dde173960cf23808f9fae4be"}, + {file = "scipy-1.11.4-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:1b7c3dca977f30a739e0409fb001056484661cb2541a01aba0bb0029f7b68db8"}, + {file = "scipy-1.11.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00150c5eae7b610c32589dda259eacc7c4f1665aedf25d921907f4d08a951b1c"}, + {file = "scipy-1.11.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:530f9ad26440e85766509dbf78edcfe13ffd0ab7fec2560ee5c36ff74d6269ff"}, + {file = "scipy-1.11.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5e347b14fe01003d3b78e196e84bd3f48ffe4c8a7b8a1afbcb8f5505cb710993"}, + {file = "scipy-1.11.4-cp311-cp311-win_amd64.whl", hash = "sha256:acf8ed278cc03f5aff035e69cb511741e0418681d25fbbb86ca65429c4f4d9cd"}, + {file = "scipy-1.11.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:028eccd22e654b3ea01ee63705681ee79933652b2d8f873e7949898dda6d11b6"}, + {file = "scipy-1.11.4-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:2c6ff6ef9cc27f9b3db93a6f8b38f97387e6e0591600369a297a50a8e96e835d"}, + {file = "scipy-1.11.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b030c6674b9230d37c5c60ab456e2cf12f6784596d15ce8da9365e70896effc4"}, + {file = "scipy-1.11.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad669df80528aeca5f557712102538f4f37e503f0c5b9541655016dd0932ca79"}, + {file = "scipy-1.11.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:ce7fff2e23ab2cc81ff452a9444c215c28e6305f396b2ba88343a567feec9660"}, + {file = "scipy-1.11.4-cp312-cp312-win_amd64.whl", hash = "sha256:36750b7733d960d7994888f0d148d31ea3017ac15eef664194b4ef68d36a4a97"}, + {file = "scipy-1.11.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6e619aba2df228a9b34718efb023966da781e89dd3d21637b27f2e54db0410d7"}, + {file = "scipy-1.11.4-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:f3cd9e7b3c2c1ec26364856f9fbe78695fe631150f94cd1c22228456404cf1ec"}, + {file = "scipy-1.11.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d10e45a6c50211fe256da61a11c34927c68f277e03138777bdebedd933712fea"}, + {file = "scipy-1.11.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:91af76a68eeae0064887a48e25c4e616fa519fa0d38602eda7e0f97d65d57937"}, + {file = "scipy-1.11.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:6df1468153a31cf55ed5ed39647279beb9cfb5d3f84369453b49e4b8502394fd"}, + {file = "scipy-1.11.4-cp39-cp39-win_amd64.whl", hash = "sha256:ee410e6de8f88fd5cf6eadd73c135020bfbbbdfcd0f6162c36a7638a1ea8cc65"}, + {file = "scipy-1.11.4.tar.gz", hash = "sha256:90a2b78e7f5733b9de748f589f09225013685f9b218275257f8a8168ededaeaa"}, ] [package.dependencies] -numpy = ">=1.18.5,<1.26.0" +numpy = ">=1.21.6,<1.28.0" [package.extras] -dev = ["flake8", "mypy", "pycodestyle", "typing_extensions"] -doc = ["matplotlib (>2)", "numpydoc", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-panels (>=0.5.2)", "sphinx-tabs"] -test = ["asv", "gmpy2", "mpmath", "pytest", "pytest-cov", "pytest-xdist", "scikit-umfpack", "threadpoolctl"] +dev = ["click", "cython-lint (>=0.12.2)", "doit (>=0.36.0)", "mypy", "pycodestyle", "pydevtool", "rich-click", "ruff", "types-psutil", "typing_extensions"] +doc = ["jupytext", "matplotlib (>2)", "myst-nb", "numpydoc", "pooch", "pydata-sphinx-theme (==0.9.0)", "sphinx (!=4.1.0)", "sphinx-design (>=0.2.0)"] +test = ["asv", "gmpy2", "mpmath", "pooch", "pytest", "pytest-cov", "pytest-timeout", "pytest-xdist", "scikit-umfpack", "threadpoolctl"] [[package]] name = "six" @@ -590,13 +582,13 @@ files = [ [[package]] name = "stack-data" -version = "0.6.2" +version = "0.6.3" description = "Extract data from python stack frames and tracebacks for informative displays" optional = false python-versions = "*" files = [ - {file = "stack_data-0.6.2-py3-none-any.whl", hash = "sha256:cbb2a53eb64e5785878201a97ed7c7b94883f48b87bfb0bbe8b623c74679e4a8"}, - {file = "stack_data-0.6.2.tar.gz", hash = "sha256:32d2dd0376772d01b6cb9fc996f3c8b57a357089dec328ed4b6553d037eaf815"}, + {file = "stack_data-0.6.3-py3-none-any.whl", hash = "sha256:d5558e0c25a4cb0853cddad3d77da9891a08cb85dd9f9f91b9f8cd66e511e695"}, + {file = "stack_data-0.6.3.tar.gz", hash = "sha256:836a778de4fec4dcd1dcd89ed8abff8a221f58308462e1c4aa2a3cf30148f0b9"}, ] [package.dependencies] @@ -609,13 +601,13 @@ tests = ["cython", "littleutils", "pygments", "pytest", "typeguard"] [[package]] name = "svgpathtools" -version = "1.6.0" +version = "1.6.1" description = "A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves." optional = false python-versions = "*" files = [ - {file = "svgpathtools-1.6.0-py2.py3-none-any.whl", hash = "sha256:b046301769de58fe3d35a3f633914455b5bafba52dddfe0a41ec57ac1bcb9439"}, - {file = "svgpathtools-1.6.0.tar.gz", hash = "sha256:c0b934eed29acaeb09988afb4d15c5984366847236e21b80c079d8edb5ac0c4e"}, + {file = "svgpathtools-1.6.1-py2.py3-none-any.whl", hash = "sha256:39967f9a817b8a12cc6dd1646fc162d522fca6c3fd5f8c94913c15ee4cb3a906"}, + {file = "svgpathtools-1.6.1.tar.gz", hash = "sha256:7054e6de1953e295bf565d535d585695453b09f8db4a2f7c4853348732097a3e"}, ] [package.dependencies] @@ -647,123 +639,129 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.6" +version = "0.12.3" description = "Style preserving TOML library" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.6-py3-none-any.whl", hash = "sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b"}, - {file = "tomlkit-0.11.6.tar.gz", hash = "sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73"}, + {file = "tomlkit-0.12.3-py3-none-any.whl", hash = "sha256:b0a645a9156dc7cb5d3a1f0d4bab66db287fcb8e0430bdd4664a095ea16414ba"}, + {file = "tomlkit-0.12.3.tar.gz", hash = "sha256:75baf5012d06501f07bee5bf8e801b9f343e7aac5a92581f20f80ce632e6b5a4"}, ] [[package]] name = "traitlets" -version = "5.9.0" +version = "5.14.0" description = "Traitlets Python configuration system" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "traitlets-5.9.0-py3-none-any.whl", hash = "sha256:9e6ec080259b9a5940c797d58b613b5e31441c2257b87c2e795c5228ae80d2d8"}, - {file = "traitlets-5.9.0.tar.gz", hash = "sha256:f6cde21a9c68cf756af02035f72d5a723bf607e862e7be33ece505abf4a3bad9"}, + {file = "traitlets-5.14.0-py3-none-any.whl", hash = "sha256:f14949d23829023013c47df20b4a76ccd1a85effb786dc060f34de7948361b33"}, + {file = "traitlets-5.14.0.tar.gz", hash = "sha256:fcdaa8ac49c04dfa0ed3ee3384ef6dfdb5d6f3741502be247279407679296772"}, ] [package.extras] docs = ["myst-parser", "pydata-sphinx-theme", "sphinx"] -test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"] +test = ["argcomplete (>=3.0.3)", "mypy (>=1.7.0)", "pre-commit", "pytest (>=7.0,<7.5)", "pytest-mock", "pytest-mypy-testing"] [[package]] name = "typing-extensions" -version = "4.5.0" -description = "Backported and Experimental Type Hints for Python 3.7+" +version = "4.9.0" +description = "Backported and Experimental Type Hints for Python 3.8+" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, + {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, + {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ] [[package]] name = "wcwidth" -version = "0.2.6" +version = "0.2.12" description = "Measures the displayed width of unicode strings in a terminal" optional = false python-versions = "*" files = [ - {file = "wcwidth-0.2.6-py2.py3-none-any.whl", hash = "sha256:795b138f6875577cd91bba52baf9e445cd5118fd32723b460e30a0af30ea230e"}, - {file = "wcwidth-0.2.6.tar.gz", hash = "sha256:a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0"}, + {file = "wcwidth-0.2.12-py2.py3-none-any.whl", hash = "sha256:f26ec43d96c8cbfed76a5075dac87680124fa84e0855195a6184da9c187f133c"}, + {file = "wcwidth-0.2.12.tar.gz", hash = "sha256:f01c104efdf57971bcb756f054dd58ddec5204dd15fa31d6503ea57947d97c02"}, ] [[package]] name = "wrapt" -version = "1.14.1" +version = "1.16.0" description = "Module for decorators, wrappers and monkey patching." optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -files = [ - {file = "wrapt-1.14.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:1b376b3f4896e7930f1f772ac4b064ac12598d1c38d04907e696cc4d794b43d3"}, - {file = "wrapt-1.14.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:903500616422a40a98a5a3c4ff4ed9d0066f3b4c951fa286018ecdf0750194ef"}, - {file = "wrapt-1.14.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:5a9a0d155deafd9448baff28c08e150d9b24ff010e899311ddd63c45c2445e28"}, - {file = "wrapt-1.14.1-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:ddaea91abf8b0d13443f6dac52e89051a5063c7d014710dcb4d4abb2ff811a59"}, - {file = "wrapt-1.14.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:36f582d0c6bc99d5f39cd3ac2a9062e57f3cf606ade29a0a0d6b323462f4dd87"}, - {file = "wrapt-1.14.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:7ef58fb89674095bfc57c4069e95d7a31cfdc0939e2a579882ac7d55aadfd2a1"}, - {file = "wrapt-1.14.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:e2f83e18fe2f4c9e7db597e988f72712c0c3676d337d8b101f6758107c42425b"}, - {file = "wrapt-1.14.1-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:ee2b1b1769f6707a8a445162ea16dddf74285c3964f605877a20e38545c3c462"}, - {file = "wrapt-1.14.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:833b58d5d0b7e5b9832869f039203389ac7cbf01765639c7309fd50ef619e0b1"}, - {file = "wrapt-1.14.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:80bb5c256f1415f747011dc3604b59bc1f91c6e7150bd7db03b19170ee06b320"}, - {file = "wrapt-1.14.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:07f7a7d0f388028b2df1d916e94bbb40624c59b48ecc6cbc232546706fac74c2"}, - {file = "wrapt-1.14.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:02b41b633c6261feff8ddd8d11c711df6842aba629fdd3da10249a53211a72c4"}, - {file = "wrapt-1.14.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fe803deacd09a233e4762a1adcea5db5d31e6be577a43352936179d14d90069"}, - {file = "wrapt-1.14.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:257fd78c513e0fb5cdbe058c27a0624c9884e735bbd131935fd49e9fe719d310"}, - {file = "wrapt-1.14.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4fcc4649dc762cddacd193e6b55bc02edca674067f5f98166d7713b193932b7f"}, - {file = "wrapt-1.14.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:11871514607b15cfeb87c547a49bca19fde402f32e2b1c24a632506c0a756656"}, - {file = "wrapt-1.14.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8ad85f7f4e20964db4daadcab70b47ab05c7c1cf2a7c1e51087bfaa83831854c"}, - {file = "wrapt-1.14.1-cp310-cp310-win32.whl", hash = "sha256:a9a52172be0b5aae932bef82a79ec0a0ce87288c7d132946d645eba03f0ad8a8"}, - {file = "wrapt-1.14.1-cp310-cp310-win_amd64.whl", hash = "sha256:6d323e1554b3d22cfc03cd3243b5bb815a51f5249fdcbb86fda4bf62bab9e164"}, - {file = "wrapt-1.14.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:43ca3bbbe97af00f49efb06e352eae40434ca9d915906f77def219b88e85d907"}, - {file = "wrapt-1.14.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:6b1a564e6cb69922c7fe3a678b9f9a3c54e72b469875aa8018f18b4d1dd1adf3"}, - {file = "wrapt-1.14.1-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:00b6d4ea20a906c0ca56d84f93065b398ab74b927a7a3dbd470f6fc503f95dc3"}, - {file = "wrapt-1.14.1-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:a85d2b46be66a71bedde836d9e41859879cc54a2a04fad1191eb50c2066f6e9d"}, - {file = "wrapt-1.14.1-cp35-cp35m-win32.whl", hash = "sha256:dbcda74c67263139358f4d188ae5faae95c30929281bc6866d00573783c422b7"}, - {file = "wrapt-1.14.1-cp35-cp35m-win_amd64.whl", hash = "sha256:b21bb4c09ffabfa0e85e3a6b623e19b80e7acd709b9f91452b8297ace2a8ab00"}, - {file = "wrapt-1.14.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:9e0fd32e0148dd5dea6af5fee42beb949098564cc23211a88d799e434255a1f4"}, - {file = "wrapt-1.14.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9736af4641846491aedb3c3f56b9bc5568d92b0692303b5a305301a95dfd38b1"}, - {file = "wrapt-1.14.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5b02d65b9ccf0ef6c34cba6cf5bf2aab1bb2f49c6090bafeecc9cd81ad4ea1c1"}, - {file = "wrapt-1.14.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21ac0156c4b089b330b7666db40feee30a5d52634cc4560e1905d6529a3897ff"}, - {file = "wrapt-1.14.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:9f3e6f9e05148ff90002b884fbc2a86bd303ae847e472f44ecc06c2cd2fcdb2d"}, - {file = "wrapt-1.14.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:6e743de5e9c3d1b7185870f480587b75b1cb604832e380d64f9504a0535912d1"}, - {file = "wrapt-1.14.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:d79d7d5dc8a32b7093e81e97dad755127ff77bcc899e845f41bf71747af0c569"}, - {file = "wrapt-1.14.1-cp36-cp36m-win32.whl", hash = "sha256:81b19725065dcb43df02b37e03278c011a09e49757287dca60c5aecdd5a0b8ed"}, - {file = "wrapt-1.14.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b014c23646a467558be7da3d6b9fa409b2c567d2110599b7cf9a0c5992b3b471"}, - {file = "wrapt-1.14.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:88bd7b6bd70a5b6803c1abf6bca012f7ed963e58c68d76ee20b9d751c74a3248"}, - {file = "wrapt-1.14.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b5901a312f4d14c59918c221323068fad0540e34324925c8475263841dbdfe68"}, - {file = "wrapt-1.14.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d77c85fedff92cf788face9bfa3ebaa364448ebb1d765302e9af11bf449ca36d"}, - {file = "wrapt-1.14.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d649d616e5c6a678b26d15ece345354f7c2286acd6db868e65fcc5ff7c24a77"}, - {file = "wrapt-1.14.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7d2872609603cb35ca513d7404a94d6d608fc13211563571117046c9d2bcc3d7"}, - {file = "wrapt-1.14.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:ee6acae74a2b91865910eef5e7de37dc6895ad96fa23603d1d27ea69df545015"}, - {file = "wrapt-1.14.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:2b39d38039a1fdad98c87279b48bc5dce2c0ca0d73483b12cb72aa9609278e8a"}, - {file = "wrapt-1.14.1-cp37-cp37m-win32.whl", hash = "sha256:60db23fa423575eeb65ea430cee741acb7c26a1365d103f7b0f6ec412b893853"}, - {file = "wrapt-1.14.1-cp37-cp37m-win_amd64.whl", hash = "sha256:709fe01086a55cf79d20f741f39325018f4df051ef39fe921b1ebe780a66184c"}, - {file = "wrapt-1.14.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8c0ce1e99116d5ab21355d8ebe53d9460366704ea38ae4d9f6933188f327b456"}, - {file = "wrapt-1.14.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e3fb1677c720409d5f671e39bac6c9e0e422584e5f518bfd50aa4cbbea02433f"}, - {file = "wrapt-1.14.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:642c2e7a804fcf18c222e1060df25fc210b9c58db7c91416fb055897fc27e8cc"}, - {file = "wrapt-1.14.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b7c050ae976e286906dd3f26009e117eb000fb2cf3533398c5ad9ccc86867b1"}, - {file = "wrapt-1.14.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef3f72c9666bba2bab70d2a8b79f2c6d2c1a42a7f7e2b0ec83bb2f9e383950af"}, - {file = "wrapt-1.14.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:01c205616a89d09827986bc4e859bcabd64f5a0662a7fe95e0d359424e0e071b"}, - {file = "wrapt-1.14.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:5a0f54ce2c092aaf439813735584b9537cad479575a09892b8352fea5e988dc0"}, - {file = "wrapt-1.14.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:2cf71233a0ed05ccdabe209c606fe0bac7379fdcf687f39b944420d2a09fdb57"}, - {file = "wrapt-1.14.1-cp38-cp38-win32.whl", hash = "sha256:aa31fdcc33fef9eb2552cbcbfee7773d5a6792c137b359e82879c101e98584c5"}, - {file = "wrapt-1.14.1-cp38-cp38-win_amd64.whl", hash = "sha256:d1967f46ea8f2db647c786e78d8cc7e4313dbd1b0aca360592d8027b8508e24d"}, - {file = "wrapt-1.14.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3232822c7d98d23895ccc443bbdf57c7412c5a65996c30442ebe6ed3df335383"}, - {file = "wrapt-1.14.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:988635d122aaf2bdcef9e795435662bcd65b02f4f4c1ae37fbee7401c440b3a7"}, - {file = "wrapt-1.14.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cca3c2cdadb362116235fdbd411735de4328c61425b0aa9f872fd76d02c4e86"}, - {file = "wrapt-1.14.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d52a25136894c63de15a35bc0bdc5adb4b0e173b9c0d07a2be9d3ca64a332735"}, - {file = "wrapt-1.14.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40e7bc81c9e2b2734ea4bc1aceb8a8f0ceaac7c5299bc5d69e37c44d9081d43b"}, - {file = "wrapt-1.14.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b9b7a708dd92306328117d8c4b62e2194d00c365f18eff11a9b53c6f923b01e3"}, - {file = "wrapt-1.14.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:6a9a25751acb379b466ff6be78a315e2b439d4c94c1e99cb7266d40a537995d3"}, - {file = "wrapt-1.14.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:34aa51c45f28ba7f12accd624225e2b1e5a3a45206aa191f6f9aac931d9d56fe"}, - {file = "wrapt-1.14.1-cp39-cp39-win32.whl", hash = "sha256:dee0ce50c6a2dd9056c20db781e9c1cfd33e77d2d569f5d1d9321c641bb903d5"}, - {file = "wrapt-1.14.1-cp39-cp39-win_amd64.whl", hash = "sha256:dee60e1de1898bde3b238f18340eec6148986da0455d8ba7848d50470a7a32fb"}, - {file = "wrapt-1.14.1.tar.gz", hash = "sha256:380a85cf89e0e69b7cfbe2ea9f765f004ff419f34194018a6827ac0e3edfed4d"}, +python-versions = ">=3.6" +files = [ + {file = "wrapt-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ffa565331890b90056c01db69c0fe634a776f8019c143a5ae265f9c6bc4bd6d4"}, + {file = "wrapt-1.16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e4fdb9275308292e880dcbeb12546df7f3e0f96c6b41197e0cf37d2826359020"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb2dee3874a500de01c93d5c71415fcaef1d858370d405824783e7a8ef5db440"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2a88e6010048489cda82b1326889ec075a8c856c2e6a256072b28eaee3ccf487"}, + {file = "wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac83a914ebaf589b69f7d0a1277602ff494e21f4c2f743313414378f8f50a4cf"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:73aa7d98215d39b8455f103de64391cb79dfcad601701a3aa0dddacf74911d72"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:807cc8543a477ab7422f1120a217054f958a66ef7314f76dd9e77d3f02cdccd0"}, + {file = "wrapt-1.16.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bf5703fdeb350e36885f2875d853ce13172ae281c56e509f4e6eca049bdfb136"}, + {file = "wrapt-1.16.0-cp310-cp310-win32.whl", hash = "sha256:f6b2d0c6703c988d334f297aa5df18c45e97b0af3679bb75059e0e0bd8b1069d"}, + {file = "wrapt-1.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:decbfa2f618fa8ed81c95ee18a387ff973143c656ef800c9f24fb7e9c16054e2"}, + {file = "wrapt-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1a5db485fe2de4403f13fafdc231b0dbae5eca4359232d2efc79025527375b09"}, + {file = "wrapt-1.16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:75ea7d0ee2a15733684badb16de6794894ed9c55aa5e9903260922f0482e687d"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a452f9ca3e3267cd4d0fcf2edd0d035b1934ac2bd7e0e57ac91ad6b95c0c6389"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:43aa59eadec7890d9958748db829df269f0368521ba6dc68cc172d5d03ed8060"}, + {file = "wrapt-1.16.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72554a23c78a8e7aa02abbd699d129eead8b147a23c56e08d08dfc29cfdddca1"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d2efee35b4b0a347e0d99d28e884dfd82797852d62fcd7ebdeee26f3ceb72cf3"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6dcfcffe73710be01d90cae08c3e548d90932d37b39ef83969ae135d36ef3956"}, + {file = "wrapt-1.16.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:eb6e651000a19c96f452c85132811d25e9264d836951022d6e81df2fff38337d"}, + {file = "wrapt-1.16.0-cp311-cp311-win32.whl", hash = "sha256:66027d667efe95cc4fa945af59f92c5a02c6f5bb6012bff9e60542c74c75c362"}, + {file = "wrapt-1.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:aefbc4cb0a54f91af643660a0a150ce2c090d3652cf4052a5397fb2de549cd89"}, + {file = "wrapt-1.16.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:5eb404d89131ec9b4f748fa5cfb5346802e5ee8836f57d516576e61f304f3b7b"}, + {file = "wrapt-1.16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9090c9e676d5236a6948330e83cb89969f433b1943a558968f659ead07cb3b36"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:94265b00870aa407bd0cbcfd536f17ecde43b94fb8d228560a1e9d3041462d73"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f2058f813d4f2b5e3a9eb2eb3faf8f1d99b81c3e51aeda4b168406443e8ba809"}, + {file = "wrapt-1.16.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98b5e1f498a8ca1858a1cdbffb023bfd954da4e3fa2c0cb5853d40014557248b"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:14d7dc606219cdd7405133c713f2c218d4252f2a469003f8c46bb92d5d095d81"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:49aac49dc4782cb04f58986e81ea0b4768e4ff197b57324dcbd7699c5dfb40b9"}, + {file = "wrapt-1.16.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:418abb18146475c310d7a6dc71143d6f7adec5b004ac9ce08dc7a34e2babdc5c"}, + {file = "wrapt-1.16.0-cp312-cp312-win32.whl", hash = "sha256:685f568fa5e627e93f3b52fda002c7ed2fa1800b50ce51f6ed1d572d8ab3e7fc"}, + {file = "wrapt-1.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:dcdba5c86e368442528f7060039eda390cc4091bfd1dca41e8046af7c910dda8"}, + {file = "wrapt-1.16.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d462f28826f4657968ae51d2181a074dfe03c200d6131690b7d65d55b0f360f8"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a33a747400b94b6d6b8a165e4480264a64a78c8a4c734b62136062e9a248dd39"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3646eefa23daeba62643a58aac816945cadc0afaf21800a1421eeba5f6cfb9c"}, + {file = "wrapt-1.16.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ebf019be5c09d400cf7b024aa52b1f3aeebeff51550d007e92c3c1c4afc2a40"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:1acd723ee2a8826f3d53910255643e33673e1d11db84ce5880675954183ec47e"}, + {file = "wrapt-1.16.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:bc57efac2da352a51cc4658878a68d2b1b67dbe9d33c36cb826ca449d80a8465"}, + {file = "wrapt-1.16.0-cp36-cp36m-win32.whl", hash = "sha256:da4813f751142436b075ed7aa012a8778aa43a99f7b36afe9b742d3ed8bdc95e"}, + {file = "wrapt-1.16.0-cp36-cp36m-win_amd64.whl", hash = "sha256:6f6eac2360f2d543cc875a0e5efd413b6cbd483cb3ad7ebf888884a6e0d2e966"}, + {file = "wrapt-1.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a0ea261ce52b5952bf669684a251a66df239ec6d441ccb59ec7afa882265d593"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bd2d7ff69a2cac767fbf7a2b206add2e9a210e57947dd7ce03e25d03d2de292"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9159485323798c8dc530a224bd3ffcf76659319ccc7bbd52e01e73bd0241a0c5"}, + {file = "wrapt-1.16.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a86373cf37cd7764f2201b76496aba58a52e76dedfaa698ef9e9688bfd9e41cf"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:73870c364c11f03ed072dda68ff7aea6d2a3a5c3fe250d917a429c7432e15228"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:b935ae30c6e7400022b50f8d359c03ed233d45b725cfdd299462f41ee5ffba6f"}, + {file = "wrapt-1.16.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:db98ad84a55eb09b3c32a96c576476777e87c520a34e2519d3e59c44710c002c"}, + {file = "wrapt-1.16.0-cp37-cp37m-win32.whl", hash = "sha256:9153ed35fc5e4fa3b2fe97bddaa7cbec0ed22412b85bcdaf54aeba92ea37428c"}, + {file = "wrapt-1.16.0-cp37-cp37m-win_amd64.whl", hash = "sha256:66dfbaa7cfa3eb707bbfcd46dab2bc6207b005cbc9caa2199bcbc81d95071a00"}, + {file = "wrapt-1.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1dd50a2696ff89f57bd8847647a1c363b687d3d796dc30d4dd4a9d1689a706f0"}, + {file = "wrapt-1.16.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:44a2754372e32ab315734c6c73b24351d06e77ffff6ae27d2ecf14cf3d229202"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e9723528b9f787dc59168369e42ae1c3b0d3fadb2f1a71de14531d321ee05b0"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dbed418ba5c3dce92619656802cc5355cb679e58d0d89b50f116e4a9d5a9603e"}, + {file = "wrapt-1.16.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:941988b89b4fd6b41c3f0bfb20e92bd23746579736b7343283297c4c8cbae68f"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6a42cd0cfa8ffc1915aef79cb4284f6383d8a3e9dcca70c445dcfdd639d51267"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:1ca9b6085e4f866bd584fb135a041bfc32cab916e69f714a7d1d397f8c4891ca"}, + {file = "wrapt-1.16.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d5e49454f19ef621089e204f862388d29e6e8d8b162efce05208913dde5b9ad6"}, + {file = "wrapt-1.16.0-cp38-cp38-win32.whl", hash = "sha256:c31f72b1b6624c9d863fc095da460802f43a7c6868c5dda140f51da24fd47d7b"}, + {file = "wrapt-1.16.0-cp38-cp38-win_amd64.whl", hash = "sha256:490b0ee15c1a55be9c1bd8609b8cecd60e325f0575fc98f50058eae366e01f41"}, + {file = "wrapt-1.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9b201ae332c3637a42f02d1045e1d0cccfdc41f1f2f801dafbaa7e9b4797bfc2"}, + {file = "wrapt-1.16.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2076fad65c6736184e77d7d4729b63a6d1ae0b70da4868adeec40989858eb3fb"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5cd603b575ebceca7da5a3a251e69561bec509e0b46e4993e1cac402b7247b8"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b47cfad9e9bbbed2339081f4e346c93ecd7ab504299403320bf85f7f85c7d46c"}, + {file = "wrapt-1.16.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8212564d49c50eb4565e502814f694e240c55551a5f1bc841d4fcaabb0a9b8a"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:5f15814a33e42b04e3de432e573aa557f9f0f56458745c2074952f564c50e664"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:db2e408d983b0e61e238cf579c09ef7020560441906ca990fe8412153e3b291f"}, + {file = "wrapt-1.16.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:edfad1d29c73f9b863ebe7082ae9321374ccb10879eeabc84ba3b69f2579d537"}, + {file = "wrapt-1.16.0-cp39-cp39-win32.whl", hash = "sha256:ed867c42c268f876097248e05b6117a65bcd1e63b779e916fe2e33cd6fd0d3c3"}, + {file = "wrapt-1.16.0-cp39-cp39-win_amd64.whl", hash = "sha256:eb1b046be06b0fce7249f1d025cd359b4b80fc1c3e24ad9eca33e0dcdb2e4a35"}, + {file = "wrapt-1.16.0-py3-none-any.whl", hash = "sha256:6906c4100a8fcbf2fa735f6059214bb13b97f75b1a61777fcf6432121ef12ef1"}, + {file = "wrapt-1.16.0.tar.gz", hash = "sha256:5f370f952971e7d17c7d1ead40e49f32345a7f7a5373571ef44d800d06b1899d"}, ] [metadata] From 78afb12997ddeaf8a8c80e2643bee3828b7cc2b9 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 09:00:34 +0100 Subject: [PATCH 050/144] Use ExtractIDFragment function --- src/preparedatafunctor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/preparedatafunctor.cpp b/src/preparedatafunctor.cpp index e33f0daa2fd..bf6a106a6e3 100644 --- a/src/preparedatafunctor.cpp +++ b/src/preparedatafunctor.cpp @@ -380,8 +380,7 @@ FunctorCode PrepareFacsimileFunctor::VisitObject(Object *object) FacsimileInterface *interface = object->GetFacsimileInterface(); assert(interface); if (interface->HasFacs()) { - std::string facsID = ((interface->GetFacs().compare(0, 1, "#") == 0) ? interface->GetFacs().substr(1) - : interface->GetFacs()); + std::string facsID = ExtractIDFragment(interface->GetFacs()); Zone *zone = m_facsimile->FindZoneByID(facsID); if (zone != NULL) { interface->AttachZone(zone); From d449c0a96c6d0529d73d287a4cae1cb7b52f9431 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 16 May 2023 14:23:47 -0400 Subject: [PATCH 051/144] pass neon path as command line argument --- emscripten/testNeon.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 emscripten/testNeon.sh diff --git a/emscripten/testNeon.sh b/emscripten/testNeon.sh new file mode 100644 index 00000000000..0158466bf4a --- /dev/null +++ b/emscripten/testNeon.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# This is a little script that compiles verovio using buildToolkit +# and moves the output, verovio.js, into Neon/verovio-util. +# It then starts up a local instance of Neon using yarn so the +# developer can see the changes as soon as possible. +# Please change [location_of_your_Neon] with the actual path. +# For example: ~/Desktop/DDMAL + + +# Builds verovio for Neon +./buildToolkit -x "Gootville,Petaluma" -DHPX + +cd build + +# Moves the needed verovio.js into Neon +cp verovio.js verovio_new.js + +mv verovio_new.js /Users/yinanzhou/SIMSSA/Neon/verovio-util + +cd /Users/yinanzhou/SIMSSA/Neon/verovio-util + +rm verovio.js; mv verovio_new.js verovio.js + +# Runs Neon +yarn build && yarn start \ No newline at end of file From 9f8ef22d9fc68a74a95d6de1ea1973c40be4bbfb Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Wed, 5 Jul 2023 16:30:52 -0400 Subject: [PATCH 052/144] Remove testNeon.sh from git --- emscripten/testNeon.sh | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 emscripten/testNeon.sh diff --git a/emscripten/testNeon.sh b/emscripten/testNeon.sh deleted file mode 100644 index 0158466bf4a..00000000000 --- a/emscripten/testNeon.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# This is a little script that compiles verovio using buildToolkit -# and moves the output, verovio.js, into Neon/verovio-util. -# It then starts up a local instance of Neon using yarn so the -# developer can see the changes as soon as possible. -# Please change [location_of_your_Neon] with the actual path. -# For example: ~/Desktop/DDMAL - - -# Builds verovio for Neon -./buildToolkit -x "Gootville,Petaluma" -DHPX - -cd build - -# Moves the needed verovio.js into Neon -cp verovio.js verovio_new.js - -mv verovio_new.js /Users/yinanzhou/SIMSSA/Neon/verovio-util - -cd /Users/yinanzhou/SIMSSA/Neon/verovio-util - -rm verovio.js; mv verovio_new.js verovio.js - -# Runs Neon -yarn build && yarn start \ No newline at end of file From e6bc31854e78fff0d8fd126fc97181bb743bab32 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 10 Jul 2023 11:49:20 -0400 Subject: [PATCH 053/144] MatchHeight editor action for bbox --- include/vrv/editortoolkit_neume.h | 2 + src/editortoolkit_neume.cpp | 80 +++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/include/vrv/editortoolkit_neume.h b/include/vrv/editortoolkit_neume.h index dfeb65043e5..a31242d2970 100644 --- a/include/vrv/editortoolkit_neume.h +++ b/include/vrv/editortoolkit_neume.h @@ -44,6 +44,7 @@ class EditorToolkitNeume : public EditorToolkit { bool Insert(std::string elementType, std::string staffId, int ulx, int uly, int lrx, int lry, std::vector> attributes); bool InsertToSyllable(std::string elementId); + bool MatchHeight(std::string elementId); bool Merge(std::vector elementIds); bool MoveOutsideSyllable(std::string elementId); bool Set(std::string elementId, std::string attrType, std::string attrValue); @@ -72,6 +73,7 @@ class EditorToolkitNeume : public EditorToolkit { bool ParseInsertAction(jsonxx::Object param, std::string *elementType, std::string *staffId, int *ulx, int *uly, int *lrx, int *lry, std::vector> *attributes); bool ParseInsertToSyllableAction(jsonxx::Object param, std::string *elementId); + bool ParseMatchHeightAction(jsonxx::Object param, std::string *elementId); bool ParseMergeAction(jsonxx::Object param, std::vector *elementIds); bool ParseMoveOutsideSyllableAction(jsonxx::Object param, std::string *elementId); bool ParseSetAction(jsonxx::Object param, std::string *elementId, std::string *attrType, std::string *attrValue); diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index e355c23fd64..880c7b4454c 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -184,6 +184,13 @@ bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) return this->SplitNeume(elementId, ncId); } } + else if (action == "matchHeight") { + std::string elementId; + if (this->ParseMatchHeightAction(json.get("param"), &elementId)) { + return this->MatchHeight(elementId); + } + LogWarning("Could not parse the insert action"); + } else if (action == "merge") { std::vector elementIds; if (this->ParseMergeAction(json.get("param"), &elementIds)) { @@ -1595,6 +1602,72 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d return true; } +bool EditorToolkitNeume::MatchHeight(std::string elementId) +{ + if (!m_doc->GetDrawingPage()) { + LogError("Could not get drawing page"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "Could not get drawing page."); + return false; + } + if (m_doc->GetType() != Facs) { + LogError("Drawing page without facsimile"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + return false; + } + + Object *element = m_doc->GetDrawingPage()->FindDescendantByID(elementId); + assert(element); + Object *staffParent = element->GetFirstAncestor(STAFF); + if (element == NULL) { + LogError("No element exists with ID '%s'.", elementId.c_str()); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "No element exists with ID" + elementId + "."); + return false; + } + if (!element->Is(SYL)) { + LogError("Element is of type %s, but only element can match height.", element->GetClassName().c_str()); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import( + "message", "Element is of type " + element->GetClassName() + ", but only element can match height."); + return false; + } + + // get the position of the selected bbox + int uly; + int lry; + if (dynamic_cast(element)->HasFacs()) { + uly = element->GetFacsimileInterface()->GetZone()->GetUly(); + lry = element->GetFacsimileInterface()->GetZone()->GetLry(); + } + else { + LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); + return false; + } + + // find all syls in staff + ListOfObjects syls; + ClassIdComparison ac(SYL); + staffParent->FindAllDescendantsByComparison(&syls, &ac); + Syl *syl; + Zone *zone; + + for (auto it = syls.begin(); it != syls.end(); ++it) { + syl = dynamic_cast(*it); + zone = syl->GetFacsimileInterface()->GetZone(); + assert(zone); + zone->SetUly(uly); + zone->SetLry(lry); + } + + m_infoObject.import("status", "OK"); + m_infoObject.import("message", ""); + return true; +} + bool EditorToolkitNeume::Merge(std::vector elementIds) { if (!m_doc->GetDrawingPage()) return false; @@ -3776,6 +3849,13 @@ bool EditorToolkitNeume::ParseDisplaceClefAction(jsonxx::Object param, std::stri return true; } +bool EditorToolkitNeume::ParseMatchHeightAction(jsonxx::Object param, std::string *elementId) +{ + if (!param.has("elementId")) return false; + (*elementId) = param.get("elementId"); + return true; +} + bool EditorToolkitNeume::ParseMergeAction(jsonxx::Object param, std::vector *elementIds) { if (!param.has("elementIds")) return false; From f41a0a0f88707da27de4e2e9f5406b97d0af89db Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Wed, 12 Jul 2023 17:25:17 -0400 Subject: [PATCH 054/144] Add overlap correction on x-axis --- src/editortoolkit_neume.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 880c7b4454c..b0692ef2e3a 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1654,11 +1654,25 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) staffParent->FindAllDescendantsByComparison(&syls, &ac); Syl *syl; Zone *zone; + int rightMost = -1; + int itUlx; + int itLrx; for (auto it = syls.begin(); it != syls.end(); ++it) { syl = dynamic_cast(*it); zone = syl->GetFacsimileInterface()->GetZone(); assert(zone); + + // adjust x-axis first + itUlx = zone->GetUlx(); + itLrx = zone->GetLrx(); + if (itLrx > rightMost) { + // correct overlap + if (itUlx < rightMost) zone->SetUlx(rightMost); + // Update right most point if needed + rightMost = itLrx; + } + zone->SetUly(uly); zone->SetLry(lry); } From 23057412c0e701b1572f6fa7d5b1851ea823add0 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 13 Jul 2023 15:14:05 -0400 Subject: [PATCH 055/144] Add staff rotation offset --- src/editortoolkit_neume.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index b0692ef2e3a..7df8954643e 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1635,11 +1635,15 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) } // get the position of the selected bbox + int ulx; int uly; - int lry; + int height; + int lrx; if (dynamic_cast(element)->HasFacs()) { + ulx = element->GetFacsimileInterface()->GetZone()->GetUlx(); uly = element->GetFacsimileInterface()->GetZone()->GetUly(); - lry = element->GetFacsimileInterface()->GetZone()->GetLry(); + lrx = element->GetFacsimileInterface()->GetZone()->GetLrx(); + height = element->GetFacsimileInterface()->GetZone()->GetLry() - uly; } else { LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); @@ -1654,9 +1658,11 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) staffParent->FindAllDescendantsByComparison(&syls, &ac); Syl *syl; Zone *zone; - int rightMost = -1; int itUlx; int itLrx; + int offsetY; + int rightMost = -1; + double theta = staffParent->GetFacsimileInterface()->GetZone()->GetRotate(); for (auto it = syls.begin(); it != syls.end(); ++it) { syl = dynamic_cast(*it); @@ -1673,8 +1679,14 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) rightMost = itLrx; } - zone->SetUly(uly); - zone->SetLry(lry); + offsetY = 0; + if (theta) { + double factor = 1.3; + offsetY = (int)((itUlx - ulx) * tan(theta * M_PI / 180.0) / factor); + } + + zone->SetUly(uly + offsetY); + zone->SetLry(uly + offsetY + height); } m_infoObject.import("status", "OK"); From 187d98256fa5bfeb532ff5e7701f48a32cd316fb Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 13 Jul 2023 16:50:21 -0400 Subject: [PATCH 056/144] Adjust original bbox size for ungrouping --- src/editortoolkit_neume.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 7df8954643e..3747bcba517 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2987,6 +2987,10 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // if the element is a syl then we want to keep it attached to the first node if (el->Is(SYL)) { + Zone *zone = dynamic_cast(el->GetFacsimileInterface()->GetZone()); + + zone->SetLrx(zone->GetUlx() + 100); + zone->SetLry(zone->GetUly() + 200); continue; } From 81fd49f34631a8477e15024527203a7e9997957e Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 14 Jul 2023 15:20:47 -0400 Subject: [PATCH 057/144] Fix ungroup when syllable start with layer element --- src/editortoolkit_neume.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 3747bcba517..3979269ad3d 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2931,8 +2931,10 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector sparent->ReorderByXPos(); fparent->ClearRelinquishedChildren(); fparent->ReorderByXPos(); + uuidArray << (*it); + it = elementIds.erase(it); + el = m_doc->GetDrawingPage()->FindDescendantByID(*it); } - continue; } if (elementIds.begin() == it || firstIsSyl) { // if the element is a syl we want it to stay attached to the first element From dea073b10e8209e762547bfdafb3c0375198b065 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 14 Jul 2023 16:12:22 -0400 Subject: [PATCH 058/144] Clean up comments --- src/editortoolkit_neume.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 3979269ad3d..ec0430a7b29 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2996,12 +2996,6 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector continue; } - // if (el->Is(DIVLINE) || el->Is(ACCID)) { - // el->MoveItselfTo(sparent); - // fparent->ClearRelinquishedChildren(); - // continue; - // } - if (groupType == "nc") { Nc *nc = dynamic_cast(el); assert(nc); @@ -3095,15 +3089,11 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector FacsimileInterface *fi = syl->GetFacsimileInterface(); assert(fi); fi->AttachZone(zone); - - // syl->ResetFacsimile(); - // syl->SetFacs(zone->GetID()); } } if (ligNum != 1) { // if not 1st nc in ligature, add child - uuidArray << newParent->GetID(); sparent->AddChild(newParent); From 89321b8033222ddac0e4cf059bf6dfbad50f0499 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 24 Jul 2023 16:22:34 -0400 Subject: [PATCH 059/144] Refactor ungroup bbox --- src/editortoolkit_neume.cpp | 67 +++++++++---------------------------- 1 file changed, 15 insertions(+), 52 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index ec0430a7b29..c0f63cfee33 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2844,6 +2844,7 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector int ligNum = 0; // for ligature in ungroupNcs int firstIsLig = false; bool firstIsSyl = false; + Zone *oldSylZone = NULL; Clef *oldClef = NULL; ClassIdComparison ac(CLEF); ListOfObjects syllables; // List of syllables used. groupType=neume only. @@ -2976,6 +2977,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector if (oldClef == NULL) { oldClef = dynamic_cast(sparent)->GetCurrentClef(); } + + // Get orginal syl zone + oldSylZone = dynamic_cast(currentParent->GetFirst(SYL)->GetFacsimileInterface()->GetZone()); } else { @@ -2989,10 +2993,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // if the element is a syl then we want to keep it attached to the first node if (el->Is(SYL)) { - Zone *zone = dynamic_cast(el->GetFacsimileInterface()->GetZone()); - - zone->SetLrx(zone->GetUlx() + 100); - zone->SetLry(zone->GetUly() + 200); + if (oldSylZone) { + oldSylZone->SetLrx(oldSylZone->GetUlx() + 100); + } continue; } @@ -3034,55 +3037,15 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector if (m_doc->GetType() == Facs) { Zone *zone = new Zone(); - // Use syllable parent positions if possible - FacsimileInterface *syllableFi = NULL; - if (syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface()->HasFacs()) { - syllableFi = syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface(); - Zone *tempZone = dynamic_cast(syllableFi->GetZone()); - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - // otherwise get a boundingbox that comprises all the neumes in the syllable - else { - ListOfObjects children; - InterfaceComparison comp(INTERFACE_FACSIMILE); - syl->GetFirstAncestor(SYLLABLE)->FindAllDescendantsByComparison(&children, &comp); - for (auto iter2 = children.begin(); iter2 != children.end(); ++iter2) { - FacsimileInterface *temp = (*iter2)->GetFacsimileInterface(); - assert(temp); - Zone *tempZone = vrv_cast(temp->GetZone()); - assert(tempZone); - if (temp->HasFacs()) { - if (syllableFi == NULL) { - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - else { - if (tempZone->GetUlx() < zone->GetUlx()) { - zone->SetUlx(tempZone->GetUlx()); - } - if (tempZone->GetUly() < zone->GetUly()) { - zone->SetUly(tempZone->GetUly()); - } - if (tempZone->GetLrx() > zone->GetLrx()) { - zone->SetLrx(tempZone->GetLrx()); - } - if (tempZone->GetLry() > zone->GetLry()) { - zone->SetLry(tempZone->GetLry()); - } - } - } - } - } + zone->SetUlx(el->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); + zone->SetUly(oldSylZone->GetUly()); + zone->SetLrx(el->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); + zone->SetLry(oldSylZone->GetLry()); - // make the bounding box a little bigger and lower so it's easier to edit - zone->SetUly(zone->GetUly() + 100); - zone->SetLrx(zone->GetLrx() + 100); - zone->SetLry(zone->GetLry() + 200); + // Make bbox larger if it has less than 2 ncs + if (newParent->GetChildCount(NC, 2) <= 2) { + zone->SetLrx(zone->GetLrx() + 50); + } assert(m_doc->GetFacsimile()); m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone); From 9cb464b86377993d3c7a4304af6c949d7b1fd63b Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 24 Jul 2023 16:23:34 -0400 Subject: [PATCH 060/144] Clean up --- src/editortoolkit_neume.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index c0f63cfee33..a08fb58f098 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2949,7 +2949,6 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector Nc *nc = dynamic_cast(el); assert(nc); if (nc->HasLigated() && nc->GetLigated() == BOOLEAN_true) { - // ligNum++; firstIsLig = true; } @@ -3002,7 +3001,6 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector if (groupType == "nc") { Nc *nc = dynamic_cast(el); assert(nc); - // if (nc->HasLigated()) continue; if (firstIsLig) { // if 1st is ligature, neglect 2nd, go to the next nc From b302f3e76f9356a9cafe9160b83c0c53c0aa9c3e Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 25 Jul 2023 11:30:52 -0400 Subject: [PATCH 061/144] Remove x-axis adjustment --- src/editortoolkit_neume.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index a08fb58f098..30e4e7b5794 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1659,9 +1659,9 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) Syl *syl; Zone *zone; int itUlx; - int itLrx; + // int itLrx; int offsetY; - int rightMost = -1; + // int rightMost = -1; double theta = staffParent->GetFacsimileInterface()->GetZone()->GetRotate(); for (auto it = syls.begin(); it != syls.end(); ++it) { @@ -1669,17 +1669,18 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) zone = syl->GetFacsimileInterface()->GetZone(); assert(zone); - // adjust x-axis first - itUlx = zone->GetUlx(); - itLrx = zone->GetLrx(); - if (itLrx > rightMost) { - // correct overlap - if (itUlx < rightMost) zone->SetUlx(rightMost); - // Update right most point if needed - rightMost = itLrx; - } + // // adjust x-axis first + // itUlx = zone->GetUlx(); + // itLrx = zone->GetLrx(); + // if (itLrx > rightMost) { + // // correct overlap + // if (itUlx < rightMost) zone->SetUlx(rightMost); + // // Update right most point if needed + // rightMost = itLrx; + // } offsetY = 0; + itUlx = zone->GetUlx(); if (theta) { double factor = 1.3; offsetY = (int)((itUlx - ulx) * tan(theta * M_PI / 180.0) / factor); From 92fe5f6d70e5e64da3b3997339683dc36636ba06 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 27 Jul 2023 16:57:47 -0400 Subject: [PATCH 062/144] Fix ungroup when firstIsSyl --- src/editortoolkit_neume.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 30e4e7b5794..9188864f0bb 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2943,6 +2943,10 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // we'll still need to initialize all the parents, thus the bool if (el->Is(SYL)) { firstIsSyl = true; + oldSylZone = dynamic_cast(el->GetFacsimileInterface()->GetZone()); + if (oldSylZone) { + oldSylZone->SetLrx(oldSylZone->GetUlx() + 100); + } continue; } else if (groupType == "nc") { @@ -2979,7 +2983,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector } // Get orginal syl zone - oldSylZone = dynamic_cast(currentParent->GetFirst(SYL)->GetFacsimileInterface()->GetZone()); + if (!oldSylZone) { + oldSylZone = dynamic_cast(currentParent->GetFirst(SYL)->GetFacsimileInterface()->GetZone()); + } } else { From a0e3dcdf9c649c7dcceb8a3f8df224d41603e418 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 28 Jul 2023 17:17:43 -0400 Subject: [PATCH 063/144] Remove redundant new syl for insert action --- src/editortoolkit_neume.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 9188864f0bb..abef4f7c69f 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -875,8 +875,6 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in if (m_doc->GetType() == Facs) { FacsimileInterface *fi = vrv_cast(syl->GetFacsimileInterface()); assert(fi); - Text *text = new Text(); - syl->AddChild(text); Zone *sylZone = new Zone(); // calculate bboxUlx and bboxUly wrt rotation using sine rule From 0b26cc73174a1204280ff2fc877d8d42646d4dca Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:46:13 -0400 Subject: [PATCH 064/144] Remove unnecessary doubleParent check --- src/editortoolkit_neume.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index abef4f7c69f..9bf1655b406 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2647,16 +2647,14 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e // also in this case we need to make sure that the facsimile of the resulting syl is correct else { if (elementClass == NC) { - if (doubleParent) { - parent = new Neume(); - for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { - (*it)->MoveItselfTo(parent); - parent->ReorderByXPos(); - } + parent = new Neume(); + for (auto it = elements.begin(); it != elements.end(); ++it) { + if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); + parent->ReorderByXPos(); } - doubleParent->AddChild(parent); } + doubleParent->AddChild(parent); Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); if (!layer) { From 682d11d91a259010d35b81ee7e553d40fd80f0a8 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:50:29 -0400 Subject: [PATCH 065/144] Rename doubleParent to secondParent --- src/editortoolkit_neume.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 9bf1655b406..057d536f5ae 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2313,7 +2313,7 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx bool EditorToolkitNeume::Group(std::string groupType, std::vector elementIds) { - Object *parent = NULL, *doubleParent = NULL; + Object *parent = NULL, *secondParent = NULL; std::map parents; std::set elements; std::vector sortedElements; @@ -2440,9 +2440,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (doubleParent == NULL) { - doubleParent = par->GetParent(); - if (doubleParent == NULL) { + if (secondParent == NULL) { + secondParent = par->GetParent(); + if (secondParent == NULL) { LogError("No second level parent!"); m_infoObject.import("status", "FAILURE"); m_infoObject.import("message", "No second level parent."); @@ -2450,7 +2450,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } else { - if (par->GetParent() != doubleParent) { + if (par->GetParent() != secondParent) { LogError("No shared second level parent!"); m_infoObject.import("status", "FAILURE"); m_infoObject.import("message", "No shared second level parent."); @@ -2619,10 +2619,10 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } parent->ReorderByXPos(); - if (doubleParent == NULL) { + if (secondParent == NULL) { return false; } - doubleParent->AddChild(parent); + secondParent->AddChild(parent); Layer *layer = vrv_cast(parent->GetFirstAncestor(LAYER)); assert(layer); @@ -2654,7 +2654,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e parent->ReorderByXPos(); } } - doubleParent->AddChild(parent); + secondParent->AddChild(parent); Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); if (!layer) { @@ -2732,11 +2732,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (doubleParent == NULL) { + if (secondParent == NULL) { LogError("No second level parent!"); return false; } - doubleParent->AddChild(fullSyllable); + secondParent->AddChild(fullSyllable); Layer *layer = vrv_cast(fullSyllable->GetFirstAncestor(LAYER)); assert(layer); if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { @@ -2778,11 +2778,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *obj = (*it).first; obj->ClearRelinquishedChildren(); if (obj->GetChildCount() == 0) { - if (doubleParent == NULL) { + if (secondParent == NULL) { LogError("No second level parent!"); return false; } - doubleParent->DeleteChild(obj); + secondParent->DeleteChild(obj); } else if (obj->GetChildCount() == (obj->GetChildCount(SYL) + obj->GetChildCount(DIVLINE) + obj->GetChildCount(ACCID) @@ -2806,11 +2806,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } - if (doubleParent == NULL) { + if (secondParent == NULL) { LogError("No second level parent!"); return false; } - doubleParent->DeleteChild(obj); + secondParent->DeleteChild(obj); } } From 6d29f65d6f501249002aaea1981e33a08f012d4b Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:57:04 -0400 Subject: [PATCH 066/144] Optimize parents counting --- src/editortoolkit_neume.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 057d536f5ae..db13d027509 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2457,13 +2457,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } } - auto possibleEntry = parents.find(el->GetParent()); - if (possibleEntry == parents.end()) { - parents.emplace(el->GetParent(), 1); - } - else { - possibleEntry->second += 1; - } + parents[par]++; elements.insert(el); } From ee769848d8bd7adfb7a8312949d2f7d369dbe6ce Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 16:59:10 -0400 Subject: [PATCH 067/144] Clean up --- src/editortoolkit_neume.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index db13d027509..695156fd75e 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2474,16 +2474,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } - // auto it = elementIds.begin(); - // Object *el = m_doc->GetDrawingPage()->FindDescendantByID(*it); - // Layer *layer = dynamic_cast(el->GetFirstAncestor(LAYER)); - // if (!layer) { - // LogError("Elements does not have Layer parent. This should not happen."); - // m_infoObject.import("status", "FAILURE"); - // m_infoObject.import("message", "Elements does not have Layer parent."); - // return false; - // } - std::copy(elements.begin(), elements.end(), std::back_inserter(sortedElements)); std::stable_sort(sortedElements.begin(), sortedElements.end(), Object::sortByUlx); From affe5b4d1d187a8ccecac8c6959b64eafe258ef1 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Sun, 30 Jul 2023 17:18:21 -0400 Subject: [PATCH 068/144] Remove unnecessary conversion --- src/editortoolkit_neume.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 695156fd75e..df5d45d534e 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2315,8 +2315,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e { Object *parent = NULL, *secondParent = NULL; std::map parents; - std::set elements; - std::vector sortedElements; + ListOfObjects elements; std::vector fullParents; std::map clefsBefore; @@ -2458,7 +2457,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } parents[par]++; - elements.insert(el); + elements.push_back(el); } if (parents.size() == 0) { @@ -2474,34 +2473,29 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } - std::copy(elements.begin(), elements.end(), std::back_inserter(sortedElements)); - std::stable_sort(sortedElements.begin(), sortedElements.end(), Object::sortByUlx); - ListOfObjects clefs; - std::set syllables; - ListOfObjects sortedSyllables; + ListOfObjects syllables; ClassIdComparison clefComp(CLEF); InterfaceComparison pitchComp(INTERFACE_PITCH); Clef *newClef = NULL; - m_doc->GetDrawingPage()->FindAllDescendantsBetween(&clefs, &clefComp, - sortedElements.front()->GetFirstAncestor(SYLLABLE), sortedElements.back()->GetFirstAncestor(SYLLABLE)); + m_doc->GetDrawingPage()->FindAllDescendantsBetween( + &clefs, &clefComp, elements.front()->GetFirstAncestor(SYLLABLE), elements.back()->GetFirstAncestor(SYLLABLE)); // if there are clefs between the elements getting grouped // some elements will need their pitch adjusted for the new clef // clefsBefore maps the syllable parent to its clef before the group // so we can reassociate any pitched children from their old clef to the new one if (clefs.size() != 0) { - for (auto it = sortedElements.begin(); it != sortedElements.end(); ++it) { + for (auto it = elements.begin(); it != elements.end(); ++it) { if ((*it)->Is(SYLLABLE)) { - syllables.insert(dynamic_cast(*it)); + syllables.push_back(dynamic_cast(*it)); } else { - syllables.insert((*it)->GetFirstAncestor(SYLLABLE)); + syllables.push_back((*it)->GetFirstAncestor(SYLLABLE)); } } - std::copy(syllables.begin(), syllables.end(), std::back_inserter(sortedSyllables)); - for (auto it = sortedSyllables.begin(); it != sortedSyllables.end(); ++it) { + for (auto it = syllables.begin(); it != syllables.end(); ++it) { Clef *tempClef = dynamic_cast(m_doc->GetDrawingPage()->FindPreviousChild(&clefComp, (*it))); if (tempClef == NULL) { Layer *layer = vrv_cast((*it)->GetFirstAncestor(LAYER)); @@ -2509,7 +2503,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } clefsBefore.insert(std::pair(dynamic_cast(*it), tempClef)); } - newClef = clefsBefore[dynamic_cast(sortedSyllables.front())]; + newClef = clefsBefore[dynamic_cast(syllables.front())]; } // find parents where all of their children are being grouped @@ -2745,8 +2739,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e // change the pitch of any pitched elements whose clef may have changed assert(newClef); ListOfObjects pitchedChildren; - if (sortedSyllables.size()) { - for (auto it = sortedSyllables.begin(); it != sortedSyllables.end(); ++it) { + if (syllables.size()) { + for (auto it = syllables.begin(); it != syllables.end(); ++it) { Syllable *syllable = dynamic_cast(*it); if (clefsBefore[syllable] != newClef) { syllable->FindAllDescendantsByComparison(&pitchedChildren, &pitchComp); From 88a7b37405dd8a5a01acdf84ba73d8c1bdc35683 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 11:28:45 -0400 Subject: [PATCH 069/144] Move second level parent check --- src/editortoolkit_neume.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index df5d45d534e..6ea4fb0bda8 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2439,23 +2439,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (secondParent == NULL) { - secondParent = par->GetParent(); - if (secondParent == NULL) { - LogError("No second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No second level parent."); - return false; - } - } - else { - if (par->GetParent() != secondParent) { - LogError("No shared second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No shared second level parent."); - return false; - } - } parents[par]++; elements.push_back(el); } @@ -2506,11 +2489,25 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e newClef = clefsBefore[dynamic_cast(syllables.front())]; } + // check if share second level parent + secondParent = (*parents.begin()).first->GetParent(); + if (secondParent == NULL) { + LogError("No second level parent!"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "No second level parent."); + return false; + } // find parents where all of their children are being grouped for (auto it = parents.begin(); it != parents.end(); ++it) { auto parentPair = *it; Object *par = parentPair.first; int expected; + if (par->GetParent() != secondParent) { + LogError("No shared second level parent!"); + m_infoObject.import("status", "FAILURE"); + m_infoObject.import("message", "No shared second level parent."); + return false; + } if (par->GetClassId() == SYLLABLE) { expected = par->GetChildCount(NEUME); } From 3c91687ea8a32945e2d59fe240e24686a949c0e5 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 11:29:17 -0400 Subject: [PATCH 070/144] Clean up --- src/editortoolkit_neume.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 6ea4fb0bda8..1bbc257c66c 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2587,9 +2587,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e FacsimileInterface *fi = vrv_cast((*syl).GetFacsimileInterface()); assert(fi); fi->AttachZone(zone); - - // syl->ResetFacsimile(); - // syl->SetFacs(zone->GetID()); } } From 8cc6061ae3bbeae18476b70b19567744f430769b Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 11:30:22 -0400 Subject: [PATCH 071/144] Remove unnecessary second level parent check --- src/editortoolkit_neume.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 1bbc257c66c..3ca84d14d52 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2591,9 +2591,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } parent->ReorderByXPos(); - if (secondParent == NULL) { - return false; - } secondParent->AddChild(parent); Layer *layer = vrv_cast(parent->GetFirstAncestor(LAYER)); From 08c4dcf939e08bb714bc3a7e7a52008b5d3d001a Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 13:14:45 -0400 Subject: [PATCH 072/144] Simplify syl zone calculation --- src/editortoolkit_neume.cpp | 57 +++++++++++++------------------------ 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 3ca84d14d52..b93f1ba1579 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2518,6 +2518,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e fullParents.push_back(parentPair.first); } } + // if there are no full parents we need to make a new one to attach everything to if (fullParents.empty()) { if (elementClass == NC) { @@ -2525,10 +2526,18 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else if (elementClass == NEUME) { parent = new Syllable(); + int lry; + int uly; for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { - (*it)->MoveItselfTo(parent); + if ((*it)->GetParent() != parent) { + if (!(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); + } + else { + lry = (*it)->GetFacsimileInterface()->GetZone()->GetLry(); + uly = (*it)->GetFacsimileInterface()->GetZone()->GetUly(); + } } } @@ -2544,43 +2553,15 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e if (m_doc->GetType() == Facs) { Zone *zone = new Zone(); - // if it's syllable parent has position values just use those - FacsimileInterface *syllableFi = NULL; - if (syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface()->HasFacs()) { - syllableFi = syl->GetFirstAncestor(SYLLABLE)->GetFacsimileInterface(); - Zone *tempZone = dynamic_cast(syllableFi->GetZone()); - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - // otherwise get a boundingbox that comprises all the neumes in the syllable - else { - ListOfObjects children; - InterfaceComparison comp(INTERFACE_FACSIMILE); - syl->GetFirstAncestor(SYLLABLE)->FindAllDescendantsByComparison(&children, &comp); - for (auto iter2 = children.begin(); iter2 != children.end(); ++iter2) { - FacsimileInterface *temp = (*iter2)->GetFacsimileInterface(); - assert(temp); - Zone *tempZone = vrv_cast(temp->GetZone()); - assert(tempZone); - if (temp->HasFacs()) { - zone->SetUlx(tempZone->GetUlx()); - zone->SetUly(tempZone->GetUly()); - zone->SetLrx(tempZone->GetLrx()); - zone->SetLry(tempZone->GetLry()); - } - } - } - - // make the bounding box a little bigger and lower so it's easier to edit - const int offSetUly = 100; - const int offSetLrx = 100; - const int offSetLry = 200; + zone->SetUlx(parent->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); + zone->SetUly(uly); + zone->SetLrx(parent->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); + zone->SetLry(lry); - zone->SetUly(zone->GetUly() + offSetUly); - zone->SetLrx(zone->GetLrx() + offSetLrx); - zone->SetLry(zone->GetLry() + offSetLry); + // Make bbox larger if it has less than 2 ncs + if (parent->GetChildCount(NC, 2) <= 2) { + zone->SetLrx(zone->GetLrx() + 50); + } assert(m_doc->GetFacsimile()); m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone); From 3c901209f2f4e3a747a0ff5a65ec8e2e50e9b234 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 13:30:20 -0400 Subject: [PATCH 073/144] Optimize reordering --- src/editortoolkit_neume.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index b93f1ba1579..0f3af38680d 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2571,12 +2571,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - parent->ReorderByXPos(); secondParent->AddChild(parent); - - Layer *layer = vrv_cast(parent->GetFirstAncestor(LAYER)); - assert(layer); - layer->ReorderByXPos(); } // if there's only one full parent we just add the other elements to it @@ -2589,7 +2584,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e (*it)->MoveItselfTo(parent); } } - parent->ReorderByXPos(); } // if there is more than 1 full parent we need to concat syl's @@ -2601,20 +2595,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e for (auto it = elements.begin(); it != elements.end(); ++it) { if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { (*it)->MoveItselfTo(parent); - parent->ReorderByXPos(); } } secondParent->AddChild(parent); - - Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); - if (!layer) { - LogError("Elements does not have Layer parent. This should not happen."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Elements does not have Layer parent."); - return false; - } - - layer->ReorderByXPos(); } else { std::sort(fullParents.begin(), fullParents.end(), Object::sortByUlx); @@ -2687,8 +2670,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e return false; } secondParent->AddChild(fullSyllable); - Layer *layer = vrv_cast(fullSyllable->GetFirstAncestor(LAYER)); - assert(layer); if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { FacsimileInterface *facsInter = vrv_cast(fullSyl->GetFacsimileInterface()); assert(facsInter); @@ -2703,7 +2684,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e assert(lry >= 0); zone->SetLry(lry); } - layer->ReorderByXPos(); parent = fullSyllable; } } @@ -2764,6 +2744,10 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } + Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); + assert(layer); + layer->ReorderByXPos(); + m_infoObject.import("uuid", parent->GetID()); m_infoObject.import("status", status); m_infoObject.import("message", message); From 87bc478aa03a96cc3d8b129db18228326cfe44a0 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 31 Jul 2023 15:48:36 -0400 Subject: [PATCH 074/144] Rename fullSyllable to parent --- src/editortoolkit_neume.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 0f3af38680d..9607b387ac1 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2601,7 +2601,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else { std::sort(fullParents.begin(), fullParents.end(), Object::sortByUlx); - Syllable *fullSyllable = new Syllable(); + Syllable *parent = new Syllable(); Syl *fullSyl = NULL; // construct concatenated string of all the syls @@ -2655,13 +2655,13 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Text *text = vrv_cast(fullSyl->FindDescendantByType(TEXT)); assert(text); text->SetText(fullString); - assert(fullSyllable); - fullSyllable->AddChild(fullSyl); + assert(parent); + parent->AddChild(fullSyl); // Move elements to the new group syllable for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != fullSyllable && !(*it)->Is(SYL)) { - (*it)->MoveItselfTo(fullSyllable); + if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); } } @@ -2669,7 +2669,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e LogError("No second level parent!"); return false; } - secondParent->AddChild(fullSyllable); + secondParent->AddChild(parent); if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { FacsimileInterface *facsInter = vrv_cast(fullSyl->GetFacsimileInterface()); assert(facsInter); @@ -2684,7 +2684,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e assert(lry >= 0); zone->SetLry(lry); } - parent = fullSyllable; } } From d5fc196a72333b8cdd15255673b99dcd45cacb90 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 16:15:37 -0400 Subject: [PATCH 075/144] Refactor multiple full parents --- src/editortoolkit_neume.cpp | 79 +++++++++++-------------------------- 1 file changed, 22 insertions(+), 57 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 9607b387ac1..8bebe73d0dc 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2600,17 +2600,23 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent->AddChild(parent); } else { - std::sort(fullParents.begin(), fullParents.end(), Object::sortByUlx); Syllable *parent = new Syllable(); Syl *fullSyl = NULL; + int ulx, uly, lrx, lry; // construct concatenated string of all the syls std::u32string fullString = U""; for (auto it = fullParents.begin(); it != fullParents.end(); ++it) { Syl *syl = dynamic_cast((*it)->FindDescendantByType(SYL)); - if (syl != NULL) { + if (syl != NULL && m_doc->GetType() == Facs) { + Zone *zone = dynamic_cast(syl->GetFacsimileInterface()->GetZone()); + if (fullSyl == NULL) { fullSyl = syl; + ulx = zone->GetUlx(); + uly = zone->GetUly(); + lrx = zone->GetLrx(); + lry = zone->GetLry(); } Text *text = dynamic_cast(syl->FindDescendantByType(TEXT)); @@ -2618,46 +2624,13 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e std::u32string currentString = text->GetText(); fullString = fullString + currentString; } + + ulx = zone->GetUlx() < ulx ? zone->GetUlx() : ulx; + uly = zone->GetUly() < uly ? zone->GetUly() : uly; + lrx = zone->GetLrx() > lrx ? zone->GetLrx() : lrx; + lry = zone->GetLry() > lry ? zone->GetLry() : lry; } } - // find the new boundingbox comprising all of the text - int ulx = -1, uly = -1, lrx = -1, lry = -1; - for (auto it = fullParents.begin(); it != fullParents.end(); ++it) { - Object *par = vrv_cast(*it); - assert(par); - Syl *descSyl = vrv_cast(par->FindDescendantByType(SYL)); - assert(descSyl); - // FacsimileInterface *facsInter = dynamic_cast - // ((*it)->FindDescendantByType(SYL)->GetFacsimileInterface()); - if (descSyl != NULL) { - FacsimileInterface *facsInter - = dynamic_cast(descSyl->GetFacsimileInterface()); - - if (facsInter != NULL) { - if (ulx == -1 || ulx > facsInter->GetDrawingX()) { - ulx = facsInter->GetDrawingX(); - } - - if (lrx < facsInter->GetWidth() + facsInter->GetDrawingX()) { - lrx = facsInter->GetWidth() + facsInter->GetDrawingX(); - } - - if (uly == -1 || uly > facsInter->GetDrawingY()) { - uly = facsInter->GetDrawingY(); - } - if (lry < facsInter->GetHeight() + facsInter->GetDrawingY()) { - lry = facsInter->GetHeight() + facsInter->GetDrawingY(); - } - } - } - } - assert(fullSyl); - Text *text = vrv_cast(fullSyl->FindDescendantByType(TEXT)); - assert(text); - text->SetText(fullString); - assert(parent); - parent->AddChild(fullSyl); - // Move elements to the new group syllable for (auto it = elements.begin(); it != elements.end(); ++it) { if ((*it)->GetParent() != parent && !(*it)->Is(SYL)) { @@ -2665,25 +2638,19 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - if (secondParent == NULL) { - LogError("No second level parent!"); - return false; - } - secondParent->AddChild(parent); - if (ulx >= 0 && uly >= 0 && lrx >= 0 && lry >= 0) { - FacsimileInterface *facsInter = vrv_cast(fullSyl->GetFacsimileInterface()); - assert(facsInter); - Zone *zone = vrv_cast(facsInter->GetZone()); - assert(zone); - assert(ulx >= 0); + Text *fullText = dynamic_cast(fullSyl->FindDescendantByType(TEXT)); + fullText->SetText(fullString); + parent->AddChild(fullSyl); + + if (m_doc->GetType() == Facs) { + Zone *zone = dynamic_cast(fullSyl->GetFacsimileInterface()->GetZone()); zone->SetUlx(ulx); - assert(uly >= 0); zone->SetUly(uly); - assert(lrx >= 0); zone->SetLrx(lrx); - assert(lry >= 0); zone->SetLry(lry); } + + secondParent->AddChild(parent); } } @@ -2743,9 +2710,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } } - Layer *layer = dynamic_cast(parent->GetFirstAncestor(LAYER)); - assert(layer); - layer->ReorderByXPos(); + secondParent->ReorderByXPos(); m_infoObject.import("uuid", parent->GetID()); m_infoObject.import("status", status); From a52ba37f6d6752b8a4a8dea1a5c7f0efc9a3eba9 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 18:05:45 -0400 Subject: [PATCH 076/144] Fix bbox calculation for empty full parent --- src/editortoolkit_neume.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 8bebe73d0dc..73538765a79 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2526,18 +2526,11 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else if (elementClass == NEUME) { parent = new Syllable(); - int lry; - int uly; + Object *oldSyl = (*elements.begin())->GetFirstAncestor(SYLLABLE)->GetFirst(SYL); for (auto it = elements.begin(); it != elements.end(); ++it) { - if ((*it)->GetParent() != parent) { - if (!(*it)->Is(SYL)) { - (*it)->MoveItselfTo(parent); - } - else { - lry = (*it)->GetFacsimileInterface()->GetZone()->GetLry(); - uly = (*it)->GetFacsimileInterface()->GetZone()->GetUly(); - } + if (!(*it)->Is(SYL)) { + (*it)->MoveItselfTo(parent); } } @@ -2553,10 +2546,10 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e if (m_doc->GetType() == Facs) { Zone *zone = new Zone(); - zone->SetUlx(parent->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); - zone->SetUly(uly); - zone->SetLrx(parent->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); - zone->SetLry(lry); + zone->SetUlx(parent->GetFirst(NEUME)->GetFirst(NC)->GetFacsimileInterface()->GetZone()->GetUlx()); + zone->SetUly(oldSyl->GetFacsimileInterface()->GetZone()->GetUly()); + zone->SetLrx(parent->GetLast(NEUME)->GetLast(NC)->GetFacsimileInterface()->GetZone()->GetLrx()); + zone->SetLry(oldSyl->GetFacsimileInterface()->GetZone()->GetLry()); // Make bbox larger if it has less than 2 ncs if (parent->GetChildCount(NC, 2) <= 2) { @@ -2565,7 +2558,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e assert(m_doc->GetFacsimile()); m_doc->GetFacsimile()->FindDescendantByType(SURFACE)->AddChild(zone); - FacsimileInterface *fi = vrv_cast((*syl).GetFacsimileInterface()); + FacsimileInterface *fi = syl->GetFacsimileInterface(); assert(fi); fi->AttachZone(zone); } From f35390d1fc3dc1a6a875b4bf4789b0326e224353 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 18:10:30 -0400 Subject: [PATCH 077/144] Remove unnecessary checks & reordering --- src/editortoolkit_neume.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 73538765a79..3a0ad6178a9 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2667,10 +2667,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *obj = (*it).first; obj->ClearRelinquishedChildren(); if (obj->GetChildCount() == 0) { - if (secondParent == NULL) { - LogError("No second level parent!"); - return false; - } secondParent->DeleteChild(obj); } else if (obj->GetChildCount() @@ -2682,23 +2678,16 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } while ((leftover = obj->FindDescendantByType(DIVLINE)) != NULL) { leftover->MoveItselfTo(parent); - parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } while ((leftover = obj->FindDescendantByType(ACCID)) != NULL) { leftover->MoveItselfTo(parent); - parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } while ((leftover = obj->FindDescendantByType(CLEF)) != NULL) { leftover->MoveItselfTo(parent); - parent->ReorderByXPos(); obj->ClearRelinquishedChildren(); } - if (secondParent == NULL) { - LogError("No second level parent!"); - return false; - } secondParent->DeleteChild(obj); } } From 11425b4bbc59b82ce5f4eb23f66678def3b22ffb Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 1 Aug 2023 18:14:44 -0400 Subject: [PATCH 078/144] Remove unused variable --- src/editortoolkit_neume.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 3a0ad6178a9..44f49fba0fc 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -1636,11 +1636,9 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) int ulx; int uly; int height; - int lrx; if (dynamic_cast(element)->HasFacs()) { ulx = element->GetFacsimileInterface()->GetZone()->GetUlx(); uly = element->GetFacsimileInterface()->GetZone()->GetUly(); - lrx = element->GetFacsimileInterface()->GetZone()->GetLrx(); height = element->GetFacsimileInterface()->GetZone()->GetLry() - uly; } else { From dc01be2ae49b7b66b1753c7a3d7fb792ecbc8e9c Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Wed, 2 Aug 2023 16:12:11 -0400 Subject: [PATCH 079/144] Preserve ordering of multiple ligated nc in the same neume --- src/object.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/object.cpp b/src/object.cpp index bd6a76b6c67..c9c303b72c7 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -1272,7 +1272,10 @@ bool Object::sortByUlx(Object *a, Object *b) if (a->Is(NC) && b->Is(NC)) { Nc *nca = dynamic_cast(a); Nc *ncb = dynamic_cast(b); - if (nca->HasLigated() && ncb->HasLigated() && (a->GetParent() == b->GetParent())) { + Zone *zonea = dynamic_cast(nca->GetFacsimileInterface()->GetZone()); + Zone *zoneb = dynamic_cast(ncb->GetFacsimileInterface()->GetZone()); + if (nca->HasLigated() && ncb->HasLigated() && (a->GetParent() == b->GetParent()) + && (zonea->GetUlx() == zoneb->GetUly())) { Object *parent = a->GetParent(); assert(parent); if (abs(parent->GetChildIndex(a) - parent->GetChildIndex(b)) == 1) { From 9abbe67bb2429852cda906ed1325fb8ae840e12f Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 3 Aug 2023 10:41:03 -0400 Subject: [PATCH 080/144] Add validity check && correction --- src/object.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/object.cpp b/src/object.cpp index c9c303b72c7..086e4589db2 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -1273,9 +1273,11 @@ bool Object::sortByUlx(Object *a, Object *b) Nc *nca = dynamic_cast(a); Nc *ncb = dynamic_cast(b); Zone *zonea = dynamic_cast(nca->GetFacsimileInterface()->GetZone()); + assert(zonea); Zone *zoneb = dynamic_cast(ncb->GetFacsimileInterface()->GetZone()); + assert(zoneb); if (nca->HasLigated() && ncb->HasLigated() && (a->GetParent() == b->GetParent()) - && (zonea->GetUlx() == zoneb->GetUly())) { + && (zonea->GetUlx() == zoneb->GetUlx())) { Object *parent = a->GetParent(); assert(parent); if (abs(parent->GetChildIndex(a) - parent->GetChildIndex(b)) == 1) { From 51f2b105eb9ee8d47fc4ce02df4e33cf19408971 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 14:37:15 -0400 Subject: [PATCH 081/144] Convert m_infoObject to m_editInfo --- include/vrv/editortoolkit_neume.h | 7 +- src/editortoolkit_neume.cpp | 622 +++++++++++++++--------------- 2 files changed, 315 insertions(+), 314 deletions(-) diff --git a/include/vrv/editortoolkit_neume.h b/include/vrv/editortoolkit_neume.h index a31242d2970..108b50e5266 100644 --- a/include/vrv/editortoolkit_neume.h +++ b/include/vrv/editortoolkit_neume.h @@ -31,8 +31,8 @@ namespace vrv { class EditorToolkitNeume : public EditorToolkit { public: EditorToolkitNeume(Doc *doc, View *view) : EditorToolkit(doc, view) {} - bool ParseEditorAction(const std::string &json_editorAction); - virtual std::string EditInfo() { return m_infoObject.json(); }; + bool ParseEditorAction(const std::string &json_editorAction) override; + std::string EditInfo() override; /** * Experimental editor functions. @@ -100,9 +100,6 @@ class EditorToolkitNeume : public EditorToolkit { bool AdjustPitchFromPosition(Object *obj, Clef *clef = NULL); bool AdjustClefLineFromPosition(Clef *clef, Staff *staff = NULL); ///@} - -private: - jsonxx::Object m_infoObject; }; //-------------------------------------------------------------------------------- diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 44f49fba0fc..7f55e3298ad 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -41,25 +41,29 @@ //-------------------------------------------------------------------------------- namespace vrv { +std::string EditorToolkitNeume::EditInfo() +{ + return m_editInfo.json(); +} bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) { jsonxx::Object json; - m_infoObject.reset(); + // m_editInfo.reset(); // Read JSON actions if (!json.parse(json_editorAction)) { LogError("Cannot parse JSON std::string."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Cannot parse JSON from std::string " + json_editorAction); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Cannot parse JSON from std::string " + json_editorAction); return false; } if (!json.has("action") || (!json.has("param") && !json.has("param"))) { LogWarning("Incorrectly formatted JSON action"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "JSON action misformatted."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "JSON action misformatted."); return false; } @@ -67,8 +71,8 @@ bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) if (action != "chain" && json.has("param")) { LogWarning("Only 'chain' uses 'param' as an array."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "'param' can only be an array for a chain action."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "'param' can only be an array for a chain action."); return false; } @@ -239,8 +243,8 @@ bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) else { LogWarning("Unknown action type '%s'.", action.c_str()); } - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Action " + action + " could not be parsed or is unknown."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Action " + action + " could not be parsed or is unknown."); return false; } @@ -252,15 +256,15 @@ bool EditorToolkitNeume::Chain(jsonxx::Array actions) for (int i = 0; i < (int)actions.size(); i++) { if (!actions.has(0)) { LogError("Action %d was not an object", i); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Action " + std::to_string(i) + " was not an object."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Action " + std::to_string(i) + " was not an object."); return false; } status |= this->ParseEditorAction(actions.get(i).json()); - results.import(std::to_string(i), m_infoObject); + results.import(std::to_string(i), m_editInfo); } - m_infoObject = results; + m_editInfo = results; return status; } @@ -481,8 +485,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) std::string status = "OK", message = ""; if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } @@ -514,8 +518,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Layer *layer = dynamic_cast(element->GetFirstAncestor(LAYER)); if (!layer) { LogError("Element does not have Layer parent. This should not happen."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Element does not have Layer parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element does not have Layer parent."); return false; } @@ -594,8 +598,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Clef *clef = dynamic_cast(element); if (!clef->HasFacs()) { LogError("Clef dragging is only supported for clefs with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Clef dragging is only supported for clefs with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Clef dragging is only supported for clefs with facsimiles."); return false; } FacsimileInterface *fi = (*clef).GetFacsimileInterface(); @@ -646,8 +650,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Staff *staff = vrv_cast(element); if (!staff->HasFacs()) { LogError("Staff dragging is only supported for staves with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff dragging is only supported for staves with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff dragging is only supported for staves with facsimiles."); return false; } @@ -675,8 +679,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Syl *syl = dynamic_cast(element); if (!syl->HasFacs()) { LogError("Syl (boundingbox) dragging is only supported for syls with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Syl dragging is only supported for syls with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Syl dragging is only supported for syls with facsimiles."); return false; } FacsimileInterface *fi = (*syl).GetFacsimileInterface(); @@ -689,8 +693,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) Accid *accid = dynamic_cast(element); if (!accid->HasFacs()) { LogError("Accid dragging is only supported for accid with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Accid dragging is only supported for accid with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Accid dragging is only supported for accid with facsimiles."); return false; } FacsimileInterface *fi = (*accid).GetFacsimileInterface(); @@ -706,8 +710,8 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) DivLine *divLine = dynamic_cast(element); if (!divLine->HasFacs()) { LogError("DivLine dragging is only supported for divLine with facsimiles!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "DivLine dragging is only supported for divLine with facsimiles."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "DivLine dragging is only supported for divLine with facsimiles."); return false; } FacsimileInterface *fi = (*divLine).GetFacsimileInterface(); @@ -721,14 +725,14 @@ bool EditorToolkitNeume::Drag(std::string elementId, int x, int y) } else { LogWarning("Unsupported element for dragging."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported element for dragging."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported element for dragging."); return false; } Layer *layer = vrv_cast(element->GetFirstAncestor(LAYER)); layer->ReorderByXPos(); // Reflect position order of elements internally (and in the resulting output file) - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -737,14 +741,14 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -821,9 +825,9 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in parent->InsertChild(newStaff, i); parent->Modify(); - m_infoObject.import("uuid", newStaff->GetID()); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", newStaff->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -833,17 +837,17 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in parent->AddChild(newStaff); parent->Modify(); - m_infoObject.import("uuid", newStaff->GetID()); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", newStaff->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } if (staff == NULL) { LogError("A staff must exist in the page to add a non-staff element."); delete zone; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A staff must exist in the page to add a non-staff element."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A staff must exist in the page to add a non-staff element."); return false; } Layer *layer = vrv_cast(staff->FindDescendantByType(LAYER)); @@ -930,8 +934,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in delete nc; LogError("Failed to set pitch."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set pitch."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set pitch."); return false; } @@ -993,8 +997,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("Unsupported character in contour."); delete newNc; delete newZone; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported character in contour."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported character in contour."); return false; } @@ -1019,10 +1023,10 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in } } if (elementType == "nc") { - m_infoObject.import("uuid", nc->GetID()); + m_editInfo.import("uuid", nc->GetID()); } else { - m_infoObject.import("uuid", neume->GetID()); + m_editInfo.import("uuid", neume->GetID()); } } else if (elementType == "clef") { @@ -1047,8 +1051,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("A clef shape must be specified."); delete clef; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A clef shape must be specified."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A clef shape must be specified."); return false; } clef->SetShape(clefShape); @@ -1069,7 +1073,7 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in assert(surface); surface->AddChild(zone); layer->AddChild(clef); - m_infoObject.import("uuid", clef->GetID()); + m_editInfo.import("uuid", clef->GetID()); layer->ReorderByXPos(); // ensure pitched elements associated with this clef keep their x,y positions @@ -1120,11 +1124,11 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in if (!AdjustPitchFromPosition(custos)) { LogError("Failed to set pitch."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set pitch."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set pitch."); return false; } - m_infoObject.import("uuid", custos->GetID()); + m_editInfo.import("uuid", custos->GetID()); } else if (elementType == "accid") { Accid *accid = new Accid(); @@ -1145,8 +1149,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("A accid type must be specified."); delete accid; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A accid type must be specified."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A accid type must be specified."); return false; } @@ -1171,7 +1175,7 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in zone->SetLry(uly + noteHeight); layer->ReorderByXPos(); - m_infoObject.import("uuid", accid->GetID()); + m_editInfo.import("uuid", accid->GetID()); } else if (elementType == "divLine") { DivLine *divLine = new DivLine(); @@ -1209,8 +1213,8 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in LogError("A divLine type must be specified."); delete divLine; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "A divLine type must be specified."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "A divLine type must be specified."); return false; } @@ -1235,18 +1239,18 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in zone->SetLry(uly + noteHeight); layer->ReorderByXPos(); - m_infoObject.import("uuid", divLine->GetID()); + m_editInfo.import("uuid", divLine->GetID()); } else { delete zone; LogError("Unsupported type '%s' for insertion", elementType.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported type '" + elementType + "' for insertion."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported type '" + elementType + "' for insertion."); return false; } layer->ReorderByXPos(); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -1254,14 +1258,14 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -1272,23 +1276,23 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!(element->Is(DIVLINE) || element->Is(ACCID) || element->Is(CLEF))) { LogError("Element is of type %s, but only Divlines and Accids can be inserted into syllables.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only DivLines, Accids, and Clefs can be inserted into syllables."); return false; } if (!parent->Is(LAYER)) { LogError("The selected %s is not a child of layer.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected " + element->GetClassName() + "is not a child of layer."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected " + element->GetClassName() + "is not a child of layer."); return false; } @@ -1301,8 +1305,8 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) } else { LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); return false; } @@ -1316,8 +1320,8 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) if (neumes.empty()) { LogError("A syllable must exist in the staff to insert a '%s' into.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import( + m_editInfo.import("status", "FAILURE"); + m_editInfo.import( "message", "A syllable must exist in the staff to insert a '" + element->GetClassName() + "' into."); return false; } @@ -1395,8 +1399,8 @@ bool EditorToolkitNeume::InsertToSyllable(std::string elementId) } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1404,14 +1408,14 @@ bool EditorToolkitNeume::MoveOutsideSyllable(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -1422,23 +1426,23 @@ bool EditorToolkitNeume::MoveOutsideSyllable(std::string elementId) if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!(element->Is(DIVLINE) || element->Is(ACCID) || element->Is(CLEF))) { LogError("Element is of type %s, but only Divlines, Accids, and Clefs can be moved out of syllables.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only DivLines and Accids can be inserted into syllables."); return false; } if (!parent->Is(SYLLABLE)) { LogError("The selected %s is not a child of syllable.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected " + element->GetClassName() + "is not a child of syllable."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected " + element->GetClassName() + "is not a child of syllable."); return false; } @@ -1518,8 +1522,8 @@ bool EditorToolkitNeume::MoveOutsideSyllable(std::string elementId) // INSIDE do nothing } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1527,15 +1531,15 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (direction != "above" && direction != "below") { LogError("Direction can only be either \"above\" or \"below\"."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Direction can only be either \"above\" or \"below\"."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Direction can only be either \"above\" or \"below\"."); return false; } @@ -1543,8 +1547,8 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d Object *obj = page->FindDescendantByID(elementId); if (obj == NULL || !obj->Is(CLEF)) { LogError("This action can only be done on clefs!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This action can only be done on clefs!"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This action can only be done on clefs!"); return false; } @@ -1559,8 +1563,8 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d if (octaveDis > 3 || octaveDis < -3) { LogError("Clefs can only be displaced 3 octaves."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Clefs can only be displaced 3 octaves."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Clefs can only be displaced 3 octaves."); return false; } @@ -1595,8 +1599,8 @@ bool EditorToolkitNeume::DisplaceClefOctave(std::string elementId, std::string d nc->SetOct(nc->GetOct() + move); }); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1604,14 +1608,14 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get drawing page."); return false; } if (m_doc->GetType() != Facs) { LogError("Drawing page without facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Drawing page without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Drawing page without facsimile is unsupported."); return false; } @@ -1620,14 +1624,14 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) Object *staffParent = element->GetFirstAncestor(STAFF); if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!element->Is(SYL)) { LogError("Element is of type %s, but only element can match height.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import( + m_editInfo.import("status", "FAILURE"); + m_editInfo.import( "message", "Element is of type " + element->GetClassName() + ", but only element can match height."); return false; } @@ -1643,8 +1647,8 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) } else { LogError("Selected '%s' without facsimile", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Selected '" + element->GetClassName() + "' without facsimile is unsupported."); return false; } @@ -1686,8 +1690,8 @@ bool EditorToolkitNeume::MatchHeight(std::string elementId) zone->SetLry(uly + offsetY + height); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1704,15 +1708,15 @@ bool EditorToolkitNeume::Merge(std::vector elementIds) } else { LogError("Staff with ID '%s' does not exist!", it->c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff with ID '" + *it + "' does not exist."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff with ID '" + *it + "' does not exist."); return false; } } if (staves.size() < 2) { LogError("At least two staves must be provided."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "At least two staves must be provided."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "At least two staves must be provided."); return false; } @@ -1773,9 +1777,9 @@ bool EditorToolkitNeume::Merge(std::vector elementIds) fillLayer->ReorderByXPos(); - m_infoObject.import("uuid", fillStaff->GetID()); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("uuid", fillStaff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); // TODO change zones for staff children @@ -1817,8 +1821,8 @@ bool EditorToolkitNeume::Set(std::string elementId, std::string attrType, std::s m_doc->PrepareData(); m_doc->GetDrawingPage()->LayOut(true); } - m_infoObject.import("status", success ? "OK" : "FAILURE"); - m_infoObject.import("message", success ? "" : "Could not set attribute '" + attrType + "' to '" + attrValue + "'."); + m_editInfo.import("status", success ? "OK" : "FAILURE"); + m_editInfo.import("message", success ? "" : "Could not set attribute '" + attrType + "' to '" + attrValue + "'."); return success; } @@ -1828,15 +1832,15 @@ bool EditorToolkitNeume::SetText(std::string elementId, const std::string &text) std::string status = "OK", message = ""; const std::u32string wtext = UTF8to32(text); if (!m_doc->GetDrawingPage()) { - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not find drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not find drawing page."); return false; } Object *element = m_doc->GetDrawingPage()->FindDescendantByID(elementId); if (element == NULL) { LogWarning("No element with ID '%s' exists", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element with ID '" + elementId + "' exists."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element with ID '" + elementId + "' exists."); return false; } @@ -1920,12 +1924,12 @@ bool EditorToolkitNeume::SetText(std::string elementId, const std::string &text) } else { LogError("Element type '%s' is unsupported for SetText", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Element type '" + element->GetClassName() + "' is unsupported for SetText."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element type '" + element->GetClassName() + "' is unsupported for SetText."); return false; } - m_infoObject.import("status", success ? status : "FAILURE"); - m_infoObject.import("message", success ? message : "SetText method failed."); + m_editInfo.import("status", success ? status : "FAILURE"); + m_editInfo.import("message", success ? message : "SetText method failed."); return success; } @@ -1933,8 +1937,8 @@ bool EditorToolkitNeume::SetClef(std::string elementId, std::string shape) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } ListOfObjects objects; @@ -1957,8 +1961,8 @@ bool EditorToolkitNeume::SetClef(std::string elementId, std::string shape) success = AttModule::SetShared(clef, "shape", shape); if (!success) { LogError("Unable to set clef shape"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unable to set clef shape."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unable to set clef shape."); return false; } @@ -1985,8 +1989,8 @@ bool EditorToolkitNeume::SetClef(std::string elementId, std::string shape) m_doc->PrepareData(); m_doc->GetDrawingPage()->LayOut(true); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -1994,23 +1998,23 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } Staff *staff = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(elementId)); // Validate parameters if (staff == NULL) { LogError("Either no element exists with ID '%s' or it is not a staff.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Either no element exists with ID '" + elementId + "' or it is not a staff."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Either no element exists with ID '" + elementId + "' or it is not a staff."); return false; } if (staff->GetZone()->GetUlx() > x || staff->GetZone()->GetLrx() < x) { LogError("The 'x' parameter is not within the bounds of the original staff."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The 'x' parameter is not within bounds of the original staff."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The 'x' parameter is not within bounds of the original staff."); return false; } @@ -2024,19 +2028,19 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) if (!this->Insert("staff", "auto", newUlx, newUly, newLrx, newLry, v)) { LogError("Failed to create a second staff."); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to create a second staff."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to create a second staff."); return false; } Staff *splitStaff - = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(m_infoObject.get("uuid"))); + = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(m_editInfo.get("uuid"))); assert(splitStaff); if (splitStaff == NULL) { LogError("Split staff is null"); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Split staff is null."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Split staff is null."); return false; } @@ -2078,9 +2082,9 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) } } layer->ClearRelinquishedChildren(); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("uuid", splitStaff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("uuid", splitStaff->GetID()); return true; } @@ -2088,8 +2092,8 @@ bool EditorToolkitNeume::Remove(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } Object *obj = m_doc->GetDrawingPage()->FindDescendantByID(elementId); @@ -2101,7 +2105,7 @@ bool EditorToolkitNeume::Remove(std::string elementId) isClef = obj->Is(CLEF); Object *parent = obj->GetParent(); assert(parent); - m_infoObject.import("uuid", elementId); + m_editInfo.import("uuid", elementId); // Remove Zone for element (if any) InterfaceComparison ic(INTERFACE_FACSIMILE); ListOfObjects fiChildren; @@ -2142,9 +2146,9 @@ bool EditorToolkitNeume::Remove(std::string elementId) if (!result) { LogError("Failed to delete the desired element (%s)", elementId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete the desired element (" + elementId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete the desired element (" + elementId + ")."); return false; } @@ -2162,9 +2166,9 @@ bool EditorToolkitNeume::Remove(std::string elementId) if (!result) { LogError("Failed to delete the desired element (%s)", elementId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete the desired element (" + elementId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete the desired element (" + elementId + ")."); return false; } // Check if this leaves any containers empty and delete them @@ -2178,9 +2182,9 @@ bool EditorToolkitNeume::Remove(std::string elementId) result &= parent->DeleteChild(obj); if (!result) { LogError("Failed to delete empty neume (%s)", neumeId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete empty neume (" + neumeId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete empty neume (" + neumeId + ")."); return false; } } @@ -2208,16 +2212,16 @@ bool EditorToolkitNeume::Remove(std::string elementId) result &= parent->DeleteChild(obj); if (!result) { LogError("Failed to delete empty syllable (%s)", syllableId.c_str()); - m_infoObject.reset(); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to delete empty syllable (" + syllableId + ")."); + m_editInfo.reset(); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to delete empty syllable (" + syllableId + ")."); return false; } } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -2225,22 +2229,22 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (m_doc->GetType() != Facs) { LogWarning("Resizing is only available in facsimile mode."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Resizing is only available in facsimile mode."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Resizing is only available in facsimile mode."); return false; } Object *obj = m_doc->GetDrawingPage()->FindDescendantByID(elementId); if (obj == NULL) { LogError("Object with ID '%s' not found.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Object with ID '" + elementId + "' could not be found."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Object with ID '" + elementId + "' could not be found."); return false; } if (obj->Is(STAFF)) { @@ -2248,8 +2252,8 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx assert(staff); if (!staff->HasFacs()) { LogError("This staff does not have a facsimile."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This staff does not have a facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This staff does not have a facsimile."); return false; } Zone *zone = staff->GetZone(); @@ -2269,8 +2273,8 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx assert(syl); if (!syl->HasFacs()) { LogError("This syl (bounding box) does not have a facsimile"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This syl does not have a facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This syl does not have a facsimile."); return false; } Zone *zone = syl->GetZone(); @@ -2300,12 +2304,12 @@ bool EditorToolkitNeume::Resize(std::string elementId, int ulx, int uly, int lrx } else { LogError("Element of type '%s' is unsupported.", obj->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Element of type '" + obj->GetClassName() + "' is unsupported."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element of type '" + obj->GetClassName() + "' is unsupported."); return false; } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -2322,16 +2326,16 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e // Get the current drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (elementIds.size() == 0) { LogWarning("No element IDs to group!"); status = "WARNING"; message = "No element IDs to group!"; - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } ClassId elementClass; @@ -2343,8 +2347,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e } else { LogError("Invalid groupType: %s", groupType.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Invalid groupType: " + groupType); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Invalid groupType: " + groupType); return false; } @@ -2354,15 +2358,15 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *el = m_doc->GetDrawingPage()->FindDescendantByID(*it); if (el == NULL) { LogError("Could not get element with ID %s", it->c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get element with ID " + *it); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get element with ID " + *it); return false; } if (el->GetClassId() != elementClass) { LogError("Element %s was of class %s. Expected class %s", el->GetID().c_str(), el->GetClassName().c_str(), groupType.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element " + el->GetID() + " was of class " + el->GetClassName() + " but expected class " + groupType + "."); return false; @@ -2372,8 +2376,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e Object *par = el->GetParent(); if (par == NULL) { LogError("Parent of %s is null!", el->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Parent of " + el->GetID() + " is null."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Parent of " + el->GetID() + " is null."); return false; } @@ -2401,20 +2405,20 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e std::vector elementIds0 = { elementIds.begin(), elementIds.begin() + idx }; Group("neume", elementIds0); - if (m_infoObject.get("status") == "FAILURE") { + if (m_editInfo.get("status") == "FAILURE") { resultId0 = linkedID; } else { - resultId0 = m_infoObject.get("uuid"); + resultId0 = m_editInfo.get("uuid"); } std::vector elementIds1 = { elementIds.begin() + idx, elementIds.end() }; Group("neume", elementIds1); - if (m_infoObject.get("status") == "FAILURE") { + if (m_editInfo.get("status") == "FAILURE") { resultId1 = par->GetID(); } else { - resultId1 = m_infoObject.get("uuid"); + resultId1 = m_editInfo.get("uuid"); par = m_doc->GetDrawingPage()->FindDescendantByID(resultId1); } @@ -2430,9 +2434,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e uuidArray << resultId0; uuidArray << resultId1; - m_infoObject.import("uuid", uuidArray); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", uuidArray); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } } @@ -2443,14 +2447,14 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e if (parents.size() == 0) { LogError("Could not get the parent."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the parent."); return false; } else if (parents.size() == 1) { LogError("The selected elements are already grouped."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected elements are already grouped."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected elements are already grouped."); return false; } @@ -2491,8 +2495,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent = (*parents.begin()).first->GetParent(); if (secondParent == NULL) { LogError("No second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No second level parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No second level parent."); return false; } // find parents where all of their children are being grouped @@ -2502,8 +2506,8 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e int expected; if (par->GetParent() != secondParent) { LogError("No shared second level parent!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No shared second level parent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No shared second level parent."); return false; } if (par->GetClassId() == SYLLABLE) { @@ -2692,9 +2696,9 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent->ReorderByXPos(); - m_infoObject.import("uuid", parent->GetID()); - m_infoObject.import("status", status); - m_infoObject.import("message", message); + m_editInfo.import("uuid", parent->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); return true; } @@ -2729,8 +2733,8 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } @@ -2792,8 +2796,8 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector } else { LogError("Unable to toggle ligature within ungroup ncs!"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unable to toggle ligature within ungroup ncs."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unable to toggle ligature within ungroup ncs."); return false; } } @@ -2864,8 +2868,8 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector else { LogError("Invalid groupType for ungrouping"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Invalid groupType for ungrouping."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Invalid groupType for ungrouping."); return false; } } @@ -2967,9 +2971,9 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("uuid", uuidArray); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("uuid", uuidArray); return true; } @@ -2978,8 +2982,8 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } @@ -3001,8 +3005,8 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) int nLen = fparent->GetChildCount(); if (nLen == 0) { LogError("The selected neume has no children."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected neume has no children."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected neume has no children."); return false; } @@ -3010,8 +3014,8 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) int fIdx = fparent->GetChildIndex(elNc); if (fIdx == -1) { LogError("The selected neume component is not a child of the selected neume."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected neume component is not a child of the selected neume."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected neume component is not a child of the selected neume."); return false; } // if click on a ligature, ncId point to the second nc in the ligature, thus minus 1 @@ -3045,9 +3049,9 @@ bool EditorToolkitNeume::SplitNeume(std::string neumeId, std::string ncId) // insert newParent to sparent sparent->InsertAfter(fparent, newParent); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("uuid", uuidArray); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("uuid", uuidArray); return true; } @@ -3056,15 +3060,15 @@ bool EditorToolkitNeume::ChangeGroup(std::string elementId, std::string contour) // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } Neume *el = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(elementId)); if (el == NULL) { LogError("Unable to find neume with id %s", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unable to find neume with id " + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unable to find neume with id " + elementId + "."); return false; } Nc *firstChild = NULL; @@ -3128,8 +3132,8 @@ bool EditorToolkitNeume::ChangeGroup(std::string elementId, std::string contour) LogError("Unsupported character in contour."); delete newNc; delete zone; - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Unsupported character in contour."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Unsupported character in contour."); return false; } zone->SetUlx(newUlx); @@ -3152,9 +3156,9 @@ bool EditorToolkitNeume::ChangeGroup(std::string elementId, std::string contour) initialLry = newLry; prevNc = newNc; } - m_infoObject.import("uuid", el->GetID()); - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("uuid", el->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); return true; } @@ -3172,8 +3176,8 @@ bool EditorToolkitNeume::ToggleLigature(std::vector elementIds) // Check if you can get drawing page if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } @@ -3187,8 +3191,8 @@ bool EditorToolkitNeume::ToggleLigature(std::vector elementIds) int secondIdx = secondNc->GetIdx(); if (std::abs(firstIdx - secondIdx) != 1) { LogError("The selected ncs are not adjacent."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "The selected ncs are not adjacent."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "The selected ncs are not adjacent."); return false; } @@ -3246,20 +3250,20 @@ bool EditorToolkitNeume::ToggleLigature(std::vector elementIds) } // else { // LogError("isLigature is invalid!"); - // m_infoObject.import("status", "FAILURE"); - // m_infoObject.import("message", "isLigature value '" + isLigature + "' is invalid."); + // m_editInfo.import("status", "FAILURE"); + // m_editInfo.import("message", "isLigature value '" + isLigature + "' is invalid."); // return false; // } if (success1 && success2 && m_doc->GetType() != Facs) { m_doc->PrepareData(); m_doc->GetDrawingPage()->LayOut(true); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); if (!(success1 && success2)) { LogWarning("Unable to update ligature attribute"); - m_infoObject.import("message", "Unable to update ligature attribute."); - m_infoObject.import("status", "WARNING"); + m_editInfo.import("message", "Unable to update ligature attribute."); + m_editInfo.import("status", "WARNING"); } surface->AddChild(zone); @@ -3270,15 +3274,15 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (m_doc->GetType() != Facs) { LogWarning("Staff re-association is only available in facsimile mode."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff re-association is only available in facsimile mode."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff re-association is only available in facsimile mode."); return false; } @@ -3286,8 +3290,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) assert(element); if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } @@ -3295,8 +3299,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) || element->Is(ACCID))) { LogError("Element is of type %s, but only Syllables, Custos, Clefs, Divlines, and Accids can change staves.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only Syllables, Custos, Clefs, DivLines, and Accids can change staves."); return false; @@ -3317,8 +3321,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) LayerElement *layerElement = dynamic_cast(element); if (!layerElement->GenerateZoneBounds(&ulx, &uly, &lrx, &lry)) { LogError("Couldn't generate bounding box for syllable."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't generate bounding box for syllable."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't generate bounding box for syllable."); return false; } comp.x = (lrx + ulx) / 2; @@ -3326,8 +3330,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) } else { LogError("This element does not have a facsimile."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "This element does not have a facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "This element does not have a facsimile."); return false; } @@ -3340,8 +3344,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) } else { LogError("Could not find any staves. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not find any staves. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not find any staves. This should not happen"); return false; } @@ -3350,8 +3354,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) assert(parent); if (parent == NULL || sParent == NULL) { LogError("Couldn't find staff parent of element with id '%s'", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find staff parent of element with id " + elementId); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find staff parent of element with id " + elementId); return false; } @@ -3359,16 +3363,16 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) assert(LAYER); if (layer == NULL) { LogError("Couldn't find layer child of staff. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find layer child of staff. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find layer child of staff. This should not happen"); return false; } if (layer == parent) { - m_infoObject.import("status", "WARNING"); - m_infoObject.import("message", "Moving to the same staff as before."); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "WARNING"); + m_editInfo.import("message", "Moving to the same staff as before."); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } @@ -3426,8 +3430,8 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) // Adjust clefline if (!AdjustClefLineFromPosition(dynamic_cast(element), staff)) { LogError("Could not adjust clef line of %s", element->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set clef line from facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set clef line from facsimile."); return false; } @@ -3455,19 +3459,19 @@ bool EditorToolkitNeume::ChangeStaff(std::string elementId) if (!(element->Is(ACCID) || element->Is(DIVLINE))) { if (!AdjustPitchFromPosition(element)) { LogError("Could not adjust pitch of %s", element->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to properly set pitch."); - m_infoObject.import("elementId", element->GetID()); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to properly set pitch."); + m_editInfo.import("elementId", element->GetID()); + m_editInfo.import("newStaffId", staff->GetID()); return false; } } } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } @@ -3475,15 +3479,15 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI { if (!m_doc->GetDrawingPage()) { LogError("Could not get the drawing page"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); return false; } if (m_doc->GetType() != Facs) { LogWarning("Staff re-association is only available in facsimile mode."); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Staff re-association is only available in facsimile mode."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Staff re-association is only available in facsimile mode."); return false; } @@ -3491,16 +3495,16 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI assert(element); if (element == NULL) { LogError("No element exists with ID '%s'.", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "No element exists with ID" + elementId + "."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "No element exists with ID" + elementId + "."); return false; } if (!(element->Is(CLEF) || element->Is(DIVLINE) || element->Is(ACCID))) { LogError("Element is of type %s, but only Clefs, Divlines, and Accids can change to a specified staff.", element->GetClassName().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Element is of type " + element->GetClassName() + ", but only Clefs, Divlines, and Accids can change to a specified staff."); return false; @@ -3510,8 +3514,8 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI if (!staff) { LogError("Could not find any staves. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Could not find any staves. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not find any staves. This should not happen"); return false; } @@ -3520,8 +3524,8 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI assert(parent); if (parent == NULL || sParent == NULL) { LogError("Couldn't find staff parent of element with id '%s'", elementId.c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find staff parent of element with id " + elementId); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find staff parent of element with id " + elementId); return false; } @@ -3529,16 +3533,16 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI assert(LAYER); if (layer == NULL) { LogError("Couldn't find layer child of staff. This should not happen"); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Couldn't find layer child of staff. This should not happen"); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Couldn't find layer child of staff. This should not happen"); return false; } if (layer == parent) { - m_infoObject.import("status", "WARNING"); - m_infoObject.import("message", "Moving to the same staff as before."); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "WARNING"); + m_editInfo.import("message", "Moving to the same staff as before."); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } @@ -3596,8 +3600,8 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI // Adjust clefline if (!AdjustClefLineFromPosition(dynamic_cast(element), staff)) { LogError("Could not adjust clef line of %s", element->GetID().c_str()); - m_infoObject.import("status", "FAILURE"); - m_infoObject.import("message", "Failed to set clef line from facsimile."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Failed to set clef line from facsimile."); return false; } @@ -3624,10 +3628,10 @@ bool EditorToolkitNeume::ChangeStaffTo(std::string elementId, std::string staffI parent->ReorderByXPos(); } - m_infoObject.import("status", "OK"); - m_infoObject.import("message", ""); - m_infoObject.import("elementId", elementId); - m_infoObject.import("newStaffId", staff->GetID()); + m_editInfo.import("status", "OK"); + m_editInfo.import("message", ""); + m_editInfo.import("elementId", elementId); + m_editInfo.import("newStaffId", staff->GetID()); return true; } From 8e0d846cc3f326f4ef45d3daac2eb2715edeca88 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 14:48:46 -0400 Subject: [PATCH 082/144] Fix outer scope shadowing --- src/editortoolkit_neume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 7f55e3298ad..cfc0b513083 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2595,7 +2595,7 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e secondParent->AddChild(parent); } else { - Syllable *parent = new Syllable(); + parent = new Syllable(); Syl *fullSyl = NULL; int ulx, uly, lrx, lry; From 31dcb03c1f003b845fbd43f8e512ebd9e2ffdf94 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 14:49:21 -0400 Subject: [PATCH 083/144] Clean up comments --- src/editortoolkit_neume.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index cfc0b513083..b565321602d 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2400,9 +2400,6 @@ bool EditorToolkitNeume::Group(std::string groupType, std::vector e std::string resultId0; std::string resultId1; - // LogMessage("%s", chainArray.get(0).json().c_str()); - // for_each(elementIds.begin(), elementIds.begin()+idx,[](std::string s){LogMessage("%s", s.c_str());}); - std::vector elementIds0 = { elementIds.begin(), elementIds.begin() + idx }; Group("neume", elementIds0); if (m_editInfo.get("status") == "FAILURE") { From f3a565111fde416729014f189a41f471d2d09633 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 14 Aug 2023 16:56:28 -0400 Subject: [PATCH 084/144] Break when last element --- src/editortoolkit_neume.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index b565321602d..decb9bc5ca6 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2810,6 +2810,7 @@ bool EditorToolkitNeume::Ungroup(std::string groupType, std::vector fparent->ReorderByXPos(); uuidArray << (*it); it = elementIds.erase(it); + if (it == elementIds.end()) break; el = m_doc->GetDrawingPage()->FindDescendantByID(*it); } } From 7b96407768f77f6e0ec7122fdb5163509c82ef9e Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 15 Aug 2023 16:50:29 -0400 Subject: [PATCH 085/144] Reset m_editInfo for OOM error --- src/editortoolkit_neume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index decb9bc5ca6..5a9dd322d76 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -49,7 +49,7 @@ std::string EditorToolkitNeume::EditInfo() bool EditorToolkitNeume::ParseEditorAction(const std::string &json_editorAction) { jsonxx::Object json; - // m_editInfo.reset(); + m_editInfo.reset(); // Read JSON actions if (!json.parse(json_editorAction)) { From 6238cffd718b9e77007932ab6a230d75709ed1b4 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 17 Aug 2023 18:15:41 -0400 Subject: [PATCH 086/144] Refactor new bbox zone && add staff rotation offset --- src/editortoolkit_neume.cpp | 66 ++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 5a9dd322d76..769fc5e0c34 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -858,12 +858,12 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in Syl *syl = new Syl(); Neume *neume = new Neume(); Nc *nc = new Nc(); + Zone *sylZone; std::string contour = ""; nc->AttachZone(zone); Surface *surface = vrv_cast(facsimile->FindDescendantByType(SURFACE)); surface->AddChild(zone); - zone->SetUlx(ulx); Text *text = new Text(); std::u32string str = U""; @@ -875,57 +875,48 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in syllable->AddChild(syl); layer->AddChild(syllable); + const int noteHeight + = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_HEIGHT_TO_STAFF_SIZE_RATIO); + const int noteWidth + = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_WIDTH_TO_STAFF_SIZE_RATIO); + ulx -= noteWidth / 2; + + // calculate staff rotation offset + double theta = staff->GetDrawingRotate(); + int offsetY = 0; + if (theta) { + double factor = 1.3; + offsetY = (int)((ulx - staff->GetFacsimileInterface()->GetZone()->GetUlx()) * tan(theta * M_PI / 180.0) + / factor); + } + + // Set up facsimile + zone->SetUlx(ulx); + zone->SetUly(uly + offsetY); + zone->SetLrx(ulx + noteWidth); + zone->SetLry(uly + offsetY + noteHeight); + // add syl bounding box if Facs if (m_doc->GetType() == Facs) { FacsimileInterface *fi = vrv_cast(syl->GetFacsimileInterface()); assert(fi); - Zone *sylZone = new Zone(); + sylZone = new Zone(); - // calculate bboxUlx and bboxUly wrt rotation using sine rule - int draw_w = staff->GetWidth(); int draw_h = staff->GetHeight(); - double theta = staff->GetDrawingRotate(); int staffUly = staff->GetDrawingY(); - int x = ulx - staff->GetDrawingX(); - int bboxUlx = ulx; - int bboxUly; - // if staff rotates downward to the right - if (theta > 0) { - int y = (int)((draw_w - x) * tan(theta * M_PI / 180.0)); - bboxUly = staffUly + draw_h - y; - } - // if staff rotates upwards to the right - else { - int y = (int)(x * tan(-theta * M_PI / 180.0)); - int h = (int)(draw_w * tan(-theta * M_PI / 180.0)); - bboxUly = staffUly + (draw_h - h) - y; - } // width height and offset can be adjusted - int bboxWidth = 225; int bboxHeight = 175; int bboxOffsetX = 50; - sylZone->SetUlx(bboxUlx - bboxOffsetX); - sylZone->SetUly(bboxUly); - sylZone->SetLrx(bboxUlx + bboxWidth - bboxOffsetX); - sylZone->SetLry(bboxUly + bboxHeight); + sylZone->SetUlx(ulx); + sylZone->SetUly(staffUly + draw_h + offsetY); + sylZone->SetLrx(ulx + noteWidth + bboxOffsetX); + sylZone->SetLry(staffUly + draw_h + offsetY + bboxHeight); surface->AddChild(sylZone); fi->AttachZone(sylZone); } - const int noteHeight - = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_HEIGHT_TO_STAFF_SIZE_RATIO); - const int noteWidth - = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_WIDTH_TO_STAFF_SIZE_RATIO); - ulx -= noteWidth / 2; - // uly -= noteHeight / 2; - // Set up facsimile - zone->SetUlx(ulx); - zone->SetUly(uly); - zone->SetLrx(ulx + noteWidth); - zone->SetLry(uly + noteHeight); - layer->ReorderByXPos(); if (!AdjustPitchFromPosition(syllable)) { @@ -1006,12 +997,13 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in newUly += (newUlx - ulx) * tan(-staff->GetDrawingRotate() * M_PI / 180.0); newZone->SetUlx(newUlx); newZone->SetUly(newUly); - ; newZone->SetLrx(newUlx + noteWidth); newZone->SetLry(newUly + noteHeight); newNc->AttachZone(newZone); + if (sylZone) sylZone->SetLrx(newUlx + noteWidth); + assert(surface); surface->AddChild(newZone); From 7be37548e61310d0b62e265a4e0a93ddeca557db Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 27 Oct 2023 16:32:50 -0400 Subject: [PATCH 087/144] Add empty syl for follows syllable if precedes becomes empty --- src/editortoolkit_neume.cpp | 41 ++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 769fc5e0c34..7bea9763139 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2196,7 +2196,46 @@ bool EditorToolkitNeume::Remove(std::string elementId) = dynamic_cast(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 From b0916d7e41de50fd0066625fcbe26aa2aabdc3e5 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Fri, 1 Dec 2023 17:14:09 -0500 Subject: [PATCH 088/144] Set column value for newly inserted staff if has columns --- src/editortoolkit_neume.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 7bea9763139..1fe7b435ff8 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -783,10 +783,12 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in if (elementType == "staff") { Object *parent; Staff *newStaff; + std::string columnValue; // Use closest existing staff (if there is one) if (staff) { parent = staff->GetParent(); assert(parent); + columnValue = staff->GetType(); int n = parent->GetChildCount() + 1; newStaff = new Staff(n); newStaff->m_drawingStaffDef = staff->m_drawingStaffDef; @@ -811,6 +813,7 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in assert(surface); surface->AddChild(zone); newStaff->AttachZone(zone); + if (columnValue.length()) newStaff->SetType(columnValue); Layer *newLayer = new Layer(); newStaff->AddChild(newLayer); From 8e884fa5b0ca4b6a23c82d3b72aa4a171ce8294f Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 4 Dec 2023 20:38:54 -0500 Subject: [PATCH 089/144] Unlink syllable when removed --- include/vrv/editortoolkit_neume.h | 1 + src/editortoolkit_neume.cpp | 108 +++++++++++++++++------------- 2 files changed, 62 insertions(+), 47 deletions(-) diff --git a/include/vrv/editortoolkit_neume.h b/include/vrv/editortoolkit_neume.h index 108b50e5266..11828f083cb 100644 --- a/include/vrv/editortoolkit_neume.h +++ b/include/vrv/editortoolkit_neume.h @@ -55,6 +55,7 @@ class EditorToolkitNeume : public EditorToolkit { bool Remove(std::string elementId); bool Resize(std::string elementId, int ulx, int uly, int lrx, int lry, float resize = NAN); bool Group(std::string groupType, std::vector elementIds); + void UnlinkSyllable(Syllable *syllable); bool Ungroup(std::string groupType, std::vector elementIds); bool ChangeGroup(std::string elementId, std::string contour); bool ToggleLigature(std::vector elementIds); diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 1fe7b435ff8..d1c4b9de3ed 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2083,6 +2083,58 @@ bool EditorToolkitNeume::Split(std::string elementId, int x) return true; } +void EditorToolkitNeume::UnlinkSyllable(Syllable *syllable) +{ + if (!m_doc->GetDrawingPage()) { + LogError("Could not get the drawing page."); + m_editInfo.import("status", "FAILURE"); + m_editInfo.import("message", "Could not get the drawing page."); + return; + } + + assert(syllable); + + std::string linkedID = (syllable->HasPrecedes() ? syllable->GetPrecedes() : syllable->GetFollows()); + if (linkedID.compare(0, 1, "#") == 0) linkedID.erase(0, 1); + Syllable *linkedSyllable = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(linkedID)); + if (linkedSyllable != NULL) { + if (linkedSyllable->HasPrecedes()) linkedSyllable->SetPrecedes(""); + 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); + } + } + } +} + bool EditorToolkitNeume::Remove(std::string elementId) { if (!m_doc->GetDrawingPage()) { @@ -2155,6 +2207,14 @@ bool EditorToolkitNeume::Remove(std::string elementId) } } + if (obj->Is(SYLLABLE)) { + Syllable *syllable = dynamic_cast(obj); + assert(syllable); + if (syllable->HasPrecedes() || syllable->HasFollows()) { + UnlinkSyllable(syllable); + } + } + if (!result) { result = parent->DeleteChild(obj); } @@ -2193,53 +2253,7 @@ bool EditorToolkitNeume::Remove(std::string elementId) Syllable *li = dynamic_cast(obj); assert(li); if (li->HasPrecedes() || li->HasFollows()) { - std::string linkedID = (li->HasPrecedes() ? li->GetPrecedes() : li->GetFollows()); - if (linkedID.compare(0, 1, "#") == 0) linkedID.erase(0, 1); - Syllable *linkedSyllable - = dynamic_cast(m_doc->GetDrawingPage()->FindDescendantByID(linkedID)); - if (linkedSyllable != NULL) { - if (linkedSyllable->HasPrecedes()) linkedSyllable->SetPrecedes(""); - 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); - } - }; - } + UnlinkSyllable(li); } // Delete the syllable empty of neumes std::string syllableId = obj->GetID(); From f6a7ecfc391aed4678c8df20a1b82a8101918b23 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Mon, 11 Dec 2023 17:14:31 -0500 Subject: [PATCH 090/144] Handle empty staff when inserting new staff --- src/editortoolkit_neume.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index d1c4b9de3ed..7fe8ec86401 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -817,28 +817,27 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in Layer *newLayer = new Layer(); newStaff->AddChild(newLayer); - // Find index to insert new staff - ListOfObjects staves = parent->FindAllDescendantsByType(STAFF, false); - std::vector stavesVector(staves.begin(), staves.end()); - stavesVector.push_back(newStaff); - StaffSort staffSort; - std::stable_sort(stavesVector.begin(), stavesVector.end(), staffSort); - for (int i = 0; i < (int)staves.size(); ++i) { - if (stavesVector.at(i) == newStaff) { - parent->InsertChild(newStaff, i); - parent->Modify(); - - m_editInfo.import("uuid", newStaff->GetID()); - m_editInfo.import("status", status); - m_editInfo.import("message", message); - - return true; + if (staff) { + // Find index to insert new staff + ListOfObjects staves = parent->FindAllDescendantsByType(STAFF, false); + std::vector stavesVector(staves.begin(), staves.end()); + stavesVector.push_back(newStaff); + StaffSort staffSort; + std::stable_sort(stavesVector.begin(), stavesVector.end(), staffSort); + for (int i = 0; i < (int)staves.size(); ++i) { + if (stavesVector.at(i) == newStaff) { + parent->InsertChild(newStaff, i); + parent->Modify(); + + m_editInfo.import("uuid", newStaff->GetID()); + m_editInfo.import("status", status); + m_editInfo.import("message", message); + + return true; + } } } - LogWarning("Failed to insert newStaff into staff"); - message += "Failed to insert newStaff into staves."; parent->AddChild(newStaff); - parent->Modify(); m_editInfo.import("uuid", newStaff->GetID()); m_editInfo.import("status", status); From bcbde28d54f075e8b7507b4cc7ec21258e493802 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 12 Dec 2023 17:06:45 -0500 Subject: [PATCH 091/144] New for blank files in neume notation --- src/iomei.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/iomei.cpp b/src/iomei.cpp index aaa69f00c64..3a5fd146a75 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -4472,6 +4472,13 @@ bool MEIInput::ReadSectionChildren(Object *parent, pugi::xml_node parentNode) LogWarning("Unsupported '<%s>' within
", current.name()); } } + + // New for blank files in neume notation + if (!unmeasured && parent->Is(SECTION) && (m_doc->m_notationType == NOTATIONTYPE_neume)) { + unmeasured = new Measure(false); + m_doc->SetMensuralMusicOnly(true); + parent->AddChild(unmeasured); + } return success; } From 4a1c61fa96f68fdd7b4d23b3c969b3fcc9b8e2b9 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Tue, 19 Dec 2023 16:37:58 -0500 Subject: [PATCH 092/144] Fix removing clef error --- src/editortoolkit_neume.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index 7fe8ec86401..b80c98efcac 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -2145,10 +2145,11 @@ bool EditorToolkitNeume::Remove(std::string elementId) Object *obj = m_doc->GetDrawingPage()->FindDescendantByID(elementId); assert(obj); bool result = false; - bool isNeumeOrNc, isNc, isClef; + bool isNeumeOrNc, isNc, isClef, isSyllable; isNeumeOrNc = (obj->Is(NC) || obj->Is(NEUME)); isNc = obj->Is(NC); isClef = obj->Is(CLEF); + isSyllable = obj->Is(SYLLABLE); Object *parent = obj->GetParent(); assert(parent); m_editInfo.import("uuid", elementId); @@ -2205,8 +2206,7 @@ bool EditorToolkitNeume::Remove(std::string elementId) pi->AdjustPitchForNewClef(clef, previousClef); } } - - if (obj->Is(SYLLABLE)) { + else if (isSyllable) { Syllable *syllable = dynamic_cast(obj); assert(syllable); if (syllable->HasPrecedes() || syllable->HasFollows()) { From 6ed5103e3c439bc7b7d55c61ebdb9c588767f4e1 Mon Sep 17 00:00:00 2001 From: Yinan Zhou Date: Thu, 21 Dec 2023 16:07:26 -0500 Subject: [PATCH 093/144] Fix staff rotation offset for inserted syllables --- src/editortoolkit_neume.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/editortoolkit_neume.cpp b/src/editortoolkit_neume.cpp index b80c98efcac..2b1d30f6dc8 100644 --- a/src/editortoolkit_neume.cpp +++ b/src/editortoolkit_neume.cpp @@ -881,22 +881,12 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_HEIGHT_TO_STAFF_SIZE_RATIO); const int noteWidth = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_WIDTH_TO_STAFF_SIZE_RATIO); - ulx -= noteWidth / 2; - - // calculate staff rotation offset - double theta = staff->GetDrawingRotate(); - int offsetY = 0; - if (theta) { - double factor = 1.3; - offsetY = (int)((ulx - staff->GetFacsimileInterface()->GetZone()->GetUlx()) * tan(theta * M_PI / 180.0) - / factor); - } // Set up facsimile zone->SetUlx(ulx); - zone->SetUly(uly + offsetY); + zone->SetUly(uly); zone->SetLrx(ulx + noteWidth); - zone->SetLry(uly + offsetY + noteHeight); + zone->SetLry(uly + noteHeight); // add syl bounding box if Facs if (m_doc->GetType() == Facs) { @@ -904,17 +894,25 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in assert(fi); sylZone = new Zone(); - int draw_h = staff->GetHeight(); - int staffUly = staff->GetDrawingY(); + int staffLry = staff->GetFacsimileInterface()->GetZone()->GetLry(); // width height and offset can be adjusted int bboxHeight = 175; int bboxOffsetX = 50; + // calculate staff rotation offset + double theta = staff->GetDrawingRotate(); + int offsetY = 0; + if (theta) { + double factor = 1.3; + offsetY = (int)((ulx - staff->GetFacsimileInterface()->GetZone()->GetUlx()) * tan(theta * M_PI / 180.0) + / factor); + } + sylZone->SetUlx(ulx); - sylZone->SetUly(staffUly + draw_h + offsetY); + sylZone->SetUly(staffLry + offsetY); sylZone->SetLrx(ulx + noteWidth + bboxOffsetX); - sylZone->SetLry(staffUly + draw_h + offsetY + bboxHeight); + sylZone->SetLry(staffLry + offsetY + bboxHeight); surface->AddChild(sylZone); fi->AttachZone(sylZone); } From 3b005e8391a78478870c0ca1cc912f2bc7e8de27 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 09:23:17 +0100 Subject: [PATCH 094/144] Add Doc::IsFacs helper (and others) and use it --- include/vrv/doc.h | 4 ++++ src/doc.cpp | 8 ++++---- src/iomei.cpp | 2 +- src/layer.cpp | 2 +- src/layerelement.cpp | 4 ++-- src/staff.cpp | 8 ++++---- src/view.cpp | 2 +- src/view_element.cpp | 16 ++++++++-------- src/view_neume.cpp | 12 ++++++------ src/view_page.cpp | 4 ++-- 10 files changed, 33 insertions(+), 29 deletions(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index d32fd434a3b..3952633bb49 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -114,6 +114,10 @@ class Doc : public Object { ///@{ DocType GetType() const { return m_type; } void SetType(DocType type); + bool IsFacs() const { return (m_type == Facs); } + bool IsRaw() const { return (m_type == Raw); } + bool IsRendering() const { return (m_type == Rendering); } + bool IsTranscription() const { return (m_type == Transcription); } ///@} /** diff --git a/src/doc.cpp b/src/doc.cpp index e1dc8fb97de..19a52cf8215 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -869,7 +869,7 @@ void Doc::PrepareData() } /************ Resolve @facs ************/ - if (this->GetType() == Facs) { + if (this->IsFacs()) { // Associate zones with elements PrepareFacsimileFunctor prepareFacsimile(this->GetFacsimile()); this->Process(prepareFacsimile); @@ -1284,7 +1284,7 @@ void Doc::ConvertToCastOffMensuralDoc(bool castOff) if (this->GetType() == Transcription) return; // Do not convert facs files - if (this->GetType() == Facs) return; + if (this->IsFacs()) return; // We are converting to measure music in a definite way if (this->GetOptions()->m_mensuralToMeasure.GetValue()) { @@ -2088,7 +2088,7 @@ int Doc::GetAdjustedDrawingPageHeight() const { assert(m_drawingPage); - if ((this->GetType() == Transcription) || (this->GetType() == Facs)) { + if ((this->GetType() == Transcription) || this->IsFacs()) { return m_drawingPage->m_pageHeight / DEFINITION_FACTOR; } @@ -2100,7 +2100,7 @@ int Doc::GetAdjustedDrawingPageWidth() const { assert(m_drawingPage); - if ((this->GetType() == Transcription) || (this->GetType() == Facs)) { + if ((this->GetType() == Transcription) || this->IsFacs()) { return m_drawingPage->m_pageWidth / DEFINITION_FACTOR; } diff --git a/src/iomei.cpp b/src/iomei.cpp index aaa69f00c64..ed8028cf3f7 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -6940,7 +6940,7 @@ bool MEIInput::ReadStem(Object *parent, pugi::xml_node stem) bool MEIInput::ReadSyl(Object *parent, pugi::xml_node syl) { // Add empty text node for empty syl element for invisible bbox in neume notation - if (!syl.first_child() && (m_doc->GetType() == Facs) && (m_doc->m_notationType == NOTATIONTYPE_neume)) { + if (!syl.first_child() && m_doc->IsFacs() && (m_doc->m_notationType == NOTATIONTYPE_neume)) { syl.text().set(""); } Syl *vrvSyl = new Syl(); diff --git a/src/layer.cpp b/src/layer.cpp index a2ea2da1ba4..a05d48903f1 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -273,7 +273,7 @@ const Clef *Layer::GetClefFacs(const LayerElement *test) const { const Doc *doc = vrv_cast(this->GetFirstAncestor(DOC)); assert(doc); - if (doc->GetType() == Facs) { + if (doc->IsFacs()) { ListOfConstObjects clefs; ClassIdComparison ac(CLEF); doc->FindAllDescendantsBetween(&clefs, &ac, doc->GetFirst(CLEF), test); diff --git a/src/layerelement.cpp b/src/layerelement.cpp index 589bc8e4dd9..90d453f4569 100644 --- a/src/layerelement.cpp +++ b/src/layerelement.cpp @@ -400,7 +400,7 @@ int LayerElement::GetDrawingX() const if (this->HasFacs()) { const Doc *doc = vrv_cast(this->GetFirstAncestor(DOC)); assert(doc); - if (doc->GetType() == Facs) { + if (doc->IsFacs()) { return FacsimileInterface::GetDrawingX(); } } @@ -448,7 +448,7 @@ int LayerElement::GetDrawingY() const if (this->HasFacs()) { const Doc *doc = vrv_cast(this->GetFirstAncestor(DOC)); assert(doc); - if (doc->GetType() == Facs) { + if (doc->IsFacs()) { return FacsimileInterface::GetDrawingY(); } } diff --git a/src/staff.cpp b/src/staff.cpp index 3d91195fea9..9a01f64d063 100644 --- a/src/staff.cpp +++ b/src/staff.cpp @@ -125,7 +125,7 @@ int Staff::GetDrawingX() const if (this->HasFacs()) { const Doc *doc = vrv_cast(this->GetFirstAncestor(DOC)); assert(doc); - if (doc->GetType() == Facs) { + if (doc->IsFacs()) { return FacsimileInterface::GetDrawingX(); } } @@ -137,7 +137,7 @@ int Staff::GetDrawingY() const if (this->HasFacs()) { const Doc *doc = vrv_cast(this->GetFirstAncestor(DOC)); assert(DOC); - if (doc->GetType() == Facs) { + if (doc->IsFacs()) { return FacsimileInterface::GetDrawingY(); } } @@ -160,7 +160,7 @@ double Staff::GetDrawingRotate() const if (this->HasFacs()) { const Doc *doc = vrv_cast(this->GetFirstAncestor(DOC)); assert(doc); - if (doc->GetType() == Facs) { + if (doc->IsFacs()) { return FacsimileInterface::GetDrawingRotate(); } } @@ -172,7 +172,7 @@ void Staff::AdjustDrawingStaffSize() if (this->HasFacs()) { Doc *doc = vrv_cast(this->GetFirstAncestor(DOC)); assert(doc); - if (doc->GetType() == Facs) { + if (doc->IsFacs()) { double rotate = this->GetDrawingRotate(); Zone *zone = this->GetZone(); assert(zone); diff --git a/src/view.cpp b/src/view.cpp index f9ee518f1eb..f474d7c3b8a 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -74,7 +74,7 @@ void View::SetPage(int pageIdx, bool doLayout) m_doc->ScoreDefSetCurrentDoc(); // if we once deal with multiple views, it would be better // to redo the layout only when necessary? - if (m_doc->GetType() == Transcription || m_doc->GetType() == Facs) { + if (m_doc->GetType() == Transcription || m_doc->IsFacs()) { m_currentPage->LayOutTranscription(); } else { diff --git a/src/view_element.cpp b/src/view_element.cpp index c970d76b031..eab43c14a38 100644 --- a/src/view_element.cpp +++ b/src/view_element.cpp @@ -301,12 +301,12 @@ void View::DrawAccid(DeviceContext *dc, LayerElement *element, Layer *layer, Sta if (notationType == NOTATIONTYPE_neume) { int rotateOffset = 0; - if ((m_doc->GetType() == Facs) && (staff->GetDrawingRotate() != 0)) { + if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) { double deg = staff->GetDrawingRotate(); int xDiff = x - staff->GetDrawingX(); rotateOffset = int(xDiff * tan(deg * M_PI / 180.0)); } - if (accid->HasFacs() && (m_doc->GetType() == Facs)) { + if (accid->HasFacs() && m_doc->IsFacs()) { y = ToLogicalY(y); } y -= rotateOffset; @@ -671,7 +671,7 @@ void View::DrawClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staf if (clef->HasLine()) { y -= m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) * (staff->m_drawingLines - clef->GetLine()); - if ((m_doc->GetType() == Facs) && (staff->GetDrawingRotate() != 0)) { + if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) { double deg = staff->GetDrawingRotate(); int xDiff = x - staff->GetDrawingX(); y -= int(xDiff * tan(deg * M_PI / 180.0)); @@ -689,7 +689,7 @@ void View::DrawClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staf this->DrawSmuflCode(dc, x, y, sym, staff->m_drawingStaffSize, false); - if ((m_doc->GetType() == Facs) && element->HasFacs()) { + if (m_doc->IsFacs() && element->HasFacs()) { const int noteHeight = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_HEIGHT_TO_STAFF_SIZE_RATIO); const int noteWidth @@ -748,7 +748,7 @@ void View::DrawCustos(DeviceContext *dc, LayerElement *element, Layer *layer, St const int sym = custos->GetCustosGlyph(staff->m_drawingNotationType); int x, y; - if (custos->HasFacs() && m_doc->GetType() == Facs) { + if (custos->HasFacs() && m_doc->IsFacs()) { x = custos->GetDrawingX(); // Recalculate y from pitch to prevent visual/meaning mismatch Clef *clef = layer->GetClef(element); @@ -777,7 +777,7 @@ void View::DrawCustos(DeviceContext *dc, LayerElement *element, Layer *layer, St y -= m_doc->GetDrawingUnit(staff->m_drawingStaffSize); } - if ((m_doc->GetType() == Facs) && (staff->GetDrawingRotate() != 0)) { + if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) { double deg = staff->GetDrawingRotate(); int xDiff = x - staff->GetDrawingX(); y -= int(xDiff * tan(deg * M_PI / 180.0)); @@ -785,7 +785,7 @@ void View::DrawCustos(DeviceContext *dc, LayerElement *element, Layer *layer, St this->DrawSmuflCode(dc, x, y, sym, staff->m_drawingStaffSize, false, true); - if ((m_doc->GetType() == Facs) && element->HasFacs()) { + if (m_doc->IsFacs() && element->HasFacs()) { const int noteHeight = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / 2); const int noteWidth = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / 1.4); @@ -1770,7 +1770,7 @@ void View::DrawSyl(DeviceContext *dc, LayerElement *element, Layer *layer, Staff TextDrawingParams params; params.m_x = syl->GetDrawingX(); params.m_y = syl->GetDrawingY(); - if (m_doc->GetType() == Facs) { + if (m_doc->IsFacs()) { params.m_width = syl->GetDrawingWidth(); params.m_height = syl->GetDrawingHeight(); } diff --git a/src/view_neume.cpp b/src/view_neume.cpp index cbdf0b8c624..eeeaed614b1 100644 --- a/src/view_neume.cpp +++ b/src/view_neume.cpp @@ -204,12 +204,12 @@ void View::DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff = (int)(m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) / NOTE_WIDTH_TO_STAFF_SIZE_RATIO); int noteY, noteX; int yValue; - if (nc->HasFacs() && (m_doc->GetType() == Facs)) { + if (nc->HasFacs() && m_doc->IsFacs()) { noteY = ToLogicalY(staff->GetDrawingY()); noteX = nc->GetDrawingX(); params.at(0).xOffset = 0; } - else if (neume->HasFacs() && (m_doc->GetType() == Facs)) { + else if (neume->HasFacs() && m_doc->IsFacs()) { noteY = ToLogicalY(staff->GetDrawingY()); noteX = neume->GetDrawingX() + position * noteWidth; } @@ -229,7 +229,7 @@ void View::DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff } int octaveOffset = (nc->GetOct() - clefOctave) * ((staffSize / 2) * 7); int rotateOffset; - if ((m_doc->GetType() == Facs) && (staff->GetDrawingRotate() != 0)) { + if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) { double deg = staff->GetDrawingRotate(); int xDiff = noteX - staff->GetDrawingX(); rotateOffset = int(xDiff * tan(deg * M_PI / 180.0)); @@ -265,7 +265,7 @@ void View::DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff } // adjust facsimile values of element based on where it is rendered if necessary - if ((m_doc->GetType() == Facs) && element->HasFacs()) { + if (m_doc->IsFacs() && element->HasFacs()) { FacsimileInterface *fi = element->GetFacsimileInterface(); fi->GetZone()->SetUlx(noteX); fi->GetZone()->SetUly(ToDeviceContextY(yValue)); @@ -380,7 +380,7 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S } int x, y; - if ((m_doc->GetType() == Facs) && (divLine->HasFacs())) { + if (m_doc->IsFacs() && (divLine->HasFacs())) { x = divLine->GetDrawingX(); y = ToLogicalY(staff->GetDrawingY()); } @@ -393,7 +393,7 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S y -= (m_doc->GetDrawingUnit(staff->m_drawingStaffSize)) * 3; int rotateOffset; - if ((m_doc->GetType() == Facs) && (staff->GetDrawingRotate() != 0)) { + if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) { double deg = staff->GetDrawingRotate(); int xDiff = x - staff->GetDrawingX(); rotateOffset = int(xDiff * tan(deg * M_PI / 180.0)); diff --git a/src/view_page.cpp b/src/view_page.cpp index 7a49126257c..51d8b78be5c 100644 --- a/src/view_page.cpp +++ b/src/view_page.cpp @@ -1238,7 +1238,7 @@ void View::DrawStaff(DeviceContext *dc, Staff *staff, Measure *measure, System * dc->StartGraphic(staff, "", staff->GetID()); - if (m_doc->GetType() == Facs) { + if (m_doc->IsFacs()) { staff->SetFromFacsimile(m_doc); } @@ -1283,7 +1283,7 @@ void View::DrawStaffLines(DeviceContext *dc, Staff *staff, Measure *measure, Sys int j, x1, x2, y1, y2; - if (staff->HasFacs() && (m_doc->GetType() == Facs)) { + if (staff->HasFacs() && m_doc->IsFacs()) { double d = staff->GetDrawingRotate(); x1 = staff->GetDrawingX(); x2 = x1 + staff->GetWidth(); From a2667ae15381bd5b08123bdd44c4336e54df933e Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 09:31:29 +0100 Subject: [PATCH 095/144] Use Doc::IsTranscription helper --- src/doc.cpp | 6 +++--- src/iomei.cpp | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/doc.cpp b/src/doc.cpp index 19a52cf8215..8d1710d09e3 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -1281,7 +1281,7 @@ void Doc::ConvertToCastOffMensuralDoc(bool castOff) if (!m_isMensuralMusicOnly) return; // Do not convert transcription files - if (this->GetType() == Transcription) return; + if (this->IsTranscription()) return; // Do not convert facs files if (this->IsFacs()) return; @@ -2088,7 +2088,7 @@ int Doc::GetAdjustedDrawingPageHeight() const { assert(m_drawingPage); - if ((this->GetType() == Transcription) || this->IsFacs()) { + if (this->IsTranscription() || this->IsFacs()) { return m_drawingPage->m_pageHeight / DEFINITION_FACTOR; } @@ -2100,7 +2100,7 @@ int Doc::GetAdjustedDrawingPageWidth() const { assert(m_drawingPage); - if ((this->GetType() == Transcription) || this->IsFacs()) { + if (this->IsTranscription() || this->IsFacs()) { return m_drawingPage->m_pageWidth / DEFINITION_FACTOR; } diff --git a/src/iomei.cpp b/src/iomei.cpp index ed8028cf3f7..07ed3f6ce56 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -4141,7 +4141,7 @@ bool MEIInput::ReadPage(Object *parent, pugi::xml_node page) Page *vrvPage = new Page(); this->SetMeiID(page, vrvPage); - if ((m_doc->GetType() == Transcription) && (m_meiversion == meiVersion_MEIVERSION_2013)) { + if (m_doc->IsTranscription() && (m_meiversion == meiVersion_MEIVERSION_2013)) { UpgradePageTo_3_0_0(vrvPage, m_doc); } @@ -4180,12 +4180,12 @@ bool MEIInput::ReadPage(Object *parent, pugi::xml_node page) parent->AddChild(vrvPage); bool success = this->ReadPageChildren(vrvPage, page); - if (success && (m_doc->GetType() == Transcription) && (vrvPage->GetPPUFactor() != 1.0)) { + if (success && m_doc->IsTranscription() && (vrvPage->GetPPUFactor() != 1.0)) { ApplyPPUFactorFunctor applyPPUFactor; vrvPage->Process(applyPPUFactor); } - if ((m_doc->GetType() == Transcription) && (m_meiversion == meiVersion_MEIVERSION_2013)) { + if (m_doc->IsTranscription() && (m_meiversion == meiVersion_MEIVERSION_2013)) { UpgradePageTo_5_0(vrvPage); } @@ -4563,7 +4563,7 @@ bool MEIInput::ReadSystem(Object *parent, pugi::xml_node system) vrvSystem->m_systemRightMar = system.attribute("system.rightmar").as_int(); system.remove_attribute("system.rightmar"); } - if (system.attribute("uly") && (m_doc->GetType() == Transcription)) { + if (system.attribute("uly") && m_doc->IsTranscription()) { vrvSystem->m_yAbs = system.attribute("uly").as_int() * DEFINITION_FACTOR; system.remove_attribute("uly"); } @@ -4612,7 +4612,7 @@ bool MEIInput::ReadSystemChildren(Object *parent, pugi::xml_node parentNode) assert(system); unmeasured = new Measure(false); m_doc->SetMensuralMusicOnly(true); - if ((m_doc->GetType() == Transcription) && (m_meiversion == meiVersion_MEIVERSION_2013)) { + if (m_doc->IsTranscription() && (m_meiversion == meiVersion_MEIVERSION_2013)) { UpgradeMeasureTo_3_0_0(unmeasured, system); } system->AddChild(unmeasured); @@ -5348,11 +5348,11 @@ bool MEIInput::ReadMeasure(Object *parent, pugi::xml_node measure) vrvMeasure->ReadPointing(measure); vrvMeasure->ReadTyped(measure); - if ((m_doc->GetType() == Transcription) && (m_meiversion == meiVersion_MEIVERSION_2013)) { + if (m_doc->IsTranscription() && (m_meiversion == meiVersion_MEIVERSION_2013)) { UpgradeMeasureTo_5_0(measure); } - if (measure.attribute("coord.x1") && measure.attribute("coord.x2") && (m_doc->GetType() == Transcription)) { + if (measure.attribute("coord.x1") && measure.attribute("coord.x2") && m_doc->IsTranscription()) { vrvMeasure->ReadCoordX1(measure); vrvMeasure->ReadCoordX2(measure); vrvMeasure->m_xAbs = vrvMeasure->GetCoordX1() * DEFINITION_FACTOR; @@ -6042,11 +6042,11 @@ bool MEIInput::ReadStaff(Object *parent, pugi::xml_node staff) vrvStaff->ReadTyped(staff); vrvStaff->ReadVisibility(staff); - if ((m_doc->GetType() == Transcription) && (m_meiversion == meiVersion_MEIVERSION_2013)) { + if (m_doc->IsTranscription() && (m_meiversion == meiVersion_MEIVERSION_2013)) { UpgradeStaffTo_5_0(staff); } - if (staff.attribute("coord.y1") && (m_doc->GetType() == Transcription)) { + if (staff.attribute("coord.y1") && m_doc->IsTranscription()) { vrvStaff->ReadCoordY1(staff); vrvStaff->m_yAbs = vrvStaff->GetCoordY1() * DEFINITION_FACTOR; } @@ -6281,11 +6281,11 @@ bool MEIInput::ReadLayerElement(pugi::xml_node element, LayerElement *object) object->ReadLabelled(element); object->ReadTyped(element); - if ((m_doc->GetType() == Transcription) && (m_meiversion == meiVersion_MEIVERSION_2013)) { + if (m_doc->IsTranscription() && (m_meiversion == meiVersion_MEIVERSION_2013)) { UpgradeLayerElementTo_5_0(element); } - if (element.attribute("coord.x1") && (m_doc->GetType() == Transcription)) { + if (element.attribute("coord.x1") && m_doc->IsTranscription()) { object->ReadCoordX1(element); object->m_xAbs = object->GetCoordX1() * DEFINITION_FACTOR; } From 28b980855fb3e381f78477b207e2ce2439d6b8f5 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 09:38:25 +0100 Subject: [PATCH 096/144] Use Doc type helpers in Toolkit and in DrawClef --- src/toolkit.cpp | 10 +++++----- src/view_element.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/toolkit.cpp b/src/toolkit.cpp index cb8fe6e8ada..bcfd058ebe3 100644 --- a/src/toolkit.cpp +++ b/src/toolkit.cpp @@ -751,7 +751,7 @@ bool Toolkit::LoadData(const std::string &data) // Always set breaks to 'none' with Transcription or Facs rendering - rendering them differenty requires the MEI // to be converted - if (m_doc.GetType() == Transcription || m_doc.GetType() == Facs) breaks = BREAKS_none; + if (m_doc.IsTranscription() || m_doc.IsFacs()) breaks = BREAKS_none; if (breaks != BREAKS_none) { if (input->GetLayoutInformation() == LAYOUT_ENCODED @@ -1402,7 +1402,7 @@ void Toolkit::RedoLayout(const std::string &jsonOptions) this->ResetLogBuffer(); - if ((this->GetPageCount() == 0) || (m_doc.GetType() == Transcription) || (m_doc.GetType() == Facs)) { + if ((this->GetPageCount() == 0) || m_doc.IsTranscription() || m_doc.IsFacs()) { LogWarning("No data to re-layout"); return; } @@ -1465,7 +1465,7 @@ bool Toolkit::RenderToDeviceContext(int pageNo, DeviceContext *deviceContext) if (adjustWidth || (breaks == BREAKS_none)) width = m_doc.GetAdjustedDrawingPageWidth(); if (adjustHeight || (breaks == BREAKS_none)) height = m_doc.GetAdjustedDrawingPageHeight(); - if (m_doc.GetType() == Transcription) { + if (m_doc.IsTranscription()) { width = m_doc.GetAdjustedDrawingPageWidth(); height = m_doc.GetAdjustedDrawingPageHeight(); } @@ -1488,7 +1488,7 @@ bool Toolkit::RenderToDeviceContext(int pageNo, DeviceContext *deviceContext) deviceContext->SetWidth(width); deviceContext->SetHeight(height); - if (m_doc.GetType() == Facs) { + if (m_doc.IsFacs()) { deviceContext->SetWidth(m_doc.GetFacsimile()->GetMaxX()); deviceContext->SetHeight(m_doc.GetFacsimile()->GetMaxY()); } @@ -1524,7 +1524,7 @@ std::string Toolkit::RenderToSVG(int pageNo, bool xmlDeclaration) svg.SetMMOutput(true); } - if (m_doc.GetType() == Facs) { + if (m_doc.IsFacs()) { svg.SetFacsimile(true); } diff --git a/src/view_element.cpp b/src/view_element.cpp index eab43c14a38..82ba0443207 100644 --- a/src/view_element.cpp +++ b/src/view_element.cpp @@ -653,7 +653,7 @@ void View::DrawClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staf } int x, y; - if (m_doc->GetType() == Facs && clef->HasFacs()) { + if (m_doc->IsFacs() && clef->HasFacs()) { y = ToLogicalY(staff->GetDrawingY()); x = clef->GetDrawingX(); } From b071364e2c374b24c99da8cf12f4db1a3bef3f39 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 10:02:30 +0100 Subject: [PATCH 097/144] Remove unnecessary check in FacsimileInterface::GetSurfaceY * Same check is performed in Surface::GetMaxY --- src/facsimileinterface.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/facsimileinterface.cpp b/src/facsimileinterface.cpp index 6ef3a50b88a..420b18be836 100644 --- a/src/facsimileinterface.cpp +++ b/src/facsimileinterface.cpp @@ -79,12 +79,7 @@ int FacsimileInterface::GetSurfaceY() const assert(m_zone); Surface *surface = vrv_cast(m_zone->GetFirstAncestor(SURFACE)); assert(surface); - if (surface->HasLry()) { - return surface->GetLry(); - } - else { - return surface->GetMaxY(); - } + return surface->GetMaxY(); } void FacsimileInterface::AttachZone(Zone *zone) From d8600ed22957539dc191f82060141a95af8162e2 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 10:37:59 +0100 Subject: [PATCH 098/144] Read and write `staff@facs` through Read/WriteFacsimileInterface * Also remove call to Read/WriteFacsimileInterface in LayerElement child classes --- src/iomei.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/iomei.cpp b/src/iomei.cpp index 07ed3f6ce56..ba53ace1cb0 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -2216,7 +2216,7 @@ void MEIOutput::WriteStaff(pugi::xml_node currentNode, Staff *staff) assert(staff); this->WriteXmlId(currentNode, staff); - staff->WriteFacsimile(currentNode); + this->WriteFacsimileInterface(currentNode, staff); staff->WriteNInteger(currentNode); staff->WriteTyped(currentNode); staff->WriteVisibility(currentNode); @@ -2298,6 +2298,7 @@ void MEIOutput::WriteLayerElement(pugi::xml_node currentNode, LayerElement *elem assert(element); this->WriteXmlId(currentNode, element); + this->WriteFacsimileInterface(currentNode, element); this->WriteLinkingInterface(currentNode, element); element->WriteLabelled(currentNode); element->WriteTyped(currentNode); @@ -2320,7 +2321,6 @@ void MEIOutput::WriteAccid(pugi::xml_node currentNode, Accid *accid) } WriteLayerElement(currentNode, accid); - WriteFacsimileInterface(currentNode, accid); WritePositionInterface(currentNode, accid); accid->WriteAccidental(currentNode); accid->WriteAccidentalGes(currentNode); @@ -2433,7 +2433,6 @@ void MEIOutput::WriteClef(pugi::xml_node currentNode, Clef *clef) } this->WriteLayerElement(currentNode, clef); - this->WriteFacsimileInterface(currentNode, clef); clef->WriteClefLog(currentNode); clef->WriteClefShape(currentNode); clef->WriteColor(currentNode); @@ -2451,7 +2450,6 @@ void MEIOutput::WriteCustos(pugi::xml_node currentNode, Custos *custos) { assert(custos); - this->WriteFacsimileInterface(currentNode, custos); this->WritePitchInterface(currentNode, custos); this->WritePositionInterface(currentNode, custos); this->WriteLayerElement(currentNode, custos); @@ -2465,7 +2463,6 @@ void MEIOutput::WriteDivLine(pugi::xml_node currentNode, DivLine *divLine) assert(divLine); this->WriteLayerElement(currentNode, divLine); - this->WriteFacsimileInterface(currentNode, divLine); divLine->WriteDivLineLog(currentNode); divLine->WriteColor(currentNode); divLine->WriteVisibility(currentNode); @@ -2698,7 +2695,6 @@ void MEIOutput::WriteNc(pugi::xml_node currentNode, Nc *nc) this->WriteLayerElement(currentNode, nc); this->WriteDurationInterface(currentNode, nc); - this->WriteFacsimileInterface(currentNode, nc); this->WritePitchInterface(currentNode, nc); this->WritePositionInterface(currentNode, nc); nc->WriteColor(currentNode); @@ -2711,7 +2707,6 @@ void MEIOutput::WriteNeume(pugi::xml_node currentNode, Neume *neume) assert(neume); this->WriteLayerElement(currentNode, neume); - this->WriteFacsimileInterface(currentNode, neume); neume->WriteColor(currentNode); } @@ -2830,7 +2825,6 @@ void MEIOutput::WriteSyl(pugi::xml_node currentNode, Syl *syl) assert(syl); this->WriteLayerElement(currentNode, syl); - this->WriteFacsimileInterface(currentNode, syl); syl->WriteLang(currentNode); syl->WriteTypography(currentNode); syl->WriteSylLog(currentNode); @@ -6036,8 +6030,8 @@ bool MEIInput::ReadStaff(Object *parent, pugi::xml_node staff) { Staff *vrvStaff = new Staff(); this->SetMeiID(staff, vrvStaff); + this->ReadFacsimileInterface(staff, vrvStaff); - vrvStaff->ReadFacsimile(staff); vrvStaff->ReadNInteger(staff); vrvStaff->ReadTyped(staff); vrvStaff->ReadVisibility(staff); @@ -6277,6 +6271,7 @@ bool MEIInput::ReadLayerChildren(Object *parent, pugi::xml_node parentNode, Obje bool MEIInput::ReadLayerElement(pugi::xml_node element, LayerElement *object) { this->SetMeiID(element, object); + this->ReadFacsimileInterface(element, object); this->ReadLinkingInterface(element, object); object->ReadLabelled(element); object->ReadTyped(element); @@ -6299,7 +6294,6 @@ bool MEIInput::ReadAccid(Object *parent, pugi::xml_node accid) this->ReadLayerElement(accid, vrvAccid); ReadPositionInterface(accid, vrvAccid); - ReadFacsimileInterface(accid, vrvAccid); vrvAccid->ReadAccidental(accid); vrvAccid->ReadAccidentalGes(accid); vrvAccid->ReadAccidLog(accid); @@ -6444,7 +6438,6 @@ bool MEIInput::ReadClef(Object *parent, pugi::xml_node clef) { Clef *vrvClef = new Clef(); this->ReadLayerElement(clef, vrvClef); - this->ReadFacsimileInterface(clef, vrvClef); vrvClef->ReadClefLog(clef); vrvClef->ReadClefShape(clef); @@ -6502,7 +6495,6 @@ bool MEIInput::ReadDivLine(Object *parent, pugi::xml_node divLine) DivLine *vrvDivLine = new DivLine(); this->ReadLayerElement(divLine, vrvDivLine); - this->ReadFacsimileInterface(divLine, vrvDivLine); vrvDivLine->ReadDivLineLog(divLine); vrvDivLine->ReadColor(divLine); vrvDivLine->ReadVisibility(divLine); @@ -6785,7 +6777,6 @@ bool MEIInput::ReadNc(Object *parent, pugi::xml_node nc) this->ReadLayerElement(nc, vrvNc); this->ReadDurationInterface(nc, vrvNc); - this->ReadFacsimileInterface(nc, vrvNc); this->ReadPitchInterface(nc, vrvNc); this->ReadPositionInterface(nc, vrvNc); vrvNc->ReadColor(nc); @@ -6800,7 +6791,6 @@ bool MEIInput::ReadNeume(Object *parent, pugi::xml_node neume) { Neume *vrvNeume = new Neume(); this->ReadLayerElement(neume, vrvNeume); - this->ReadFacsimileInterface(neume, vrvNeume); vrvNeume->ReadColor(neume); From 24bc829ff1e29163177c4a24eecab8586b50e4f5 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 10:40:02 +0100 Subject: [PATCH 099/144] Add FacsimileInterface to Measure --- include/vrv/measure.h | 2 ++ src/iomei.cpp | 3 +++ src/measure.cpp | 3 +++ 3 files changed, 8 insertions(+) diff --git a/include/vrv/measure.h b/include/vrv/measure.h index e9fe0cef9ca..f431913b8a3 100644 --- a/include/vrv/measure.h +++ b/include/vrv/measure.h @@ -11,6 +11,7 @@ #include "atts_cmn.h" #include "atts_shared.h" #include "barline.h" +#include "facsimileinterface.h" #include "horizontalaligner.h" #include "object.h" @@ -34,6 +35,7 @@ class TimestampAttr; * For internally simplication of processing, unmeasured music is contained in one single measure object */ class Measure : public Object, + public FacsimileInterface, public AttBarring, public AttCoordX1, public AttCoordX2, diff --git a/src/iomei.cpp b/src/iomei.cpp index ba53ace1cb0..e612b02b1c9 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -1883,6 +1883,8 @@ void MEIOutput::WriteMeasure(pugi::xml_node currentNode, Measure *measure) assert(measure); this->WriteXmlId(currentNode, measure); + this->WriteFacsimileInterface(currentNode, measure); + measure->WriteBarring(currentNode); measure->WriteMeasureLog(currentNode); measure->WriteMeterConformanceBar(currentNode); @@ -5334,6 +5336,7 @@ bool MEIInput::ReadMeasure(Object *parent, pugi::xml_node measure) m_doc->SetMensuralMusicOnly(false); } this->SetMeiID(measure, vrvMeasure); + this->ReadFacsimileInterface(measure, vrvMeasure); vrvMeasure->ReadBarring(measure); vrvMeasure->ReadMeasureLog(measure); diff --git a/src/measure.cpp b/src/measure.cpp index b6cff691a5a..3e5cf77f2db 100644 --- a/src/measure.cpp +++ b/src/measure.cpp @@ -56,6 +56,7 @@ static const ClassRegistrar s_factory("measure", MEASURE); Measure::Measure(bool measureMusic, int logMeasureNb) : Object(MEASURE, "measure-") + , FacsimileInterface() , AttBarring() , AttCoordX1() , AttCoordX2() @@ -73,6 +74,7 @@ Measure::Measure(bool measureMusic, int logMeasureNb) this->RegisterAttClass(ATT_NNUMBERLIKE); this->RegisterAttClass(ATT_POINTING); this->RegisterAttClass(ATT_TYPED); + this->RegisterInterface(FacsimileInterface::GetAttClasses(), FacsimileInterface::IsInterface()); m_measuredMusic = measureMusic; @@ -121,6 +123,7 @@ void Measure::CloneReset() void Measure::Reset() { Object::Reset(); + FacsimileInterface::Reset(); this->ResetCoordX1(); this->ResetCoordX2(); this->ResetMeasureLog(); From da9470f6e878719ceff966262d6411da54acfaa5 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 11:12:28 +0100 Subject: [PATCH 100/144] Add FacsimileInterface getters to Measure --- Verovio.xcodeproj/project.pbxproj | 16 ++++++++ include/vrv/facsimilefunctor.h | 62 +++++++++++++++++++++++++++++++ include/vrv/measure.h | 11 ++++++ src/facsimilefunctor.cp | 45 ++++++++++++++++++++++ 4 files changed, 134 insertions(+) create mode 100644 include/vrv/facsimilefunctor.h create mode 100644 src/facsimilefunctor.cp diff --git a/Verovio.xcodeproj/project.pbxproj b/Verovio.xcodeproj/project.pbxproj index b129cb6e9af..ff5bdc6da47 100644 --- a/Verovio.xcodeproj/project.pbxproj +++ b/Verovio.xcodeproj/project.pbxproj @@ -800,6 +800,12 @@ 4DE96E3B21C4373200CB85BE /* bracketspan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DE96E3A21C4373200CB85BE /* bracketspan.cpp */; }; 4DE96E3C21C4373200CB85BE /* bracketspan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DE96E3A21C4373200CB85BE /* bracketspan.cpp */; }; 4DE96E3D21C4373200CB85BE /* bracketspan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DE96E3A21C4373200CB85BE /* bracketspan.cpp */; }; + 4DEBE6E12B36E78900B67DFB /* facsimilefunctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */; }; + 4DEBE6E22B36E78900B67DFB /* facsimilefunctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4DEBE6E42B36E79600B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; + 4DEBE6E52B36E79600B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; + 4DEBE6E62B36E9B300B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; + 4DEBE6E72B36E9B400B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; 4DEC4D5A21C800A000D1D273 /* abbr.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DEC4D5921C8009600D1D273 /* abbr.h */; }; 4DEC4D7A21C8048700D1D273 /* abbr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEC4D7921C8048700D1D273 /* abbr.cpp */; }; 4DEC4D7B21C8048700D1D273 /* abbr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEC4D7921C8048700D1D273 /* abbr.cpp */; }; @@ -2014,6 +2020,8 @@ 4DE644F41EDBEA01002FBE6C /* breath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = breath.cpp; path = src/breath.cpp; sourceTree = ""; }; 4DE96E3821C4370E00CB85BE /* bracketspan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bracketspan.h; path = include/vrv/bracketspan.h; sourceTree = ""; }; 4DE96E3A21C4373200CB85BE /* bracketspan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bracketspan.cpp; path = src/bracketspan.cpp; sourceTree = ""; }; + 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = facsimilefunctor.h; path = include/vrv/facsimilefunctor.h; sourceTree = ""; }; + 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = facsimilefunctor.cp; path = src/facsimilefunctor.cp; sourceTree = ""; }; 4DEC4D5921C8009600D1D273 /* abbr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = abbr.h; path = include/vrv/abbr.h; sourceTree = ""; }; 4DEC4D7921C8048700D1D273 /* abbr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = abbr.cpp; path = src/abbr.cpp; sourceTree = ""; }; 4DEC4D7D21C804C500D1D273 /* add.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = add.cpp; path = src/add.cpp; sourceTree = ""; }; @@ -3012,6 +3020,8 @@ E7265E6D29DC6FD200D11F41 /* castofffunctor.h */, E763EF4129E939FB0029E56D /* convertfunctor.cpp */, E763EF3E29E939C00029E56D /* convertfunctor.h */, + 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */, + 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */, E74A806028BC9111005274E7 /* findfunctor.cpp */, E74A806528BC97D5005274E7 /* findfunctor.h */, E722106528F856C4002CD6E9 /* findlayerelementsfunctor.cpp */, @@ -3384,6 +3394,7 @@ 40DA9C3720905CEB006BED92 /* ioabc.h in Headers */, 4DB3D8CD1F83D11100B5FC2B /* harm.h in Headers */, 40D45EC2204EEAFB009C1EC9 /* instrdef.h in Headers */, + 4DEBE6E12B36E78900B67DFB /* facsimilefunctor.h in Headers */, 4D94E0E22995411100F49F89 /* meibasic.h in Headers */, BD2E4D9B2875882200B04350 /* stem.h in Headers */, 4DACC9EA2990F29A00B55913 /* attmodule.h in Headers */, @@ -3441,6 +3452,7 @@ E7908EA0298582090004C1F9 /* alignfunctor.h in Headers */, BB4C4B9822A932E5001F6AF0 /* durationinterface.h in Headers */, BB4C4BB722A932F6001F6AF0 /* jsonxx.h in Headers */, + 4DEBE6E22B36E78900B67DFB /* facsimilefunctor.h in Headers */, BB4C4B1622A932C8001F6AF0 /* systemelement.h in Headers */, BB4C4AC622A932B6001F6AF0 /* measure.h in Headers */, E741AD00299A3D3500854426 /* calcslurdirectionfunctor.h in Headers */, @@ -3926,6 +3938,7 @@ E7F39C6229A62B430055DBE0 /* adjustclefchangesfunctor.cpp in Sources */, E79320682991454000D80975 /* calcstemfunctor.cpp in Sources */, 4DED4F18294733140073E504 /* altsyminterface.cpp in Sources */, + 4DEBE6E72B36E9B400B67DFB /* facsimilefunctor.cp in Sources */, 4DEF8A6521B7AAF90093A76B /* f.cpp in Sources */, 4D2073F922A3BCE000E0765F /* tabdursym.cpp in Sources */, 4D16940B1E3A44F300569BF4 /* keysig.cpp in Sources */, @@ -4206,6 +4219,7 @@ 8F086EF1188539540037FD8E /* keysig.cpp in Sources */, E74A806C28BC98B2005274E7 /* functorinterface.cpp in Sources */, E7870357299CF06D00156DC4 /* adjustarpegfunctor.cpp in Sources */, + 4DEBE6E62B36E9B300B67DFB /* facsimilefunctor.cp in Sources */, 4DEC4D9E21C81E9400D1D273 /* orig.cpp in Sources */, 4DDBBB5D1C7AE45900054AFF /* hairpin.cpp in Sources */, 4D43C30C1A9BB22A00EA28F3 /* view_mensural.cpp in Sources */, @@ -4489,6 +4503,7 @@ 4DB3D8D51F83D12B00B5FC2B /* tempo.cpp in Sources */, 4DEC4DA021C81E9400D1D273 /* orig.cpp in Sources */, E7F39C6329A62B440055DBE0 /* adjustclefchangesfunctor.cpp in Sources */, + 4DEBE6E42B36E79600B67DFB /* facsimilefunctor.cp in Sources */, E79320692991454000D80975 /* calcstemfunctor.cpp in Sources */, 8F3DD33E18854B2E0051330C /* beam.cpp in Sources */, 4DED4F19294733140073E504 /* altsyminterface.cpp in Sources */, @@ -4771,6 +4786,7 @@ E793206A2991454100D80975 /* calcstemfunctor.cpp in Sources */, BB4C4AD722A932B6001F6AF0 /* staff.cpp in Sources */, 4DED4F1A294733140073E504 /* altsyminterface.cpp in Sources */, + 4DEBE6E52B36E79600B67DFB /* facsimilefunctor.cp in Sources */, BB4C4B9F22A932E5001F6AF0 /* positioninterface.cpp in Sources */, BB4C4B5322A932D7001F6AF0 /* halfmrpt.cpp in Sources */, BB4C4B8722A932DF001F6AF0 /* num.cpp in Sources */, diff --git a/include/vrv/facsimilefunctor.h b/include/vrv/facsimilefunctor.h new file mode 100644 index 00000000000..f31c3b887cc --- /dev/null +++ b/include/vrv/facsimilefunctor.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: facsimilefunctor.h +// Author: Laurent Pugin +// Created: 2023 +// Copyright (c) Authors and others. All rights reserved. +///////////////////////////////////////////////////////////////////////////// + +#ifndef __VRV_FACSIMILEFUNCTOR_H__ +#define __VRV_FACSIMILEFUNCTOR_H__ + +#include "functor.h" + +namespace vrv { + +class LayerElement; +class Measure; +class Staff; + +//---------------------------------------------------------------------------- +// SyncFromFacsimileFunctor +//---------------------------------------------------------------------------- + +/** + * This class sync the layout encoded in the facsimile to m_Abs members + */ +class SyncFromFacsimileFunctor : public Functor { +public: + /** + * @name Constructors, destructors + */ + ///@{ + SyncFromFacsimileFunctor(); + virtual ~SyncFromFacsimileFunctor() = default; + ///@} + + /* + * Abstract base implementation + */ + bool ImplementsEndInterface() const override { return false; } + + /* + * Functor interface + */ + ///@{ + FunctorCode VisitLayerElement(LayerElement *layerElement) override; + FunctorCode VisitMeasure(Measure *measure) override; + FunctorCode VisitStaff(Staff *staff) override; + ///@} + +protected: + // +private: + // +public: + // +private: + // +}; + +} // namespace vrv + +#endif // __VRV_FACSIMILEFUNCTOR_H__ diff --git a/include/vrv/measure.h b/include/vrv/measure.h index f431913b8a3..e76832df519 100644 --- a/include/vrv/measure.h +++ b/include/vrv/measure.h @@ -65,6 +65,17 @@ class Measure : public Object, */ void CloneReset() override; + /** + * @name Getter to interfaces + */ + ///@{ + FacsimileInterface *GetFacsimileInterface() override { return vrv_cast(this); } + const FacsimileInterface *GetFacsimileInterface() const override + { + return vrv_cast(this); + } + ///@} + /** * Return true if measured music (otherwise we have fake measures) */ diff --git a/src/facsimilefunctor.cp b/src/facsimilefunctor.cp new file mode 100644 index 00000000000..4b3aaa946bd --- /dev/null +++ b/src/facsimilefunctor.cp @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: facsimilefunctor.cpp +// Author: Laurent Pugin +// Created: 2023 +// Copyright (c) Authors and others. All rights reserved. +///////////////////////////////////////////////////////////////////////////// + +#include "facsimilefunctor.h" + +//---------------------------------------------------------------------------- + +#include "doc.h" +#include "layerelement.h" +#include "measure.h" +#include "staff.h" +#include "vrv.h" + +//---------------------------------------------------------------------------- + +namespace vrv { + +//---------------------------------------------------------------------------- +// SyncFromFacsimileFunctor +//---------------------------------------------------------------------------- + +SyncFromFacsimileFunctor::SyncFromFacsimileFunctor() : Functor() +{ +} + +FunctorCode SyncFromFacsimileFunctor::VisitLayerElement(LayerElement *layerElement) +{ + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncFromFacsimileFunctor::VisitMeasure(Measure *measure) +{ + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncFromFacsimileFunctor::VisitStaff(Staff *staff) +{ + return FUNCTOR_CONTINUE; +} + +} // namespace vrv From dabd14bd4976f95140beeb5b76894c235080abab Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 16:06:08 +0000 Subject: [PATCH 101/144] Add Doc::SyncFromFacsimileDoc and implement functor --- include/vrv/doc.h | 7 ++++++- src/doc.cpp | 10 ++++++++++ src/facsimilefunctor.cp | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index 3952633bb49..f4113c32aff 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -109,7 +109,6 @@ class Doc : public Object { /** * Getter and setter for the DocType. - * The setter resets the document. */ ///@{ DocType GetType() const { return m_type; } @@ -370,6 +369,12 @@ class Doc : public Object { */ void ConvertMarkupDoc(bool permanent = true); + /** + * Sync the coordinate provided trought to m_Abs. + * Call the SyncToFacsimile functor. + */ + void SyncFromFacsimileDoc(); + /** * Transpose the content of the doc. */ diff --git a/src/doc.cpp b/src/doc.cpp index 8d1710d09e3..b48afdd4b5d 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -23,6 +23,7 @@ #include "convertfunctor.h" #include "docselection.h" #include "expansion.h" +#include "facsimilefunctor.h" #include "featureextractor.h" #include "functor.h" #include "glyph.h" @@ -1391,6 +1392,15 @@ void Doc::ConvertMarkupDoc(bool permanent) } } +void Doc::SyncFromFacsimileDoc() +{ + PrepareFacsimileFunctor prepareFacsimile(this->GetFacsimile()); + this->Process(prepareFacsimile); + + SyncFromFacsimileFunctor syncFacsimileFunctor; + this->Process(syncFacsimileFunctor); +} + void Doc::TransposeDoc() { Transposer transposer; diff --git a/src/facsimilefunctor.cp b/src/facsimilefunctor.cp index 4b3aaa946bd..2b932db87d6 100644 --- a/src/facsimilefunctor.cp +++ b/src/facsimilefunctor.cp @@ -12,8 +12,10 @@ #include "doc.h" #include "layerelement.h" #include "measure.h" + #include "staff.h" #include "vrv.h" +#include "zone.h" //---------------------------------------------------------------------------- @@ -29,16 +31,31 @@ SyncFromFacsimileFunctor::SyncFromFacsimileFunctor() : Functor() FunctorCode SyncFromFacsimileFunctor::VisitLayerElement(LayerElement *layerElement) { + if (!layerElement->Is({NOTE, REST})) return FUNCTOR_CONTINUE; + + Zone *zone = layerElement->GetZone(); + assert(zone); + layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + return FUNCTOR_CONTINUE; } FunctorCode SyncFromFacsimileFunctor::VisitMeasure(Measure *measure) { + Zone *zone = measure->GetZone(); + assert(zone); + measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; + return FUNCTOR_CONTINUE; } FunctorCode SyncFromFacsimileFunctor::VisitStaff(Staff *staff) { + Zone *zone = staff->GetZone(); + assert(zone); + staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + return FUNCTOR_CONTINUE; } From 70b1646e0c36636d21aafc5d36087e5f0659db85 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 16:07:15 +0000 Subject: [PATCH 102/144] Fix missing Read/Write zone coordinated ul --- src/iomei.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iomei.cpp b/src/iomei.cpp index e612b02b1c9..db220383508 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -2896,6 +2896,7 @@ void MEIOutput::WriteZone(pugi::xml_node currentNode, Zone *zone) assert(zone); this->WriteXmlId(currentNode, zone); zone->WriteCoordinated(currentNode); + zone->WriteCoordinatedUl(currentNode); zone->WriteTyped(currentNode); } @@ -8517,6 +8518,7 @@ bool MEIInput::ReadZone(Surface *parent, pugi::xml_node zone) Zone *vrvZone = new Zone(); this->SetMeiID(zone, vrvZone); vrvZone->ReadCoordinated(zone); + vrvZone->ReadCoordinatedUl(zone); vrvZone->ReadTyped(zone); parent->AddChild(vrvZone); return true; From cdc8cab0cbc716219d3c9cc05186e10b02d46ef6 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 16:07:45 +0000 Subject: [PATCH 103/144] Fix overlooked Doc type helper --- src/view.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view.cpp b/src/view.cpp index f474d7c3b8a..666db7ba544 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -74,7 +74,7 @@ void View::SetPage(int pageIdx, bool doLayout) m_doc->ScoreDefSetCurrentDoc(); // if we once deal with multiple views, it would be better // to redo the layout only when necessary? - if (m_doc->GetType() == Transcription || m_doc->IsFacs()) { + if (m_doc->IsTranscription() || m_doc->IsFacs()) { m_currentPage->LayOutTranscription(); } else { From f3ac85b0ef11de84e14c7e3f2aa52e03b258bdfd Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 16:08:33 +0000 Subject: [PATCH 104/144] Initial implementation of call to SyncFromFacsimileDoc --- src/iomei.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/iomei.cpp b/src/iomei.cpp index db220383508..68a5839469d 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -3902,6 +3902,12 @@ bool MEIInput::ReadDoc(pugi::xml_node root) m_doc->m_drawingPageHeight = m_doc->GetFacsimile()->GetMaxY(); m_doc->m_drawingPageWidth = m_doc->GetFacsimile()->GetMaxX(); } + // Temporary solution to set the document type to Transcription when using + else if (m_doc->HasFacsimile() && !m_doc->GetFacsimile()->GetType().empty()) { + m_doc->SetType(StrToDocType(m_doc->GetFacsimile()->GetType())); + m_doc->m_drawingPageHeight = m_doc->GetFacsimile()->GetMaxY(); + m_doc->m_drawingPageWidth = m_doc->GetFacsimile()->GetMaxX(); + } if (facsimile.next_sibling("facsimile")) { LogWarning("Only first is processed"); } @@ -3991,6 +3997,10 @@ bool MEIInput::ReadDoc(pugi::xml_node root) m_doc->ConvertMarkupDoc(!m_doc->GetOptions()->m_preserveAnalyticalMarkup.GetValue()); } + if (success && m_doc->IsTranscription()) { + m_doc->SyncFromFacsimileDoc(); + } + if (success && !m_hasScoreDef) { LogWarning("No scoreDef provided, trying to generate one..."); success = m_doc->GenerateDocumentScoreDef(); From 6742a01751dbdf5644703006781f5e2a0fdff9bd Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 18:03:05 +0000 Subject: [PATCH 105/144] Add FacsimileInterface to Pb and Sb --- include/vrv/pb.h | 13 ++++++++++++- include/vrv/sb.h | 13 ++++++++++++- src/iomei.cpp | 4 ++++ src/pb.cpp | 4 +++- src/sb.cpp | 4 +++- 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/include/vrv/pb.h b/include/vrv/pb.h index 92cecf39fd6..11f66ab2b0a 100644 --- a/include/vrv/pb.h +++ b/include/vrv/pb.h @@ -9,6 +9,7 @@ #define __VRV_PB_H__ #include "atts_shared.h" +#include "facsimileinterface.h" #include "systemelement.h" namespace vrv { @@ -21,7 +22,7 @@ namespace vrv { * This class represents a MEI pb in score-based MEI. * In page-based MEI, it remains as is as. Actual pages are represented by Page objects. */ -class Pb : public SystemElement, public AttNNumberLike { +class Pb : public SystemElement, public FacsimileInterface, public AttNNumberLike { public: /** * @name Constructors, destructors, and other standard methods @@ -35,6 +36,16 @@ class Pb : public SystemElement, public AttNNumberLike { std::string GetClassName() const override { return "Pb"; } ///@} + /** + * @name Getter to interfaces + */ + ///@{ + FacsimileInterface *GetFacsimileInterface() override { return vrv_cast(this); } + const FacsimileInterface *GetFacsimileInterface() const override + { + return vrv_cast(this); + } + //----------// // Functors // //----------// diff --git a/include/vrv/sb.h b/include/vrv/sb.h index 83d4812dd7a..f1d43319e0e 100644 --- a/include/vrv/sb.h +++ b/include/vrv/sb.h @@ -9,6 +9,7 @@ #define __VRV_SB_H__ #include "atts_shared.h" +#include "facsimileinterface.h" #include "systemelement.h" namespace vrv { @@ -21,7 +22,7 @@ namespace vrv { * This class represents a MEI sb in score-based MEI. * In page-based MEI, it remains as it is. Actual systems are represented by System objects. */ -class Sb : public SystemElement, public AttNNumberLike { +class Sb : public SystemElement, public FacsimileInterface, public AttNNumberLike { public: /** * @name Constructors, destructors, and other standard methods @@ -35,6 +36,16 @@ class Sb : public SystemElement, public AttNNumberLike { std::string GetClassName() const override { return "Sb"; } ///@} + /** + * @name Getter to interfaces + */ + ///@{ + FacsimileInterface *GetFacsimileInterface() override { return vrv_cast(this); } + const FacsimileInterface *GetFacsimileInterface() const override + { + return vrv_cast(this); + } + //----------// // Functors // //----------// diff --git a/src/iomei.cpp b/src/iomei.cpp index 68a5839469d..c3779dc75fd 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -1698,6 +1698,7 @@ void MEIOutput::WritePb(pugi::xml_node currentNode, Pb *pb) assert(pb); this->WriteSystemElement(currentNode, pb); + this->WriteFacsimileInterface(currentNode, pb); pb->WriteNNumberLike(currentNode); } @@ -1706,6 +1707,7 @@ void MEIOutput::WriteSb(pugi::xml_node currentNode, Sb *sb) assert(sb); this->WriteSystemElement(currentNode, sb); + this->WriteFacsimileInterface(currentNode, sb); sb->WriteNNumberLike(currentNode); } @@ -4528,6 +4530,7 @@ bool MEIInput::ReadPb(Object *parent, pugi::xml_node pb) Pb *vrvPb = new Pb(); this->ReadSystemElement(pb, vrvPb); + this->ReadFacsimileInterface(pb, vrvPb); vrvPb->ReadNNumberLike(pb); @@ -4544,6 +4547,7 @@ bool MEIInput::ReadSb(Object *parent, pugi::xml_node sb) Sb *vrvSb = new Sb(); this->ReadSystemElement(sb, vrvSb); + this->ReadFacsimileInterface(sb, vrvSb); vrvSb->ReadNNumberLike(sb); diff --git a/src/pb.cpp b/src/pb.cpp index 9b7386736a8..10f68009081 100644 --- a/src/pb.cpp +++ b/src/pb.cpp @@ -29,9 +29,10 @@ namespace vrv { static const ClassRegistrar s_factory("pb", PB); -Pb::Pb() : SystemElement(PB, "pb-"), AttNNumberLike() +Pb::Pb() : SystemElement(PB, "pb-"), FacsimileInterface(), AttNNumberLike() { this->RegisterAttClass(ATT_NNUMBERLIKE); + this->RegisterInterface(FacsimileInterface::GetAttClasses(), FacsimileInterface::IsInterface()); this->Reset(); } @@ -41,6 +42,7 @@ Pb::~Pb() {} void Pb::Reset() { SystemElement::Reset(); + FacsimileInterface::Reset(); this->ResetNNumberLike(); } diff --git a/src/sb.cpp b/src/sb.cpp index 33a33c0bdf6..883f46a7e1c 100644 --- a/src/sb.cpp +++ b/src/sb.cpp @@ -29,9 +29,10 @@ namespace vrv { static const ClassRegistrar s_factory("sb", SB); -Sb::Sb() : SystemElement(SB, "sb-"), AttNNumberLike() +Sb::Sb() : SystemElement(SB, "sb-"), FacsimileInterface(), AttNNumberLike() { this->RegisterAttClass(ATT_NNUMBERLIKE); + this->RegisterInterface(FacsimileInterface::GetAttClasses(), FacsimileInterface::IsInterface()); this->Reset(); } @@ -41,6 +42,7 @@ Sb::~Sb() {} void Sb::Reset() { SystemElement::Reset(); + FacsimileInterface::Reset(); this->ResetNNumberLike(); } From 808aa9d78f2225efff3bc8d58a0c7fdf0db6a083 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 18:21:44 +0000 Subject: [PATCH 106/144] Sync Pb facsimile in SyncFromFacsimile functor * Placeholder for sb but not tested nor enabled --- include/vrv/facsimilefunctor.h | 10 +++++++ src/facsimilefunctor.cp | 51 +++++++++++++++++++++++++++++++++- src/iomei.cpp | 3 +- 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/include/vrv/facsimilefunctor.h b/include/vrv/facsimilefunctor.h index f31c3b887cc..3df74f90dcd 100644 --- a/include/vrv/facsimilefunctor.h +++ b/include/vrv/facsimilefunctor.h @@ -14,7 +14,11 @@ namespace vrv { class LayerElement; class Measure; +class Page; +class Pb; +class Sb; class Staff; +class System; //---------------------------------------------------------------------------- // SyncFromFacsimileFunctor @@ -44,7 +48,11 @@ class SyncFromFacsimileFunctor : public Functor { ///@{ FunctorCode VisitLayerElement(LayerElement *layerElement) override; FunctorCode VisitMeasure(Measure *measure) override; + FunctorCode VisitPage(Page *page) override; + FunctorCode VisitPb(Pb *pb) override; + FunctorCode VisitSb(Sb *sb) override; FunctorCode VisitStaff(Staff *staff) override; + FunctorCode VisitSystem(System *system) override; ///@} protected: @@ -55,6 +63,8 @@ class SyncFromFacsimileFunctor : public Functor { // private: // + Page *m_currentPage; + System *m_currentSystem; }; } // namespace vrv diff --git a/src/facsimilefunctor.cp b/src/facsimilefunctor.cp index 2b932db87d6..bfb5495fd44 100644 --- a/src/facsimilefunctor.cp +++ b/src/facsimilefunctor.cp @@ -12,8 +12,11 @@ #include "doc.h" #include "layerelement.h" #include "measure.h" - +#include "page.h" +#include "pb.h" +#include "sb.h" #include "staff.h" +#include "system.h" #include "vrv.h" #include "zone.h" @@ -27,6 +30,8 @@ namespace vrv { SyncFromFacsimileFunctor::SyncFromFacsimileFunctor() : Functor() { + m_currentPage = NULL; + m_currentSystem = NULL; } FunctorCode SyncFromFacsimileFunctor::VisitLayerElement(LayerElement *layerElement) @@ -50,6 +55,42 @@ FunctorCode SyncFromFacsimileFunctor::VisitMeasure(Measure *measure) return FUNCTOR_CONTINUE; } +FunctorCode SyncFromFacsimileFunctor::VisitPage(Page *page) +{ + m_currentPage = page; + + return FUNCTOR_CONTINUE; +} + + +FunctorCode SyncFromFacsimileFunctor::VisitPb(Pb *pb) +{ + // This would happen if we run the functor on data not converted to page-based + assert(m_currentPage); + + Zone *zone = pb->GetZone(); + assert(zone); + m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; + m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; + + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncFromFacsimileFunctor::VisitSb(Sb *sb) +{ + // This would happen if we run the functor on data not converted to page-based + assert(m_currentSystem); + + Zone *zone = sb->GetZone(); + /* + assert(zone); + m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + */ + + return FUNCTOR_CONTINUE; +} + FunctorCode SyncFromFacsimileFunctor::VisitStaff(Staff *staff) { Zone *zone = staff->GetZone(); @@ -59,4 +100,12 @@ FunctorCode SyncFromFacsimileFunctor::VisitStaff(Staff *staff) return FUNCTOR_CONTINUE; } +FunctorCode SyncFromFacsimileFunctor::VisitSystem(System *system) +{ + m_currentSystem = system; + + return FUNCTOR_CONTINUE; +} + + } // namespace vrv diff --git a/src/iomei.cpp b/src/iomei.cpp index c3779dc75fd..9dd0095f1dd 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -3907,8 +3907,7 @@ bool MEIInput::ReadDoc(pugi::xml_node root) // Temporary solution to set the document type to Transcription when using else if (m_doc->HasFacsimile() && !m_doc->GetFacsimile()->GetType().empty()) { m_doc->SetType(StrToDocType(m_doc->GetFacsimile()->GetType())); - m_doc->m_drawingPageHeight = m_doc->GetFacsimile()->GetMaxY(); - m_doc->m_drawingPageWidth = m_doc->GetFacsimile()->GetMaxX(); + // Facsimile data eventually sync with Doc::SyncFromFacsimileDoc below } if (facsimile.next_sibling("facsimile")) { LogWarning("Only first is processed"); From a1a7a933b7f42fb0d9a1ee94f7d12accd1619501 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 18:41:50 +0000 Subject: [PATCH 107/144] Scaffold SyncFromFacsimileFunctor --- Verovio.xcodeproj/project.pbxproj | 20 +++--- include/vrv/facsimilefunctor.h | 47 +++++++++++++ ...csimilefunctor.cp => facsimilefunctor.cpp} | 66 +++++++++++++++++++ 3 files changed, 123 insertions(+), 10 deletions(-) rename src/{facsimilefunctor.cp => facsimilefunctor.cpp} (63%) diff --git a/Verovio.xcodeproj/project.pbxproj b/Verovio.xcodeproj/project.pbxproj index ff5bdc6da47..6a55d542017 100644 --- a/Verovio.xcodeproj/project.pbxproj +++ b/Verovio.xcodeproj/project.pbxproj @@ -802,10 +802,10 @@ 4DE96E3D21C4373200CB85BE /* bracketspan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DE96E3A21C4373200CB85BE /* bracketspan.cpp */; }; 4DEBE6E12B36E78900B67DFB /* facsimilefunctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */; }; 4DEBE6E22B36E78900B67DFB /* facsimilefunctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4DEBE6E42B36E79600B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; - 4DEBE6E52B36E79600B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; - 4DEBE6E62B36E9B300B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; - 4DEBE6E72B36E9B400B67DFB /* facsimilefunctor.cp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */; }; + 4DEBE6E42B36E79600B67DFB /* facsimilefunctor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cpp */; }; + 4DEBE6E52B36E79600B67DFB /* facsimilefunctor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cpp */; }; + 4DEBE6E62B36E9B300B67DFB /* facsimilefunctor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cpp */; }; + 4DEBE6E72B36E9B400B67DFB /* facsimilefunctor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cpp */; }; 4DEC4D5A21C800A000D1D273 /* abbr.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DEC4D5921C8009600D1D273 /* abbr.h */; }; 4DEC4D7A21C8048700D1D273 /* abbr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEC4D7921C8048700D1D273 /* abbr.cpp */; }; 4DEC4D7B21C8048700D1D273 /* abbr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DEC4D7921C8048700D1D273 /* abbr.cpp */; }; @@ -2021,7 +2021,7 @@ 4DE96E3821C4370E00CB85BE /* bracketspan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bracketspan.h; path = include/vrv/bracketspan.h; sourceTree = ""; }; 4DE96E3A21C4373200CB85BE /* bracketspan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bracketspan.cpp; path = src/bracketspan.cpp; sourceTree = ""; }; 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = facsimilefunctor.h; path = include/vrv/facsimilefunctor.h; sourceTree = ""; }; - 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = facsimilefunctor.cp; path = src/facsimilefunctor.cp; sourceTree = ""; }; + 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = facsimilefunctor.cpp; path = src/facsimilefunctor.cpp; sourceTree = ""; }; 4DEC4D5921C8009600D1D273 /* abbr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = abbr.h; path = include/vrv/abbr.h; sourceTree = ""; }; 4DEC4D7921C8048700D1D273 /* abbr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = abbr.cpp; path = src/abbr.cpp; sourceTree = ""; }; 4DEC4D7D21C804C500D1D273 /* add.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = add.cpp; path = src/add.cpp; sourceTree = ""; }; @@ -3020,7 +3020,7 @@ E7265E6D29DC6FD200D11F41 /* castofffunctor.h */, E763EF4129E939FB0029E56D /* convertfunctor.cpp */, E763EF3E29E939C00029E56D /* convertfunctor.h */, - 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cp */, + 4DEBE6E32B36E79600B67DFB /* facsimilefunctor.cpp */, 4DEBE6E02B36E78900B67DFB /* facsimilefunctor.h */, E74A806028BC9111005274E7 /* findfunctor.cpp */, E74A806528BC97D5005274E7 /* findfunctor.h */, @@ -3938,7 +3938,7 @@ E7F39C6229A62B430055DBE0 /* adjustclefchangesfunctor.cpp in Sources */, E79320682991454000D80975 /* calcstemfunctor.cpp in Sources */, 4DED4F18294733140073E504 /* altsyminterface.cpp in Sources */, - 4DEBE6E72B36E9B400B67DFB /* facsimilefunctor.cp in Sources */, + 4DEBE6E72B36E9B400B67DFB /* facsimilefunctor.cpp in Sources */, 4DEF8A6521B7AAF90093A76B /* f.cpp in Sources */, 4D2073F922A3BCE000E0765F /* tabdursym.cpp in Sources */, 4D16940B1E3A44F300569BF4 /* keysig.cpp in Sources */, @@ -4219,7 +4219,7 @@ 8F086EF1188539540037FD8E /* keysig.cpp in Sources */, E74A806C28BC98B2005274E7 /* functorinterface.cpp in Sources */, E7870357299CF06D00156DC4 /* adjustarpegfunctor.cpp in Sources */, - 4DEBE6E62B36E9B300B67DFB /* facsimilefunctor.cp in Sources */, + 4DEBE6E62B36E9B300B67DFB /* facsimilefunctor.cpp in Sources */, 4DEC4D9E21C81E9400D1D273 /* orig.cpp in Sources */, 4DDBBB5D1C7AE45900054AFF /* hairpin.cpp in Sources */, 4D43C30C1A9BB22A00EA28F3 /* view_mensural.cpp in Sources */, @@ -4503,7 +4503,7 @@ 4DB3D8D51F83D12B00B5FC2B /* tempo.cpp in Sources */, 4DEC4DA021C81E9400D1D273 /* orig.cpp in Sources */, E7F39C6329A62B440055DBE0 /* adjustclefchangesfunctor.cpp in Sources */, - 4DEBE6E42B36E79600B67DFB /* facsimilefunctor.cp in Sources */, + 4DEBE6E42B36E79600B67DFB /* facsimilefunctor.cpp in Sources */, E79320692991454000D80975 /* calcstemfunctor.cpp in Sources */, 8F3DD33E18854B2E0051330C /* beam.cpp in Sources */, 4DED4F19294733140073E504 /* altsyminterface.cpp in Sources */, @@ -4786,7 +4786,7 @@ E793206A2991454100D80975 /* calcstemfunctor.cpp in Sources */, BB4C4AD722A932B6001F6AF0 /* staff.cpp in Sources */, 4DED4F1A294733140073E504 /* altsyminterface.cpp in Sources */, - 4DEBE6E52B36E79600B67DFB /* facsimilefunctor.cp in Sources */, + 4DEBE6E52B36E79600B67DFB /* facsimilefunctor.cpp in Sources */, BB4C4B9F22A932E5001F6AF0 /* positioninterface.cpp in Sources */, BB4C4B5322A932D7001F6AF0 /* halfmrpt.cpp in Sources */, BB4C4B8722A932DF001F6AF0 /* num.cpp in Sources */, diff --git a/include/vrv/facsimilefunctor.h b/include/vrv/facsimilefunctor.h index 3df74f90dcd..5073049d496 100644 --- a/include/vrv/facsimilefunctor.h +++ b/include/vrv/facsimilefunctor.h @@ -67,6 +67,53 @@ class SyncFromFacsimileFunctor : public Functor { System *m_currentSystem; }; +//---------------------------------------------------------------------------- +// SyncToFacsimileFunctor +//---------------------------------------------------------------------------- + +/** + * This class sync the layout calculated to the facsimile + */ +class SyncToFacsimileFunctor : public Functor { +public: + /** + * @name Constructors, destructors + */ + ///@{ + SyncToFacsimileFunctor(); + virtual ~SyncToFacsimileFunctor() = default; + ///@} + + /* + * Abstract base implementation + */ + bool ImplementsEndInterface() const override { return false; } + + /* + * Functor interface + */ + ///@{ + FunctorCode VisitLayerElement(LayerElement *layerElement) override; + FunctorCode VisitMeasure(Measure *measure) override; + FunctorCode VisitPage(Page *page) override; + FunctorCode VisitPb(Pb *pb) override; + FunctorCode VisitSb(Sb *sb) override; + FunctorCode VisitStaff(Staff *staff) override; + FunctorCode VisitSystem(System *system) override; + ///@} + +protected: + // +private: + // +public: + // +private: + // + Page *m_currentPage; + System *m_currentSystem; +}; + } // namespace vrv #endif // __VRV_FACSIMILEFUNCTOR_H__ diff --git a/src/facsimilefunctor.cp b/src/facsimilefunctor.cpp similarity index 63% rename from src/facsimilefunctor.cp rename to src/facsimilefunctor.cpp index bfb5495fd44..7923024c713 100644 --- a/src/facsimilefunctor.cp +++ b/src/facsimilefunctor.cpp @@ -107,5 +107,71 @@ FunctorCode SyncFromFacsimileFunctor::VisitSystem(System *system) return FUNCTOR_CONTINUE; } +//---------------------------------------------------------------------------- +// SyncToFacsimileFunctor +//---------------------------------------------------------------------------- + +SyncToFacsimileFunctor::SyncToFacsimileFunctor() : Functor() +{ + m_currentPage = NULL; + m_currentSystem = NULL; +} + +FunctorCode SyncToFacsimileFunctor::VisitLayerElement(LayerElement *layerElement) +{ + if (!layerElement->Is({NOTE, REST})) return FUNCTOR_CONTINUE; + + //layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncToFacsimileFunctor::VisitMeasure(Measure *measure) +{ + //measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + //measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; + + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncToFacsimileFunctor::VisitPage(Page *page) +{ + m_currentPage = page; + + return FUNCTOR_CONTINUE; +} + + +FunctorCode SyncToFacsimileFunctor::VisitPb(Pb *pb) +{ + //m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; + //m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; + + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncToFacsimileFunctor::VisitSb(Sb *sb) +{ + //m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + //m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncToFacsimileFunctor::VisitStaff(Staff *staff) +{ + //staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + + return FUNCTOR_CONTINUE; +} + +FunctorCode SyncToFacsimileFunctor::VisitSystem(System *system) +{ + m_currentSystem = system; + + return FUNCTOR_CONTINUE; +} + + } // namespace vrv From 44e83659b6e9c6a46d5f4ce55f1be0346321278e Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 18:44:15 +0000 Subject: [PATCH 108/144] Fix format --- src/facsimilefunctor.cpp | 52 +++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/src/facsimilefunctor.cpp b/src/facsimilefunctor.cpp index 7923024c713..68e54dbbe7a 100644 --- a/src/facsimilefunctor.cpp +++ b/src/facsimilefunctor.cpp @@ -36,12 +36,12 @@ SyncFromFacsimileFunctor::SyncFromFacsimileFunctor() : Functor() FunctorCode SyncFromFacsimileFunctor::VisitLayerElement(LayerElement *layerElement) { - if (!layerElement->Is({NOTE, REST})) return FUNCTOR_CONTINUE; - + if (!layerElement->Is({ NOTE, REST })) return FUNCTOR_CONTINUE; + Zone *zone = layerElement->GetZone(); assert(zone); layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - + return FUNCTOR_CONTINUE; } @@ -51,18 +51,17 @@ FunctorCode SyncFromFacsimileFunctor::VisitMeasure(Measure *measure) assert(zone); measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; - + return FUNCTOR_CONTINUE; } FunctorCode SyncFromFacsimileFunctor::VisitPage(Page *page) { m_currentPage = page; - + return FUNCTOR_CONTINUE; } - FunctorCode SyncFromFacsimileFunctor::VisitPb(Pb *pb) { // This would happen if we run the functor on data not converted to page-based @@ -87,7 +86,7 @@ FunctorCode SyncFromFacsimileFunctor::VisitSb(Sb *sb) m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; */ - + return FUNCTOR_CONTINUE; } @@ -96,14 +95,14 @@ FunctorCode SyncFromFacsimileFunctor::VisitStaff(Staff *staff) Zone *zone = staff->GetZone(); assert(zone); staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; - + return FUNCTOR_CONTINUE; } FunctorCode SyncFromFacsimileFunctor::VisitSystem(System *system) { m_currentSystem = system; - + return FUNCTOR_CONTINUE; } @@ -119,59 +118,56 @@ SyncToFacsimileFunctor::SyncToFacsimileFunctor() : Functor() FunctorCode SyncToFacsimileFunctor::VisitLayerElement(LayerElement *layerElement) { - if (!layerElement->Is({NOTE, REST})) return FUNCTOR_CONTINUE; - - //layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - + if (!layerElement->Is({ NOTE, REST })) return FUNCTOR_CONTINUE; + + // layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitMeasure(Measure *measure) { - //measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - //measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; - + // measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + // measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; + return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitPage(Page *page) { m_currentPage = page; - + return FUNCTOR_CONTINUE; } - FunctorCode SyncToFacsimileFunctor::VisitPb(Pb *pb) { - //m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; - //m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; + // m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; + // m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitSb(Sb *sb) { - //m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - //m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; - + // m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + // m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitStaff(Staff *staff) { - //staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; - + // staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitSystem(System *system) { m_currentSystem = system; - + return FUNCTOR_CONTINUE; } - - } // namespace vrv From 85c6b517af3b44a1089c53b0d955d6184bd6e584 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 27 Dec 2023 09:39:21 +0000 Subject: [PATCH 109/144] Implement SyncToFacsimile --- include/vrv/doc.h | 6 ++++++ include/vrv/facsimilefunctor.h | 13 ++++++++++-- src/doc.cpp | 25 ++++++++++++++++++++-- src/facsimilefunctor.cpp | 39 ++++++++++++++++++++++++++++++++-- 4 files changed, 77 insertions(+), 6 deletions(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index f4113c32aff..c6573a53d09 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -375,6 +375,12 @@ class Doc : public Object { */ void SyncFromFacsimileDoc(); + /** + * Sync the coordinate provided in rendering to a . + * The document must have encoded layout and the option --break encoded must have enabled. + */ + void SyncToFacsimileDoc(); + /** * Transpose the content of the doc. */ diff --git a/include/vrv/facsimilefunctor.h b/include/vrv/facsimilefunctor.h index 5073049d496..626b7c71a38 100644 --- a/include/vrv/facsimilefunctor.h +++ b/include/vrv/facsimilefunctor.h @@ -18,6 +18,7 @@ class Page; class Pb; class Sb; class Staff; +class Surface; class System; //---------------------------------------------------------------------------- @@ -80,7 +81,7 @@ class SyncToFacsimileFunctor : public Functor { * @name Constructors, destructors */ ///@{ - SyncToFacsimileFunctor(); + SyncToFacsimileFunctor(Doc *doc, Surface *surface, int height, int width); virtual ~SyncToFacsimileFunctor() = default; ///@} @@ -105,10 +106,18 @@ class SyncToFacsimileFunctor : public Functor { protected: // private: - // + /** Create zone if not exist */ + Zone *GetZone(FacsimileInterface *interface); public: // private: + /** The doc */ + Doc *m_doc; + /** Page height and width */ + int m_height; + int m_width; + /** The surface we are going to add / update zone */ + Surface *m_surface; // Page *m_currentPage; System *m_currentSystem; diff --git a/src/doc.cpp b/src/doc.cpp index b48afdd4b5d..b909bb5f4d0 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -59,6 +59,7 @@ #include "staff.h" #include "staffdef.h" #include "staffgrp.h" +#include "surface.h" #include "syl.h" #include "syllable.h" #include "system.h" @@ -1397,8 +1398,28 @@ void Doc::SyncFromFacsimileDoc() PrepareFacsimileFunctor prepareFacsimile(this->GetFacsimile()); this->Process(prepareFacsimile); - SyncFromFacsimileFunctor syncFacsimileFunctor; - this->Process(syncFacsimileFunctor); + SyncFromFacsimileFunctor syncFromFacsimileFunctor; + this->Process(syncFromFacsimileFunctor); +} + +void Doc::SyncToFacsimileDoc() +{ + // Create a new facsimile object if we do not have one already + if (!this->HasFacsimile()) { + Facsimile *facsimile = new Facsimile(); + this->SetFacsimile(facsimile); + } + if (!m_facsimile->FindDescendantByType(SURFACE)) { + m_facsimile->AddChild(new Surface()); + } + m_facsimile->SetType("transcription"); + Surface *surface = vrv_cast(m_facsimile->FindDescendantByType(SURFACE)); + assert(surface); + + const int width = m_options->m_pageWidth.GetUnfactoredValue(); + const int height = m_options->m_pageHeight.GetUnfactoredValue(); + SyncToFacsimileFunctor syncToFacimileFunctor(this, surface, height, width); + this->Process(syncToFacimileFunctor); } void Doc::TransposeDoc() diff --git a/src/facsimilefunctor.cpp b/src/facsimilefunctor.cpp index 68e54dbbe7a..57756c828f3 100644 --- a/src/facsimilefunctor.cpp +++ b/src/facsimilefunctor.cpp @@ -16,6 +16,7 @@ #include "pb.h" #include "sb.h" #include "staff.h" +#include "surface.h" #include "system.h" #include "vrv.h" #include "zone.h" @@ -110,8 +111,12 @@ FunctorCode SyncFromFacsimileFunctor::VisitSystem(System *system) // SyncToFacsimileFunctor //---------------------------------------------------------------------------- -SyncToFacsimileFunctor::SyncToFacsimileFunctor() : Functor() +SyncToFacsimileFunctor::SyncToFacsimileFunctor(Doc *doc, Surface *surface, int height, int width) : Functor() { + m_doc = doc; + m_height = height; + m_width = width; + m_surface = surface; m_currentPage = NULL; m_currentSystem = NULL; } @@ -121,6 +126,8 @@ FunctorCode SyncToFacsimileFunctor::VisitLayerElement(LayerElement *layerElement if (!layerElement->Is({ NOTE, REST })) return FUNCTOR_CONTINUE; // layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + Zone *zone = this->GetZone(layerElement); + zone->SetUlx(layerElement->GetDrawingX() / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -129,6 +136,9 @@ FunctorCode SyncToFacsimileFunctor::VisitMeasure(Measure *measure) { // measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; // measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; + Zone *zone = this->GetZone(measure); + zone->SetUlx(measure->GetDrawingX() / DEFINITION_FACTOR); + zone->SetLrx(measure->GetDrawingX() + measure->GetWidth() / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -136,6 +146,8 @@ FunctorCode SyncToFacsimileFunctor::VisitMeasure(Measure *measure) FunctorCode SyncToFacsimileFunctor::VisitPage(Page *page) { m_currentPage = page; + m_doc->SetDrawingPage(page->GetIdx()); + page->LayOut(); return FUNCTOR_CONTINUE; } @@ -144,7 +156,10 @@ FunctorCode SyncToFacsimileFunctor::VisitPb(Pb *pb) { // m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; // m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; - + Zone *zone = this->GetZone(pb); + zone->SetLry(m_height); + zone->SetLrx(m_width); + return FUNCTOR_CONTINUE; } @@ -152,6 +167,9 @@ FunctorCode SyncToFacsimileFunctor::VisitSb(Sb *sb) { // m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; // m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + Zone *zone = this->GetZone(sb); + zone->SetUlx(m_currentSystem->GetDrawingX() / DEFINITION_FACTOR); + zone->SetUly(m_currentSystem->GetDrawingY() / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -159,6 +177,8 @@ FunctorCode SyncToFacsimileFunctor::VisitSb(Sb *sb) FunctorCode SyncToFacsimileFunctor::VisitStaff(Staff *staff) { // staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + Zone *zone = this->GetZone(staff); + zone->SetUly(staff->GetDrawingY() / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -170,4 +190,19 @@ FunctorCode SyncToFacsimileFunctor::VisitSystem(System *system) return FUNCTOR_CONTINUE; } +Zone *SyncToFacsimileFunctor::GetZone(FacsimileInterface *interface) +{ + if (interface->GetZone()) { + // Here we should probably check if the zone is a child of m_surface + return interface->GetZone(); + } + else { + Zone *zone = new Zone(); + m_surface->AddChild(zone); + interface->SetFacs(StringFormat("#%s", zone->GetID().c_str())); + interface->AttachZone(zone); + return interface->GetZone(); + } +} + } // namespace vrv From aa34af471e5f5e92fb7d99ce594d637558ac3e06 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 27 Dec 2023 09:39:32 +0000 Subject: [PATCH 110/144] Read sb@facs --- src/facsimilefunctor.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/facsimilefunctor.cpp b/src/facsimilefunctor.cpp index 57756c828f3..4dd47302093 100644 --- a/src/facsimilefunctor.cpp +++ b/src/facsimilefunctor.cpp @@ -82,11 +82,9 @@ FunctorCode SyncFromFacsimileFunctor::VisitSb(Sb *sb) assert(m_currentSystem); Zone *zone = sb->GetZone(); - /* assert(zone); m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; - */ return FUNCTOR_CONTINUE; } From 220f0fbdc56a46bae22b4200dba55d9d0ec89790 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 27 Dec 2023 09:40:03 +0000 Subject: [PATCH 111/144] Call SyncToFacsimileDoc (testing) * To be reverted --- src/toolkit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/toolkit.cpp b/src/toolkit.cpp index bcfd058ebe3..f178da04c5b 100644 --- a/src/toolkit.cpp +++ b/src/toolkit.cpp @@ -857,6 +857,8 @@ std::string Toolkit::GetMEI(const std::string &jsonOptions) hadSelection = true; m_doc.DeactiveateSelection(); } + + m_doc.SyncToFacsimileDoc(); MEIOutput meioutput(&m_doc); meioutput.SetScoreBasedMEI(scoreBased); From d89dc949357cb22a8fd062515af56bf3b533cb70 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Sat, 23 Dec 2023 16:07:15 +0000 Subject: [PATCH 112/144] Fix missing Read/Write zone coordinated ul --- src/iomei.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iomei.cpp b/src/iomei.cpp index 97556fbbde0..6ff5920f6c4 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -2900,6 +2900,7 @@ void MEIOutput::WriteZone(pugi::xml_node currentNode, Zone *zone) assert(zone); this->WriteXmlId(currentNode, zone); zone->WriteCoordinated(currentNode); + zone->WriteCoordinatedUl(currentNode); zone->WriteTyped(currentNode); } @@ -8531,6 +8532,7 @@ bool MEIInput::ReadZone(Surface *parent, pugi::xml_node zone) Zone *vrvZone = new Zone(); this->SetMeiID(zone, vrvZone); vrvZone->ReadCoordinated(zone); + vrvZone->ReadCoordinatedUl(zone); vrvZone->ReadTyped(zone); parent->AddChild(vrvZone); return true; From 065805f6286d6f228c0bd34a0be3298e85ea00b8 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 27 Dec 2023 21:15:04 +0000 Subject: [PATCH 113/144] Remove FunctorParams old mentions * Clang formatting --- include/vrv/doc.h | 2 +- include/vrv/durationinterface.h | 1 - include/vrv/object.h | 1 - include/vrv/vrvdef.h | 2 +- src/toolkit.cpp | 2 +- 5 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index c6573a53d09..788483f2554 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -380,7 +380,7 @@ class Doc : public Object { * The document must have encoded layout and the option --break encoded must have enabled. */ void SyncToFacsimileDoc(); - + /** * Transpose the content of the doc. */ diff --git a/include/vrv/durationinterface.h b/include/vrv/durationinterface.h index 67bf2caab43..17d0ec0cc22 100644 --- a/include/vrv/durationinterface.h +++ b/include/vrv/durationinterface.h @@ -16,7 +16,6 @@ namespace vrv { -class FunctorParams; class Mensur; class Object; diff --git a/include/vrv/object.h b/include/vrv/object.h index 1cb3f41ff41..31bbf863f95 100644 --- a/include/vrv/object.h +++ b/include/vrv/object.h @@ -31,7 +31,6 @@ class EditorialElement; class Output; class Filters; class Functor; -class FunctorParams; class Functor; class ConstFunctor; class LinkingInterface; diff --git a/include/vrv/vrvdef.h b/include/vrv/vrvdef.h index 86ead543896..8178d672501 100644 --- a/include/vrv/vrvdef.h +++ b/include/vrv/vrvdef.h @@ -61,7 +61,7 @@ namespace vrv { #ifdef VRV_DYNAMIC_CAST // To be used for all cases where type is cheched through Object::m_type #define vrv_cast dynamic_cast -// To be used for all FunctorParams casts within Functors +// To be used for params casts within Functors #define vrv_params_cast dynamic_cast #else #define vrv_cast static_cast diff --git a/src/toolkit.cpp b/src/toolkit.cpp index f178da04c5b..c946c020aca 100644 --- a/src/toolkit.cpp +++ b/src/toolkit.cpp @@ -857,7 +857,7 @@ std::string Toolkit::GetMEI(const std::string &jsonOptions) hadSelection = true; m_doc.DeactiveateSelection(); } - + m_doc.SyncToFacsimileDoc(); MEIOutput meioutput(&m_doc); From 4cc1e8309111afc5f18d8fa7c3abce0da5b48554 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 27 Dec 2023 21:19:54 +0000 Subject: [PATCH 114/144] Allow surface within surface * Not MEI valid structure --- include/vrv/iomei.h | 2 +- src/iomei.cpp | 9 ++++++++- src/surface.cpp | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/vrv/iomei.h b/include/vrv/iomei.h index 6b0d7800119..6f0b358c3db 100644 --- a/include/vrv/iomei.h +++ b/include/vrv/iomei.h @@ -846,7 +846,7 @@ class MEIInput : public Input { ///@{ bool ReadFacsimile(Doc *doc, pugi::xml_node facsimile); bool ReadGraphic(Object *parent, pugi::xml_node graphic); - bool ReadSurface(Facsimile *parent, pugi::xml_node surface); + bool ReadSurface(Object *parent, pugi::xml_node surface); bool ReadTupletSpanAsTuplet(Measure *measure, pugi::xml_node tupletSpan); bool ReadZone(Surface *parent, pugi::xml_node zone); ///@} diff --git a/src/iomei.cpp b/src/iomei.cpp index 9dd0095f1dd..f7ac28f32c7 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -2883,6 +2883,10 @@ void MEIOutput::WriteSurface(pugi::xml_node currentNode, Surface *surface) pugi::xml_node childNode = currentNode.append_child("graphic"); this->WriteGraphic(childNode, dynamic_cast(child)); } + else if (child->GetClassId() == SURFACE) { + pugi::xml_node childNode = currentNode.append_child("surface"); + this->WriteSurface(childNode, dynamic_cast(child)); + } else if (child->GetClassId() == ZONE) { pugi::xml_node childNode = currentNode.append_child("zone"); this->WriteZone(childNode, dynamic_cast(child)); @@ -8502,7 +8506,7 @@ bool MEIInput::ReadGraphic(Object *parent, pugi::xml_node graphic) return true; } -bool MEIInput::ReadSurface(Facsimile *parent, pugi::xml_node surface) +bool MEIInput::ReadSurface(Object *parent, pugi::xml_node surface) { assert(parent); Surface *vrvSurface = new Surface(); @@ -8514,6 +8518,9 @@ bool MEIInput::ReadSurface(Facsimile *parent, pugi::xml_node surface) if (strcmp(child.name(), "graphic") == 0) { this->ReadGraphic(vrvSurface, child); } + else if (strcmp(child.name(), "surface") == 0) { + this->ReadSurface(vrvSurface, child); + } else if (strcmp(child.name(), "zone") == 0) { this->ReadZone(vrvSurface, child); } diff --git a/src/surface.cpp b/src/surface.cpp index 3c0b01d1b43..799f8477e26 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -49,6 +49,9 @@ bool Surface::IsSupportedChild(Object *object) if (object->Is(GRAPHIC)) { assert(dynamic_cast(object)); } + else if (object->Is(SURFACE)) { + assert(dynamic_cast(object)); + } else if (object->Is(ZONE)) { assert(dynamic_cast(object)); } From af4fe04ece718cb99b3880f46b308d9213ccfc8e Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 27 Dec 2023 21:20:51 +0000 Subject: [PATCH 115/144] Read and write att.coordinated.ul in Surface (missing) --- src/iomei.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iomei.cpp b/src/iomei.cpp index f7ac28f32c7..dbe70a5232d 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -2876,6 +2876,7 @@ void MEIOutput::WriteSurface(pugi::xml_node currentNode, Surface *surface) assert(surface); this->WriteXmlId(currentNode, surface); surface->WriteCoordinated(currentNode); + surface->WriteCoordinatedUl(currentNode); surface->WriteTyped(currentNode); for (Object *child = surface->GetFirst(); child != NULL; child = surface->GetNext()) { @@ -8512,6 +8513,7 @@ bool MEIInput::ReadSurface(Object *parent, pugi::xml_node surface) Surface *vrvSurface = new Surface(); this->SetMeiID(surface, vrvSurface); vrvSurface->ReadCoordinated(surface); + vrvSurface->ReadCoordinatedUl(surface); vrvSurface->ReadTyped(surface); for (pugi::xml_node child = surface.first_child(); child; child = child.next_sibling()) { From 8a4a76a09ffd015af94b4ab2e29e2cfb3a4d3dee Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 27 Dec 2023 21:21:50 +0000 Subject: [PATCH 116/144] Output facsimile with nested surface (invalid MEI) --- include/vrv/facsimilefunctor.h | 11 ++++---- include/vrv/facsimileinterface.h | 3 +-- src/doc.cpp | 9 +++---- src/facsimilefunctor.cpp | 45 ++++++++++++++++++++------------ 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/include/vrv/facsimilefunctor.h b/include/vrv/facsimilefunctor.h index 626b7c71a38..4f3ae259fe5 100644 --- a/include/vrv/facsimilefunctor.h +++ b/include/vrv/facsimilefunctor.h @@ -9,6 +9,7 @@ #define __VRV_FACSIMILEFUNCTOR_H__ #include "functor.h" +#include "view.h" namespace vrv { @@ -81,7 +82,7 @@ class SyncToFacsimileFunctor : public Functor { * @name Constructors, destructors */ ///@{ - SyncToFacsimileFunctor(Doc *doc, Surface *surface, int height, int width); + SyncToFacsimileFunctor(Doc *doc); virtual ~SyncToFacsimileFunctor() = default; ///@} @@ -107,20 +108,20 @@ class SyncToFacsimileFunctor : public Functor { // private: /** Create zone if not exist */ - Zone *GetZone(FacsimileInterface *interface); + Zone *GetZone(FacsimileInterface *interface, std::string type); + public: // private: /** The doc */ Doc *m_doc; - /** Page height and width */ - int m_height; - int m_width; /** The surface we are going to add / update zone */ Surface *m_surface; // Page *m_currentPage; System *m_currentSystem; + // + View m_view; }; } // namespace vrv diff --git a/include/vrv/facsimileinterface.h b/include/vrv/facsimileinterface.h index cbc46f7ddb3..6faa2ab80b9 100644 --- a/include/vrv/facsimileinterface.h +++ b/include/vrv/facsimileinterface.h @@ -13,8 +13,7 @@ #include "interface.h" namespace vrv { -class FunctorParams; -class View; + class Zone; //---------------------------------------------------------------------------- diff --git a/src/doc.cpp b/src/doc.cpp index b909bb5f4d0..1b5d917a0d5 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -1413,12 +1413,9 @@ void Doc::SyncToFacsimileDoc() m_facsimile->AddChild(new Surface()); } m_facsimile->SetType("transcription"); - Surface *surface = vrv_cast(m_facsimile->FindDescendantByType(SURFACE)); - assert(surface); - - const int width = m_options->m_pageWidth.GetUnfactoredValue(); - const int height = m_options->m_pageHeight.GetUnfactoredValue(); - SyncToFacsimileFunctor syncToFacimileFunctor(this, surface, height, width); + m_facsimile->ClearChildren(); + + SyncToFacsimileFunctor syncToFacimileFunctor(this); this->Process(syncToFacimileFunctor); } diff --git a/src/facsimilefunctor.cpp b/src/facsimilefunctor.cpp index 4dd47302093..62a3e61b795 100644 --- a/src/facsimilefunctor.cpp +++ b/src/facsimilefunctor.cpp @@ -109,12 +109,11 @@ FunctorCode SyncFromFacsimileFunctor::VisitSystem(System *system) // SyncToFacsimileFunctor //---------------------------------------------------------------------------- -SyncToFacsimileFunctor::SyncToFacsimileFunctor(Doc *doc, Surface *surface, int height, int width) : Functor() +SyncToFacsimileFunctor::SyncToFacsimileFunctor(Doc *doc) : Functor() { m_doc = doc; - m_height = height; - m_width = width; - m_surface = surface; + m_view.SetDoc(doc); + m_surface = NULL; m_currentPage = NULL; m_currentSystem = NULL; } @@ -124,8 +123,8 @@ FunctorCode SyncToFacsimileFunctor::VisitLayerElement(LayerElement *layerElement if (!layerElement->Is({ NOTE, REST })) return FUNCTOR_CONTINUE; // layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - Zone *zone = this->GetZone(layerElement); - zone->SetUlx(layerElement->GetDrawingX() / DEFINITION_FACTOR); + Zone *zone = this->GetZone(layerElement, layerElement->GetClassName()); + zone->SetUlx(m_view.ToLogicalX(layerElement->GetDrawingX()) / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -134,7 +133,7 @@ FunctorCode SyncToFacsimileFunctor::VisitMeasure(Measure *measure) { // measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; // measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; - Zone *zone = this->GetZone(measure); + Zone *zone = this->GetZone(measure, measure->GetClassName()); zone->SetUlx(measure->GetDrawingX() / DEFINITION_FACTOR); zone->SetLrx(measure->GetDrawingX() + measure->GetWidth() / DEFINITION_FACTOR); @@ -146,6 +145,18 @@ FunctorCode SyncToFacsimileFunctor::VisitPage(Page *page) m_currentPage = page; m_doc->SetDrawingPage(page->GetIdx()); page->LayOut(); + // + Surface *surface = new Surface(); + assert(m_doc->GetFacsimile()); + m_doc->GetFacsimile()->AddChild(surface); + surface->SetLrx(m_doc->m_drawingPageWidth / DEFINITION_FACTOR); + surface->SetLry(m_doc->m_drawingPageHeight / DEFINITION_FACTOR); + m_surface = new Surface(); + surface->AddChild(m_surface); + m_surface->SetUlx(m_doc->m_drawingPageMarginLeft / DEFINITION_FACTOR); + m_surface->SetUly(m_doc->m_drawingPageMarginRight / DEFINITION_FACTOR); + m_surface->SetLrx(m_doc->m_drawingPageContentWidth / DEFINITION_FACTOR); + m_surface->SetLry(m_doc->m_drawingPageContentHeight / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -154,10 +165,8 @@ FunctorCode SyncToFacsimileFunctor::VisitPb(Pb *pb) { // m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; // m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; - Zone *zone = this->GetZone(pb); - zone->SetLry(m_height); - zone->SetLrx(m_width); - + // Zone *zone = this->GetZone(pb, pb->GetClassName()); + return FUNCTOR_CONTINUE; } @@ -165,9 +174,9 @@ FunctorCode SyncToFacsimileFunctor::VisitSb(Sb *sb) { // m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; // m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; - Zone *zone = this->GetZone(sb); - zone->SetUlx(m_currentSystem->GetDrawingX() / DEFINITION_FACTOR); - zone->SetUly(m_currentSystem->GetDrawingY() / DEFINITION_FACTOR); + Zone *zone = this->GetZone(sb, sb->GetClassName()); + zone->SetUlx(m_view.ToLogicalX(m_currentSystem->GetDrawingX()) / DEFINITION_FACTOR); + zone->SetUly(m_view.ToLogicalY(m_currentSystem->GetDrawingY()) / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -175,8 +184,8 @@ FunctorCode SyncToFacsimileFunctor::VisitSb(Sb *sb) FunctorCode SyncToFacsimileFunctor::VisitStaff(Staff *staff) { // staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; - Zone *zone = this->GetZone(staff); - zone->SetUly(staff->GetDrawingY() / DEFINITION_FACTOR); + Zone *zone = this->GetZone(staff, staff->GetClassName()); + zone->SetUly(m_view.ToLogicalY(staff->GetDrawingY()) / DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -188,7 +197,7 @@ FunctorCode SyncToFacsimileFunctor::VisitSystem(System *system) return FUNCTOR_CONTINUE; } -Zone *SyncToFacsimileFunctor::GetZone(FacsimileInterface *interface) +Zone *SyncToFacsimileFunctor::GetZone(FacsimileInterface *interface, std::string type) { if (interface->GetZone()) { // Here we should probably check if the zone is a child of m_surface @@ -196,6 +205,8 @@ Zone *SyncToFacsimileFunctor::GetZone(FacsimileInterface *interface) } else { Zone *zone = new Zone(); + std::transform(type.begin(), type.end(), type.begin(), ::tolower); + zone->SetType(type); m_surface->AddChild(zone); interface->SetFacs(StringFormat("#%s", zone->GetID().c_str())); interface->AttachZone(zone); From 82845f9bfb57a333a22217525b5a3734380639c3 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 28 Dec 2023 10:08:51 +0000 Subject: [PATCH 117/144] Add pseudo functors to FacsimileInterface --- include/vrv/facsimileinterface.h | 21 ++++++++++++++++- include/vrv/preparedatafunctor.h | 5 ++++ src/facsimileinterface.cpp | 40 +++++++++++++++++++++++++++++++- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/include/vrv/facsimileinterface.h b/include/vrv/facsimileinterface.h index 6faa2ab80b9..7afafef144b 100644 --- a/include/vrv/facsimileinterface.h +++ b/include/vrv/facsimileinterface.h @@ -14,6 +14,10 @@ namespace vrv { +class Facsimile; +class PrepareFacsimileFunctor; +class ResetDataFunctor; +class Surface; class Zone; //---------------------------------------------------------------------------- @@ -55,8 +59,23 @@ class FacsimileInterface : public Interface, public AttFacsimile { const Zone *GetZone() const { return m_zone; } ///@} + //-----------------// + // Pseudo functors // + //-----------------// + + /** + * We have functor code in the interface for avoiding code duplication in each implementation class. + * Since we are in an interface, we need to pass the object (implementation) to + * the pseudo functor method. + */ + ///@{ + FunctorCode InterfacePrepareFacsimile(PrepareFacsimileFunctor &functor, Object *object); + FunctorCode InterfaceResetData(ResetDataFunctor &functor, Object *object); + ///@} + private: - Zone *m_zone = NULL; + Zone *m_zone; + Surface *m_surface; }; } // namespace vrv #endif diff --git a/include/vrv/preparedatafunctor.h b/include/vrv/preparedatafunctor.h index 412ef9f3918..793d1e66c0e 100644 --- a/include/vrv/preparedatafunctor.h +++ b/include/vrv/preparedatafunctor.h @@ -218,6 +218,11 @@ class PrepareFacsimileFunctor : public Functor { */ const ListOfObjects &GetZonelessSyls() const { return m_zonelessSyls; } + /* + * Getter for the facsimile + */ + Facsimile *GetFacsimile() const { return m_facsimile; } + /* * Functor interface */ diff --git a/src/facsimileinterface.cpp b/src/facsimileinterface.cpp index 420b18be836..d6caee2e131 100644 --- a/src/facsimileinterface.cpp +++ b/src/facsimileinterface.cpp @@ -15,6 +15,7 @@ #include "doc.h" #include "facsimile.h" +#include "preparedatafunctor.h" #include "surface.h" #include "syllable.h" #include "view.h" @@ -34,7 +35,9 @@ FacsimileInterface::~FacsimileInterface() {} void FacsimileInterface::Reset() { this->ResetFacsimile(); - this->AttachZone(NULL); + + m_zone = NULL; + m_surface = NULL; } int FacsimileInterface::GetDrawingX() const @@ -99,4 +102,39 @@ void FacsimileInterface::AttachZone(Zone *zone) } } +//---------------------------------------------------------------------------- +// Interface pseudo functor (redirected) +//---------------------------------------------------------------------------- + +FunctorCode FacsimileInterface::InterfacePrepareFacsimile(PrepareFacsimileFunctor &functor, Object *object) +{ + assert(functor.GetFacsimile()); + Facsimile *facsimile = functor.GetFacsimile(); + std::string facsID = ExtractIDFragment(this->GetFacs()); + Object *facsDescendant = facsimile->FindDescendantByID(facsID); + if (!facsDescendant) { + LogWarning("Could not find @facs '%s' in facsimile element", facsID.c_str()); + return FUNCTOR_CONTINUE; + } + + if (facsDescendant->Is(ZONE)) { + m_zone = vrv_cast(facsDescendant); + assert(m_zone); + } + else if (facsDescendant->Is(SURFACE)) { + m_surface = vrv_cast(facsDescendant); + assert(m_surface); + } + + return FUNCTOR_CONTINUE; +} + +FunctorCode FacsimileInterface::InterfaceResetData(ResetDataFunctor &functor, Object *object) +{ + m_zone = NULL; + m_surface = NULL; + + return FUNCTOR_CONTINUE; +} + } // namespace vrv From 0eb3ce4806c1de5cd2cc391a7aa271c36f0ff931 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 28 Dec 2023 10:09:42 +0000 Subject: [PATCH 118/144] Make sure ResetData parent is always called * Also add call to FascimileInterface::ResetDataInterface --- include/vrv/resetfunctor.h | 1 + src/preparedatafunctor.cpp | 6 +----- src/resetfunctor.cpp | 44 ++++++++++++++++++++++++++++++-------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/include/vrv/resetfunctor.h b/include/vrv/resetfunctor.h index 2e681f1d877..f8f4d5c1032 100644 --- a/include/vrv/resetfunctor.h +++ b/include/vrv/resetfunctor.h @@ -62,6 +62,7 @@ class ResetDataFunctor : public Functor { FunctorCode VisitMeasure(Measure *measure) override; FunctorCode VisitMRest(MRest *mRest) override; FunctorCode VisitNote(Note *note) override; + FunctorCode VisitObject(Object *object) override; FunctorCode VisitRepeatMark(RepeatMark *repeatMark) override; FunctorCode VisitRest(Rest *rest) override; FunctorCode VisitSection(Section *section) override; diff --git a/src/preparedatafunctor.cpp b/src/preparedatafunctor.cpp index bf6a106a6e3..98b7b07152e 100644 --- a/src/preparedatafunctor.cpp +++ b/src/preparedatafunctor.cpp @@ -380,11 +380,7 @@ FunctorCode PrepareFacsimileFunctor::VisitObject(Object *object) FacsimileInterface *interface = object->GetFacsimileInterface(); assert(interface); if (interface->HasFacs()) { - std::string facsID = ExtractIDFragment(interface->GetFacs()); - Zone *zone = m_facsimile->FindZoneByID(facsID); - if (zone != NULL) { - interface->AttachZone(zone); - } + interface->InterfacePrepareFacsimile(*this, object); } // Zoneless syl else if (object->Is(SYL)) { diff --git a/src/resetfunctor.cpp b/src/resetfunctor.cpp index 8a09f26fe80..6c53b73e881 100644 --- a/src/resetfunctor.cpp +++ b/src/resetfunctor.cpp @@ -63,10 +63,7 @@ FunctorCode ResetDataFunctor::VisitArpeg(Arpeg *arpeg) { // Call parent one too this->VisitControlElement(arpeg); - - PlistInterface *interface = arpeg->GetPlistInterface(); - assert(interface); - interface->InterfaceResetData(*this, arpeg); + arpeg->PlistInterface::InterfaceResetData(*this, arpeg); return FUNCTOR_CONTINUE; } @@ -184,6 +181,9 @@ FunctorCode ResetDataFunctor::VisitDots(Dots *dots) FunctorCode ResetDataFunctor::VisitEditorialElement(EditorialElement *editorialElement) { + // Call parent one too + this->VisitObject(editorialElement); + if (editorialElement->IsSystemMilestone()) { editorialElement->SystemMilestoneInterface::InterfaceResetData(*this); } @@ -194,7 +194,6 @@ FunctorCode ResetDataFunctor::VisitEditorialElement(EditorialElement *editorialE FunctorCode ResetDataFunctor::VisitEnding(Ending *ending) { this->VisitFloatingObject(ending); - ending->SystemMilestoneInterface::InterfaceResetData(*this); return FUNCTOR_CONTINUE; @@ -203,10 +202,7 @@ FunctorCode ResetDataFunctor::VisitEnding(Ending *ending) FunctorCode ResetDataFunctor::VisitF(F *f) { this->VisitTextElement(f); - - TimeSpanningInterface *interface = f->GetTimeSpanningInterface(); - assert(interface); - interface->InterfaceResetData(*this, f); + f->TimeSpanningInterface::InterfaceResetData(*this, f); return FUNCTOR_CONTINUE; } @@ -222,10 +218,19 @@ FunctorCode ResetDataFunctor::VisitFlag(Flag *flag) FunctorCode ResetDataFunctor::VisitFloatingObject(FloatingObject *floatingObject) { + // Call parent one too + this->VisitObject(floatingObject); + floatingObject->ResetDrawing(); floatingObject->SetDrawingGrpId(0); // Pass it to the pseudo functor of the interface + if (floatingObject->HasInterface(INTERFACE_FACSIMILE)) { + FacsimileInterface *interface = floatingObject->GetFacsimileInterface(); + assert(interface); + interface->InterfaceResetData(*this, floatingObject); + } + // else / else if because TimpeSpanningInterface::InterfaceResetData resets TimePointingInterface if (floatingObject->HasInterface(INTERFACE_TIME_SPANNING)) { TimeSpanningInterface *interface = floatingObject->GetTimeSpanningInterface(); assert(interface); @@ -265,6 +270,9 @@ FunctorCode ResetDataFunctor::VisitHairpin(Hairpin *hairpin) FunctorCode ResetDataFunctor::VisitLayer(Layer *layer) { + // Call parent one too + this->VisitObject(layer); + layer->SetCrossStaffFromAbove(false); layer->SetCrossStaffFromBelow(false); return FUNCTOR_CONTINUE; @@ -272,6 +280,10 @@ FunctorCode ResetDataFunctor::VisitLayer(Layer *layer) FunctorCode ResetDataFunctor::VisitLayerElement(LayerElement *layerElement) { + // Call parent one too + this->VisitObject(layerElement); + layerElement->FacsimileInterface::InterfaceResetData(*this, layerElement); + layerElement->SetIsInBeamSpan(false); layerElement->SetDrawingCueSize(false); layerElement->m_crossStaff = NULL; @@ -299,6 +311,10 @@ FunctorCode ResetDataFunctor::VisitLigature(Ligature *ligature) FunctorCode ResetDataFunctor::VisitMeasure(Measure *measure) { + // Call parent one too + this->VisitObject(measure); + measure->FacsimileInterface::InterfaceResetData(*this, measure); + measure->m_timestampAligner.Reset(); measure->SetDrawingEnding(NULL); return FUNCTOR_CONTINUE; @@ -327,6 +343,11 @@ FunctorCode ResetDataFunctor::VisitNote(Note *note) return FUNCTOR_CONTINUE; } +FunctorCode ResetDataFunctor::VisitObject(Object *object) +{ + return FUNCTOR_CONTINUE; +} + FunctorCode ResetDataFunctor::VisitRepeatMark(RepeatMark *repeatMark) { // Call parent one too @@ -348,6 +369,7 @@ FunctorCode ResetDataFunctor::VisitRest(Rest *rest) FunctorCode ResetDataFunctor::VisitSection(Section *section) { + // Call parent one too this->VisitFloatingObject(section); if (section->IsSystemMilestone()) { @@ -369,6 +391,10 @@ FunctorCode ResetDataFunctor::VisitSlur(Slur *slur) FunctorCode ResetDataFunctor::VisitStaff(Staff *staff) { + // Call parent one too + this->VisitObject(staff); + staff->FacsimileInterface::InterfaceResetData(*this, staff); + staff->m_timeSpanningElements.clear(); staff->ClearLedgerLines(); return FUNCTOR_CONTINUE; From 238e3bbdbd62483396ca3635ebb7b1089fd0179e Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 28 Dec 2023 10:13:23 +0000 Subject: [PATCH 119/144] Revert "Allow surface within surface" This reverts commit 4cc1e8309111afc5f18d8fa7c3abce0da5b48554. --- include/vrv/iomei.h | 2 +- src/iomei.cpp | 9 +-------- src/surface.cpp | 3 --- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/vrv/iomei.h b/include/vrv/iomei.h index 6f0b358c3db..6b0d7800119 100644 --- a/include/vrv/iomei.h +++ b/include/vrv/iomei.h @@ -846,7 +846,7 @@ class MEIInput : public Input { ///@{ bool ReadFacsimile(Doc *doc, pugi::xml_node facsimile); bool ReadGraphic(Object *parent, pugi::xml_node graphic); - bool ReadSurface(Object *parent, pugi::xml_node surface); + bool ReadSurface(Facsimile *parent, pugi::xml_node surface); bool ReadTupletSpanAsTuplet(Measure *measure, pugi::xml_node tupletSpan); bool ReadZone(Surface *parent, pugi::xml_node zone); ///@} diff --git a/src/iomei.cpp b/src/iomei.cpp index dbe70a5232d..039e39b29e8 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -2884,10 +2884,6 @@ void MEIOutput::WriteSurface(pugi::xml_node currentNode, Surface *surface) pugi::xml_node childNode = currentNode.append_child("graphic"); this->WriteGraphic(childNode, dynamic_cast(child)); } - else if (child->GetClassId() == SURFACE) { - pugi::xml_node childNode = currentNode.append_child("surface"); - this->WriteSurface(childNode, dynamic_cast(child)); - } else if (child->GetClassId() == ZONE) { pugi::xml_node childNode = currentNode.append_child("zone"); this->WriteZone(childNode, dynamic_cast(child)); @@ -8507,7 +8503,7 @@ bool MEIInput::ReadGraphic(Object *parent, pugi::xml_node graphic) return true; } -bool MEIInput::ReadSurface(Object *parent, pugi::xml_node surface) +bool MEIInput::ReadSurface(Facsimile *parent, pugi::xml_node surface) { assert(parent); Surface *vrvSurface = new Surface(); @@ -8520,9 +8516,6 @@ bool MEIInput::ReadSurface(Object *parent, pugi::xml_node surface) if (strcmp(child.name(), "graphic") == 0) { this->ReadGraphic(vrvSurface, child); } - else if (strcmp(child.name(), "surface") == 0) { - this->ReadSurface(vrvSurface, child); - } else if (strcmp(child.name(), "zone") == 0) { this->ReadZone(vrvSurface, child); } diff --git a/src/surface.cpp b/src/surface.cpp index 799f8477e26..3c0b01d1b43 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -49,9 +49,6 @@ bool Surface::IsSupportedChild(Object *object) if (object->Is(GRAPHIC)) { assert(dynamic_cast(object)); } - else if (object->Is(SURFACE)) { - assert(dynamic_cast(object)); - } else if (object->Is(ZONE)) { assert(dynamic_cast(object)); } From 3a5dda70b23cd67fe7d3176f252a462a760b89be Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 28 Dec 2023 11:49:56 +0000 Subject: [PATCH 120/144] Make a separate Doc::UpdatePageDrawingSizes method --- include/vrv/doc.h | 5 +++++ src/doc.cpp | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index 788483f2554..3a60bfe6c6b 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -398,6 +398,11 @@ class Doc : public Object { */ Page *SetDrawingPage(int pageIdx); + /** + * Update the drawing page sizes when a page is set as drawing page. + */ + void UpdatePageDrawingSizes(); + /** * Reset drawing page to NULL. * This might be necessary if we have replaced a page in the document. diff --git a/src/doc.cpp b/src/doc.cpp index 1b5d917a0d5..ce24cb3dbed 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -2038,6 +2038,15 @@ Page *Doc::SetDrawingPage(int pageIdx) m_drawingPage = vrv_cast(pages->GetChild(pageIdx)); assert(m_drawingPage); + UpdatePageDrawingSizes(); + + return m_drawingPage; +} + +void Doc::UpdatePageDrawingSizes() +{ + assert(m_drawingPage); + int glyph_size; // we use the page members only if set (!= -1) @@ -2103,8 +2112,6 @@ Page *Doc::SetDrawingPage(int pageIdx) glyph_size = this->GetGlyphWidth(SMUFL_E0A2_noteheadWhole, 100, 0); m_drawingBrevisWidth = (int)((glyph_size * 0.8) / 2); - - return m_drawingPage; } int Doc::CalcMusicFontSize() From 64110d14b35c3c7269372deeefecbce9143911cd Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 28 Dec 2023 12:19:56 +0000 Subject: [PATCH 121/144] Adjust the implementation of SyncFromFacsimile * Read page size from the surface attributes * Convert to logical units --- include/vrv/facsimilefunctor.h | 11 ++++- src/doc.cpp | 2 +- src/facsimilefunctor.cpp | 82 +++++++++++++++++++--------------- src/facsimileinterface.cpp | 4 +- 4 files changed, 59 insertions(+), 40 deletions(-) diff --git a/include/vrv/facsimilefunctor.h b/include/vrv/facsimilefunctor.h index 4f3ae259fe5..1273343626c 100644 --- a/include/vrv/facsimilefunctor.h +++ b/include/vrv/facsimilefunctor.h @@ -35,7 +35,7 @@ class SyncFromFacsimileFunctor : public Functor { * @name Constructors, destructors */ ///@{ - SyncFromFacsimileFunctor(); + SyncFromFacsimileFunctor(Doc *doc); virtual ~SyncFromFacsimileFunctor() = default; ///@} @@ -64,6 +64,10 @@ class SyncFromFacsimileFunctor : public Functor { public: // private: + /** The doc */ + Doc *m_doc; + // + View m_view; // Page *m_currentPage; System *m_currentSystem; @@ -115,13 +119,16 @@ class SyncToFacsimileFunctor : public Functor { private: /** The doc */ Doc *m_doc; + // + View m_view; /** The surface we are going to add / update zone */ Surface *m_surface; // Page *m_currentPage; System *m_currentSystem; // - View m_view; + int m_pageMarginTop; + int m_pageMarginLeft; }; } // namespace vrv diff --git a/src/doc.cpp b/src/doc.cpp index ce24cb3dbed..d138ced9ba9 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -1398,7 +1398,7 @@ void Doc::SyncFromFacsimileDoc() PrepareFacsimileFunctor prepareFacsimile(this->GetFacsimile()); this->Process(prepareFacsimile); - SyncFromFacsimileFunctor syncFromFacsimileFunctor; + SyncFromFacsimileFunctor syncFromFacsimileFunctor(this); this->Process(syncFromFacsimileFunctor); } diff --git a/src/facsimilefunctor.cpp b/src/facsimilefunctor.cpp index 62a3e61b795..eb97b6ed18d 100644 --- a/src/facsimilefunctor.cpp +++ b/src/facsimilefunctor.cpp @@ -29,8 +29,10 @@ namespace vrv { // SyncFromFacsimileFunctor //---------------------------------------------------------------------------- -SyncFromFacsimileFunctor::SyncFromFacsimileFunctor() : Functor() +SyncFromFacsimileFunctor::SyncFromFacsimileFunctor(Doc *doc) : Functor() { + m_doc = doc; + m_view.SetDoc(doc); m_currentPage = NULL; m_currentSystem = NULL; } @@ -41,7 +43,7 @@ FunctorCode SyncFromFacsimileFunctor::VisitLayerElement(LayerElement *layerEleme Zone *zone = layerElement->GetZone(); assert(zone); - layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; + layerElement->m_xAbs = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -50,8 +52,8 @@ FunctorCode SyncFromFacsimileFunctor::VisitMeasure(Measure *measure) { Zone *zone = measure->GetZone(); assert(zone); - measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; + measure->m_xAbs = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); + measure->m_xAbs2 = m_view.ToLogicalX(zone->GetLrx() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -59,6 +61,7 @@ FunctorCode SyncFromFacsimileFunctor::VisitMeasure(Measure *measure) FunctorCode SyncFromFacsimileFunctor::VisitPage(Page *page) { m_currentPage = page; + m_doc->SetDrawingPage(m_currentPage->GetIdx()); return FUNCTOR_CONTINUE; } @@ -69,9 +72,20 @@ FunctorCode SyncFromFacsimileFunctor::VisitPb(Pb *pb) assert(m_currentPage); Zone *zone = pb->GetZone(); - assert(zone); - m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; - m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; + assert(zone && zone->GetParent()); + Surface *surface = (zone->GetParent()->Is(SURFACE)) ? vrv_cast(zone->GetParent()) : NULL; + // Use the parent surface attributes if given + if (surface && surface->HasLrx() && surface->HasLry()) { + m_currentPage->m_pageHeight = surface->GetLry() * DEFINITION_FACTOR; + m_currentPage->m_pageWidth = surface->GetLrx() * DEFINITION_FACTOR; + } + // Fallback on zone + else { + m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; + m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; + } + // Update the page size to have to View::ToLogicalX/Y valid + m_doc->UpdatePageDrawingSizes(); return FUNCTOR_CONTINUE; } @@ -83,8 +97,8 @@ FunctorCode SyncFromFacsimileFunctor::VisitSb(Sb *sb) Zone *zone = sb->GetZone(); assert(zone); - m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + m_currentSystem->m_xAbs = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); + m_currentSystem->m_yAbs = m_view.ToLogicalY(zone->GetUly() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -93,7 +107,7 @@ FunctorCode SyncFromFacsimileFunctor::VisitStaff(Staff *staff) { Zone *zone = staff->GetZone(); assert(zone); - staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; + staff->m_yAbs = m_view.ToLogicalY(zone->GetUly() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -116,26 +130,26 @@ SyncToFacsimileFunctor::SyncToFacsimileFunctor(Doc *doc) : Functor() m_surface = NULL; m_currentPage = NULL; m_currentSystem = NULL; + m_pageMarginTop = 0; + m_pageMarginLeft = 0; } FunctorCode SyncToFacsimileFunctor::VisitLayerElement(LayerElement *layerElement) { if (!layerElement->Is({ NOTE, REST })) return FUNCTOR_CONTINUE; - // layerElement->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; Zone *zone = this->GetZone(layerElement, layerElement->GetClassName()); - zone->SetUlx(m_view.ToLogicalX(layerElement->GetDrawingX()) / DEFINITION_FACTOR); + zone->SetUlx(m_view.ToDeviceContextX(layerElement->GetDrawingX()) / DEFINITION_FACTOR + m_pageMarginLeft); return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitMeasure(Measure *measure) { - // measure->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - // measure->m_xAbs2 = zone->GetLrx() * DEFINITION_FACTOR; Zone *zone = this->GetZone(measure, measure->GetClassName()); - zone->SetUlx(measure->GetDrawingX() / DEFINITION_FACTOR); - zone->SetLrx(measure->GetDrawingX() + measure->GetWidth() / DEFINITION_FACTOR); + zone->SetUlx(m_view.ToDeviceContextX(measure->GetDrawingX()) / DEFINITION_FACTOR + m_pageMarginLeft); + zone->SetLrx( + m_view.ToDeviceContextX(measure->GetDrawingX() + measure->GetWidth()) / DEFINITION_FACTOR + m_pageMarginLeft); return FUNCTOR_CONTINUE; } @@ -146,46 +160,44 @@ FunctorCode SyncToFacsimileFunctor::VisitPage(Page *page) m_doc->SetDrawingPage(page->GetIdx()); page->LayOut(); // - Surface *surface = new Surface(); - assert(m_doc->GetFacsimile()); - m_doc->GetFacsimile()->AddChild(surface); - surface->SetLrx(m_doc->m_drawingPageWidth / DEFINITION_FACTOR); - surface->SetLry(m_doc->m_drawingPageHeight / DEFINITION_FACTOR); m_surface = new Surface(); - surface->AddChild(m_surface); - m_surface->SetUlx(m_doc->m_drawingPageMarginLeft / DEFINITION_FACTOR); - m_surface->SetUly(m_doc->m_drawingPageMarginRight / DEFINITION_FACTOR); - m_surface->SetLrx(m_doc->m_drawingPageContentWidth / DEFINITION_FACTOR); - m_surface->SetLry(m_doc->m_drawingPageContentHeight / DEFINITION_FACTOR); + assert(m_doc->GetFacsimile()); + m_doc->GetFacsimile()->AddChild(m_surface); + m_surface->SetLrx(m_doc->m_drawingPageWidth / DEFINITION_FACTOR); + m_surface->SetLry(m_doc->m_drawingPageHeight / DEFINITION_FACTOR); + // Because the facsimile output zone positions include the margins, we will add them to each zone + m_pageMarginTop = m_doc->m_drawingPageMarginTop / DEFINITION_FACTOR; + m_pageMarginLeft = m_doc->m_drawingPageMarginLeft / DEFINITION_FACTOR; return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitPb(Pb *pb) { - // m_currentPage->m_pageHeight = zone->GetLry() * DEFINITION_FACTOR; - // m_currentPage->m_pageWidth = zone->GetLrx() * DEFINITION_FACTOR; - // Zone *zone = this->GetZone(pb, pb->GetClassName()); + Zone *zone = this->GetZone(pb, pb->GetClassName()); + // The Pb zone values are currently not used in SyncFromFacsimileFunctor because the + // page sizes are synced from the parent Surface and zone positions include margins + zone->SetUlx(m_pageMarginLeft); + zone->SetUly(m_pageMarginTop); + zone->SetLrx(m_doc->m_drawingPageContentWidth / DEFINITION_FACTOR + m_pageMarginLeft); + zone->SetLry(m_doc->m_drawingPageContentHeight / DEFINITION_FACTOR + m_pageMarginTop); return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitSb(Sb *sb) { - // m_currentSystem->m_xAbs = zone->GetUlx() * DEFINITION_FACTOR; - // m_currentSystem->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; Zone *zone = this->GetZone(sb, sb->GetClassName()); - zone->SetUlx(m_view.ToLogicalX(m_currentSystem->GetDrawingX()) / DEFINITION_FACTOR); - zone->SetUly(m_view.ToLogicalY(m_currentSystem->GetDrawingY()) / DEFINITION_FACTOR); + zone->SetUlx(m_view.ToDeviceContextX(m_currentSystem->GetDrawingX()) / DEFINITION_FACTOR + m_pageMarginLeft); + zone->SetUly(m_view.ToDeviceContextY(m_currentSystem->GetDrawingY()) / DEFINITION_FACTOR + m_pageMarginTop); return FUNCTOR_CONTINUE; } FunctorCode SyncToFacsimileFunctor::VisitStaff(Staff *staff) { - // staff->m_yAbs = zone->GetUly() * DEFINITION_FACTOR; Zone *zone = this->GetZone(staff, staff->GetClassName()); - zone->SetUly(m_view.ToLogicalY(staff->GetDrawingY()) / DEFINITION_FACTOR); + zone->SetUly(m_view.ToDeviceContextY(staff->GetDrawingY()) / DEFINITION_FACTOR + m_pageMarginTop); return FUNCTOR_CONTINUE; } diff --git a/src/facsimileinterface.cpp b/src/facsimileinterface.cpp index d6caee2e131..93dd965da22 100644 --- a/src/facsimileinterface.cpp +++ b/src/facsimileinterface.cpp @@ -35,7 +35,7 @@ FacsimileInterface::~FacsimileInterface() {} void FacsimileInterface::Reset() { this->ResetFacsimile(); - + m_zone = NULL; m_surface = NULL; } @@ -116,7 +116,7 @@ FunctorCode FacsimileInterface::InterfacePrepareFacsimile(PrepareFacsimileFuncto LogWarning("Could not find @facs '%s' in facsimile element", facsID.c_str()); return FUNCTOR_CONTINUE; } - + if (facsDescendant->Is(ZONE)) { m_zone = vrv_cast(facsDescendant); assert(m_zone); From ca055284bbdac22aa97ad4fed49064e36a0a0d9d Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 28 Dec 2023 14:15:53 +0000 Subject: [PATCH 122/144] Remove unused vrv_params_cast --- include/vrv/vrvdef.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/vrv/vrvdef.h b/include/vrv/vrvdef.h index 8178d672501..eb3644af011 100644 --- a/include/vrv/vrvdef.h +++ b/include/vrv/vrvdef.h @@ -61,11 +61,8 @@ namespace vrv { #ifdef VRV_DYNAMIC_CAST // To be used for all cases where type is cheched through Object::m_type #define vrv_cast dynamic_cast -// To be used for params casts within Functors -#define vrv_params_cast dynamic_cast #else #define vrv_cast static_cast -#define vrv_params_cast static_cast #endif //---------------------------------------------------------------------------- From cc9269df0bd0ba3f2d47e6698f92d237f90c57e1 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 28 Dec 2023 19:17:22 +0000 Subject: [PATCH 123/144] Add mei-facs output option in the command-line tool --- src/options.cpp | 2 +- src/toolkit.cpp | 17 +++++++++++++++-- tools/main.cpp | 14 +++++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index 08aa84dad59..294837d2679 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -954,7 +954,7 @@ Options::Options() m_baseOptions.AddOption(&m_scale); m_outputTo.SetInfo("Output to", - "Select output format to: \"mei\", \"mei-pb\", \"mei-basic\", \"svg\", \"midi\", \"timemap\", " + "Select output format to: \"mei\", \"mei-pb\", \"mei-facs\", \"mei-basic\", \"svg\", \"midi\", \"timemap\", " "\"expansionmap\", \"humdrum\" or " "\"pae\""); m_outputTo.Init("svg"); diff --git a/src/toolkit.cpp b/src/toolkit.cpp index c946c020aca..b7a31251bd2 100644 --- a/src/toolkit.cpp +++ b/src/toolkit.cpp @@ -152,6 +152,9 @@ bool Toolkit::SetOutputTo(std::string const &outputTo) else if (outputTo == "mei-pb") { m_outputTo = MEI; } + else if (outputTo == "mei-facs") { + m_outputTo = MEI; + } else if (outputTo == "midi") { m_outputTo = MIDI; } @@ -816,6 +819,7 @@ std::string Toolkit::GetMEI(const std::string &jsonOptions) std::string firstMeasure; std::string lastMeasure; std::string mdiv; + bool generateFacs = false; jsonxx::Object json; @@ -838,6 +842,7 @@ std::string Toolkit::GetMEI(const std::string &jsonOptions) if (json.has("firstMeasure")) firstMeasure = json.get("firstMeasure"); if (json.has("lastMeasure")) lastMeasure = json.get("lastMeasure"); if (json.has("mdiv")) mdiv = json.get("mdiv"); + if (json.has("generateFacs")) generateFacs = json.get("generateFacs"); } } @@ -858,8 +863,6 @@ std::string Toolkit::GetMEI(const std::string &jsonOptions) m_doc.DeactiveateSelection(); } - m_doc.SyncToFacsimileDoc(); - MEIOutput meioutput(&m_doc); meioutput.SetScoreBasedMEI(scoreBased); meioutput.SetBasic(basic); @@ -875,6 +878,16 @@ std::string Toolkit::GetMEI(const std::string &jsonOptions) if (!lastMeasure.empty()) meioutput.SetLastMeasure(lastMeasure); if (!mdiv.empty()) meioutput.SetMdiv(mdiv); + if (generateFacs) { + if (meioutput.HasFilter() || !scoreBased || (m_options->m_breaks.GetValue() != BREAKS_encoded) + || m_doc.HasSelection()) { + LogError("Generating facsimile is only possible with all pages, encoded breaks, score-based output and " + "without selection."); + return ""; + } + m_doc.SyncToFacsimileDoc(); + } + std::string output = meioutput.GetOutput(); if (hadSelection) m_doc.ReactivateSelection(false); diff --git a/tools/main.cpp b/tools/main.cpp index 6f5aba3d793..3c0c8ee647f 100644 --- a/tools/main.cpp +++ b/tools/main.cpp @@ -279,10 +279,11 @@ int main(int argc, char **argv) } if ((outformat != "svg") && (outformat != "mei") && (outformat != "mei-basic") && (outformat != "mei-pb") - && (outformat != "midi") && (outformat != "timemap") && (outformat != "expansionmap") - && (outformat != "humdrum") && (outformat != "hum") && (outformat != "pae")) { + && (outformat != "mei-facs") && (outformat != "midi") && (outformat != "timemap") + && (outformat != "expansionmap") && (outformat != "humdrum") && (outformat != "hum") && (outformat != "pae")) { std::cerr << "Output format (" << outformat - << ") can only be 'mei', 'mei-basic', 'mei-pb', 'svg', 'midi', 'timemap', 'expansionmap', 'humdrum' " + << ") can only be 'mei', 'mei-basic', 'mei-pb', mei-facs', 'svg', 'midi', 'timemap', 'expansionmap', " + "'humdrum' " "or 'pae'." << std::endl; exit(1); @@ -553,10 +554,12 @@ int main(int argc, char **argv) const char *scoreBased = (outformat == "mei-pb") ? "false" : "true"; const char *basic = (outformat == "mei-basic") ? "true" : "false"; const char *removeIds = (options->m_removeIds.GetValue()) ? "true" : "false"; + const char *generateFacs = (outformat == "mei-facs") ? "true" : "false"; outfile += ".mei"; if (all_pages) { std::string params - = vrv::StringFormat("{'scoreBased': %s, 'basic': %s, 'removeIds': %s}", scoreBased, basic, removeIds); + = vrv::StringFormat("{'scoreBased': %s, 'basic': %s, 'removeIds': %s, 'generateFacs': %s}", scoreBased, + basic, removeIds, generateFacs); if (std_output) { std::string output; std::cout << toolkit.GetMEI(params); @@ -570,7 +573,8 @@ int main(int argc, char **argv) } else { std::string params = vrv::StringFormat( - "{'scoreBased': %s, 'basic': %s, 'pageNo': %d, 'removeIds': %s}", scoreBased, basic, page, removeIds); + "{'scoreBased': %s, 'basic': %s, 'pageNo': %d, 'removeIds': %s, 'generateFacs': %s}", scoreBased, basic, + page, removeIds, generateFacs); if (std_output) { std::cout << toolkit.GetMEI(params); } From 972ae2cc11922fa0258a1c0c220253a5777eeee9 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 29 Dec 2023 07:52:05 +0000 Subject: [PATCH 124/144] Move call to Doc::SyncFromFacsimile to Toolkit::LoadData --- src/iomei.cpp | 4 ---- src/toolkit.cpp | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/iomei.cpp b/src/iomei.cpp index 7aa1a46e76d..66c7cf2076c 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -3999,10 +3999,6 @@ bool MEIInput::ReadDoc(pugi::xml_node root) m_doc->ConvertMarkupDoc(!m_doc->GetOptions()->m_preserveAnalyticalMarkup.GetValue()); } - if (success && m_doc->IsTranscription()) { - m_doc->SyncFromFacsimileDoc(); - } - if (success && !m_hasScoreDef) { LogWarning("No scoreDef provided, trying to generate one..."); success = m_doc->GenerateDocumentScoreDef(); diff --git a/src/toolkit.cpp b/src/toolkit.cpp index b7a31251bd2..4821605cf8b 100644 --- a/src/toolkit.cpp +++ b/src/toolkit.cpp @@ -752,9 +752,14 @@ bool Toolkit::LoadData(const std::string &data) breaks = BREAKS_none; } - // Always set breaks to 'none' with Transcription or Facs rendering - rendering them differenty requires the MEI - // to be converted - if (m_doc.IsTranscription() || m_doc.IsFacs()) breaks = BREAKS_none; + // Always set breaks to 'none' with Facs rendering + if (m_doc.IsFacs()) breaks = BREAKS_none; + + // Always set breaks to 'none' or 'encoded' with Transcription rendering + // rendering them differenty requires the MEI + if (m_doc.IsTranscription()) { + breaks = (m_doc.HasFacsimile()) ? BREAKS_encoded : BREAKS_none; + } if (breaks != BREAKS_none) { if (input->GetLayoutInformation() == LAYOUT_ENCODED @@ -787,6 +792,10 @@ bool Toolkit::LoadData(const std::string &data) } } + if (m_doc.IsTranscription() && m_doc.HasFacsimile()) { + m_doc.SyncFromFacsimileDoc(); + } + delete input; m_view.SetDoc(&m_doc); From 6d05ef624340fba31c3ce65fe19d221321a8f804 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 29 Dec 2023 11:58:11 +0100 Subject: [PATCH 125/144] Rename m_*Abs members to m_drawingFacs* --- include/vrv/doc.h | 2 +- include/vrv/layerelement.h | 2 +- include/vrv/measure.h | 4 +-- include/vrv/staff.h | 2 +- include/vrv/system.h | 4 +-- src/adjustxrelfortranscriptionfunctor.cpp | 2 +- src/facsimilefunctor.cpp | 12 ++++---- src/iomei.cpp | 34 +++++++++++------------ src/layerelement.cpp | 8 +++--- src/measure.cpp | 16 +++++------ src/miscfunctor.cpp | 12 ++++---- src/staff.cpp | 4 +-- src/system.cpp | 8 +++--- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index 3a60bfe6c6b..8b387ef995a 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -370,7 +370,7 @@ class Doc : public Object { void ConvertMarkupDoc(bool permanent = true); /** - * Sync the coordinate provided trought to m_Abs. + * Sync the coordinate provided trought to m_drawingFacsX/Y. * Call the SyncToFacsimile functor. */ void SyncFromFacsimileDoc(); diff --git a/include/vrv/layerelement.h b/include/vrv/layerelement.h index af0917a61d7..085fa811845 100644 --- a/include/vrv/layerelement.h +++ b/include/vrv/layerelement.h @@ -386,7 +386,7 @@ class LayerElement : public Object, public: /** Absolute position X. This is used for facsimile (transcription) encoding */ - int m_xAbs; + int m_drawingFacsX; /** * This stores a pointer to the cross-staff (if any) and the appropriate layer * See PrepareCrossStaffFunctor diff --git a/include/vrv/measure.h b/include/vrv/measure.h index e76832df519..49ab432a0d7 100644 --- a/include/vrv/measure.h +++ b/include/vrv/measure.h @@ -371,8 +371,8 @@ class Measure : public Object, * This is the left and right position of the measure. */ ///@{ - int m_xAbs; - int m_xAbs2; + int m_drawingFacsX1; + int m_drawingFacsX2; ///@} /** diff --git a/include/vrv/staff.h b/include/vrv/staff.h index db2edc25618..51cbdbd9346 100644 --- a/include/vrv/staff.h +++ b/include/vrv/staff.h @@ -226,7 +226,7 @@ class Staff : public Object, * The Y absolute position of the staff for facsimile (transcription) encodings. * This is the top left corner of the staff (the X position is the position of the system). */ - int m_yAbs; + int m_drawingFacsY; StaffDef *m_drawingStaffDef; diff --git a/include/vrv/system.h b/include/vrv/system.h index a8900f2a9c5..7485e2abfbe 100644 --- a/include/vrv/system.h +++ b/include/vrv/system.h @@ -191,12 +191,12 @@ class System : public Object, public DrawingListInterface, public AttTyped { * The Y absolute position of the staff for facsimile (transcription) encodings. * This is the top left corner of the system. */ - int m_yAbs; + int m_drawingFacsY; /** * The x absolute position of the system for facsimile layouts. * This is the top left corner of the system. */ - int m_xAbs; + int m_drawingFacsX; /** * The width used by the abbreviated labels at the left of the system. * It is used internally when calculating the layout and it is not stored in the file. diff --git a/src/adjustxrelfortranscriptionfunctor.cpp b/src/adjustxrelfortranscriptionfunctor.cpp index c4e4c1f20d4..be005259ec4 100644 --- a/src/adjustxrelfortranscriptionfunctor.cpp +++ b/src/adjustxrelfortranscriptionfunctor.cpp @@ -21,7 +21,7 @@ AdjustXRelForTranscriptionFunctor::AdjustXRelForTranscriptionFunctor() : Functor FunctorCode AdjustXRelForTranscriptionFunctor::VisitLayerElement(LayerElement *layerElement) { - if (layerElement->m_xAbs == VRV_UNSET) return FUNCTOR_CONTINUE; + if (layerElement->m_drawingFacsX == VRV_UNSET) return FUNCTOR_CONTINUE; if (layerElement->IsScoreDefElement()) return FUNCTOR_SIBLINGS; diff --git a/src/facsimilefunctor.cpp b/src/facsimilefunctor.cpp index eb97b6ed18d..73ec1ef23ca 100644 --- a/src/facsimilefunctor.cpp +++ b/src/facsimilefunctor.cpp @@ -43,7 +43,7 @@ FunctorCode SyncFromFacsimileFunctor::VisitLayerElement(LayerElement *layerEleme Zone *zone = layerElement->GetZone(); assert(zone); - layerElement->m_xAbs = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); + layerElement->m_drawingFacsX = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -52,8 +52,8 @@ FunctorCode SyncFromFacsimileFunctor::VisitMeasure(Measure *measure) { Zone *zone = measure->GetZone(); assert(zone); - measure->m_xAbs = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); - measure->m_xAbs2 = m_view.ToLogicalX(zone->GetLrx() * DEFINITION_FACTOR); + measure->m_drawingFacsX1 = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); + measure->m_drawingFacsX2 = m_view.ToLogicalX(zone->GetLrx() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -97,8 +97,8 @@ FunctorCode SyncFromFacsimileFunctor::VisitSb(Sb *sb) Zone *zone = sb->GetZone(); assert(zone); - m_currentSystem->m_xAbs = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); - m_currentSystem->m_yAbs = m_view.ToLogicalY(zone->GetUly() * DEFINITION_FACTOR); + m_currentSystem->m_drawingFacsX = m_view.ToLogicalX(zone->GetUlx() * DEFINITION_FACTOR); + m_currentSystem->m_drawingFacsY = m_view.ToLogicalY(zone->GetUly() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } @@ -107,7 +107,7 @@ FunctorCode SyncFromFacsimileFunctor::VisitStaff(Staff *staff) { Zone *zone = staff->GetZone(); assert(zone); - staff->m_yAbs = m_view.ToLogicalY(zone->GetUly() * DEFINITION_FACTOR); + staff->m_drawingFacsY = m_view.ToLogicalY(zone->GetUly() * DEFINITION_FACTOR); return FUNCTOR_CONTINUE; } diff --git a/src/iomei.cpp b/src/iomei.cpp index 66c7cf2076c..d9487f9020d 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -1640,8 +1640,8 @@ void MEIOutput::WriteSystem(pugi::xml_node currentNode, System *system) currentNode.append_attribute("system.rightmar") = StringFormat("%d", system->m_systemRightMar / DEFINITION_FACTOR).c_str(); // y positions - if (system->m_yAbs != VRV_UNSET) { - currentNode.append_attribute("uly") = StringFormat("%d", system->m_yAbs / DEFINITION_FACTOR).c_str(); + if (system->m_drawingFacsY != VRV_UNSET) { + currentNode.append_attribute("uly") = StringFormat("%d", system->m_drawingFacsY / DEFINITION_FACTOR).c_str(); } system->WriteTyped(currentNode); } @@ -1894,9 +1894,9 @@ void MEIOutput::WriteMeasure(pugi::xml_node currentNode, Measure *measure) measure->WritePointing(currentNode); measure->WriteTyped(currentNode); // For now we copy the adjusted value of coord.x1 and coord.x2 to xAbs and xAbs2 respectively - if ((measure->m_xAbs != VRV_UNSET) && (measure->m_xAbs2 != VRV_UNSET)) { - measure->SetCoordX1(measure->m_xAbs / DEFINITION_FACTOR); - measure->SetCoordX2(measure->m_xAbs2 / DEFINITION_FACTOR); + if ((measure->m_drawingFacsX1 != VRV_UNSET) && (measure->m_drawingFacsX2 != VRV_UNSET)) { + measure->SetCoordX1(measure->m_drawingFacsX1 / DEFINITION_FACTOR); + measure->SetCoordX2(measure->m_drawingFacsX2 / DEFINITION_FACTOR); measure->WriteCoordX1(currentNode); measure->WriteCoordX2(currentNode); } @@ -2226,8 +2226,8 @@ void MEIOutput::WriteStaff(pugi::xml_node currentNode, Staff *staff) staff->WriteVisibility(currentNode); // y position - if (staff->m_yAbs != VRV_UNSET) { - staff->SetCoordY1(staff->m_yAbs / DEFINITION_FACTOR); + if (staff->m_drawingFacsY != VRV_UNSET) { + staff->SetCoordY1(staff->m_drawingFacsY / DEFINITION_FACTOR); staff->WriteCoordY1(currentNode); } } @@ -2306,8 +2306,8 @@ void MEIOutput::WriteLayerElement(pugi::xml_node currentNode, LayerElement *elem this->WriteLinkingInterface(currentNode, element); element->WriteLabelled(currentNode); element->WriteTyped(currentNode); - if (element->m_xAbs != VRV_UNSET) { - element->SetCoordX1(element->m_xAbs / DEFINITION_FACTOR); + if (element->m_drawingFacsX != VRV_UNSET) { + element->SetCoordX1(element->m_drawingFacsX / DEFINITION_FACTOR); element->WriteCoordX1(currentNode); } } @@ -4578,7 +4578,7 @@ bool MEIInput::ReadSystem(Object *parent, pugi::xml_node system) system.remove_attribute("system.rightmar"); } if (system.attribute("uly") && m_doc->IsTranscription()) { - vrvSystem->m_yAbs = system.attribute("uly").as_int() * DEFINITION_FACTOR; + vrvSystem->m_drawingFacsY = system.attribute("uly").as_int() * DEFINITION_FACTOR; system.remove_attribute("uly"); } @@ -5370,8 +5370,8 @@ bool MEIInput::ReadMeasure(Object *parent, pugi::xml_node measure) if (measure.attribute("coord.x1") && measure.attribute("coord.x2") && m_doc->IsTranscription()) { vrvMeasure->ReadCoordX1(measure); vrvMeasure->ReadCoordX2(measure); - vrvMeasure->m_xAbs = vrvMeasure->GetCoordX1() * DEFINITION_FACTOR; - vrvMeasure->m_xAbs2 = vrvMeasure->GetCoordX2() * DEFINITION_FACTOR; + vrvMeasure->m_drawingFacsX1 = vrvMeasure->GetCoordX1() * DEFINITION_FACTOR; + vrvMeasure->m_drawingFacsX2 = vrvMeasure->GetCoordX2() * DEFINITION_FACTOR; } parent->AddChild(vrvMeasure); @@ -6063,7 +6063,7 @@ bool MEIInput::ReadStaff(Object *parent, pugi::xml_node staff) if (staff.attribute("coord.y1") && m_doc->IsTranscription()) { vrvStaff->ReadCoordY1(staff); - vrvStaff->m_yAbs = vrvStaff->GetCoordY1() * DEFINITION_FACTOR; + vrvStaff->m_drawingFacsY = vrvStaff->GetCoordY1() * DEFINITION_FACTOR; } if (!vrvStaff->HasN() || (vrvStaff->GetN() == 0)) { @@ -6303,7 +6303,7 @@ bool MEIInput::ReadLayerElement(pugi::xml_node element, LayerElement *object) if (element.attribute("coord.x1") && m_doc->IsTranscription()) { object->ReadCoordX1(element); - object->m_xAbs = object->GetCoordX1() * DEFINITION_FACTOR; + object->m_drawingFacsX = object->GetCoordX1() * DEFINITION_FACTOR; } return true; @@ -8471,14 +8471,14 @@ void MEIInput::UpgradeMeasureTo_3_0_0(Measure *measure, System *system) assert(system); assert(!measure->IsMeasuredMusic()); - if (system->m_yAbs == VRV_UNSET) return; + if (system->m_drawingFacsY == VRV_UNSET) return; if (system->m_systemRightMar == VRV_UNSET) return; if (system->m_systemRightMar == VRV_UNSET) return; Page *page = vrv_cast(system->GetFirstAncestor(PAGE)); assert(page); - measure->m_xAbs = system->m_systemLeftMar; - measure->m_xAbs2 = page->m_pageWidth - system->m_systemRightMar; + measure->m_drawingFacsX1 = system->m_systemLeftMar; + measure->m_drawingFacsX2 = page->m_pageWidth - system->m_systemRightMar; } void MEIInput::UpgradePageTo_3_0_0(Page *page, Doc *doc) diff --git a/src/layerelement.cpp b/src/layerelement.cpp index 90d453f4569..459d4c505df 100644 --- a/src/layerelement.cpp +++ b/src/layerelement.cpp @@ -127,7 +127,7 @@ void LayerElement::Reset() this->ResetLabelled(); this->ResetTyped(); - m_xAbs = VRV_UNSET; + m_drawingFacsX = VRV_UNSET; m_drawingYRel = 0; m_drawingXRel = 0; m_drawingCueSize = false; @@ -405,8 +405,8 @@ int LayerElement::GetDrawingX() const } } - // Since m_xAbs is the left position, we adjust the XRel accordingly in AdjustXRelForTranscription - if (m_xAbs != VRV_UNSET) return m_xAbs + this->GetDrawingXRel(); + // Since m_drawingFacsX is the left position, we adjust the XRel accordingly in AdjustXRelForTranscription + if (m_drawingFacsX != VRV_UNSET) return m_drawingFacsX + this->GetDrawingXRel(); if (m_cachedDrawingX != VRV_UNSET) return m_cachedDrawingX; @@ -532,7 +532,7 @@ void LayerElement::CacheYRel(bool restore) void LayerElement::CenterDrawingX() { - if (m_xAbs != VRV_UNSET) return; + if (m_drawingFacsX != VRV_UNSET) return; this->SetDrawingXRel(0); diff --git a/src/measure.cpp b/src/measure.cpp index 3e5cf77f2db..4439fe36ce8 100644 --- a/src/measure.cpp +++ b/src/measure.cpp @@ -137,8 +137,8 @@ void Measure::Reset() this->ResetDrawingScoreDef(); m_timestampAligner.Reset(); - m_xAbs = VRV_UNSET; - m_xAbs2 = VRV_UNSET; + m_drawingFacsX1 = VRV_UNSET; + m_drawingFacsX2 = VRV_UNSET; m_drawingXRel = 0; m_cachedXRel = VRV_UNSET; @@ -150,8 +150,8 @@ void Measure::Reset() m_leftBarLine.SetForm(this->GetLeft()); if (!m_measuredMusic) { - m_xAbs = VRV_UNSET; - m_xAbs2 = VRV_UNSET; + m_drawingFacsX1 = VRV_UNSET; + m_drawingFacsX2 = VRV_UNSET; } m_drawingEnding = NULL; @@ -216,12 +216,12 @@ int Measure::GetDrawingX() const if (!this->IsMeasuredMusic()) { const System *system = vrv_cast(this->GetFirstAncestor(SYSTEM)); assert(system); - if (system->m_yAbs != VRV_UNSET) { + if (system->m_drawingFacsY != VRV_UNSET) { return (system->m_systemLeftMar); } } - if (m_xAbs != VRV_UNSET) return m_xAbs; + if (m_drawingFacsX1 != VRV_UNSET) return m_drawingFacsX1; if (m_cachedDrawingX != VRV_UNSET) return m_cachedDrawingX; @@ -356,7 +356,7 @@ int Measure::GetWidth() const if (!this->IsMeasuredMusic()) { const System *system = vrv_cast(this->GetFirstAncestor(SYSTEM)); assert(system); - if (system->m_yAbs != VRV_UNSET) { + if (system->m_drawingFacsY != VRV_UNSET) { const Page *page = vrv_cast(system->GetFirstAncestor(PAGE)); assert(page); // xAbs2 = page->m_pageWidth - system->m_systemRightMar; @@ -364,7 +364,7 @@ int Measure::GetWidth() const } } - if (m_xAbs2 != VRV_UNSET) return (m_xAbs2 - m_xAbs); + if (m_drawingFacsX2 != VRV_UNSET) return (m_drawingFacsX2 - m_drawingFacsX1); assert(m_measureAligner.GetRightAlignment()); return m_measureAligner.GetRightAlignment()->GetXRel(); diff --git a/src/miscfunctor.cpp b/src/miscfunctor.cpp index c592281c499..9c3677a2823 100644 --- a/src/miscfunctor.cpp +++ b/src/miscfunctor.cpp @@ -32,15 +32,15 @@ FunctorCode ApplyPPUFactorFunctor::VisitLayerElement(LayerElement *layerElement) { if (layerElement->IsScoreDefElement()) return FUNCTOR_SIBLINGS; - if (layerElement->m_xAbs != VRV_UNSET) layerElement->m_xAbs /= m_page->GetPPUFactor(); + if (layerElement->m_drawingFacsX != VRV_UNSET) layerElement->m_drawingFacsX /= m_page->GetPPUFactor(); return FUNCTOR_CONTINUE; } FunctorCode ApplyPPUFactorFunctor::VisitMeasure(Measure *measure) { - if (measure->m_xAbs != VRV_UNSET) measure->m_xAbs /= m_page->GetPPUFactor(); - if (measure->m_xAbs2 != VRV_UNSET) measure->m_xAbs2 /= m_page->GetPPUFactor(); + if (measure->m_drawingFacsX1 != VRV_UNSET) measure->m_drawingFacsX1 /= m_page->GetPPUFactor(); + if (measure->m_drawingFacsX2 != VRV_UNSET) measure->m_drawingFacsX2 /= m_page->GetPPUFactor(); return FUNCTOR_CONTINUE; } @@ -60,15 +60,15 @@ FunctorCode ApplyPPUFactorFunctor::VisitPage(Page *page) FunctorCode ApplyPPUFactorFunctor::VisitStaff(Staff *staff) { - if (staff->m_yAbs != VRV_UNSET) staff->m_yAbs /= m_page->GetPPUFactor(); + if (staff->m_drawingFacsY != VRV_UNSET) staff->m_drawingFacsY /= m_page->GetPPUFactor(); return FUNCTOR_CONTINUE; } FunctorCode ApplyPPUFactorFunctor::VisitSystem(System *system) { - if (system->m_xAbs != VRV_UNSET) system->m_xAbs /= m_page->GetPPUFactor(); - if (system->m_yAbs != VRV_UNSET) system->m_yAbs /= m_page->GetPPUFactor(); + if (system->m_drawingFacsX != VRV_UNSET) system->m_drawingFacsX /= m_page->GetPPUFactor(); + if (system->m_drawingFacsY != VRV_UNSET) system->m_drawingFacsY /= m_page->GetPPUFactor(); system->m_systemLeftMar *= m_page->GetPPUFactor(); system->m_systemRightMar *= m_page->GetPPUFactor(); diff --git a/src/staff.cpp b/src/staff.cpp index 9a01f64d063..28b69219213 100644 --- a/src/staff.cpp +++ b/src/staff.cpp @@ -66,7 +66,7 @@ void Staff::Reset() this->ResetTyped(); this->ResetVisibility(); - m_yAbs = VRV_UNSET; + m_drawingFacsY = VRV_UNSET; m_drawingStaffSize = 100; m_drawingLines = 5; @@ -142,7 +142,7 @@ int Staff::GetDrawingY() const } } - if (m_yAbs != VRV_UNSET) return m_yAbs; + if (m_drawingFacsY != VRV_UNSET) return m_drawingFacsY; if (!m_staffAlignment) return 0; diff --git a/src/system.cpp b/src/system.cpp index f7deae78600..2a070dba54f 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -74,9 +74,9 @@ void System::Reset() m_systemLeftMar = 0; m_systemRightMar = 0; - m_xAbs = VRV_UNSET; + m_drawingFacsX = VRV_UNSET; m_drawingXRel = 0; - m_yAbs = VRV_UNSET; + m_drawingFacsY = VRV_UNSET; m_drawingYRel = 0; m_drawingTotalWidth = 0; m_drawingJustifiableWidth = 0; @@ -111,7 +111,7 @@ bool System::IsSupportedChild(Object *child) int System::GetDrawingX() const { - if (m_xAbs != VRV_UNSET) return m_xAbs; + if (m_drawingFacsX != VRV_UNSET) return m_drawingFacsX; m_cachedDrawingX = 0; return m_drawingXRel; @@ -119,7 +119,7 @@ int System::GetDrawingX() const int System::GetDrawingY() const { - if (m_yAbs != VRV_UNSET) return m_yAbs; + if (m_drawingFacsY != VRV_UNSET) return m_drawingFacsY; m_cachedDrawingY = 0; return m_drawingYRel; From bc5b52ab8a4c726a4d1c839ce410985189be5e8d Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 3 Jan 2024 14:06:38 +0100 Subject: [PATCH 126/144] Revert "Fix crash when converting mensural notation from Humdrum" This reverts commit 3ded68c67693dc7a80639aef3548751c1b2da016. --- src/doc.cpp | 3 --- src/iohumdrum.cpp | 1 - 2 files changed, 4 deletions(-) diff --git a/src/doc.cpp b/src/doc.cpp index 8d1710d09e3..01c2024601d 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -1291,9 +1291,6 @@ void Doc::ConvertToCastOffMensuralDoc(bool castOff) m_isMensuralMusicOnly = false; } - // Calling Doc::PrepareData is expected to collect visible scores - assert(m_dataPreparationDone); - // Make sure the document is not cast-off this->UnCastOffDoc(); diff --git a/src/iohumdrum.cpp b/src/iohumdrum.cpp index be58d5bb7ca..4353e83816a 100644 --- a/src/iohumdrum.cpp +++ b/src/iohumdrum.cpp @@ -31612,7 +31612,6 @@ void HumdrumInput::finalizeDocument(Doc *doc) if (m_mens) { doc->SetMensuralMusicOnly(true); doc->m_notationType = NOTATIONTYPE_mensural; - doc->PrepareData(); doc->ConvertToCastOffMensuralDoc(true); } } From 3ae599edf9ed1171cf3fe9d17a5d4daf82ff6abe Mon Sep 17 00:00:00 2001 From: David Bauer Date: Wed, 3 Jan 2024 14:51:52 +0100 Subject: [PATCH 127/144] Generic version of Doc::GetCorrespondingScore --- include/vrv/doc.h | 2 ++ src/doc.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index 3952633bb49..a5f5c17f2e9 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -163,6 +163,8 @@ class Doc : public Object { ///@{ Score *GetCorrespondingScore(const Object *object); const Score *GetCorrespondingScore(const Object *object) const; + // Generic version that does not necessarily rely on precalculated visible scores + const Score *GetCorrespondingScore(const Object *object, const std::list &scores) const; ///@} /** diff --git a/src/doc.cpp b/src/doc.cpp index 01c2024601d..62c596e4684 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -1523,10 +1523,15 @@ Score *Doc::GetCorrespondingScore(const Object *object) const Score *Doc::GetCorrespondingScore(const Object *object) const { - assert(!m_visibleScores.empty()); + return this->GetCorrespondingScore(object, m_visibleScores); +} - const Score *correspondingScore = m_visibleScores.front(); - for (Score *score : m_visibleScores) { +const Score *Doc::GetCorrespondingScore(const Object *object, const std::list &scores) const +{ + assert(!scores.empty()); + + const Score *correspondingScore = scores.front(); + for (Score *score : scores) { if ((score == object) || Object::IsPreOrdered(score, object)) { correspondingScore = score; } From 34d358e7266e928ef24a1717e05148e4bc05ff50 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 4 Jan 2024 18:18:45 +0100 Subject: [PATCH 128/144] check fTrem attributes --- src/view_beam.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view_beam.cpp b/src/view_beam.cpp index 1be6bdbe31c..24bd8006935 100644 --- a/src/view_beam.cpp +++ b/src/view_beam.cpp @@ -150,8 +150,8 @@ void View::DrawFTremSegment(DeviceContext *dc, Staff *staff, FTrem *fTrem) secondElement->m_x += (m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)) / 2; } - // Number of bars to draw - const int allBars = fTrem->GetBeams(); + // Number of beams to draw + const int allBars = fTrem->HasBeams() ? fTrem->GetBeams() : fTrem->GetUnitdur() - DURATION_4; int floatingBars = fTrem->HasBeamsFloat() ? fTrem->GetBeamsFloat() : 0; int fullBars = allBars - floatingBars; From b9f27b988bf735c14b6882107c86eeecb7a5da06 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 4 Jan 2024 18:25:46 +0100 Subject: [PATCH 129/144] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b095c12dbf..2a415ca506a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [unreleased] +* Support for `fTrem@unitdur` (@eNote-GmbH) ## [4.1.0] - 2023-12-15 * Support for staves ordered by `scoreDef` From 32a863df94414019da4a3f6d63045c4ec61074bf Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 4 Jan 2024 21:20:25 +0100 Subject: [PATCH 130/144] Track scores in ScoreDefSetCurrentPageFunctor --- include/vrv/doc.h | 1 + include/vrv/setscoredeffunctor.h | 4 +++- src/doc.cpp | 5 +++++ src/setscoredeffunctor.cpp | 11 +++++++++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/vrv/doc.h b/include/vrv/doc.h index a5f5c17f2e9..be4b8d27d87 100644 --- a/include/vrv/doc.h +++ b/include/vrv/doc.h @@ -164,6 +164,7 @@ class Doc : public Object { Score *GetCorrespondingScore(const Object *object); const Score *GetCorrespondingScore(const Object *object) const; // Generic version that does not necessarily rely on precalculated visible scores + Score *GetCorrespondingScore(const Object *object, const std::list &scores); const Score *GetCorrespondingScore(const Object *object, const std::list &scores) const; ///@} diff --git a/include/vrv/setscoredeffunctor.h b/include/vrv/setscoredeffunctor.h index 5d4d417c455..60e3d9af41d 100644 --- a/include/vrv/setscoredeffunctor.h +++ b/include/vrv/setscoredeffunctor.h @@ -88,6 +88,7 @@ class ScoreDefSetCurrentPageFunctor : public DocFunctor { */ ///@{ FunctorCode VisitPageEnd(Page *page) override; + FunctorCode VisitScore(Score *score) override; ///@} protected: @@ -97,7 +98,8 @@ class ScoreDefSetCurrentPageFunctor : public DocFunctor { public: // private: - // + // The list of all scores + std::list m_scores; }; //---------------------------------------------------------------------------- diff --git a/src/doc.cpp b/src/doc.cpp index 62c596e4684..74fff4f5adf 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -1526,6 +1526,11 @@ const Score *Doc::GetCorrespondingScore(const Object *object) const return this->GetCorrespondingScore(object, m_visibleScores); } +Score *Doc::GetCorrespondingScore(const Object *object, const std::list &scores) +{ + return const_cast(std::as_const(*this).GetCorrespondingScore(object, scores)); +} + const Score *Doc::GetCorrespondingScore(const Object *object, const std::list &scores) const { assert(!scores.empty()); diff --git a/src/setscoredeffunctor.cpp b/src/setscoredeffunctor.cpp index 144bc4d3248..29f6548c8ce 100644 --- a/src/setscoredeffunctor.cpp +++ b/src/setscoredeffunctor.cpp @@ -68,11 +68,18 @@ FunctorCode ScoreDefSetCurrentPageFunctor::VisitPageEnd(Page *page) { const Object *firstSystem = page->GetFirst(SYSTEM); const Object *reference = firstSystem ? firstSystem : page; - page->m_score = m_doc->GetCorrespondingScore(reference); + page->m_score = m_doc->GetCorrespondingScore(reference, m_scores); const Object *lastSystem = page->GetLast(SYSTEM); reference = lastSystem ? lastSystem : page; - page->m_scoreEnd = m_doc->GetCorrespondingScore(reference); + page->m_scoreEnd = m_doc->GetCorrespondingScore(reference, m_scores); + + return FUNCTOR_CONTINUE; +} + +FunctorCode ScoreDefSetCurrentPageFunctor::VisitScore(Score *score) +{ + m_scores.push_back(score); return FUNCTOR_CONTINUE; } From e77dfdd2b2b18ce2b13f654043fc15fe217ec720 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 4 Jan 2024 21:24:02 +0100 Subject: [PATCH 131/144] Remove unused --- src/verticalaligner.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/verticalaligner.cpp b/src/verticalaligner.cpp index 0bf5b3ed82e..60cbad6b3b7 100644 --- a/src/verticalaligner.cpp +++ b/src/verticalaligner.cpp @@ -48,7 +48,6 @@ void SystemAligner::Reset() m_spacingTypes.clear(); m_system = NULL; - ArrayOfObjects &children = this->GetChildrenForModification(); m_bottomAlignment = new StaffAlignment(); m_bottomAlignment->SetStaff(NULL, NULL, this->GetAboveSpacingType(NULL)); m_bottomAlignment->SetParentSystem(this->GetSystem()); From c07e5fa091ddb6c17d3285ca26b51076521bddb0 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Sat, 6 Jan 2024 22:39:40 +0100 Subject: [PATCH 132/144] allow fTrem in beam --- src/beam.cpp | 4 ++++ src/iomei.cpp | 3 +++ src/view_beam.cpp | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/src/beam.cpp b/src/beam.cpp index 335d7c536fb..775ccb9f55a 100644 --- a/src/beam.cpp +++ b/src/beam.cpp @@ -19,6 +19,7 @@ #include "btrem.h" #include "doc.h" #include "editorial.h" +#include "ftrem.h" #include "functor.h" #include "gracegrp.h" #include "layer.h" @@ -1634,6 +1635,9 @@ bool Beam::IsSupportedChild(Object *child) else if (child->Is(CLEF)) { assert(dynamic_cast(child)); } + else if (child->Is(FTREM)) { + assert(dynamic_cast(child)); + } else if (child->Is(GRACEGRP)) { assert(dynamic_cast(child)); } diff --git a/src/iomei.cpp b/src/iomei.cpp index 6ff5920f6c4..f349669a21e 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -3533,6 +3533,9 @@ bool MEIInput::IsAllowed(std::string element, Object *filterParent) else if (element == "clef") { return true; } + else if (element == "fTrem") { + return true; + } else if (element == "graceGrp") { return true; } diff --git a/src/view_beam.cpp b/src/view_beam.cpp index 1be6bdbe31c..4fbaf6582f0 100644 --- a/src/view_beam.cpp +++ b/src/view_beam.cpp @@ -49,6 +49,14 @@ void View::DrawBeam(DeviceContext *dc, LayerElement *element, Layer *layer, Staf return; } + if (beam->GetFirst(FTREM)) { + // If there is a fTrem we ignore the beam and just handle its children + dc->StartGraphic(element, "", element->GetID()); + this->DrawLayerChildren(dc, beam, layer, staff, measure); + dc->EndGraphic(element, this); + return; + } + beam->m_beamSegment.InitCoordRefs(beam->GetElementCoords()); data_BEAMPLACE initialPlace = beam->GetPlace(); From 3a03a72143665dd104c6c117ce0034ee5dbbce19 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Tue, 9 Jan 2024 15:13:21 +0100 Subject: [PATCH 133/144] Make a vector of possible output formats --- tools/main.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/main.cpp b/tools/main.cpp index 3c0c8ee647f..c3eca7deec5 100644 --- a/tools/main.cpp +++ b/tools/main.cpp @@ -278,13 +278,12 @@ int main(int argc, char **argv) exit(1); } - if ((outformat != "svg") && (outformat != "mei") && (outformat != "mei-basic") && (outformat != "mei-pb") - && (outformat != "mei-facs") && (outformat != "midi") && (outformat != "timemap") - && (outformat != "expansionmap") && (outformat != "humdrum") && (outformat != "hum") && (outformat != "pae")) { + const std::vector outformats = { "mei", "mei-basic", "mei-pb", "mei-facs", "svg", "midi", "timemap", + "expansionmap", "humdrum", "hum", "pae" }; + if (std::find(outformats.begin(), outformats.end(), outformat) == outformats.end()) { std::cerr << "Output format (" << outformat << ") can only be 'mei', 'mei-basic', 'mei-pb', mei-facs', 'svg', 'midi', 'timemap', 'expansionmap', " - "'humdrum' " - "or 'pae'." + "'humdrum', 'hum', or 'pae'." << std::endl; exit(1); } From 6baff7119a32ed320c3c34341ecf91f127abbee6 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Tue, 9 Jan 2024 16:16:47 +0100 Subject: [PATCH 134/144] Fix repeating pattern repetition in PAE parsing. Closes #3570 --- src/iopae.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/iopae.cpp b/src/iopae.cpp index 888dfb0b62d..306c96c4d6b 100644 --- a/src/iopae.cpp +++ b/src/iopae.cpp @@ -3438,6 +3438,13 @@ bool PAEInput::ConvertRepeatedFigure() figure.push_back(*token); } } + // We are starting a new figure to be repeated + else if (token->m_char == '!') { + token->m_char = 0; + figureToken = &(*token); + figure.clear(); + status = pae::FIGURE_START; + } // We have completed a figure and will be repeating it else if (status == pae::FIGURE_END || status == pae::FIGURE_REPEAT) { // Repeat the figure. That is simply add it to the map @@ -3452,8 +3459,8 @@ bool PAEInput::ConvertRepeatedFigure() --token; status = pae::FIGURE_REPEAT; } - // End of repetitions - this includes the end of a measure - else { + // End of repetitions - this does not include the end of a measure + else if (!this->Was(*token, pae::MEASURE)) { // Make sure we repeated the figure at least once (is this too pedantic?) if (status == pae::FIGURE_END) { LogPAE(ERR_010_REP_UNUSED, *figureToken); @@ -3464,13 +3471,6 @@ bool PAEInput::ConvertRepeatedFigure() figure.clear(); } } - // We are starting a new figure to be repeated - else if (token->m_char == '!') { - token->m_char = 0; - figureToken = &(*token); - figure.clear(); - status = pae::FIGURE_START; - } // We should not have a repeat sign not after a figure end else if (token->m_char == 'f') { LogPAE(ERR_011_REP_NO_FIGURE, *token); From 6ffba7ff388011dcf4bfd1fb19ec28dbb7ec24cb Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 10:43:18 +0100 Subject: [PATCH 135/144] Try C++20 --- .github/workflows/ci_build.yml | 2 +- cmake/CMakeLists.txt | 4 ++-- setup.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 08437b037dc..5dd93eaacb2 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -6,7 +6,7 @@ on: # but only for the branches specified branches: # Push events on develop branch - - develop + - develop-c++20 # Push events on ci-test branch (uncomment if needed for testing purposes) # - ci-test paths-ignore: diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5cddd3ed514..0c865ce37df 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -48,7 +48,7 @@ if(MSVC) add_definitions(/wd4244) # suppress warning of possible loss of precision add_definitions(-DNO_PAE_SUPPORT) # regex is working differently under Windows so PAE is not supported (yet) add_definitions(-DUSE_PAE_OLD_PARSER) - add_definitions(/std:c++17) + add_definitions(/std:c++20) include_directories(../include/win32) else() if(CMAKE_BUILD_TYPE MATCHES Debug) @@ -60,7 +60,7 @@ else() # jsonxx raises -Wdollar-in-identifier-extension # gcc 8.3.1 does not like -Wdollar-in-identifier-extension option. add_definitions(-Wall -W -pedantic -Wno-unused-parameter -Wno-dollar-in-identifier-extension) - add_definitions(-std=c++17) + add_definitions(-std=c++20) # extra warnings similar to Xcode compiling settings (most probably covered by -Wall): # https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/DiagnosticGroups.td diff --git a/setup.py b/setup.py index fc1f38b2709..a310909ee60 100644 --- a/setup.py +++ b/setup.py @@ -83,10 +83,10 @@ def get_version() -> str: # extra compile arguments EXTRA_COMPILE_ARGS = ['-DPYTHON_BINDING'] if platform.system() != 'Windows': - EXTRA_COMPILE_ARGS += ['-std=c++17', + EXTRA_COMPILE_ARGS += ['-std=c++20', '-Wno-write-strings', '-Wno-overloaded-virtual', '-g0'] else: - EXTRA_COMPILE_ARGS += ['/std:c++17', + EXTRA_COMPILE_ARGS += ['/std:c++20', '-DNO_PAE_SUPPORT'] verovio_module = Extension('verovio._verovio', From 6971b2ee96110f915cef35d92100c44b9ce5ee44 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 10:44:21 +0100 Subject: [PATCH 136/144] add quotes --- .github/workflows/ci_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 5dd93eaacb2..6fae0ad4aa0 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -6,7 +6,7 @@ on: # but only for the branches specified branches: # Push events on develop branch - - develop-c++20 + - "develop-c++20" # Push events on ci-test branch (uncomment if needed for testing purposes) # - ci-test paths-ignore: From c6cd6143d8b68cd330d20659ae0f819d63aea045 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 10:48:05 +0100 Subject: [PATCH 137/144] rename branch --- .github/workflows/ci_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 6fae0ad4aa0..f48281b5631 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -6,7 +6,7 @@ on: # but only for the branches specified branches: # Push events on develop branch - - "develop-c++20" + - 'develop-c20' # Push events on ci-test branch (uncomment if needed for testing purposes) # - ci-test paths-ignore: From 3921011a1f07bd917d10bf18c4a5bd6fd6a71e39 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 11:02:15 +0100 Subject: [PATCH 138/144] Reset cache --- .github/workflows/ci_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index f48281b5631..c03acec7977 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -44,7 +44,7 @@ env: # emscripten EM_VERSION: latest EM_CACHE_FOLDER: "emsdk-cache" - EM_CACHE_ID: 2 + EM_CACHE_ID: 3 # gh-pages GH_PAGES_REPO: ${{ github.repository_owner }}/verovio.org # works from rism-digital and from forks From 199368a88683730aa78878d5f545753956e31c3c Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 11:10:45 +0100 Subject: [PATCH 139/144] Change C++ version in emscripten --- emscripten/buildToolkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emscripten/buildToolkit b/emscripten/buildToolkit index b6f20e5a7ae..afde9dd2b76 100755 --- a/emscripten/buildToolkit +++ b/emscripten/buildToolkit @@ -55,7 +55,7 @@ my ($lightQ, $version, $chattyQ, $helpQ, $exclusion, $wasmQ, $makeQ, $modularize my ($nopae, $nohumdrum, $nomusicxml, $nodarms); my ($FLAGS_NAME, $VERSION, $CHATTY); -my $cpp = 17; # c++ version to compile (11, 14, 17) +my $cpp = 20; # c++ version to compile (11, 14, 17) my $VEROVIO_ROOT = ".."; Getopt::Long::Configure("bundling"); From 29fbb92e28635d5f5a6dde7484a303b68705a15d Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 11:21:00 +0100 Subject: [PATCH 140/144] Move LedgerLine up for some compilers --- include/vrv/staff.h | 86 ++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/include/vrv/staff.h b/include/vrv/staff.h index 51cbdbd9346..cd68fe3eaa4 100644 --- a/include/vrv/staff.h +++ b/include/vrv/staff.h @@ -23,6 +23,49 @@ class Syl; class TimeSpanningInterface; class Tuning; +//---------------------------------------------------------------------------- +// LedgerLine +//---------------------------------------------------------------------------- + +/** + * This is a class with no MEI equivalent for representing legder lines. + * A ledger line is represented by a list of dashes. + * Each dash is represented by a pair of points (left - right). + */ +class LedgerLine { +public: + /** + * @name Constructors, destructors, reset methods + * Reset method reset all attribute classes + */ + ///@{ + LedgerLine(); + virtual ~LedgerLine(); + virtual void Reset(); + ///@} + + /** + * Add a dash to the ledger line object. + * If necessary merges overlapping dashes. + */ + void AddDash(int left, int right, int extension); + +protected: + // +private: + // +public: + /** + * A list of dashes relative to the staff position. + */ + std::list> m_dashes; + +protected: + // +private: + // +}; + //---------------------------------------------------------------------------- // Staff //---------------------------------------------------------------------------- @@ -249,49 +292,6 @@ class Staff : public Object, ///@} }; -//---------------------------------------------------------------------------- -// LedgerLine -//---------------------------------------------------------------------------- - -/** - * This is a class with no MEI equivalent for representing legder lines. - * A ledger line is represented by a list of dashes. - * Each dash is represented by a pair of points (left - right). - */ -class LedgerLine { -public: - /** - * @name Constructors, destructors, reset methods - * Reset method reset all attribute classes - */ - ///@{ - LedgerLine(); - virtual ~LedgerLine(); - virtual void Reset(); - ///@} - - /** - * Add a dash to the ledger line object. - * If necessary merges overlapping dashes. - */ - void AddDash(int left, int right, int extension); - -protected: - // -private: - // -public: - /** - * A list of dashes relative to the staff position. - */ - std::list> m_dashes; - -protected: - // -private: - // -}; - } // namespace vrv #endif From c858185fddd292d6985540c69ec5111d65b22585 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 11:24:00 +0100 Subject: [PATCH 141/144] Remove clang 6.0 and add 10 --- .github/workflows/ci_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index c03acec7977..b763aec2ebb 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -88,11 +88,11 @@ jobs: - os: ubuntu-20.04 compiler: clang - version: "6.0" + version: "9" - os: ubuntu-20.04 compiler: clang - version: "9" + version: "10" - os: ubuntu-20.04 compiler: clang From 4e37f51e98c54f8b32d31835e7007f5117ed07a1 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 12:12:22 +0100 Subject: [PATCH 142/144] Change g++ and clang CI to 10 to 12 versions --- .github/workflows/ci_build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index b763aec2ebb..5b91884c2b1 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -76,23 +76,23 @@ jobs: include: - os: ubuntu-20.04 compiler: g++ - version: "9" + version: "10" - os: ubuntu-20.04 compiler: g++ - version: "10" + version: "11" - os: ubuntu-20.04 compiler: g++ - version: "11" + version: "12" - os: ubuntu-20.04 compiler: clang - version: "9" + version: "10" - os: ubuntu-20.04 compiler: clang - version: "10" + version: "11" - os: ubuntu-20.04 compiler: clang From c03b92def94ff042ceb3c43a73cbdca03118aed5 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 12:12:44 +0100 Subject: [PATCH 143/144] Change xcode to c++20 --- Verovio.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Verovio.xcodeproj/project.pbxproj b/Verovio.xcodeproj/project.pbxproj index 6a55d542017..111c13c9f03 100644 --- a/Verovio.xcodeproj/project.pbxproj +++ b/Verovio.xcodeproj/project.pbxproj @@ -5024,7 +5024,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; @@ -5083,7 +5083,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; From 9b80afefca01402c9cd5636a86947fae903003e8 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 19 Jan 2024 12:16:10 +0100 Subject: [PATCH 144/144] Try g++12 on ubuntu 22.04 --- .github/workflows/ci_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 5b91884c2b1..af74d63ba6a 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -82,7 +82,7 @@ jobs: compiler: g++ version: "11" - - os: ubuntu-20.04 + - os: ubuntu-22.04 compiler: g++ version: "12"