From 9b197310da13321ac18c63bbf741be61ca0aab1a Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Wed, 9 Oct 2019 17:01:53 -0400 Subject: [PATCH 01/77] * MusicXML Parsing: Start working toward --- src/iomusxml.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index b3cac82d7ea..baa3a94ef00 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -39,6 +39,7 @@ #include "layer.h" #include "mdiv.h" #include "measure.h" +#include "mnum.h" #include "mordent.h" #include "mrest.h" #include "mrpt.h" @@ -239,7 +240,7 @@ Layer *MusicXmlInput::SelectLayer(pugi::xml_node node, Measure *measure) if (!staffNumStr.empty()) { staffNum = atoi(staffNumStr.c_str()); } - if ((staffNum < 1) || (staffNum > measure->GetChildCount())) { + if ((staffNum < 1) || (staffNum > measure->GetChildCount(STAFF))) { LogWarning("MusicXML import: Staff %d cannot be found", staffNum); staffNum = 1; } @@ -1008,6 +1009,14 @@ bool MusicXmlInput::ReadMusicXmlMeasure( std::string measureNum = node.attribute("number").as_string(); if (measure != NULL) measure->SetN(measureNum); + std::string implicit = node.attribute("implicit").as_string(); + if (implicit == "yes") { + // We would use an empty mNum, but some parts of the code + // rely on all of the children of a measure being staffs. + //MNum *mNum = new MNum(); + //measure->AddChild(mNum); + } + int i = 0; for (i = 0; i < nbStaves; i++) { // the staff @n must take into account the staffOffset @@ -1299,7 +1308,7 @@ void MusicXmlInput::ReadMusicXmlBarLine(pugi::xml_node node, Measure *measure, s assert(node); assert(measure); - Staff *staff = dynamic_cast(measure->GetChild(0)); + Staff *staff = dynamic_cast(measure->GetFirst(STAFF)); assert(staff); data_BARRENDITION barRendition = BARRENDITION_NONE; From 013c1b88c83d5a48ac14e4c3b9fdb0f5f66321d9 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 10 Oct 2019 11:20:08 -0400 Subject: [PATCH 02/77] * Measure: Make sure child is a staff when iterating through all children --- src/iomusxml.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index baa3a94ef00..7854cbbb95e 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -183,6 +183,9 @@ void MusicXmlInput::AddMeasure(Section *section, Measure *measure, int i) Measure *existingMeasure = dynamic_cast(section->FindChildByComparison(&comparisonMeasure, 1)); assert(existingMeasure); for (auto current : *measure->GetChildren()) { + if (! current->Is(STAFF) ) { + continue; + } Staff *staff = dynamic_cast(measure->Relinquish(current->GetIdx())); assert(staff); existingMeasure->AddChild(staff); @@ -224,6 +227,9 @@ Layer *MusicXmlInput::SelectLayer(pugi::xml_node node, Measure *measure) } // Check if voice number corresponds to an existing layer number in any staff (as with cross-staff notes). for (auto item : *measure->GetChildren()) { + if (! item->Is(STAFF) ) { + continue; + } Staff *staff = dynamic_cast(item); assert(staff); for (auto layer : *staff->GetChildren()) { @@ -1107,6 +1113,9 @@ bool MusicXmlInput::ReadMusicXmlMeasure( } for (auto staff : *measure->GetChildren()) { + if (! staff->Is(STAFF) ) { + continue; + } assert(staff); if (staff->GetChildCount() == 0) { // add a default layer, if staff completely empty at the end of a measure. staff->AddChild(new Layer()); From 420fe1e76d74fe02498b82fb7c7ca9617ded91ce Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 10 Oct 2019 11:33:22 -0400 Subject: [PATCH 03/77] * MusicXML Parsing: Remove assumption that children of a measure are staffs --- include/vrv/object.h | 1 + src/iomusxml.cpp | 4 ++-- src/object.cpp | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/vrv/object.h b/include/vrv/object.h index 8b82ffe9b0a..e1be6ef9210 100644 --- a/include/vrv/object.h +++ b/include/vrv/object.h @@ -246,6 +246,7 @@ class Object : public BoundingBox { * Child access (generic) */ Object *GetChild(int idx) const; + Object *GetChild(int idx, const ClassId classId); /** * Return a cont pointer to the children diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index 7854cbbb95e..3b77ce1beb8 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -251,7 +251,7 @@ Layer *MusicXmlInput::SelectLayer(pugi::xml_node node, Measure *measure) staffNum = 1; } staffNum--; - Staff *staff = dynamic_cast(measure->GetChild(staffNum)); + Staff *staff = dynamic_cast(measure->GetChild(staffNum, STAFF)); assert(staff); return SelectLayer(layerNum, staff); } @@ -259,7 +259,7 @@ Layer *MusicXmlInput::SelectLayer(pugi::xml_node node, Measure *measure) Layer *MusicXmlInput::SelectLayer(int staffNum, Measure *measure) { staffNum--; - Staff *staff = dynamic_cast(measure->GetChild(staffNum)); + Staff *staff = dynamic_cast(measure->GetChild(staffNum, STAFF)); assert(staff); // layer -1 means the first one return SelectLayer(-1, staff); diff --git a/src/object.cpp b/src/object.cpp index ca3e1ceec58..720543bc0b9 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -544,6 +544,15 @@ Object *Object::GetChild(int idx) const return m_children.at(idx); } +Object *Object::GetChild(int idx, const ClassId classId) +{ + Object* obj = GetFirst(classId); + for(int i = idx; i > 0; i--) { + obj = GetNext(); + } + return obj; +} + bool Object::DeleteChild(Object *child) { auto it = std::find(m_children.begin(), m_children.end(), child); From 616b30b4d483beed048d8d06bbe2e1d49714ea35 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 10 Oct 2019 11:34:46 -0400 Subject: [PATCH 04/77] * MusicXML parsing: Support implicit measure numbering --- src/iomusxml.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/iomusxml.cpp b/src/iomusxml.cpp index 3b77ce1beb8..77a9913ccf2 100644 --- a/src/iomusxml.cpp +++ b/src/iomusxml.cpp @@ -1017,10 +1017,9 @@ bool MusicXmlInput::ReadMusicXmlMeasure( std::string implicit = node.attribute("implicit").as_string(); if (implicit == "yes") { - // We would use an empty mNum, but some parts of the code - // rely on all of the children of a measure being staffs. - //MNum *mNum = new MNum(); - //measure->AddChild(mNum); + MNum *mNum = new MNum(); + // An empty mNum means that we like to render this measure number as blank. + measure->AddChild(mNum); } int i = 0; From 93f3bd814d4e8564903fbc5866dbbe9b48d4feb3 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 10 Oct 2019 11:42:05 -0400 Subject: [PATCH 05/77] - GetChild(idx, classId): Don't keep getting the next one when one is NULL --- src/object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/object.cpp b/src/object.cpp index 720543bc0b9..8b9eb814994 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -547,7 +547,7 @@ Object *Object::GetChild(int idx) const Object *Object::GetChild(int idx, const ClassId classId) { Object* obj = GetFirst(classId); - for(int i = idx; i > 0; i--) { + for(int i = idx; i > 0 && obj; i--) { obj = GetNext(); } return obj; From 5f8898b1bab3e5ed5b27cc6fb47a366dbedfd2f2 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Wed, 16 Oct 2019 11:30:01 -0400 Subject: [PATCH 06/77] * fix Object::GetChild(int, const ClassId) --- src/object.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/object.cpp b/src/object.cpp index 8b9eb814994..841d17ae025 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -546,11 +546,13 @@ Object *Object::GetChild(int idx) const Object *Object::GetChild(int idx, const ClassId classId) { - Object* obj = GetFirst(classId); - for(int i = idx; i > 0 && obj; i--) { - obj = GetNext(); + ArrayOfObjects objects; + ClassIdComparison matchClassId(classId); + this->FindAllChildByComparison(&objects, &matchClassId); + if ((idx < 0) || (idx >= (int)objects.size())) { + return NULL; } - return obj; + return objects.at(idx); } bool Object::DeleteChild(Object *child) From 20d40b6cb9751f54e184878b76e695216414336a Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 17 Oct 2019 12:31:58 +0200 Subject: [PATCH 07/77] Dummy test change --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index abea44c3254..a12001a9f47 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ Verovio follows the [Standard Music Font Layout (SMuFL)](http://www.smufl.org) s The project page is http://www.verovio.org. Verovio is available under the LGPL license (see LICENSE.txt). - NPM --- From 656aa6a54e14fc466c349d5556af95f3321567b3 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 17 Oct 2019 12:33:52 +0200 Subject: [PATCH 08/77] Update NPM doc in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index abea44c3254..9fe6e70ff1d 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ The project page is http://www.verovio.org. Verovio is available under the LGPL NPM --- -The development version is available via [NPM](https://www.npmjs.com/package/verovio-dev) +The latest stable version is available via [NPM](https://www.npmjs.com/package/verovio) - $ npm install verovio-dev + $ npm install verovio LibMEI ------ From e4c7387e60d9b12787042b5a5db1dd9c64e3df8d Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 17 Oct 2019 13:56:20 +0200 Subject: [PATCH 09/77] Basic emscripten build --- .travis.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 353ef7170ed..ff8dab83811 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,20 @@ branches: only: - develop -sudo: false +notifications: + email: true + +sudo: required dist: trusty language: cpp +services: + - docker + +language: node_js +node_js: + - node + matrix: include: # GCC5 on Linux @@ -21,10 +31,11 @@ matrix: # Clang on OSX - os: osx - osx_image: xcode9.2 + osx_image: xcode10.1 before_install: - eval "${MATRIX_EVAL}" + - docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash before_install: - eval "${MATRIX_EVAL}" @@ -35,3 +46,5 @@ before_script: script: - make + - docker exec -it emscripten make helloworld.js + - make test From c94c3fc0e12cb30ccf4f6b6842ef0c80adab6743 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 17 Oct 2019 14:01:16 +0200 Subject: [PATCH 10/77] Update .travis.yml --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff8dab83811..ad003fbcd3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,6 @@ before_install: - eval "${MATRIX_EVAL}" - docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash -before_install: - - eval "${MATRIX_EVAL}" - before_script: - cd tools - cmake . From f0dba751ff8b0194d0991800b1ac1299a6d15780 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 17 Oct 2019 16:06:56 +0200 Subject: [PATCH 11/77] Test travis with emscripten --- .travis.yml | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad003fbcd3c..8bfa4ca791f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,47 +1,18 @@ -branches: - only: - - develop - notifications: - email: true - -sudo: required -dist: trusty -language: cpp - -services: - - docker + email: false language: node_js node_js: - node -matrix: - include: - # GCC5 on Linux - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-5 - env: - - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" +sudo: required - # Clang on OSX - - os: osx - osx_image: xcode10.1 +services: + - docker before_install: - - eval "${MATRIX_EVAL}" - docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash -before_script: - - cd tools - - cmake . - -script: - - make +script: - docker exec -it emscripten make helloworld.js - make test From c1bd2e4a3485bbcd38542febc275ff66503b7976 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 17 Oct 2019 16:16:53 +0200 Subject: [PATCH 12/77] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8bfa4ca791f..4609a7a4c4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,5 +14,5 @@ before_install: - docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash script: - - docker exec -it emscripten make helloworld.js - - make test + - docker exec -it emscripten ./emscripten/buildToolkit.sh -H + From 8d077a98de1c9a2a3a10450480c6262f7390d5a3 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Thu, 17 Oct 2019 16:27:00 +0200 Subject: [PATCH 13/77] Update .travis.yml --- .travis.yml | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4609a7a4c4f..353ef7170ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,37 @@ -notifications: - email: false +branches: + only: + - develop -language: node_js -node_js: - - node +sudo: false +dist: trusty +language: cpp -sudo: required +matrix: + include: + # GCC5 on Linux + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + env: + - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" -services: - - docker + # Clang on OSX + - os: osx + osx_image: xcode9.2 before_install: - - docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash + - eval "${MATRIX_EVAL}" -script: - - docker exec -it emscripten ./emscripten/buildToolkit.sh -H - +before_install: + - eval "${MATRIX_EVAL}" + +before_script: + - cd tools + - cmake . + +script: + - make From 1f5493c34963772cb1d2bdffe6691e0a461f4414 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 17 Oct 2019 09:23:12 -0400 Subject: [PATCH 14/77] - Object::getChild: Only get direct children (set deepness) --- src/object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/object.cpp b/src/object.cpp index 841d17ae025..b3ae4bb4e32 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -548,7 +548,7 @@ Object *Object::GetChild(int idx, const ClassId classId) { ArrayOfObjects objects; ClassIdComparison matchClassId(classId); - this->FindAllChildByComparison(&objects, &matchClassId); + this->FindAllChildByComparison(&objects, &matchClassId, 1); if ((idx < 0) || (idx >= (int)objects.size())) { return NULL; } From 00f4d69f82fdafb0d2e0819673be63adb7b0acfa Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Tue, 22 Oct 2019 16:02:42 +0300 Subject: [PATCH 15/77] Added podspec --- verovio.podspec | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 verovio.podspec diff --git a/verovio.podspec b/verovio.podspec new file mode 100644 index 00000000000..b0c34fcd727 --- /dev/null +++ b/verovio.podspec @@ -0,0 +1,30 @@ +Pod::Spec.new do |s| + s.name = 'verovio' + s.version = '2.1.0' + s.license = { :type => 'BSD' } + s.homepage = 'https://github.com/vitalii-unicsoft/verovio' + s.authors = { 'Vitalii Yevtushenko' => 'yev@unicsoft.com' } + s.summary = 'Verovio' + s.source = { :git => 'https://github.com/vitalii-unicsoft/verovio', :tag => 'version-' + s.version.to_s } + s.swift_versions = ['5.1'] + s.source_files = 'src/**/*.{h,cpp,cc}', 'include/**/*.{h,hpp}', + 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h,cpp}' + s.public_header_files = 'include/**/*.{h,hpp}' + s.platform = :ios, '12.0' + s.resources = 'data/**' + s.xcconfig = { + "CLANG_CXX_LANGUAGE_STANDARD" => "gnu++14", + "CLANG_CXX_LIBRARY" => "libc++", + "GCC_C_LANGUAGE_STANDARD" => "gnu11", + "GCC_DYNAMIC_NO_PIC" => "NO", + "GCC_NO_COMMON_BLOCKS" => "YES", + "GCC_SYMBOLS_PRIVATE_EXTERN" => "NO", + "CLANG_ENABLE_MODULES" => "YES", + "CLANG_ENABLE_OBJC_ARC" => "YES", + "CLANG_ENABLE_OBJC_WEAK" => "YES", + "ENABLE_STRICT_OBJC_MSGSEND" => "YES", + "MTL_FAST_MATH" => "YES", + "SUPPORTS_UIKITFORMAC" => "NO", + "MTL_ENABLE_DEBUG_INFO" => "NO" + } +end From 766e75de6f4e885bce2fa18a06fb573f2367176f Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Tue, 22 Oct 2019 16:38:13 +0300 Subject: [PATCH 16/77] Added support of GIT_COMMIT macro for cocoapods --- src/vrv.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vrv.cpp b/src/vrv.cpp index 670ab503345..a976bdaf1b8 100644 --- a/src/vrv.cpp +++ b/src/vrv.cpp @@ -29,7 +29,11 @@ // Windows has no Bourne shell (sh), therefore no "git_commit.h" is created. #ifndef _WIN32 +#ifdef COCOAPODS +#define GIT_COMMIT "[cocoapods]" +#else #include "git_commit.h" +#endif #else #define GIT_COMMIT "[undefined]" #endif From c057cee4c03e4fddcf2dbc26d663796a97d3a5a9 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 23 Oct 2019 10:34:44 +0100 Subject: [PATCH 17/77] Update version number --- include/vrv/vrvdef.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/vrv/vrvdef.h b/include/vrv/vrvdef.h index d714be05de2..01352eafdf3 100644 --- a/include/vrv/vrvdef.h +++ b/include/vrv/vrvdef.h @@ -34,10 +34,10 @@ namespace vrv { //---------------------------------------------------------------------------- #define VERSION_MAJOR 2 -#define VERSION_MINOR 2 -#define VERSION_REVISION 1 +#define VERSION_MINOR 3 +#define VERSION_REVISION 0 // Adds "-dev" in the version number - should be set to false for releases -#define VERSION_DEV false +#define VERSION_DEV true enum MEIVersion { MEI_UNDEFINED = 0, MEI_2013, MEI_3_0_0, MEI_4_0_0 }; From af840e37ba2c6bb9008a76b9348a2f3c5c61432d Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 23 Oct 2019 12:26:59 +0200 Subject: [PATCH 18/77] Revert "set currentColor as default color" --- Verovio.xcodeproj/project.pbxproj | 3 ++- include/vrv/devicecontextbase.h | 1 - src/bboxdevicecontext.cpp | 4 +-- src/svgdevicecontext.cpp | 43 ++++++++++++++----------------- src/view.cpp | 2 +- src/view_element.cpp | 6 ++--- 6 files changed, 28 insertions(+), 31 deletions(-) diff --git a/Verovio.xcodeproj/project.pbxproj b/Verovio.xcodeproj/project.pbxproj index f510cc3476e..da906c99461 100644 --- a/Verovio.xcodeproj/project.pbxproj +++ b/Verovio.xcodeproj/project.pbxproj @@ -2637,9 +2637,10 @@ }; buildConfigurationList = 8F086EA3188534680037FD8E /* Build configuration list for PBXProject "Verovio" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; + developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 8F086E9E188534680037FD8E; diff --git a/include/vrv/devicecontextbase.h b/include/vrv/devicecontextbase.h index 92ea60a970d..073a0d5f752 100644 --- a/include/vrv/devicecontextbase.h +++ b/include/vrv/devicecontextbase.h @@ -17,7 +17,6 @@ namespace vrv { -#define AxNONE -1 #define AxWHITE 255 << 16 | 255 << 8 | 255 #define AxBLACK 0 #define AxRED 255 << 16 diff --git a/src/bboxdevicecontext.cpp b/src/bboxdevicecontext.cpp index b3c738eb2cc..5ca2935a0f4 100644 --- a/src/bboxdevicecontext.cpp +++ b/src/bboxdevicecontext.cpp @@ -35,8 +35,8 @@ BBoxDeviceContext::BBoxDeviceContext(View *view, int width, int height, unsigned m_drawingText = false; m_textAlignment = HORIZONTALALIGNMENT_left; - SetBrush(AxNONE, AxSOLID); - SetPen(AxNONE, 1, AxSOLID); + SetBrush(AxBLACK, AxSOLID); + SetPen(AxBLACK, 1, AxSOLID); m_update = update; diff --git a/src/svgdevicecontext.cpp b/src/svgdevicecontext.cpp index 576e4a6be09..f79e161037d 100644 --- a/src/svgdevicecontext.cpp +++ b/src/svgdevicecontext.cpp @@ -38,8 +38,8 @@ SvgDeviceContext::SvgDeviceContext() : DeviceContext() m_originX = 0; m_originY = 0; - SetBrush(AxNONE, AxSOLID); - SetPen(AxNONE, 1, AxSOLID); + SetBrush(AxBLACK, AxSOLID); + SetPen(AxBLACK, 1, AxSOLID); m_smuflGlyphs.clear(); @@ -482,9 +482,9 @@ void SvgDeviceContext::DrawComplexBezierPath(Point bezier1[4], Point bezier2[4]) bezier2[2].x, bezier2[2].y, bezier2[1].x, bezier2[1].y, bezier2[0].x, bezier2[0].y // Second Bezier ) .c_str(); - // pathChild.append_attribute("fill") = "currentColor"; + // pathChild.append_attribute("fill") = "#000000"; // pathChild.append_attribute("fill-opacity") = "1"; - pathChild.append_attribute("stroke") = GetColour(m_penStack.top().GetColour()).c_str(); + pathChild.append_attribute("stroke") = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); pathChild.append_attribute("stroke-linecap") = "round"; pathChild.append_attribute("stroke-linejoin") = "round"; // pathChild.append_attribute("stroke-opacity") = "1"; @@ -517,7 +517,7 @@ void SvgDeviceContext::DrawEllipse(int x, int y, int width, int height) if (currentPen.GetWidth() > 0) { ellipseChild.append_attribute("stroke-width") = currentPen.GetWidth(); ellipseChild.append_attribute("stroke") - = GetColour(m_penStack.top().GetColour()).c_str(); + = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); } } @@ -583,13 +583,13 @@ void SvgDeviceContext::DrawEllipticArc(int x, int y, int width, int height, doub pathChild.append_attribute("d") = StringFormat( "M%d %d A%d %d 0.0 %d %d %d %d", int(xs), int(ys), abs(int(rx)), abs(int(ry)), fArc, fSweep, int(xe), int(ye)) .c_str(); - // pathChild.append_attribute("fill") = "currentColor"; + // pathChild.append_attribute("fill") = "#000000"; if (currentBrush.GetOpacity() != 1.0) pathChild.append_attribute("fill-opacity") = currentBrush.GetOpacity(); if (currentPen.GetOpacity() != 1.0) pathChild.append_attribute("stroke-opacity") = currentPen.GetOpacity(); if (currentPen.GetWidth() > 0) { pathChild.append_attribute("stroke-width") = currentPen.GetWidth(); pathChild.append_attribute("stroke") - = GetColour(m_penStack.top().GetColour()).c_str(); + = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); } } @@ -597,7 +597,7 @@ void SvgDeviceContext::DrawLine(int x1, int y1, int x2, int y2) { pugi::xml_node pathChild = AppendChild("path"); pathChild.append_attribute("d") = StringFormat("M%d %d L%d %d", x1, y1, x2, y2).c_str(); - pathChild.append_attribute("stroke") = GetColour(m_penStack.top().GetColour()).c_str(); + pathChild.append_attribute("stroke") = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); if (m_penStack.top().GetDashLength() > 0) pathChild.append_attribute("stroke-dasharray") = StringFormat("%d, %d", m_penStack.top().GetDashLength(), m_penStack.top().GetDashLength()).c_str(); @@ -618,14 +618,14 @@ void SvgDeviceContext::DrawPolygon(int n, Point points[], int xoffset, int yoffs // else if (currentPen.GetWidth() > 0) polygonChild.append_attribute("stroke") - = GetColour(currentPen.GetColour()).c_str(); + = StringFormat("#%s", GetColour(currentPen.GetColour()).c_str()).c_str(); if (currentPen.GetWidth() > 1) polygonChild.append_attribute("stroke-width") = StringFormat("%d", currentPen.GetWidth()).c_str(); if (currentPen.GetOpacity() != 1.0) polygonChild.append_attribute("stroke-opacity") = StringFormat("%f", currentPen.GetOpacity()).c_str(); - if (currentBrush.GetColour() != AxNONE) + if (currentBrush.GetColour() != AxBLACK) polygonChild.append_attribute("fill") - = GetColour(currentBrush.GetColour()).c_str(); + = StringFormat("#%s", GetColour(currentBrush.GetColour()).c_str()).c_str(); if (currentBrush.GetOpacity() != 1.0) polygonChild.append_attribute("fill-opacity") = StringFormat("%f", currentBrush.GetOpacity()).c_str(); @@ -817,7 +817,6 @@ void SvgDeviceContext::DrawMusicText(const std::wstring &text, int x, int y, boo // Write the char in the SVG pugi::xml_node useChild = AppendChild("use"); useChild.append_attribute("xlink:href") = StringFormat("#%s", glyph->GetCodeStr().c_str()).c_str(); - useChild.append_attribute("href") = StringFormat("#%s", glyph->GetCodeStr().c_str()).c_str(); useChild.append_attribute("x") = x; useChild.append_attribute("y") = y; useChild.append_attribute("height") = StringFormat("%dpx", m_fontStack.top()->GetPointSize()).c_str(); @@ -856,18 +855,16 @@ void SvgDeviceContext::AddDescription(const std::string &text) std::string SvgDeviceContext::GetColour(int colour) { std::ostringstream ss; - ss << "#"; ss << std::hex; switch (colour) { - case (AxNONE): return "currentColor"; - case (AxBLACK): return "#000000"; - case (AxWHITE): return "#FFFFFF"; - case (AxRED): return "#FF0000"; - case (AxGREEN): return "#00FF00"; - case (AxBLUE): return "#0000FF"; - case (AxCYAN): return "#00FFFF"; - case (AxLIGHT_GREY): return "#777777"; + case (AxBLACK): return "000000"; + case (AxWHITE): return "FFFFFF"; + case (AxRED): return "FF0000"; + case (AxGREEN): return "00FF00"; + case (AxBLUE): return "0000FF"; + case (AxCYAN): return "00FFFF"; + case (AxLIGHT_GREY): return "777777"; default: int blue = (colour & 255); int green = (colour >> 8) & 255; @@ -967,8 +964,8 @@ void SvgDeviceContext::DrawSvgBoundingBox(Object *object, View *view) SetPen(AxGREEN, 10, AxSOLID); SetBrush(AxGREEN, AxSOLID); this->DrawCircle(view->ToDeviceContextX(p.x), view->ToDeviceContextY(p.y), 5); - SetPen(AxNONE, 1, AxSOLID); - SetBrush(AxNONE, AxSOLID); + SetPen(AxBLACK, 1, AxSOLID); + SetBrush(AxBLACK, AxSOLID); } } } diff --git a/src/view.cpp b/src/view.cpp index bad4697b087..6361ce77808 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -30,7 +30,7 @@ View::View() m_options = NULL; m_pageIdx = 0; - m_currentColour = AxNONE; + m_currentColour = AxBLACK; m_currentElement = NULL; m_currentLayer = NULL; m_currentMeasure = NULL; diff --git a/src/view_element.cpp b/src/view_element.cpp index faece643d83..234635b3fbc 100644 --- a/src/view_element.cpp +++ b/src/view_element.cpp @@ -81,7 +81,7 @@ void View::DrawLayerElement(DeviceContext *dc, LayerElement *element, Layer *lay m_currentColour = AxRED; } else { - m_currentColour = AxNONE; + m_currentColour = AxBLACK; } if (element->Is(ACCID)) { @@ -1466,8 +1466,8 @@ void View::DrawAcciaccaturaSlash(DeviceContext *dc, Stem *stem, Staff *staff) assert(stem); assert(staff); - dc->SetPen(AxNONE, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize), AxSOLID); - dc->SetBrush(AxNONE, AxSOLID); + dc->SetPen(AxBLACK, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize), AxSOLID); + dc->SetBrush(AxBLACK, AxSOLID); int positionShift = m_doc->GetCueSize(m_doc->GetDrawingUnit(staff->m_drawingStaffSize)); int positionShiftX1 = positionShift * 3 / 2; From 4321b673663db2a57d035e85450d2fe9e05fe527 Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Wed, 23 Oct 2019 13:56:28 +0300 Subject: [PATCH 19/77] Improved iOS cocoapods support --- .gitignore | 1 + verovio.podspec | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8e7839bef33..6bda058db00 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ emscripten/npm-dev/node_modules # VS Code files .vscode/settings.json main +DerivedData diff --git a/verovio.podspec b/verovio.podspec index b0c34fcd727..e730105f6f5 100644 --- a/verovio.podspec +++ b/verovio.podspec @@ -1,5 +1,5 @@ Pod::Spec.new do |s| - s.name = 'verovio' + s.name = 'Verovio' s.version = '2.1.0' s.license = { :type => 'BSD' } s.homepage = 'https://github.com/vitalii-unicsoft/verovio' @@ -7,9 +7,12 @@ Pod::Spec.new do |s| s.summary = 'Verovio' s.source = { :git => 'https://github.com/vitalii-unicsoft/verovio', :tag => 'version-' + s.version.to_s } s.swift_versions = ['5.1'] - s.source_files = 'src/**/*.{h,cpp,cc}', 'include/**/*.{h,hpp}', - 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h,cpp}' - s.public_header_files = 'include/**/*.{h,hpp}' + s.source_files = 'src/**/*.{h,cpp,cc}', + 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', + 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h,cpp}' + s.public_header_files = 'src/**/*.{h}', + 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', + 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h}' s.platform = :ios, '12.0' s.resources = 'data/**' s.xcconfig = { @@ -19,7 +22,6 @@ Pod::Spec.new do |s| "GCC_DYNAMIC_NO_PIC" => "NO", "GCC_NO_COMMON_BLOCKS" => "YES", "GCC_SYMBOLS_PRIVATE_EXTERN" => "NO", - "CLANG_ENABLE_MODULES" => "YES", "CLANG_ENABLE_OBJC_ARC" => "YES", "CLANG_ENABLE_OBJC_WEAK" => "YES", "ENABLE_STRICT_OBJC_MSGSEND" => "YES", From b494e685cb1fe13beedd1fa23aecb5edfd7d8f8c Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Wed, 23 Oct 2019 16:03:40 +0300 Subject: [PATCH 20/77] Put resources to a 'data' folder. Restore original bundle identifier. --- verovio.podspec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/verovio.podspec b/verovio.podspec index e730105f6f5..17c8dc35ec8 100644 --- a/verovio.podspec +++ b/verovio.podspec @@ -14,7 +14,7 @@ Pod::Spec.new do |s| 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h}' s.platform = :ios, '12.0' - s.resources = 'data/**' + s.resources = 'data' s.xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "gnu++14", "CLANG_CXX_LIBRARY" => "libc++", @@ -29,4 +29,7 @@ Pod::Spec.new do |s| "SUPPORTS_UIKITFORMAC" => "NO", "MTL_ENABLE_DEBUG_INFO" => "NO" } + s.info_plist = { + 'CFBundleIdentifier' => 'com.rism.VerovioFramework' + } end From ac958ca485f3052dd079fe988b85af8c05e3f2af Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Thu, 24 Oct 2019 10:11:13 +0300 Subject: [PATCH 21/77] Improved podspec --- verovio.podspec | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/verovio.podspec b/verovio.podspec index 17c8dc35ec8..1744a6f8c01 100644 --- a/verovio.podspec +++ b/verovio.podspec @@ -1,34 +1,30 @@ Pod::Spec.new do |s| s.name = 'Verovio' s.version = '2.1.0' - s.license = { :type => 'BSD' } + s.license = { :type => 'LGPL' } s.homepage = 'https://github.com/vitalii-unicsoft/verovio' - s.authors = { 'Vitalii Yevtushenko' => 'yev@unicsoft.com' } + s.authors = { 'Vitalii Yevtushenko' => 'https://github.com/rism-ch/verovio/graphs/contributors' } s.summary = 'Verovio' - s.source = { :git => 'https://github.com/vitalii-unicsoft/verovio', :tag => 'version-' + s.version.to_s } - s.swift_versions = ['5.1'] - s.source_files = 'src/**/*.{h,cpp,cc}', - 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', - 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h,cpp}' - s.public_header_files = 'src/**/*.{h}', - 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', - 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h}' - s.platform = :ios, '12.0' - s.resources = 'data' - s.xcconfig = { - "CLANG_CXX_LANGUAGE_STANDARD" => "gnu++14", - "CLANG_CXX_LIBRARY" => "libc++", - "GCC_C_LANGUAGE_STANDARD" => "gnu11", - "GCC_DYNAMIC_NO_PIC" => "NO", - "GCC_NO_COMMON_BLOCKS" => "YES", - "GCC_SYMBOLS_PRIVATE_EXTERN" => "NO", - "CLANG_ENABLE_OBJC_ARC" => "YES", - "CLANG_ENABLE_OBJC_WEAK" => "YES", - "ENABLE_STRICT_OBJC_MSGSEND" => "YES", - "MTL_FAST_MATH" => "YES", - "SUPPORTS_UIKITFORMAC" => "NO", - "MTL_ENABLE_DEBUG_INFO" => "NO" - } + s.source = { :git => 'https://github.com/rism-ch/verovio.git', :tag => 'version-' + s.version.to_s } + s.swift_versions = ['5.1'] + s.source_files = 'src/**/*.{h,cpp,cc}', 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h,cpp}' + s.public_header_files = 'src/**/*.{h}', 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h}' + s.platform = :ios, '12.0' + s.resources = 'data' + s.xcconfig = { + "CLANG_CXX_LANGUAGE_STANDARD" => "gnu++14", + "CLANG_CXX_LIBRARY" => "libc++", + "GCC_C_LANGUAGE_STANDARD" => "gnu11", + "GCC_DYNAMIC_NO_PIC" => "NO", + "GCC_NO_COMMON_BLOCKS" => "YES", + "GCC_SYMBOLS_PRIVATE_EXTERN" => "NO", + "CLANG_ENABLE_OBJC_ARC" => "YES", + "CLANG_ENABLE_OBJC_WEAK" => "YES", + "ENABLE_STRICT_OBJC_MSGSEND" => "YES", + "MTL_FAST_MATH" => "YES", + "SUPPORTS_UIKITFORMAC" => "NO", + "MTL_ENABLE_DEBUG_INFO" => "NO" + } s.info_plist = { 'CFBundleIdentifier' => 'com.rism.VerovioFramework' } From 5bd5c3d85fea098b04229ef3ff3ce89352205f40 Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Thu, 24 Oct 2019 10:12:11 +0300 Subject: [PATCH 22/77] Podspec improvements --- verovio.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/verovio.podspec b/verovio.podspec index 1744a6f8c01..e0dc1a40482 100644 --- a/verovio.podspec +++ b/verovio.podspec @@ -2,8 +2,8 @@ Pod::Spec.new do |s| s.name = 'Verovio' s.version = '2.1.0' s.license = { :type => 'LGPL' } - s.homepage = 'https://github.com/vitalii-unicsoft/verovio' - s.authors = { 'Vitalii Yevtushenko' => 'https://github.com/rism-ch/verovio/graphs/contributors' } + s.homepage = 'https://www.verovio.org/index.xhtml' + s.authors = { 'Contributors List' => 'https://github.com/rism-ch/verovio/graphs/contributors' } s.summary = 'Verovio' s.source = { :git => 'https://github.com/rism-ch/verovio.git', :tag => 'version-' + s.version.to_s } s.swift_versions = ['5.1'] From 80ca7d7312b6f7e70ffce6491bfbce3ebc330c4e Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 24 Oct 2019 19:22:20 +0200 Subject: [PATCH 23/77] set default color to Verovio style --- src/svgdevicecontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svgdevicecontext.cpp b/src/svgdevicecontext.cpp index 576e4a6be09..55447a0e8d2 100644 --- a/src/svgdevicecontext.cpp +++ b/src/svgdevicecontext.cpp @@ -389,7 +389,7 @@ void SvgDeviceContext::StartPage() m_currentNode = m_currentNode.append_child("style"); m_currentNode.append_attribute("type") = "text/css"; m_currentNode.append_child(pugi::node_pcdata) - .set_value("g.page-margin{font-family:Times;} " + .set_value("g.page-margin{color:black;font-family:Times;} " //"g.bounding-box{stroke:red; stroke-width:10} " //"g.content-bounding-box{stroke:blue; stroke-width:10} " "g.tempo{font-weight:bold;} g.dir, g.dynam, " From b7280636fb0f32d561b758310433eea4651394f0 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 16 Oct 2019 18:43:58 +0200 Subject: [PATCH 24/77] set currentColor as default color fixes #556 --- src/svgdevicecontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svgdevicecontext.cpp b/src/svgdevicecontext.cpp index 962fc855bf2..a755eb401da 100644 --- a/src/svgdevicecontext.cpp +++ b/src/svgdevicecontext.cpp @@ -871,7 +871,7 @@ std::string SvgDeviceContext::GetColour(int colour) int red = (colour >> 16) & 255; ss << red << green << blue; // std::strin = wxDecToHex(char(red)) + wxDecToHex(char(green)) + wxDecToHex(char(blue)) ; // ax3 - return ss.str(); + return StringFormat("#%s", ss.str()); } } From ea7c2f7f1f64e45bffae633fc6ad6dc162207d3f Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 17 Oct 2019 09:35:43 +0200 Subject: [PATCH 25/77] fix non-trivial type error --- src/svgdevicecontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svgdevicecontext.cpp b/src/svgdevicecontext.cpp index a755eb401da..962fc855bf2 100644 --- a/src/svgdevicecontext.cpp +++ b/src/svgdevicecontext.cpp @@ -871,7 +871,7 @@ std::string SvgDeviceContext::GetColour(int colour) int red = (colour >> 16) & 255; ss << red << green << blue; // std::strin = wxDecToHex(char(red)) + wxDecToHex(char(green)) + wxDecToHex(char(blue)) ; // ax3 - return StringFormat("#%s", ss.str()); + return ss.str(); } } From c66cfa682c741860a57285a3bece12c80377b8a8 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 16 Oct 2019 18:43:58 +0200 Subject: [PATCH 26/77] set currentColor as default color fixes #556 --- include/vrv/devicecontextbase.h | 1 + src/bboxdevicecontext.cpp | 4 +-- src/svgdevicecontext.cpp | 44 +++++++++++++++++---------------- src/view.cpp | 2 +- src/view_element.cpp | 6 ++--- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/include/vrv/devicecontextbase.h b/include/vrv/devicecontextbase.h index 073a0d5f752..92ea60a970d 100644 --- a/include/vrv/devicecontextbase.h +++ b/include/vrv/devicecontextbase.h @@ -17,6 +17,7 @@ namespace vrv { +#define AxNONE -1 #define AxWHITE 255 << 16 | 255 << 8 | 255 #define AxBLACK 0 #define AxRED 255 << 16 diff --git a/src/bboxdevicecontext.cpp b/src/bboxdevicecontext.cpp index 5ca2935a0f4..b3c738eb2cc 100644 --- a/src/bboxdevicecontext.cpp +++ b/src/bboxdevicecontext.cpp @@ -35,8 +35,8 @@ BBoxDeviceContext::BBoxDeviceContext(View *view, int width, int height, unsigned m_drawingText = false; m_textAlignment = HORIZONTALALIGNMENT_left; - SetBrush(AxBLACK, AxSOLID); - SetPen(AxBLACK, 1, AxSOLID); + SetBrush(AxNONE, AxSOLID); + SetPen(AxNONE, 1, AxSOLID); m_update = update; diff --git a/src/svgdevicecontext.cpp b/src/svgdevicecontext.cpp index 962fc855bf2..cd09ef7fd24 100644 --- a/src/svgdevicecontext.cpp +++ b/src/svgdevicecontext.cpp @@ -38,8 +38,8 @@ SvgDeviceContext::SvgDeviceContext() : DeviceContext() m_originX = 0; m_originY = 0; - SetBrush(AxBLACK, AxSOLID); - SetPen(AxBLACK, 1, AxSOLID); + SetBrush(AxNONE, AxSOLID); + SetPen(AxNONE, 1, AxSOLID); m_smuflGlyphs.clear(); @@ -482,9 +482,9 @@ void SvgDeviceContext::DrawComplexBezierPath(Point bezier1[4], Point bezier2[4]) bezier2[2].x, bezier2[2].y, bezier2[1].x, bezier2[1].y, bezier2[0].x, bezier2[0].y // Second Bezier ) .c_str(); - // pathChild.append_attribute("fill") = "#000000"; + // pathChild.append_attribute("fill") = "currentColor"; // pathChild.append_attribute("fill-opacity") = "1"; - pathChild.append_attribute("stroke") = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); + pathChild.append_attribute("stroke") = GetColour(m_penStack.top().GetColour()).c_str(); pathChild.append_attribute("stroke-linecap") = "round"; pathChild.append_attribute("stroke-linejoin") = "round"; // pathChild.append_attribute("stroke-opacity") = "1"; @@ -517,7 +517,7 @@ void SvgDeviceContext::DrawEllipse(int x, int y, int width, int height) if (currentPen.GetWidth() > 0) { ellipseChild.append_attribute("stroke-width") = currentPen.GetWidth(); ellipseChild.append_attribute("stroke") - = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); + = GetColour(m_penStack.top().GetColour()).c_str(); } } @@ -583,13 +583,13 @@ void SvgDeviceContext::DrawEllipticArc(int x, int y, int width, int height, doub pathChild.append_attribute("d") = StringFormat( "M%d %d A%d %d 0.0 %d %d %d %d", int(xs), int(ys), abs(int(rx)), abs(int(ry)), fArc, fSweep, int(xe), int(ye)) .c_str(); - // pathChild.append_attribute("fill") = "#000000"; + // pathChild.append_attribute("fill") = "currentColor"; if (currentBrush.GetOpacity() != 1.0) pathChild.append_attribute("fill-opacity") = currentBrush.GetOpacity(); if (currentPen.GetOpacity() != 1.0) pathChild.append_attribute("stroke-opacity") = currentPen.GetOpacity(); if (currentPen.GetWidth() > 0) { pathChild.append_attribute("stroke-width") = currentPen.GetWidth(); pathChild.append_attribute("stroke") - = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); + = GetColour(m_penStack.top().GetColour()).c_str(); } } @@ -597,7 +597,7 @@ void SvgDeviceContext::DrawLine(int x1, int y1, int x2, int y2) { pugi::xml_node pathChild = AppendChild("path"); pathChild.append_attribute("d") = StringFormat("M%d %d L%d %d", x1, y1, x2, y2).c_str(); - pathChild.append_attribute("stroke") = StringFormat("#%s", GetColour(m_penStack.top().GetColour()).c_str()).c_str(); + pathChild.append_attribute("stroke") = GetColour(m_penStack.top().GetColour()).c_str(); if (m_penStack.top().GetDashLength() > 0) pathChild.append_attribute("stroke-dasharray") = StringFormat("%d, %d", m_penStack.top().GetDashLength(), m_penStack.top().GetDashLength()).c_str(); @@ -618,14 +618,14 @@ void SvgDeviceContext::DrawPolygon(int n, Point points[], int xoffset, int yoffs // else if (currentPen.GetWidth() > 0) polygonChild.append_attribute("stroke") - = StringFormat("#%s", GetColour(currentPen.GetColour()).c_str()).c_str(); + = GetColour(currentPen.GetColour()).c_str(); if (currentPen.GetWidth() > 1) polygonChild.append_attribute("stroke-width") = StringFormat("%d", currentPen.GetWidth()).c_str(); if (currentPen.GetOpacity() != 1.0) polygonChild.append_attribute("stroke-opacity") = StringFormat("%f", currentPen.GetOpacity()).c_str(); - if (currentBrush.GetColour() != AxBLACK) + if (currentBrush.GetColour() != AxNONE) polygonChild.append_attribute("fill") - = StringFormat("#%s", GetColour(currentBrush.GetColour()).c_str()).c_str(); + = GetColour(currentBrush.GetColour()).c_str(); if (currentBrush.GetOpacity() != 1.0) polygonChild.append_attribute("fill-opacity") = StringFormat("%f", currentBrush.GetOpacity()).c_str(); @@ -817,6 +817,7 @@ void SvgDeviceContext::DrawMusicText(const std::wstring &text, int x, int y, boo // Write the char in the SVG pugi::xml_node useChild = AppendChild("use"); useChild.append_attribute("xlink:href") = StringFormat("#%s", glyph->GetCodeStr().c_str()).c_str(); + useChild.append_attribute("href") = StringFormat("#%s", glyph->GetCodeStr().c_str()).c_str(); useChild.append_attribute("x") = x; useChild.append_attribute("y") = y; useChild.append_attribute("height") = StringFormat("%dpx", m_fontStack.top()->GetPointSize()).c_str(); @@ -858,20 +859,21 @@ std::string SvgDeviceContext::GetColour(int colour) ss << std::hex; switch (colour) { - case (AxBLACK): return "000000"; - case (AxWHITE): return "FFFFFF"; - case (AxRED): return "FF0000"; - case (AxGREEN): return "00FF00"; - case (AxBLUE): return "0000FF"; - case (AxCYAN): return "00FFFF"; - case (AxLIGHT_GREY): return "777777"; + case (AxNONE): return "currentColor"; + case (AxBLACK): return "#000000"; + case (AxWHITE): return "#FFFFFF"; + case (AxRED): return "#FF0000"; + case (AxGREEN): return "#00FF00"; + case (AxBLUE): return "#0000FF"; + case (AxCYAN): return "#00FFFF"; + case (AxLIGHT_GREY): return "#777777"; default: int blue = (colour & 255); int green = (colour >> 8) & 255; int red = (colour >> 16) & 255; ss << red << green << blue; // std::strin = wxDecToHex(char(red)) + wxDecToHex(char(green)) + wxDecToHex(char(blue)) ; // ax3 - return ss.str(); + return StringFormat("#%s", ss.str()); } } @@ -964,8 +966,8 @@ void SvgDeviceContext::DrawSvgBoundingBox(Object *object, View *view) SetPen(AxGREEN, 10, AxSOLID); SetBrush(AxGREEN, AxSOLID); this->DrawCircle(view->ToDeviceContextX(p.x), view->ToDeviceContextY(p.y), 5); - SetPen(AxBLACK, 1, AxSOLID); - SetBrush(AxBLACK, AxSOLID); + SetPen(AxNONE, 1, AxSOLID); + SetBrush(AxNONE, AxSOLID); } } } diff --git a/src/view.cpp b/src/view.cpp index 6361ce77808..bad4697b087 100644 --- a/src/view.cpp +++ b/src/view.cpp @@ -30,7 +30,7 @@ View::View() m_options = NULL; m_pageIdx = 0; - m_currentColour = AxBLACK; + m_currentColour = AxNONE; m_currentElement = NULL; m_currentLayer = NULL; m_currentMeasure = NULL; diff --git a/src/view_element.cpp b/src/view_element.cpp index 234635b3fbc..faece643d83 100644 --- a/src/view_element.cpp +++ b/src/view_element.cpp @@ -81,7 +81,7 @@ void View::DrawLayerElement(DeviceContext *dc, LayerElement *element, Layer *lay m_currentColour = AxRED; } else { - m_currentColour = AxBLACK; + m_currentColour = AxNONE; } if (element->Is(ACCID)) { @@ -1466,8 +1466,8 @@ void View::DrawAcciaccaturaSlash(DeviceContext *dc, Stem *stem, Staff *staff) assert(stem); assert(staff); - dc->SetPen(AxBLACK, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize), AxSOLID); - dc->SetBrush(AxBLACK, AxSOLID); + dc->SetPen(AxNONE, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize), AxSOLID); + dc->SetBrush(AxNONE, AxSOLID); int positionShift = m_doc->GetCueSize(m_doc->GetDrawingUnit(staff->m_drawingStaffSize)); int positionShiftX1 = positionShift * 3 / 2; From 257ae72e092e5f149ed699b0b62062ac63ac4579 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 17 Oct 2019 09:35:43 +0200 Subject: [PATCH 27/77] fix non-trivial type error --- src/svgdevicecontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/svgdevicecontext.cpp b/src/svgdevicecontext.cpp index cd09ef7fd24..55447a0e8d2 100644 --- a/src/svgdevicecontext.cpp +++ b/src/svgdevicecontext.cpp @@ -856,6 +856,7 @@ void SvgDeviceContext::AddDescription(const std::string &text) std::string SvgDeviceContext::GetColour(int colour) { std::ostringstream ss; + ss << "#"; ss << std::hex; switch (colour) { @@ -873,7 +874,7 @@ std::string SvgDeviceContext::GetColour(int colour) int red = (colour >> 16) & 255; ss << red << green << blue; // std::strin = wxDecToHex(char(red)) + wxDecToHex(char(green)) + wxDecToHex(char(blue)) ; // ax3 - return StringFormat("#%s", ss.str()); + return ss.str(); } } From 0d5c9a9052c1ef98073d4dab1feae29ed60c39a9 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 24 Oct 2019 20:47:57 +0200 Subject: [PATCH 28/77] update X-Code settings --- 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 da906c99461..155955ce2b2 100644 --- a/Verovio.xcodeproj/project.pbxproj +++ b/Verovio.xcodeproj/project.pbxproj @@ -2637,11 +2637,11 @@ }; buildConfigurationList = 8F086EA3188534680037FD8E /* Build configuration list for PBXProject "Verovio" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, + Base, ); mainGroup = 8F086E9E188534680037FD8E; productRefGroup = 8F086EAA188534680037FD8E /* Products */; From 43ef630a1466d8d4599f15cf6dc01d3fb766da19 Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Thu, 24 Oct 2019 22:07:29 +0300 Subject: [PATCH 29/77] Raneme podspec file to have capitalized Verovio --- verovio.podspec => VerovioFramework.podspec | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename verovio.podspec => VerovioFramework.podspec (100%) diff --git a/verovio.podspec b/VerovioFramework.podspec similarity index 100% rename from verovio.podspec rename to VerovioFramework.podspec From bebe6ecafefbe48a3776519102fcb746898150a9 Mon Sep 17 00:00:00 2001 From: Vitalii Yevtushenko Date: Thu, 24 Oct 2019 22:20:12 +0300 Subject: [PATCH 30/77] Expanded * in libmei includes --- VerovioFramework.podspec => Verovio.podspec | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) rename VerovioFramework.podspec => Verovio.podspec (51%) diff --git a/VerovioFramework.podspec b/Verovio.podspec similarity index 51% rename from VerovioFramework.podspec rename to Verovio.podspec index e0dc1a40482..0cda1ad4451 100644 --- a/VerovioFramework.podspec +++ b/Verovio.podspec @@ -7,8 +7,18 @@ Pod::Spec.new do |s| s.summary = 'Verovio' s.source = { :git => 'https://github.com/rism-ch/verovio.git', :tag => 'version-' + s.version.to_s } s.swift_versions = ['5.1'] - s.source_files = 'src/**/*.{h,cpp,cc}', 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h,cpp}' - s.public_header_files = 'src/**/*.{h}', 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', 'libmei/{attc*,atts_a*,atts_c*,atts_ex*,atts_fa*,atts_g*,atts_m*,atts_n*,atts_pa*,atts_s*,atts_v*,attt*}.{h}' + s.source_files = 'src/**/*.{h,cpp,cc}', + 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', + 'libmei/{attclasses,attconverter,atts_analytical,atts_cmn,atts_cmnornaments}.{h,cpp}', + 'libmei/{atts_critapp,atts_externalsymbols,atts_facsimile,atts_gestural,atts_mei}.{h,cpp}', + 'libmei/{atts_mensural,atts_midi,atts_neumes,atts_pagebased,atts_shared}.{h,cpp}', + 'libmei/{atts_visual,atttypes}.{h,cpp}' + s.public_header_files = 'src/**/*.{h}', + 'include/{hum,json,midi,pugi,utf8,vrv}/*.{h,hpp}', + 'libmei/{attclasses,attconverter,atts_analytical,atts_cmn,atts_cmnornaments}.{h}', + 'libmei/{atts_critapp,atts_externalsymbols,atts_facsimile,atts_gestural,atts_mei}.{h}', + 'libmei/{atts_mensural,atts_midi,atts_neumes,atts_pagebased,atts_shared}.{h}', + 'libmei/{atts_visual,atttypes}.{h}' s.platform = :ios, '12.0' s.resources = 'data' s.xcconfig = { From 38a1f063f6e05a94be99ec6fa0ee7d41afba480f Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 25 Oct 2019 10:08:14 -0500 Subject: [PATCH 31/77] Fixing bug with grace notes and mRests --- src/horizontalaligner.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/horizontalaligner.cpp b/src/horizontalaligner.cpp index 36808a4c090..80c2b554f01 100644 --- a/src/horizontalaligner.cpp +++ b/src/horizontalaligner.cpp @@ -253,6 +253,10 @@ void MeasureAligner::AdjustGraceNoteSpacing(Doc *doc, Alignment *alignment, int rightAlignment = dynamic_cast(*riter); assert(rightAlignment); + + if (rightAlignment->IsOfType({ALIGNMENT_FULLMEASURE, ALIGNMENT_FULLMEASURE2})) { + continue; + } // Do not go beyond the left bar line if (rightAlignment->GetType() == ALIGNMENT_MEASURE_LEFT_BARLINE) { From 7b0769aebe51bdf8483e9300fcccce1fcd7a23d4 Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Fri, 25 Oct 2019 11:14:50 -0500 Subject: [PATCH 32/77] Renaming some methods to clarify child / descendant and parent / ancestor lookups --- include/vrv/clef.h | 2 +- include/vrv/keysig.h | 2 +- include/vrv/mensur.h | 2 +- include/vrv/metersig.h | 2 +- include/vrv/object.h | 33 +++++----- src/arpeg.cpp | 6 +- src/artic.cpp | 12 ++-- src/barline.cpp | 2 +- src/beam.cpp | 4 +- src/chord.cpp | 12 ++-- src/controlelement.cpp | 2 +- src/doc.cpp | 37 ++++++----- src/durationinterface.cpp | 4 +- src/editortoolkit_cmn.cpp | 22 +++---- src/editortoolkit_neume.cpp | 128 ++++++++++++++++++------------------ src/elementpart.cpp | 12 ++-- src/facsimile.cpp | 6 +- src/facsimileinterface.cpp | 2 +- src/fig.cpp | 2 +- src/ftrem.cpp | 4 +- src/horizontalaligner.cpp | 27 ++++---- src/ioabc.cpp | 10 +-- src/iomei.cpp | 22 +++---- src/iomusxml.cpp | 20 +++--- src/layer.cpp | 26 ++++---- src/layerelement.cpp | 111 ++++++++++++++++--------------- src/linkinginterface.cpp | 2 +- src/measure.cpp | 30 ++++----- src/neume.cpp | 10 +-- src/note.cpp | 32 ++++----- src/object.cpp | 46 ++++++------- src/page.cpp | 24 +++---- src/rest.cpp | 6 +- src/runningelement.cpp | 8 +-- src/scoredef.cpp | 26 ++++---- src/slur.cpp | 4 +- src/staff.cpp | 18 ++--- src/staffdef.cpp | 4 +- src/surface.cpp | 4 +- src/svgdevicecontext.cpp | 13 ++-- src/syl.cpp | 4 +- src/system.cpp | 12 ++-- src/textelement.cpp | 8 +-- src/timeinterface.cpp | 10 +-- src/toolkit.cpp | 20 +++--- src/tuplet.cpp | 35 +++++----- src/verse.cpp | 6 +- src/view_control.cpp | 40 +++++------ src/view_element.cpp | 14 ++-- src/view_mensural.cpp | 2 +- src/view_neume.cpp | 2 +- src/view_page.cpp | 46 ++++++------- src/view_slur.cpp | 12 ++-- src/view_text.cpp | 14 ++-- src/view_tuplet.cpp | 4 +- 55 files changed, 485 insertions(+), 483 deletions(-) diff --git a/include/vrv/clef.h b/include/vrv/clef.h index 5dd5d771327..744988a3962 100644 --- a/include/vrv/clef.h +++ b/include/vrv/clef.h @@ -45,7 +45,7 @@ class Clef : public LayerElement, virtual bool HasToBeAligned() const { return true; } /** Override the method since check is required */ - virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstParent(SCOREDEF)); } + virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstAncestor(SCOREDEF)); } /** * Return the offset of the clef diff --git a/include/vrv/keysig.h b/include/vrv/keysig.h index 9df1380ab24..cca8b6febff 100644 --- a/include/vrv/keysig.h +++ b/include/vrv/keysig.h @@ -51,7 +51,7 @@ class KeySig : public LayerElement, virtual bool HasToBeAligned() const { return true; } /** Override the method since check is required */ - virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstParent(SCOREDEF)); } + virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstAncestor(SCOREDEF)); } /** * Add an element (a keyAccid) to a keySig. diff --git a/include/vrv/mensur.h b/include/vrv/mensur.h index 4c4d8e91eaf..5f748642ddb 100644 --- a/include/vrv/mensur.h +++ b/include/vrv/mensur.h @@ -51,7 +51,7 @@ class Mensur : public LayerElement, virtual bool HasToBeAligned() const { return true; } /** Override the method since check is required */ - virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstParent(SCOREDEF)); } + virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstAncestor(SCOREDEF)); } //----------// // Functors // diff --git a/include/vrv/metersig.h b/include/vrv/metersig.h index 158b048a3cf..227aee2026f 100644 --- a/include/vrv/metersig.h +++ b/include/vrv/metersig.h @@ -42,7 +42,7 @@ class MeterSig : public LayerElement, public AttMeterSigLog, public AttMeterSigV virtual bool HasToBeAligned() const { return true; } /** Override the method since check is required */ - virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstParent(SCOREDEF)); } + virtual bool IsScoreDefElement() const { return (this->GetParent() && this->GetFirstAncestor(SCOREDEF)); } /** Convert attribute types form */ meterSigVis_FORM meterSigDefaultVisToMeterSigVis(meterSigDefaultVis_METERFORM form); diff --git a/include/vrv/object.h b/include/vrv/object.h index e1be6ef9210..518faf28bc5 100644 --- a/include/vrv/object.h +++ b/include/vrv/object.h @@ -343,7 +343,7 @@ class Object : public BoundingBox { /** * Look for all Objects of a class and return its position (-1 if not found) */ - int GetChildIndex(const Object *child, const ClassId classId, int deepth); + int GetDescendantIndex(const Object *child, const ClassId classId, int deepth); /** * Insert an element at the idx position. @@ -357,48 +357,49 @@ class Object : public BoundingBox { Object *DetachChild(int idx); /** - * Return true if the object has the child Object as child (reference of direct). + * Return true if the object has the child Object as descendant (reference of direct). * Processes in depth-first. */ - bool HasChild(Object *child, int deepness = UNLIMITED_DEPTH) const; + bool HasDescendant(Object *child, int deepness = UNLIMITED_DEPTH) const; /** - * Look for a child with the specified uuid (returns NULL if not found) + * Look for a descendant with the specified uuid (returns NULL if not found) * This method is a wrapper for the Object::FindByUuid functor. */ - Object *FindChildByUuid(std::string uuid, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD); + Object *FindDescendantByUuid(std::string uuid, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD); /** - * Look for a child with the specified type (returns NULL if not found) + * Look for a descendant with the specified type (returns NULL if not found) * This method is a wrapper for the Object::FindByType functor. */ - Object *FindChildByType(ClassId classId, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD); + Object *FindDescendantByType(ClassId classId, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD); /** * Return the first element matching the Comparison functor * Deepness allow to limit the depth search (EditorialElements are not count) */ - Object *FindChildByComparison(Comparison *comparison, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD); + Object *FindDescendantByComparison( + Comparison *comparison, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD); /** * Return the element matching the extreme value with an Comparison functor * Deepness allow to limit the depth search (EditorialElements are not count) */ - Object *FindChildExtremeByComparison( + Object *FindDescendantExtremeByComparison( Comparison *comparison, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD); /** * Return all the objects matching the Comparison functor * Deepness allow to limit the depth search (EditorialElements are not count) */ - void FindAllChildByComparison(ArrayOfObjects *objects, Comparison *comparison, int deepness = UNLIMITED_DEPTH, + void FindAllDescendantByComparison(ArrayOfObjects *objects, Comparison *comparison, int deepness = UNLIMITED_DEPTH, bool direction = FORWARD, bool clear = true); /** * Return all the objects matching the Comparison functor and being between start and end in the tree. * The start and end objects are included in the result set. */ - void FindAllChildBetween( + void FindAllDescendantBetween( ArrayOfObjects *objects, Comparison *comparison, Object *start, Object *end, bool clear = true); /** @@ -430,18 +431,18 @@ class Object : public BoundingBox { bool DeleteChild(Object *child); /** - * Return the first parent of the specified type. + * Return the first ancestor of the specified type. * The maxSteps parameter limits the search to a certain number of level if not -1. */ - Object *GetFirstParent(const ClassId classId, int maxSteps = -1) const; + Object *GetFirstAncestor(const ClassId classId, int maxSteps = -1) const; - Object *GetFirstParentInRange(const ClassId classIdMin, const ClassId classIdMax, int maxDepth = -1) const; + Object *GetFirstAncestorInRange(const ClassId classIdMin, const ClassId classIdMax, int maxDepth = -1) const; /** - * Return the last parent that is NOT of the specified type. + * Return the last ancestor that is NOT of the specified type. * The maxSteps parameter limits the search to a certain number of level if not -1. */ - Object *GetLastParentNot(const ClassId classId, int maxSteps = -1); + Object *GetLastAncestorNot(const ClassId classId, int maxSteps = -1); /** * Fill the list of all the children LayerElement. diff --git a/src/arpeg.cpp b/src/arpeg.cpp index 392f5ee8a16..2acd9a3160b 100644 --- a/src/arpeg.cpp +++ b/src/arpeg.cpp @@ -64,7 +64,7 @@ int Arpeg::GetDrawingX() const // Otherwise get the measure - no cast to Measure is necessary LogDebug("Accessing an arpeg x without positionner"); - Object *measure = this->GetFirstParent(MEASURE); + Object *measure = this->GetFirstAncestor(MEASURE); assert(measure); // This will be very arbitrary positionned... @@ -201,10 +201,10 @@ int Arpeg::AdjustArpeg(FunctorParams *functorParams) // We should have call DrawArpeg before assert(this->GetCurrentFloatingPositioner()); - Staff *topStaff = dynamic_cast(topNote->GetFirstParent(STAFF)); + Staff *topStaff = dynamic_cast(topNote->GetFirstAncestor(STAFF)); assert(topStaff); - Staff *bottomStaff = dynamic_cast(bottomNote->GetFirstParent(STAFF)); + Staff *bottomStaff = dynamic_cast(bottomNote->GetFirstAncestor(STAFF)); assert(bottomStaff); int minTopLeft, maxTopRight; diff --git a/src/artic.cpp b/src/artic.cpp index 09adcfaf5b4..40d9f56a78e 100644 --- a/src/artic.cpp +++ b/src/artic.cpp @@ -90,13 +90,13 @@ void Artic::SplitArtic(std::vector *insideSlur, std::vector(FindChildByComparison(&articPartComparison, 1)); + return dynamic_cast(FindDescendantByComparison(&articPartComparison, 1)); } ArticPart *Artic::GetOutsidePart() { ArticPartTypeComparison articPartComparison(ARTIC_PART_OUTSIDE); - return dynamic_cast(FindChildByComparison(&articPartComparison, 1)); + return dynamic_cast(FindDescendantByComparison(&articPartComparison, 1)); } wchar_t Artic::GetSmuflCode(data_ARTICULATION artic, const data_STAFFREL &place) @@ -259,12 +259,12 @@ int Artic::CalcArtic(FunctorParams *functorParams) LayerElement *parent = NULL; Note *parentNote = NULL; - Chord *parentChord = dynamic_cast(this->GetFirstParent(CHORD, 2)); + Chord *parentChord = dynamic_cast(this->GetFirstAncestor(CHORD, 2)); data_STEMDIRECTION stemDir = STEMDIRECTION_NONE; data_STAFFREL place = STAFFREL_NONE; if (!parentChord) { - parentNote = dynamic_cast(this->GetFirstParent(NOTE)); + parentNote = dynamic_cast(this->GetFirstAncestor(NOTE)); parent = parentNote; } else { @@ -276,9 +276,9 @@ int Artic::CalcArtic(FunctorParams *functorParams) return FUNCTOR_CONTINUE; } - Staff *staff = dynamic_cast(this->GetFirstParent(STAFF)); + Staff *staff = dynamic_cast(this->GetFirstAncestor(STAFF)); assert(staff); - Layer *layer = dynamic_cast(this->GetFirstParent(LAYER)); + Layer *layer = dynamic_cast(this->GetFirstAncestor(LAYER)); assert(layer); stemDir = parentNote ? parentNote->GetDrawingStemDir() : parentChord->GetDrawingStemDir(); diff --git a/src/barline.cpp b/src/barline.cpp index a832d9e76d4..021242df560 100644 --- a/src/barline.cpp +++ b/src/barline.cpp @@ -141,7 +141,7 @@ int BarLine::ConvertToCastOffMensural(FunctorParams *functorParams) // Look if we already have the staff (e.g., with more than one layer) AttNIntegerComparison comparisonStaffN(STAFF, params->m_targetStaff->GetN()); - Staff *staff = dynamic_cast(params->m_targetMeasure->FindChildByComparison(&comparisonStaffN)); + Staff *staff = dynamic_cast(params->m_targetMeasure->FindDescendantByComparison(&comparisonStaffN)); if (!staff) { staff = new Staff(*params->m_targetStaff); staff->ClearChildren(); diff --git a/src/beam.cpp b/src/beam.cpp index bf5ff58c3ad..3c6f304bf83 100644 --- a/src/beam.cpp +++ b/src/beam.cpp @@ -656,9 +656,9 @@ int Beam::CalcStem(FunctorParams *functorParams) int elementCount = (int)beamChildren->size(); - Layer *layer = dynamic_cast(this->GetFirstParent(LAYER)); + Layer *layer = dynamic_cast(this->GetFirstAncestor(LAYER)); assert(layer); - Staff *staff = dynamic_cast(layer->GetFirstParent(STAFF)); + Staff *staff = dynamic_cast(layer->GetFirstAncestor(STAFF)); assert(staff); this->m_drawingParams.CalcBeam(layer, staff, params->m_doc, beamElementCoords, elementCount); diff --git a/src/chord.cpp b/src/chord.cpp index 1a9dbe751f4..34988261267 100644 --- a/src/chord.cpp +++ b/src/chord.cpp @@ -462,9 +462,9 @@ int Chord::CalcStem(FunctorParams *functorParams) Stem *stem = this->GetDrawingStem(); assert(stem); - Staff *staff = dynamic_cast(this->GetFirstParent(STAFF)); + Staff *staff = dynamic_cast(this->GetFirstAncestor(STAFF)); assert(staff); - Layer *layer = dynamic_cast(this->GetFirstParent(LAYER)); + Layer *layer = dynamic_cast(this->GetFirstAncestor(LAYER)); assert(layer); if (this->m_crossStaff) staff = this->m_crossStaff; @@ -530,7 +530,7 @@ int Chord::CalcDots(FunctorParams *functorParams) } } - Dots *dots = dynamic_cast(this->FindChildByType(DOTS, 1)); + Dots *dots = dynamic_cast(this->FindDescendantByType(DOTS, 1)); assert(dots); params->m_chordDots = dots; @@ -610,9 +610,9 @@ int Chord::CalcDots(FunctorParams *functorParams) int Chord::PrepareLayerElementParts(FunctorParams *functorParams) { - Stem *currentStem = dynamic_cast(this->FindChildByType(STEM, 1)); + Stem *currentStem = dynamic_cast(this->FindDescendantByType(STEM, 1)); Flag *currentFlag = NULL; - if (currentStem) currentFlag = dynamic_cast(currentStem->FindChildByType(FLAG, 1)); + if (currentStem) currentFlag = dynamic_cast(currentStem->FindDescendantByType(FLAG, 1)); if (!currentStem) { currentStem = new Stem(); @@ -652,7 +652,7 @@ int Chord::PrepareLayerElementParts(FunctorParams *functorParams) /************ dots ***********/ - Dots *currentDots = dynamic_cast(this->FindChildByType(DOTS, 1)); + Dots *currentDots = dynamic_cast(this->FindDescendantByType(DOTS, 1)); if (this->GetDots() > 0) { if (!currentDots) { diff --git a/src/controlelement.cpp b/src/controlelement.cpp index 4edb6ab30f9..276a65ed540 100644 --- a/src/controlelement.cpp +++ b/src/controlelement.cpp @@ -56,7 +56,7 @@ void ControlElement::Reset() data_HORIZONTALALIGNMENT ControlElement::GetChildRendAlignment() { - Rend *rend = dynamic_cast(this->FindChildByType(REND)); + Rend *rend = dynamic_cast(this->FindDescendantByType(REND)); if (!rend || !rend->HasHalign()) return HORIZONTALALIGNMENT_NONE; return rend->GetHalign(); diff --git a/src/doc.cpp b/src/doc.cpp index 2766e9f5bca..bbf2baa23d9 100644 --- a/src/doc.cpp +++ b/src/doc.cpp @@ -134,7 +134,7 @@ void Doc::Refresh() bool Doc::GenerateDocumentScoreDef() { - Measure *measure = dynamic_cast(this->FindChildByType(MEASURE)); + Measure *measure = dynamic_cast(this->FindDescendantByType(MEASURE)); if (!measure) { LogError("No measure found for generating a scoreDef"); return false; @@ -142,7 +142,7 @@ bool Doc::GenerateDocumentScoreDef() ArrayOfObjects staves; ClassIdComparison matchType(STAFF); - measure->FindAllChildByComparison(&staves, &matchType); + measure->FindAllDescendantByComparison(&staves, &matchType); if (staves.empty()) { LogError("No staff found for generating a scoreDef"); @@ -170,7 +170,7 @@ bool Doc::GenerateDocumentScoreDef() bool Doc::GenerateHeaderAndFooter() { - if (m_scoreDef.FindChildByType(PGHEAD) || m_scoreDef.FindChildByType(PGFOOT)) { + if (m_scoreDef.FindDescendantByType(PGHEAD) || m_scoreDef.FindDescendantByType(PGFOOT)) { return false; } @@ -209,12 +209,12 @@ bool Doc::GenerateMeasureNumbers() ClassIdComparison matchType(MEASURE); ArrayOfObjects measures; ArrayOfObjects::iterator measureIter; - this->FindAllChildByComparison(&measures, &matchType); + this->FindAllDescendantByComparison(&measures, &matchType); // run through all measures and generate missing mNum from attribute for (measureIter = measures.begin(); measureIter != measures.end(); ++measureIter) { Measure *measure = dynamic_cast(*measureIter); - if (measure->HasN() && !measure->FindChildByType(MNUM)) { + if (measure->HasN() && !measure->FindDescendantByType(MNUM)) { MNum *mnum = new MNum; Text *text = new Text; text->SetText(UTF8to16(measure->GetN())); @@ -329,11 +329,11 @@ void Doc::ExportMIDI(smf::MidiFile *midiFile) midiFile->addTracks(addCount); } // set MIDI channel and instrument - InstrDef *instrdef = dynamic_cast(staffDef->FindChildByType(INSTRDEF, 1)); + InstrDef *instrdef = dynamic_cast(staffDef->FindDescendantByType(INSTRDEF, 1)); if (!instrdef) { - StaffGrp *staffGrp = dynamic_cast(staffDef->GetFirstParent(STAFFGRP)); + StaffGrp *staffGrp = dynamic_cast(staffDef->GetFirstAncestor(STAFFGRP)); assert(staffGrp); - instrdef = dynamic_cast(staffGrp->FindChildByType(INSTRDEF, 1)); + instrdef = dynamic_cast(staffGrp->FindDescendantByType(INSTRDEF, 1)); } if (instrdef) { if (instrdef->HasMidiChannel()) midiChannel = instrdef->GetMidiChannel(); @@ -341,18 +341,18 @@ void Doc::ExportMIDI(smf::MidiFile *midiFile) midiFile->addPatchChange(midiTrack, 0, midiChannel, instrdef->GetMidiInstrnum()); } // set MIDI track name - Label *label = dynamic_cast