Skip to content

Commit

Permalink
fix issue with font size (side effect of drawing dots)
Browse files Browse the repository at this point in the history
add hidden parameter (maybe useless)
  • Loading branch information
dfober committed Jan 8, 2024
1 parent d244b63 commit 1516d7f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/engine/abstract/ARRepeatBegin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
*/

#include <iostream>

#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
{
Expand All @@ -30,3 +35,8 @@ void ARRepeatBegin::setRepeatEnd(const ARRepeatEnd *myr)
dur = myr->getRelativeTimePosition() - getRelativeTimePosition();
}

bool ARRepeatBegin::hidden () const
{
return getParameter<TagParameterString>(kHiddenStr, true)->getBool();
}

3 changes: 2 additions & 1 deletion src/engine/abstract/ARRepeatBegin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"; };
Expand All @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/engine/abstract/ARRepeatEnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "ARBar.h"
#include "TimeUnwrap.h"
#include "TagParameterString.h"
#include "TagParameterStrings.h"

class ARRepeatBegin;

Expand All @@ -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<TagParameterString>(kHiddenStr, true)->getBool(); }

virtual void browse(TimeUnwrap& mapper) const
{ mapper.AtPos (this, TimeUnwrap::kRepeatEnd); }
Expand Down
3 changes: 3 additions & 0 deletions src/engine/graphic/GRRepeatBegin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

// --------------------------------------------------------------------------
Expand Down Expand Up @@ -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);
}

// --------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/engine/graphic/GRRepeatEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
}

// --------------------------------------------------------------------------
Expand Down

0 comments on commit 1516d7f

Please sign in to comment.