From 1516d7f6bf755e05626b3c61cdef73b3684f7543 Mon Sep 17 00:00:00 2001 From: Dominique Fober Date: Mon, 8 Jan 2024 18:48:47 +0100 Subject: [PATCH] fix issue with font size (side effect of drawing dots) add hidden parameter (maybe useless) --- src/engine/abstract/ARRepeatBegin.cpp | 14 ++++++++++++-- src/engine/abstract/ARRepeatBegin.h | 3 ++- src/engine/abstract/ARRepeatEnd.h | 5 ++++- src/engine/graphic/GRRepeatBegin.cpp | 3 +++ src/engine/graphic/GRRepeatEnd.cpp | 3 +++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/engine/abstract/ARRepeatBegin.cpp b/src/engine/abstract/ARRepeatBegin.cpp index 33946768d..3a4081361 100644 --- a/src/engine/abstract/ARRepeatBegin.cpp +++ b/src/engine/abstract/ARRepeatBegin.cpp @@ -12,12 +12,17 @@ */ -#include - #include "ARRepeatBegin.h" #include "ARRepeatEnd.h" #include "TimeUnwrap.h" +#include "TagParameterString.h" +#include "TagParameterStrings.h" +ARRepeatBegin::ARRepeatBegin() +{ + setupTagParameters (gMaps->sARRepeatMap); + dur.setNumerator(-1); +} void ARRepeatBegin::browse(TimeUnwrap& mapper) const { @@ -30,3 +35,8 @@ void ARRepeatBegin::setRepeatEnd(const ARRepeatEnd *myr) dur = myr->getRelativeTimePosition() - getRelativeTimePosition(); } +bool ARRepeatBegin::hidden () const +{ + return getParameter(kHiddenStr, true)->getBool(); +} + diff --git a/src/engine/abstract/ARRepeatBegin.h b/src/engine/abstract/ARRepeatBegin.h index d83724a9e..bca1641a7 100644 --- a/src/engine/abstract/ARRepeatBegin.h +++ b/src/engine/abstract/ARRepeatBegin.h @@ -38,7 +38,7 @@ See the [Repeat Signs](@EXAMPLES/repeats/) example. class ARRepeatBegin : public ARMTParameter { public: - ARRepeatBegin() { dur.setNumerator(-1); } + ARRepeatBegin(); virtual ~ARRepeatBegin() {} virtual const char* getTagName() const { return "ARRepeatBegin"; }; @@ -50,6 +50,7 @@ class ARRepeatBegin : public ARMTParameter ARMusicalObject *isARRepeatBegin() { return this; } const ARBar::TRanges& getRanges () const { return fRanges; } void setRanges (const ARBar::TRanges& r) { fRanges = r; } + bool hidden () const; private: ARBar::TRanges fRanges; diff --git a/src/engine/abstract/ARRepeatEnd.h b/src/engine/abstract/ARRepeatEnd.h index 277061a94..a2dafc0c6 100644 --- a/src/engine/abstract/ARRepeatEnd.h +++ b/src/engine/abstract/ARRepeatEnd.h @@ -17,6 +17,8 @@ #include "ARBar.h" #include "TimeUnwrap.h" +#include "TagParameterString.h" +#include "TagParameterStrings.h" class ARRepeatBegin; @@ -39,13 +41,14 @@ See the [Repeat Signs](@EXAMPLES/repeats/) example. class ARRepeatEnd : public ARBar { public: - ARRepeatEnd(ARRepeatBegin * curbeg = 0) { rangesetting = RANGEDC; } + ARRepeatEnd(ARRepeatBegin * curbeg = 0) { rangesetting = RANGEDC; setupTagParameters (gMaps->sARRepeatMap); } virtual ~ARRepeatEnd() { } virtual const char* getTagName() const { return "ARRepeatEnd"; }; virtual std::string getGMNName() const { return "\\repeatEnd"; }; ARMusicalObject *isARRepeatEnd() { return this; } + bool hidden () const { return getParameter(kHiddenStr, true)->getBool(); } virtual void browse(TimeUnwrap& mapper) const { mapper.AtPos (this, TimeUnwrap::kRepeatEnd); } diff --git a/src/engine/graphic/GRRepeatBegin.cpp b/src/engine/graphic/GRRepeatBegin.cpp index 966508932..051eb243e 100644 --- a/src/engine/graphic/GRRepeatBegin.cpp +++ b/src/engine/graphic/GRRepeatBegin.cpp @@ -47,6 +47,7 @@ GRRepeatBegin::GRRepeatBegin(const ARRepeatBegin *ar, GRStaff * inStaff, bool p_ fDx = ar->getDX()->getValue(); fDy = ar->getDY()->getValue(); updateBoundingBox(); + if (ar->hidden()) mShow = false; } // -------------------------------------------------------------------------- @@ -155,8 +156,10 @@ void GRRepeatBegin::DrawDots( VGDevice & hdc ) const } float x = getXOffset() + hlspace * 2.4f; + const VGFont* savedfont = hdc.GetMusicFont(); DrawSymbol(hdc, kDotSymbol, x, y1, pointSize); DrawSymbol(hdc, kDotSymbol, x, y2, pointSize); + hdc.SetMusicFont(savedfont); } // -------------------------------------------------------------------------- diff --git a/src/engine/graphic/GRRepeatEnd.cpp b/src/engine/graphic/GRRepeatEnd.cpp index 10e5c07c0..aecabc777 100644 --- a/src/engine/graphic/GRRepeatEnd.cpp +++ b/src/engine/graphic/GRRepeatEnd.cpp @@ -35,6 +35,7 @@ GRRepeatEnd::GRRepeatEnd( const ARRepeatEnd * ar, GRStaff * inStaff, const TYPE_ { setGRStaff (inStaff); InitRepeatEnd(); + if (ar->hidden()) mShow = false; } const ARRepeatEnd* GRRepeatEnd::getARRepeatEnd() { @@ -117,9 +118,11 @@ void GRRepeatEnd::DrawDots( VGDevice & hdc ) const } float x = -hlspace * 0.75f - getXOffset(); + const VGFont* savedfont = hdc.GetMusicFont(); hdc.SetFontAlign(VGDevice::kAlignBaseLeft); DrawSymbol(hdc, kDotSymbol, x, y1, pointSize); DrawSymbol(hdc, kDotSymbol, x, y2, pointSize); + hdc.SetMusicFont(savedfont); } // --------------------------------------------------------------------------