Skip to content

Commit

Permalink
More improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-spa committed Jan 20, 2022
1 parent abd17b0 commit 0a61d46
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/engraving/layout/layoutsystem.cpp
Expand Up @@ -86,7 +86,7 @@ System* LayoutSystem::collectSystem(const LayoutOptions& options, LayoutContext&
bool curTrailer = ctx.curMeasure->trailer();
MeasureBase* breakMeasure = nullptr;

Fraction minTicks = Fraction(10000, 1); // Initializing this variable at a random high value.
Fraction minTicks = Fraction::max(); // Initializing this variable at an arbitrary high value.
// In principle, it just needs to be longer than any possible note.
Fraction prevMinTicks = Fraction(1, 1);
bool changeMinSysTicks = false;
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/libmscore/system.cpp
Expand Up @@ -1832,7 +1832,7 @@ int System::lastVisibleSysStaffOfPart(const Part* part) const

Fraction System::minSysTicks() const
{
Fraction minTicks = Fraction (10000, 1); // Initializing the variable at a random high value.
Fraction minTicks = Fraction::max(); // Initializing the variable at an arbitrary high value.
// In principle, it just needs to be longer than any possible note, such that the following loop
// always correctly returns the shortest note/rest of the system.
for (MeasureBase* mb : measures()) {
Expand Down
3 changes: 3 additions & 0 deletions src/engraving/types/fraction.h
Expand Up @@ -71,6 +71,9 @@ class Fraction
int numerator() const { return m_numerator; }
int denominator() const { return m_denominator; }

static constexpr Fraction max() { return Fraction(10000, 1); }
// Use this when you need to initialize a Fraction to an arbitrary high value

void setNumerator(int v) { m_numerator = v; }
void setDenominator(int v)
{
Expand Down

0 comments on commit 0a61d46

Please sign in to comment.