From 96ccc62dc44e0fb60c9d543e75f6b86fb1a2408d Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 8 Aug 2024 16:52:55 +0200 Subject: [PATCH 1/7] add i/o for att.barline.vis --- include/vrv/barline.h | 2 ++ src/barline.cpp | 7 +++++-- src/iomei.cpp | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/vrv/barline.h b/include/vrv/barline.h index 164c2214130..3bb1c41a053 100644 --- a/include/vrv/barline.h +++ b/include/vrv/barline.h @@ -9,6 +9,7 @@ #define __VRV_BARLINE_H__ #include "atts_shared.h" +#include "atts_visual.h" #include "layerelement.h" namespace vrv { @@ -27,6 +28,7 @@ enum class BarLinePosition { None, Left, Right }; */ class BarLine : public LayerElement, public AttBarLineLog, + public AttBarLineVis, public AttColor, public AttNNumberLike, public AttVisibility { diff --git a/src/barline.cpp b/src/barline.cpp index 30952b11ed7..6181c9dba4b 100644 --- a/src/barline.cpp +++ b/src/barline.cpp @@ -33,9 +33,10 @@ namespace vrv { static const ClassRegistrar s_factory("barLine", BARLINE); -BarLine::BarLine() : LayerElement(BARLINE, "bline-"), AttBarLineLog(), AttColor(), AttNNumberLike(), AttVisibility() +BarLine::BarLine() : LayerElement(BARLINE, "bline-"), AttBarLineLog(), AttBarLineVis(), AttColor(), AttNNumberLike(), AttVisibility() { this->RegisterAttClass(ATT_BARLINELOG); + this->RegisterAttClass(ATT_BARLINEVIS); this->RegisterAttClass(ATT_COLOR); this->RegisterAttClass(ATT_VISIBILITY); @@ -43,9 +44,10 @@ BarLine::BarLine() : LayerElement(BARLINE, "bline-"), AttBarLineLog(), AttColor( } BarLine::BarLine(ClassId classId) - : LayerElement(classId, "bline-"), AttBarLineLog(), AttColor(), AttNNumberLike(), AttVisibility() + : LayerElement(classId, "bline-"), AttBarLineLog(), AttBarLineVis(), AttColor(), AttNNumberLike(), AttVisibility() { this->RegisterAttClass(ATT_BARLINELOG); + this->RegisterAttClass(ATT_BARLINEVIS); this->RegisterAttClass(ATT_COLOR); this->RegisterAttClass(ATT_VISIBILITY); @@ -59,6 +61,7 @@ void BarLine::Reset() LayerElement::Reset(); this->ResetBarLineLog(); + this->ResetBarLineVis(); this->ResetColor(); this->ResetVisibility(); diff --git a/src/iomei.cpp b/src/iomei.cpp index eeb2f763486..c74c8a8939a 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -2381,6 +2381,7 @@ void MEIOutput::WriteBarLine(pugi::xml_node currentNode, BarLine *barLine) this->WriteLayerElement(currentNode, barLine); barLine->WriteBarLineLog(currentNode); + barLine->WriteBarLineVis(currentNode); barLine->WriteColor(currentNode); barLine->WriteNNumberLike(currentNode); barLine->WriteVisibility(currentNode); @@ -6428,6 +6429,7 @@ bool MEIInput::ReadBarLine(Object *parent, pugi::xml_node barLine) this->ReadLayerElement(barLine, vrvBarLine); vrvBarLine->ReadBarLineLog(barLine); + vrvBarLine->ReadBarLineVis(barLine); vrvBarLine->ReadColor(barLine); vrvBarLine->ReadNNumberLike(barLine); vrvBarLine->ReadVisibility(barLine); From 4b4f0cd684e5111a2a90e93b26d13acf66caf52a Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 8 Aug 2024 16:53:39 +0200 Subject: [PATCH 2/7] draw takt with barLine --- src/view_element.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/view_element.cpp b/src/view_element.cpp index eb253fc26fd..f62b9741e68 100644 --- a/src/view_element.cpp +++ b/src/view_element.cpp @@ -420,11 +420,24 @@ void View::DrawBarLine(DeviceContext *dc, LayerElement *element, Layer *layer, S barLine->SetEmptyBB(); return; } - + StaffDef *drawingStaffDef = staff->m_drawingStaffDef; + // Determine the method + assert(drawingStaffDef); + auto [hasMethod, method] = barLine->GetMethod(drawingStaffDef); + if (barLine->HasMethod()) { + LogWarning("Hat Methode!"); + method = barLine->AttBarLineVis::GetMethod(); + } + dc->StartGraphic(element, "", element->GetID()); - const int yTop = staff->GetDrawingY(); - const int yBottom = yTop - (staff->m_drawingLines - 1) * m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize); + int yTop = staff->GetDrawingY(); + int yBottom = yTop - (staff->m_drawingLines - 1) * m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize); + + if (method == BARMETHOD_takt) { + yTop += m_doc->GetDrawingUnit(staff->m_drawingStaffSize); + yBottom = yTop - m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize); + } const int offset = (yTop == yBottom) ? m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) : 0; From 3ada618dfb2c44ac76c6b2f097461a9cd91fb88c Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 8 Aug 2024 17:16:11 +0200 Subject: [PATCH 3/7] import Volpiano barlines and breaks --- src/iovolpiano.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/iovolpiano.cpp b/src/iovolpiano.cpp index bfdd67ca4f2..90a3e0f2504 100644 --- a/src/iovolpiano.cpp +++ b/src/iovolpiano.cpp @@ -16,6 +16,7 @@ //---------------------------------------------------------------------------- +#include "barline.h" #include "clef.h" #include "doc.h" #include "layer.h" @@ -110,6 +111,20 @@ bool VolpianoInput::Import(const std::string &volpiano) else if (ch == 'I' || ch == 'W' || ch == 'X' || ch == 'Y' || ch == 'Z') { accidVal = ACCIDENTAL_WRITTEN_n; } + else if (ch == '3') { + BarLine *single = new BarLine(); + layer->AddChild(single); + } + else if (ch == '4') { + BarLine *dbl = new BarLine(); + dbl->SetForm(BARRENDITION_dbl); + layer->AddChild(dbl); + } + else if (ch == '7') { + BarLine *takt = new BarLine(); + takt->SetMethod(BARMETHOD_takt); + layer->AddChild(takt); + } } // add minimal scoreDef From 9e37989b759bb19fbf9585cd0785b0820d29e7a0 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Thu, 8 Aug 2024 17:25:46 +0200 Subject: [PATCH 4/7] formatting --- src/barline.cpp | 3 ++- src/view_element.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/barline.cpp b/src/barline.cpp index 6181c9dba4b..9a7beea2900 100644 --- a/src/barline.cpp +++ b/src/barline.cpp @@ -33,7 +33,8 @@ namespace vrv { static const ClassRegistrar s_factory("barLine", BARLINE); -BarLine::BarLine() : LayerElement(BARLINE, "bline-"), AttBarLineLog(), AttBarLineVis(), AttColor(), AttNNumberLike(), AttVisibility() +BarLine::BarLine() + : LayerElement(BARLINE, "bline-"), AttBarLineLog(), AttBarLineVis(), AttColor(), AttNNumberLike(), AttVisibility() { this->RegisterAttClass(ATT_BARLINELOG); this->RegisterAttClass(ATT_BARLINEVIS); diff --git a/src/view_element.cpp b/src/view_element.cpp index f62b9741e68..519320ac31c 100644 --- a/src/view_element.cpp +++ b/src/view_element.cpp @@ -428,7 +428,7 @@ void View::DrawBarLine(DeviceContext *dc, LayerElement *element, Layer *layer, S LogWarning("Hat Methode!"); method = barLine->AttBarLineVis::GetMethod(); } - + dc->StartGraphic(element, "", element->GetID()); int yTop = staff->GetDrawingY(); From 36a02dac19c74444d9a857bfd8a3b555a2e561c0 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Fri, 9 Aug 2024 08:47:19 +0200 Subject: [PATCH 5/7] fix: remove debug message --- src/view_element.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/view_element.cpp b/src/view_element.cpp index 519320ac31c..d14d3715d42 100644 --- a/src/view_element.cpp +++ b/src/view_element.cpp @@ -425,7 +425,6 @@ void View::DrawBarLine(DeviceContext *dc, LayerElement *element, Layer *layer, S assert(drawingStaffDef); auto [hasMethod, method] = barLine->GetMethod(drawingStaffDef); if (barLine->HasMethod()) { - LogWarning("Hat Methode!"); method = barLine->AttBarLineVis::GetMethod(); } From 6055053c02cafe91c697a611ca645691c4920c58 Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Mon, 2 Sep 2024 14:51:39 +0200 Subject: [PATCH 6/7] add support for end barlines --- src/iovolpiano.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/iovolpiano.cpp b/src/iovolpiano.cpp index 90a3e0f2504..96d899800b9 100644 --- a/src/iovolpiano.cpp +++ b/src/iovolpiano.cpp @@ -120,6 +120,14 @@ bool VolpianoInput::Import(const std::string &volpiano) dbl->SetForm(BARRENDITION_dbl); layer->AddChild(dbl); } + else if (ch == '5') { + BarLine *end = new BarLine(); + end->SetForm(BARRENDITION_end); + layer->AddChild(end); + } + else if (ch == '6') { + // not supported yet + } else if (ch == '7') { BarLine *takt = new BarLine(); takt->SetMethod(BARMETHOD_takt); From 44ad2fc41241ebf71c2b13cb7c45fcd5a1828bfc Mon Sep 17 00:00:00 2001 From: Klaus Rettinghaus Date: Mon, 2 Sep 2024 16:06:26 +0200 Subject: [PATCH 7/7] add warning Co-authored-by: Laurent Pugin --- src/iovolpiano.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iovolpiano.cpp b/src/iovolpiano.cpp index 96d899800b9..58313c9e66d 100644 --- a/src/iovolpiano.cpp +++ b/src/iovolpiano.cpp @@ -126,7 +126,7 @@ bool VolpianoInput::Import(const std::string &volpiano) layer->AddChild(end); } else if (ch == '6') { - // not supported yet + LogWarning("Volpiano '6' barline is not supported"); } else if (ch == '7') { BarLine *takt = new BarLine();