Skip to content

Commit 67722e0

Browse files
committed
tidy: more beatType v.s. beatDivisor clarity.
1 parent 7d8d0e6 commit 67722e0

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/nodes/midisetlisteditor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class MidiSetListProgramSignatureWidget : public TimeSignatureSetting
204204
{
205205
String text;
206206
text << getBeatsPerBar() << " / "
207-
<< (int) BeatType ((BeatType::ID) getBeatDivisor()).divisor();
207+
<< (int) BeatType ((BeatType::ID) getBeatType()).divisor();
208208
g.setFont (Font (FontOptions (editor.getFontSize())));
209209
ViewHelpers::drawBasicTextRow (text, g, getWidth(), getHeight(), selected, 0, Justification::centred);
210210
}
@@ -223,7 +223,7 @@ class MidiSetListProgramSignatureWidget : public TimeSignatureSetting
223223

224224
auto program = editor.getProgram (row);
225225
program.tsNum = getBeatsPerBar();
226-
program.tsDen = (int) BeatType ((BeatType::ID) getBeatDivisor()).divisor();
226+
program.tsDen = (int) BeatType ((BeatType::ID) getBeatType()).divisor();
227227
editor.setProgram (row, program);
228228
}
229229

src/ui/buttons.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class TimeSignatureSetting : public Component
317317
TimeSignatureSetting()
318318
{
319319
beatsPerBar.setValue (4);
320-
beatDivisor.setValue (BeatType::QuarterNote);
320+
beatType.setValue (BeatType::QuarterNote);
321321
}
322322

323323
~TimeSignatureSetting() {}
@@ -329,7 +329,7 @@ class TimeSignatureSetting : public Component
329329
g.fillAll (isOn ? Colors::toggleOrange : element::Colors::widgetBackgroundColor.brighter());
330330

331331
String text = beatsPerBar.toString();
332-
text << " / " << String (BeatType ((BeatType::ID) (int) beatDivisor.getValue()).divisor());
332+
text << " / " << String (BeatType ((BeatType::ID) (int) beatType.getValue()).divisor());
333333

334334
if (text.isNotEmpty())
335335
{
@@ -349,11 +349,11 @@ class TimeSignatureSetting : public Component
349349
if (bpb > 99)
350350
bpb = 99;
351351

352-
if (bpb == (int) beatsPerBar.getValue() && (int) beatDivisor.getValue() == div)
352+
if (bpb == (int) beatsPerBar.getValue() && (int) beatType.getValue() == div)
353353
return;
354354

355355
beatsPerBar.setValue (bpb);
356-
beatDivisor.setValue (div);
356+
beatType.setValue (div);
357357
if (notify)
358358
meterChanged();
359359

@@ -362,8 +362,7 @@ class TimeSignatureSetting : public Component
362362

363363
virtual void meterChanged() {}
364364
int getBeatsPerBar() const { return (int) beatsPerBar.getValue(); }
365-
int getBeatType() const { return (int) BeatType::QuarterNote; } // quarter note
366-
int getBeatDivisor() const { return (int) beatDivisor.getValue(); }
365+
int getBeatType() const { return (int) beatType.getValue(); }
367366

368367
void mouseDown (const MouseEvent& ev) override
369368
{
@@ -374,7 +373,7 @@ class TimeSignatureSetting : public Component
374373
lastY = ev.getDistanceFromDragStartY();
375374
}
376375

377-
Value& getDraggedValue() { return isDraggingBeatDivisor ? beatDivisor : beatsPerBar; }
376+
Value& getDraggedValue() { return isDraggingBeatDivisor ? beatType : beatsPerBar; }
378377

379378
void mouseDrag (const MouseEvent& ev) override
380379
{
@@ -408,7 +407,7 @@ class TimeSignatureSetting : public Component
408407

409408
private:
410409
Value beatsPerBar;
411-
Value beatDivisor;
410+
Value beatType;
412411
bool isDraggingBeatDivisor = false;
413412
[[maybe_unused]] int stickyValue = 0;
414413
[[maybe_unused]] int decimalPlaces = 0;

src/ui/tempoandmeterbar.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,12 @@ class TempoAndMeterBar : public Component,
488488
if (owner.checkMonitor())
489489
{
490490
if (auto e = owner.engine)
491-
e->setMeter (getBeatsPerBar(), getBeatDivisor());
491+
e->setMeter (getBeatsPerBar(), getBeatType());
492492
if (auto s = owner.session)
493493
{
494494
s->data().setProperty (tags::beatsPerBar, getBeatsPerBar(), 0);
495-
s->data().setProperty (tags::beatDivisor, getBeatDivisor(), 0);
495+
// session uses the wrong key for beat type.
496+
s->data().setProperty (tags::beatDivisor, getBeatType(), 0);
496497
}
497498
}
498499
}

0 commit comments

Comments
 (0)