clean up BeamMode enum

This commit is contained in:
Igor Korsukov 2021-12-03 16:42:56 +02:00
parent c03d422025
commit ef25e11de3
43 changed files with 238 additions and 240 deletions

View file

@ -361,16 +361,16 @@ void ExampleView::dropEvent(QDropEvent* event)
emit beamPropertyDropped(chord, icon);
switch (icon->actionType()) {
case ActionIconType::BEAM_START:
chord->setBeamMode(Beam::Mode::BEGIN);
chord->setBeamMode(BeamMode::BEGIN);
break;
case ActionIconType::BEAM_MID:
chord->setBeamMode(Beam::Mode::AUTO);
chord->setBeamMode(BeamMode::AUTO);
break;
case ActionIconType::BEAM_BEGIN_32:
chord->setBeamMode(Beam::Mode::BEGIN32);
chord->setBeamMode(BeamMode::BEGIN32);
break;
case ActionIconType::BEAM_BEGIN_64:
chord->setBeamMode(Beam::Mode::BEGIN64);
chord->setBeamMode(BeamMode::BEGIN64);
break;
default:
break;

View file

@ -188,12 +188,12 @@ void LayoutBeams::breakCrossMeasureBeams(const LayoutContext& ctx, Measure* meas
}
}
static bool beamNoContinue(Beam::Mode mode)
static bool beamNoContinue(BeamMode mode)
{
return mode == Beam::Mode::END || mode == Beam::Mode::NONE || mode == Beam::Mode::INVALID;
return mode == BeamMode::END || mode == BeamMode::NONE || mode == BeamMode::INVALID;
}
#define beamModeMid(a) (a == Beam::Mode::MID || a == Beam::Mode::BEGIN32 || a == Beam::Mode::BEGIN64)
#define beamModeMid(a) (a == BeamMode::MID || a == BeamMode::BEGIN32 || a == BeamMode::BEGIN64)
//---------------------------------------------------------
// beamGraceNotes
@ -203,12 +203,12 @@ void LayoutBeams::beamGraceNotes(Score* score, Chord* mainNote, bool after)
{
ChordRest* a1 = 0; // start of (potential) beam
Beam* beam = 0; // current beam
Beam::Mode bm = Beam::Mode::AUTO;
BeamMode bm = BeamMode::AUTO;
QVector<Chord*> graceNotes = after ? mainNote->graceNotesAfter() : mainNote->graceNotesBefore();
for (ChordRest* cr : qAsConst(graceNotes)) {
bm = Groups::endBeam(cr);
if ((cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == Beam::Mode::NONE)) {
if ((cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == BeamMode::NONE)) {
if (beam) {
beam->layoutGraceNotes();
beam = 0;
@ -221,11 +221,11 @@ void LayoutBeams::beamGraceNotes(Score* score, Chord* mainNote, bool after)
continue;
}
if (beam) {
bool beamEnd = bm == Beam::Mode::BEGIN;
bool beamEnd = bm == BeamMode::BEGIN;
if (!beamEnd) {
cr->replaceBeam(beam);
cr = 0;
beamEnd = (bm == Beam::Mode::END);
beamEnd = (bm == BeamMode::END);
}
if (beamEnd) {
beam->layoutGraceNotes();
@ -238,7 +238,7 @@ void LayoutBeams::beamGraceNotes(Score* score, Chord* mainNote, bool after)
if (a1 == 0) {
a1 = cr;
} else {
if (!beamModeMid(bm) && (bm == Beam::Mode::BEGIN)) {
if (!beamModeMid(bm) && (bm == BeamMode::BEGIN)) {
a1->removeDeleteBeam(false);
a1 = cr;
} else {
@ -276,7 +276,7 @@ void LayoutBeams::createBeams(Score* score, LayoutContext& lc, Measure* measure)
ChordRest* a1 = 0; // start of (potential) beam
bool firstCR = true;
Beam* beam = 0; // current beam
Beam::Mode bm = Beam::Mode::AUTO;
BeamMode bm = BeamMode::AUTO;
ChordRest* prev = 0;
bool checkBeats = false;
Fraction stretch = Fraction(1, 1);
@ -316,8 +316,8 @@ void LayoutBeams::createBeams(Score* score, LayoutContext& lc, Measure* measure)
if (firstCR) {
firstCR = false;
// Handle cross-measure beams
Beam::Mode mode = cr->beamMode();
if (mode == Beam::Mode::MID || mode == Beam::Mode::END) {
BeamMode mode = cr->beamMode();
if (mode == BeamMode::MID || mode == BeamMode::END) {
ChordRest* prevCR = score->findCR(measure->tick() - Fraction::fromTicks(1), track);
if (prevCR) {
const Measure* pm = prevCR->measure();
@ -346,13 +346,13 @@ void LayoutBeams::createBeams(Score* score, LayoutContext& lc, Measure* measure)
}
}
if (cr->isRest() && cr->beamMode() == Beam::Mode::AUTO) {
bm = Beam::Mode::NONE; // do not beam rests set to Beam::Mode::AUTO
if (cr->isRest() && cr->beamMode() == BeamMode::AUTO) {
bm = BeamMode::NONE; // do not beam rests set to BeamMode::AUTO
} else {
bm = Groups::endBeam(cr, prev); // get defaults from time signature properties
}
// perform additional context-dependent checks
if (bm == Beam::Mode::AUTO) {
if (bm == BeamMode::AUTO) {
// check if we need to break beams according to minimum duration in current / previous beat
if (checkBeats && cr->rtick().isNotZero()) {
Fraction tick = cr->rtick() * stretch;
@ -380,10 +380,10 @@ void LayoutBeams::createBeams(Score* score, LayoutContext& lc, Measure* measure)
// set beam mode to NONE (do not combine with following chord beam/hook, if any)
if (cr->durationType().hooks() > 0 && cr->crossMeasure() == CrossMeasure::SECOND) {
bm = Beam::Mode::NONE;
bm = BeamMode::NONE;
}
if ((cr->isChord() && cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == Beam::Mode::NONE)) {
if ((cr->isChord() && cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == BeamMode::NONE)) {
bool removeBeam = true;
if (beam) {
beam->layout1();
@ -401,11 +401,11 @@ void LayoutBeams::createBeams(Score* score, LayoutContext& lc, Measure* measure)
}
if (beam) {
bool beamEnd = (bm == Beam::Mode::BEGIN);
bool beamEnd = (bm == BeamMode::BEGIN);
if (!beamEnd) {
cr->replaceBeam(beam);
cr = 0;
beamEnd = (bm == Beam::Mode::END);
beamEnd = (bm == BeamMode::END);
}
if (beamEnd) {
beam->layout1();
@ -421,7 +421,7 @@ void LayoutBeams::createBeams(Score* score, LayoutContext& lc, Measure* measure)
} else {
if (!beamModeMid(bm)
&&
(bm == Beam::Mode::BEGIN
(bm == BeamMode::BEGIN
|| (a1->segment()->segmentType() != cr->segment()->segmentType())
|| (a1->tick() + a1->actualTicks() < cr->tick())
)

View file

@ -670,9 +670,9 @@ bool Beam::calcIsBeamletBefore(Chord* chord, int i, int level) const
// for subbeams
ChordRest* previousChordRest = _elements[i - 1];
ChordRest* nextChordRest = _elements[i + 1];
Mode beamMode = Groups::endBeam(chord, previousChordRest);
bool ends32Beam = (level >= 1) && (beamMode == Mode::BEGIN32);
bool ends64Beam = (level >= 2) && (beamMode == Mode::BEGIN64);
BeamMode beamMode = Groups::endBeam(chord, previousChordRest);
bool ends32Beam = (level >= 1) && (beamMode == BeamMode::BEGIN32);
bool ends64Beam = (level >= 2) && (beamMode == BeamMode::BEGIN64);
if (ends32Beam || ends64Beam) {
return true;
@ -1588,20 +1588,20 @@ Fraction Beam::ticks() const
// actionIconTypeForBeamMode
//---------------------------------------------------------
ActionIconType Beam::actionIconTypeForBeamMode(Mode mode)
ActionIconType Beam::actionIconTypeForBeamMode(BeamMode mode)
{
switch (mode) {
case Mode::BEGIN:
case BeamMode::BEGIN:
return ActionIconType::BEAM_START;
case Mode::MID:
case BeamMode::MID:
return ActionIconType::BEAM_MID;
case Mode::NONE:
case BeamMode::NONE:
return ActionIconType::BEAM_NONE;
case Mode::BEGIN32:
case BeamMode::BEGIN32:
return ActionIconType::BEAM_BEGIN_32;
case Mode::BEGIN64:
case BeamMode::BEGIN64:
return ActionIconType::BEAM_BEGIN_64;
case Mode::AUTO:
case BeamMode::AUTO:
return ActionIconType::BEAM_AUTO;
default:
break;

View file

@ -49,7 +49,6 @@ struct BeamFragment;
class Beam final : public EngravingItem
{
Q_GADGET
QVector<ChordRest*> _elements; // must be sorted by tick
QVector<mu::LineF*> _beamSegments;
DirectionV _direction { DirectionV::AUTO };
@ -104,13 +103,6 @@ class Beam final : public EngravingItem
void removeChordRest(ChordRest* a);
public:
enum class Mode : signed char {
///.\{
AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID = -1
///\}
};
Q_ENUM(Mode);
~Beam();
// Score Tree functions
@ -167,7 +159,7 @@ public:
void setBeamDirection(DirectionV d);
DirectionV beamDirection() const { return _direction; }
//!Note Unfortunately we have no FEATHERED_BEAM_MODE for now int Beam::Mode enum, so we'll handle this locally
//!Note Unfortunately we have no FEATHERED_BEAM_MODE for now int BeamMode enum, so we'll handle this locally
void setAsFeathered(const bool slower);
bool acceptDrop(EditData&) const override;
EngravingItem* drop(EditData&) override;
@ -205,7 +197,7 @@ public:
Grip defaultGrip() const override { return Grip::MIDDLE; }
std::vector<mu::PointF> gripsPositions(const EditData&) const override;
static ActionIconType actionIconTypeForBeamMode(Mode);
static ActionIconType actionIconTypeForBeamMode(BeamMode);
mu::RectF drag(EditData&) override;
bool isMovable() const override;

View file

@ -441,7 +441,7 @@ bool Bend::setProperty(Pid id, const PropertyValue& v)
setPlayBend(v.toBool());
break;
case Pid::LINE_WIDTH:
_lineWidth = v.toMillimetre();
_lineWidth = v.value<Millimetre>();
break;
case Pid::BEND_TYPE:
updatePointsByBendType(static_cast<BendType>(v.toInt()));

View file

@ -412,10 +412,10 @@ bool Box::setProperty(Pid propertyId, const PropertyValue& v)
_boxWidth = v.value<Spatium>();
break;
case Pid::TOP_GAP:
_topGap = v.toMillimetre();
_topGap = v.value<Millimetre>();
break;
case Pid::BOTTOM_GAP:
_bottomGap = v.toMillimetre();
_bottomGap = v.value<Millimetre>();
break;
case Pid::LEFT_MARGIN:
_leftMargin = v.toDouble();

View file

@ -2336,8 +2336,8 @@ void Chord::layoutTablature()
if (!tab->genDurations() // if tab is not set for duration symbols
|| track2voice(track()) // or not in first voice
|| (isGrace() // no tab duration symbols if grace notes
&& beamMode() == Beam::Mode::AUTO)) { // and beammode == AUTO
//
&& beamMode() == BeamMode::AUTO)) { // and beammode == AUTO
//
delete _tabDur; // delete an existing duration symbol
_tabDur = 0;
} else {
@ -2360,7 +2360,7 @@ void Chord::layoutTablature()
ChordRest* prevCR = prevChordRest(this);
if (prevCR == 0) {
needTabDur = true;
} else if (beamMode() != Beam::Mode::AUTO
} else if (beamMode() != BeamMode::AUTO
|| prevCR->durationType().type() != durationType().type()
|| prevCR->dots() != dots()
|| prevCR->tuplet() != tuplet()
@ -3017,7 +3017,7 @@ void Chord::setSlash(bool flag, bool stemless)
// make stemless if asked
if (stemless) {
undoChangeProperty(Pid::NO_STEM, true);
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::NONE));
undoChangeProperty(Pid::BEAM_MODE, BeamMode::NONE);
}
const StaffType* staffType = this->staffType();

View file

@ -26,6 +26,7 @@
#include "style/style.h"
#include "rw/xml.h"
#include "rw/xmlvalue.h"
#include "factory.h"
#include "chord.h"
@ -65,6 +66,7 @@
using namespace mu;
using namespace mu::engraving;
using namespace mu::engraving::rw;
namespace Ms {
//---------------------------------------------------------
@ -78,7 +80,7 @@ ChordRest::ChordRest(const ElementType& type, Segment* parent)
_beam = 0;
_tabDur = 0;
_up = true;
_beamMode = Beam::Mode::AUTO;
_beamMode = BeamMode::AUTO;
m_isSmall = false;
_melismaEnd = false;
_crossMeasure = CrossMeasure::UNKNOWN;
@ -145,31 +147,12 @@ void ChordRest::writeProperties(XmlWriter& xml) const
DurationElement::writeProperties(xml);
//
// Beam::Mode default:
// REST - Beam::Mode::NONE
// CHORD - Beam::Mode::AUTO
// BeamMode default:
// REST - BeamMode::NONE
// CHORD - BeamMode::AUTO
//
if ((isRest() && _beamMode != Beam::Mode::NONE) || (isChord() && _beamMode != Beam::Mode::AUTO)) {
QString s;
switch (_beamMode) {
case Beam::Mode::AUTO: s = "auto";
break;
case Beam::Mode::BEGIN: s = "begin";
break;
case Beam::Mode::MID: s = "mid";
break;
case Beam::Mode::END: s = "end";
break;
case Beam::Mode::NONE: s = "no";
break;
case Beam::Mode::BEGIN32: s = "begin32";
break;
case Beam::Mode::BEGIN64: s = "begin64";
break;
case Beam::Mode::INVALID: s = "?";
break;
}
xml.tag("BeamMode", s);
if ((isRest() && _beamMode != BeamMode::NONE) || (isChord() && _beamMode != BeamMode::AUTO)) {
xml.tag("BeamMode", XmlValue::toXml(_beamMode));
}
writeProperty(xml, Pid::SMALL);
if (actualDurationType().dots()) {
@ -249,26 +232,7 @@ bool ChordRest::readProperties(XmlReader& e)
}
}
} else if (tag == "BeamMode") {
QString val(e.readElementText());
Beam::Mode bm = Beam::Mode::AUTO;
if (val == "auto") {
bm = Beam::Mode::AUTO;
} else if (val == "begin") {
bm = Beam::Mode::BEGIN;
} else if (val == "mid") {
bm = Beam::Mode::MID;
} else if (val == "end") {
bm = Beam::Mode::END;
} else if (val == "no") {
bm = Beam::Mode::NONE;
} else if (val == "begin32") {
bm = Beam::Mode::BEGIN32;
} else if (val == "begin64") {
bm = Beam::Mode::BEGIN64;
} else {
bm = Beam::Mode(val.toInt());
}
_beamMode = Beam::Mode(bm);
_beamMode = XmlValue::fromXml(e.readElementText(), BeamMode::AUTO);
} else if (tag == "Articulation") {
Articulation* atr = Factory::createArticulation(this);
atr->setTrack(track());
@ -599,22 +563,22 @@ EngravingItem* ChordRest::drop(EditData& data)
{
switch (toActionIcon(e)->actionType()) {
case ActionIconType::BEAM_START:
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::BEGIN));
undoChangeProperty(Pid::BEAM_MODE, BeamMode::BEGIN);
break;
case ActionIconType::BEAM_MID:
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::MID));
undoChangeProperty(Pid::BEAM_MODE, BeamMode::MID);
break;
case ActionIconType::BEAM_NONE:
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::NONE));
undoChangeProperty(Pid::BEAM_MODE, BeamMode::NONE);
break;
case ActionIconType::BEAM_BEGIN_32:
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::BEGIN32));
undoChangeProperty(Pid::BEAM_MODE, BeamMode::BEGIN32);
break;
case ActionIconType::BEAM_BEGIN_64:
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::BEGIN64));
undoChangeProperty(Pid::BEAM_MODE, BeamMode::BEGIN64);
break;
case ActionIconType::BEAM_AUTO:
undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::AUTO));
undoChangeProperty(Pid::BEAM_MODE, BeamMode::AUTO);
break;
default:
break;
@ -860,9 +824,9 @@ Slur* ChordRest::slur(const ChordRest* secondChordRest) const
// undoSetBeamMode
//---------------------------------------------------------
void ChordRest::undoSetBeamMode(Beam::Mode mode)
void ChordRest::undoSetBeamMode(BeamMode mode)
{
undoChangeProperty(Pid::BEAM_MODE, int(mode));
undoChangeProperty(Pid::BEAM_MODE, mode);
}
//---------------------------------------------------------
@ -906,7 +870,7 @@ bool ChordRest::setProperty(Pid propertyId, const PropertyValue& v)
setSmall(v.toBool());
break;
case Pid::BEAM_MODE:
setBeamMode(Beam::Mode(v.toInt()));
setBeamMode(v.value<BeamMode>());
break;
case Pid::STAFF_MOVE:
setStaffMove(v.toInt());
@ -935,7 +899,7 @@ PropertyValue ChordRest::propertyDefault(Pid propertyId) const
case Pid::SMALL:
return false;
case Pid::BEAM_MODE:
return int(Beam::Mode::AUTO);
return BeamMode::AUTO;
case Pid::STAFF_MOVE:
return 0;
default:

View file

@ -68,7 +68,7 @@ protected:
TabDurationSymbol* _tabDur; // stores a duration symbol in tablature staves
Beam* _beam;
Beam::Mode _beamMode;
BeamMode _beamMode;
bool _up; // actual stem direction
bool _usesAutoUp;
bool m_isSmall;
@ -100,9 +100,9 @@ public:
virtual bool readProperties(XmlReader&) override;
virtual void readAddConnector(ConnectorInfoReader* info, bool pasteMode) override;
void setBeamMode(Beam::Mode m) { _beamMode = m; }
void undoSetBeamMode(Beam::Mode m);
Beam::Mode beamMode() const { return _beamMode; }
void setBeamMode(BeamMode m) { _beamMode = m; }
void undoSetBeamMode(BeamMode m);
BeamMode beamMode() const { return _beamMode; }
void setBeam(Beam* b);
virtual Beam* beam() const final { return !(measure() && measure()->stemless(staffIdx())) ? _beam : nullptr; }

View file

@ -2139,12 +2139,12 @@ void Score::cmdResetBeamMode()
continue;
}
if (cr->type() == ElementType::CHORD) {
if (cr->beamMode() != Beam::Mode::AUTO) {
cr->undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::AUTO));
if (cr->beamMode() != BeamMode::AUTO) {
cr->undoChangeProperty(Pid::BEAM_MODE, BeamMode::AUTO);
}
} else if (cr->type() == ElementType::REST) {
if (cr->beamMode() != Beam::Mode::NONE) {
cr->undoChangeProperty(Pid::BEAM_MODE, int(Beam::Mode::NONE));
if (cr->beamMode() != BeamMode::NONE) {
cr->undoChangeProperty(Pid::BEAM_MODE, BeamMode::NONE);
}
}
}

View file

@ -2010,11 +2010,11 @@ void Score::addNoteLine()
// cmdSetBeamMode
//---------------------------------------------------------
void Score::cmdSetBeamMode(Beam::Mode mode)
void Score::cmdSetBeamMode(BeamMode mode)
{
for (ChordRest* cr : getSelectedChordRests()) {
if (cr) {
cr->undoChangeProperty(Pid::BEAM_MODE, int(mode));
cr->undoChangeProperty(Pid::BEAM_MODE, mode);
}
}
}

View file

@ -88,9 +88,9 @@ static std::vector<NoteGroup> noteGroups {
// endBeam
//---------------------------------------------------------
Beam::Mode Groups::endBeam(ChordRest* cr, ChordRest* prev)
BeamMode Groups::endBeam(ChordRest* cr, ChordRest* prev)
{
if (cr->isGrace() || cr->beamMode() != Beam::Mode::AUTO) {
if (cr->isGrace() || cr->beamMode() != BeamMode::AUTO) {
return cr->beamMode();
}
Q_ASSERT(cr->staff());
@ -100,10 +100,10 @@ Beam::Mode Groups::endBeam(ChordRest* cr, ChordRest* prev)
Fraction stretch = cr->staff()->timeStretch(cr->tick());
Fraction tick = cr->rtick() * stretch;
Beam::Mode val = g.beamMode(tick.ticks(), d.type());
BeamMode val = g.beamMode(tick.ticks(), d.type());
// context-dependent checks
if (val == Beam::Mode::AUTO && tick.isNotZero()) {
if (val == BeamMode::AUTO && tick.isNotZero()) {
// if current or previous cr is in tuplet (but not both in same tuplet):
// consider it as if this were next shorter duration
if (prev && (cr->tuplet() != prev->tuplet()) && (d == prev->durationType())) {
@ -119,7 +119,7 @@ Beam::Mode Groups::endBeam(ChordRest* cr, ChordRest* prev)
// exclude tuplets from this check; tick calculations can be unreliable
// and they seem to be handled well anyhow
if (cr->voice() && prev && !prev->tuplet() && prev->tick() + prev->actualTicks() < cr->tick()) {
val = Beam::Mode::BEGIN;
val = BeamMode::BEGIN;
}
}
@ -131,7 +131,7 @@ Beam::Mode Groups::endBeam(ChordRest* cr, ChordRest* prev)
// tick is relative to begin of measure
//---------------------------------------------------------
Beam::Mode Groups::beamMode(int tick, TDuration::DurationType d) const
BeamMode Groups::beamMode(int tick, TDuration::DurationType d) const
{
int shift;
switch (d) {
@ -142,7 +142,7 @@ Beam::Mode Groups::beamMode(int tick, TDuration::DurationType d) const
case TDuration::DurationType::V_32ND: shift = 8;
break;
default:
return Beam::Mode::AUTO;
return BeamMode::AUTO;
}
const int dm = Constant::division / 8;
for (const GroupNode& e : *this) {
@ -155,16 +155,16 @@ Beam::Mode Groups::beamMode(int tick, TDuration::DurationType d) const
int action = (e.action >> shift) & 0xf;
switch (action) {
case 0: return Beam::Mode::AUTO;
case 1: return Beam::Mode::BEGIN;
case 2: return Beam::Mode::BEGIN32;
case 3: return Beam::Mode::BEGIN64;
case 0: return BeamMode::AUTO;
case 1: return BeamMode::BEGIN;
case 2: return BeamMode::BEGIN32;
case 3: return BeamMode::BEGIN64;
default:
qDebug(" Groups::beamMode: bad action %d", action);
return Beam::Mode::AUTO;
return BeamMode::AUTO;
}
}
return Beam::Mode::AUTO;
return BeamMode::AUTO;
}
//---------------------------------------------------------
@ -243,7 +243,7 @@ void Groups::read(XmlReader& e)
// addStop
//---------------------------------------------------------
void Groups::addStop(int pos, TDuration::DurationType d, Beam::Mode bm)
void Groups::addStop(int pos, TDuration::DurationType d, BeamMode bm)
{
int shift;
switch (d) {
@ -257,11 +257,11 @@ void Groups::addStop(int pos, TDuration::DurationType d, Beam::Mode bm)
return;
}
int action;
if (bm == Beam::Mode::BEGIN) {
if (bm == BeamMode::BEGIN) {
action = 1;
} else if (bm == Beam::Mode::BEGIN32) {
} else if (bm == BeamMode::BEGIN32) {
action = 2;
} else if (bm == Beam::Mode::BEGIN64) {
} else if (bm == BeamMode::BEGIN64) {
action = 3;
} else {
return;

View file

@ -62,8 +62,8 @@ public:
void write(XmlWriter&) const;
void read(XmlReader&);
Beam::Mode beamMode(int tick, TDuration::DurationType d) const;
void addStop(int pos, TDuration::DurationType d, Beam::Mode bm);
BeamMode beamMode(int tick, TDuration::DurationType d) const;
void addStop(int pos, TDuration::DurationType d, BeamMode bm);
bool operator==(const Groups& g) const
{
if (g.size() != size()) {
@ -80,7 +80,7 @@ public:
void dump(const char*) const;
static const Groups& endings(const Fraction& f);
static Beam::Mode endBeam(ChordRest* cr, ChordRest* prev = 0);
static BeamMode endBeam(ChordRest* cr, ChordRest* prev = 0);
};
//---------------------------------------------------------

View file

@ -68,7 +68,7 @@ class InputState
bool _rest { false }; // rest mode
NoteType _noteType { NoteType::NORMAL };
Beam::Mode _beamMode { Beam::Mode::AUTO };
BeamMode _beamMode { BeamMode::AUTO };
AccidentalType _accidentalType { AccidentalType::NONE };
Slur* _slur = nullptr;
@ -116,8 +116,8 @@ public:
NoteType noteType() const { return _noteType; }
void setNoteType(NoteType t) { _noteType = t; }
Beam::Mode beamMode() const { return _beamMode; }
void setBeamMode(Beam::Mode m) { _beamMode = m; }
BeamMode beamMode() const { return _beamMode; }
void setBeamMode(BeamMode m) { _beamMode = m; }
bool noteEntryMode() const { return _noteEntryMode; }
void setNoteEntryMode(bool v) { _noteEntryMode = v; }

View file

@ -1484,7 +1484,7 @@ bool SLine::setProperty(Pid id, const PropertyValue& v)
_lineColor = v.value<mu::draw::Color>();
break;
case Pid::LINE_WIDTH:
_lineWidth = v.toMillimetre();
_lineWidth = v.value<Millimetre>();
break;
case Pid::LINE_STYLE:
_lineStyle = mu::draw::PenStyle(v.toInt());

View file

@ -233,9 +233,6 @@ void MScore::init()
void MScore::registerUiTypes()
{
#ifdef SCRIPT_INTERFACE
qRegisterMetaType<VeloType>("ValueType");
qRegisterMetaType<DirectionH>("DirectionH");
qRegisterMetaType<Spanner::Anchor>("Anchor");
qRegisterMetaType<NoteHead::Group>("NoteHeadGroup");
qRegisterMetaType<NoteHead::Type>("NoteHeadType");
@ -249,10 +246,8 @@ void MScore::registerUiTypes()
qRegisterMetaType<Dynamic::Range>("DynamicRange");
qRegisterMetaType<Jump::Type>("JumpType");
qRegisterMetaType<Marker::Type>("MarkerType");
qRegisterMetaType<Beam::Mode>("BeamMode");
qRegisterMetaType<HairpinType>("HairpinType");
qRegisterMetaType<Lyrics::Syllabic>("Syllabic");
qRegisterMetaType<LayoutBreakType>("LayoutBreakType");
//classed enumerations
// qRegisterMetaType<MSQE_StyledPropertyListIdx::E>("StyledPropertyListIdx");

View file

@ -62,7 +62,7 @@ Rest::Rest(Segment* parent)
Rest::Rest(const ElementType& type, Segment* parent)
: ChordRest(type, parent)
{
_beamMode = Beam::Mode::NONE;
_beamMode = BeamMode::NONE;
m_sym = SymId::restQuarter;
}
@ -74,7 +74,7 @@ Rest::Rest(Segment* parent, const TDuration& d)
Rest::Rest(const ElementType& type, Segment* parent, const TDuration& d)
: ChordRest(type, parent)
{
_beamMode = Beam::Mode::NONE;
_beamMode = BeamMode::NONE;
m_sym = SymId::restQuarter;
setDurationType(d);
if (d.fraction().isValid()) {

View file

@ -594,7 +594,7 @@ public:
void cmdAddParentheses();
void cmdAddBraces();
void cmdAddFret(int fret);
void cmdSetBeamMode(Beam::Mode);
void cmdSetBeamMode(BeamMode);
void cmdRemovePart(Part*);
void cmdAddTie(bool addToChord = false);
void cmdToggleTie();

View file

@ -242,7 +242,7 @@ bool Spacer::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::SPACE:
setGap(v.toMillimetre());
setGap(v.value<Millimetre>());
break;
default:
if (!EngravingItem::setProperty(propertyId, v)) {

View file

@ -1638,7 +1638,7 @@ bool Staff::setProperty(Pid id, const PropertyValue& v)
setBarLineTo(v.toInt());
break;
case Pid::STAFF_USERDIST:
setUserDist(v.toMillimetre());
setUserDist(v.value<Millimetre>());
break;
default:
qDebug("unhandled id <%s>", propertyName(id));

View file

@ -897,8 +897,8 @@ void TabDurationSymbol::layout()
Chord* chord = explicitParent() && explicitParent()->isChord() ? toChord(explicitParent()) : nullptr;
// if no chord (shouldn't happens...) or not a special beam mode, layout regular symbol
if (!chord || !chord->isChord()
|| (chord->beamMode() != Beam::Mode::BEGIN && chord->beamMode() != Beam::Mode::MID
&& chord->beamMode() != Beam::Mode::END)) {
|| (chord->beamMode() != BeamMode::BEGIN && chord->beamMode() != BeamMode::MID
&& chord->beamMode() != BeamMode::END)) {
mu::draw::FontMetrics fm(_tab->durationFont());
hbb = _tab->durationBoxH();
wbb = fm.width(_text);
@ -921,10 +921,10 @@ void TabDurationSymbol::layout()
ybb = -hbb; // bbox top is at top of stem height
xpos = 0.75 * _spatium; // conventional centring of stem on fret marks
ypos = _tab->durationGridYOffset(); // stem start is at bottom
if (chord->beamMode() == Beam::Mode::BEGIN) {
if (chord->beamMode() == BeamMode::BEGIN) {
_beamGrid = TabBeamGrid::INITIAL;
_beamLength = 0.0;
} else if (chord->beamMode() == Beam::Mode::MID || chord->beamMode() == Beam::Mode::END) {
} else if (chord->beamMode() == BeamMode::MID || chord->beamMode() == BeamMode::END) {
_beamLevel = static_cast<int>(chord->durationType().type()) - static_cast<int>(font.zeroBeamLevel);
_beamGrid = (_beamLevel < 1 ? TabBeamGrid::INITIAL : TabBeamGrid::MEDIALFINAL);
// _beamLength and bbox x and width will be set in layout2(),

View file

@ -320,10 +320,10 @@ bool Stem::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::LINE_WIDTH:
setLineWidth(v.toMillimetre());
setLineWidth(v.value<Millimetre>());
break;
case Pid::USER_LEN:
setUserLength(v.toMillimetre());
setUserLength(v.value<Millimetre>());
break;
case Pid::STEM_DIRECTION:
chord()->setStemDirection(v.value<DirectionV>());

View file

@ -1160,7 +1160,7 @@ bool Tuplet::setProperty(Pid propertyId, const PropertyValue& v)
setBracketType(TupletBracketType(v.toInt()));
break;
case Pid::LINE_WIDTH:
setBracketWidth(v.toMillimetre());
setBracketWidth(v.value<Millimetre>());
break;
case Pid::NORMAL_NOTES:
_ratio.setDenominator(v.toInt());

View file

@ -150,6 +150,7 @@ QVariant PropertyValue::toQVariant() const
case P_TYPE::PLACEMENT_H: return static_cast<int>(value<PlacementH>());
case P_TYPE::DIRECTION_V: return static_cast<int>(value<DirectionV>());
case P_TYPE::DIRECTION_H: return static_cast<int>(value<DirectionH>());
case P_TYPE::BEAM_MODE: return static_cast<int>(value<BeamMode>());
// Duration
case P_TYPE::FRACTION: return QVariant::fromValue(value<Fraction>().toString());
@ -206,6 +207,7 @@ PropertyValue PropertyValue::fromQVariant(const QVariant& v, P_TYPE type)
case P_TYPE::PLACEMENT_H: return PropertyValue(PlacementH(v.toInt()));
case P_TYPE::DIRECTION_V: return PropertyValue(DirectionV(v.toInt()));
case P_TYPE::DIRECTION_H: return PropertyValue(DirectionH(v.toInt()));
case P_TYPE::BEAM_MODE: return PropertyValue(BeamMode(v.toInt()));
// Duration
case P_TYPE::FRACTION: return PropertyValue(Fraction::fromString(v.toString()));

View file

@ -70,15 +70,14 @@ enum class P_TYPE {
PLACEMENT_H,
DIRECTION_V,
DIRECTION_H,
BEAM_MODE,
// Duration
FRACTION,
// Types
LAYOUTBREAK_TYPE,
VELO_TYPE,
BEAM_MODE,
TEXT_PLACE,
TEMPO,
@ -170,6 +169,9 @@ public:
PropertyValue(DirectionH v)
: m_type(P_TYPE::DIRECTION_H), m_data(make_data<DirectionH>(v)) {}
PropertyValue(BeamMode v)
: m_type(P_TYPE::BEAM_MODE), m_data(make_data<BeamMode>(v)) {}
// Duration
PropertyValue(const Fraction& v)
: m_type(P_TYPE::FRACTION), m_data(make_data<Fraction>(v)) {}
@ -297,7 +299,6 @@ public:
qreal toReal() const { return value<qreal>(); }
double toDouble() const { return value<qreal>(); }
QString toString() const { return value<QString>(); }
Millimetre toMillimetre() const { return value<Millimetre>(); }
const Ms::Groups& toGroups() const;
const Ms::TDuration& toTDuration() const;

View file

@ -3032,21 +3032,21 @@ Score::FileError Read114::read114(MasterScore* masterScore, XmlReader& e, ReadCo
if (cr) {
if (!first) {
switch (cr->beamMode()) {
case Beam::Mode::AUTO:
case Beam::Mode::BEGIN:
case Beam::Mode::END:
case Beam::Mode::NONE:
case BeamMode::AUTO:
case BeamMode::BEGIN:
case BeamMode::END:
case BeamMode::NONE:
break;
case Beam::Mode::MID:
case Beam::Mode::BEGIN32:
case Beam::Mode::BEGIN64:
cr->setBeamMode(Beam::Mode::BEGIN);
case BeamMode::MID:
case BeamMode::BEGIN32:
case BeamMode::BEGIN64:
cr->setBeamMode(BeamMode::BEGIN);
break;
case Beam::Mode::INVALID:
case BeamMode::INVALID:
if (cr->isChord()) {
cr->setBeamMode(Beam::Mode::AUTO);
cr->setBeamMode(BeamMode::AUTO);
} else {
cr->setBeamMode(Beam::Mode::NONE);
cr->setBeamMode(BeamMode::NONE);
}
break;
}

View file

@ -1613,25 +1613,7 @@ bool Read206::readChordRestProperties206(XmlReader& e, ReadContext& ctx, ChordRe
}
}
} else if (tag == "BeamMode") {
QString val(e.readElementText());
Beam::Mode bm = Beam::Mode::AUTO;
if (val == "auto") {
bm = Beam::Mode::AUTO;
} else if (val == "begin") {
bm = Beam::Mode::BEGIN;
} else if (val == "mid") {
bm = Beam::Mode::MID;
} else if (val == "end") {
bm = Beam::Mode::END;
} else if (val == "no") {
bm = Beam::Mode::NONE;
} else if (val == "begin32") {
bm = Beam::Mode::BEGIN32;
} else if (val == "begin64") {
bm = Beam::Mode::BEGIN64;
} else {
bm = Beam::Mode(val.toInt());
}
BeamMode bm = XmlValue::fromXml(e.readElementText(), BeamMode::AUTO);
ch->setBeamMode(bm);
} else if (tag == "Articulation") {
EngravingItem* el = readArticulation(ch, e, ctx);
@ -3083,7 +3065,7 @@ static void readStaffContent206(Score* score, XmlReader& e, ReadContext& ctx)
if (tag == "Measure") {
if (lastReadBox) {
lastReadBox->setBottomGap(lastReadBox->bottomGap() + lastReadBox->propertyDefault(Pid::BOTTOM_GAP).toMillimetre());
lastReadBox->setBottomGap(lastReadBox->bottomGap() + lastReadBox->propertyDefault(Pid::BOTTOM_GAP).value<Millimetre>());
lastReadBox = nullptr;
}
readMeasureLast = true;
@ -3124,10 +3106,10 @@ static void readStaffContent206(Score* score, XmlReader& e, ReadContext& ctx)
// If it's the first box, and comes before any measures, reset to
// 301 default.
if (!readMeasureLast && !lastReadBox) {
b->setTopGap(b->propertyDefault(Pid::TOP_GAP).toMillimetre());
b->setTopGap(b->propertyDefault(Pid::TOP_GAP).value<Millimetre>());
b->setPropertyFlags(Pid::TOP_GAP, PropertyFlags::STYLED);
} else if (readMeasureLast) {
b->setTopGap(b->topGap() + b->propertyDefault(Pid::TOP_GAP).toMillimetre());
b->setTopGap(b->topGap() + b->propertyDefault(Pid::TOP_GAP).value<Millimetre>());
}
lastReadBox = b;

View file

@ -254,3 +254,44 @@ VeloType XmlValue::fromXml(const QString& str, VeloType def)
LOGD() << "unknown value: " << str;
return def;
}
QString XmlValue::toXml(BeamMode v)
{
switch (v) {
case BeamMode::AUTO: return "auto";
case BeamMode::BEGIN: return "begin";
case BeamMode::MID: return "mid";
case BeamMode::END: return "end";
case BeamMode::NONE: return "no";
case BeamMode::BEGIN32: return "begin32";
case BeamMode::BEGIN64: return "begin64";
case BeamMode::INVALID: return "invalid";
}
return QString();
}
BeamMode XmlValue::fromXml(const QString& str, BeamMode def)
{
if (str == "auto") {
return BeamMode::AUTO;
} else if (str == "begin") {
return BeamMode::BEGIN;
} else if (str == "mid") {
return BeamMode::MID;
} else if (str == "end") {
return BeamMode::END;
} else if (str == "no") {
return BeamMode::NONE;
} else if (str == "begin32") {
return BeamMode::BEGIN32;
} else if (str == "begin64") {
return BeamMode::BEGIN64;
} else {
bool ok = false;
int v = str.toInt(&ok);
if (ok) {
return static_cast<BeamMode>(v);
}
}
return def;
}

View file

@ -53,6 +53,9 @@ public:
static QString toXml(VeloType v);
static VeloType fromXml(const QString& str, VeloType def);
static QString toXml(BeamMode v);
static BeamMode fromXml(const QString& str, BeamMode def);
};
}

View file

@ -121,6 +121,10 @@ enum class LayoutBreakType {
enum class VeloType : char {
OFFSET_VAL, USER_VAL
};
enum class BeamMode : signed char {
AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID = -1
};
} // mu::engraving
//! NOTE compat
@ -133,6 +137,7 @@ using DirectionV = mu::engraving::DirectionV;
using DirectionH = mu::engraving::DirectionH;
using LayoutBreakType = mu::engraving::LayoutBreakType;
using VeloType = mu::engraving::VeloType;
using BeamMode = mu::engraving::BeamMode;
}
#endif // MU_ENGRAVING_TYPES_H

View file

@ -354,7 +354,7 @@ void MsScWriter::note(const QString pitch, const QVector<Bww::BeamType> beamList
ticks = 2 * ticks / 3;
}
Ms::Beam::Mode bm = (beamList.at(0) == Bww::BeamType::BM_BEGIN) ? Ms::Beam::Mode::BEGIN : Ms::Beam::Mode::AUTO;
Ms::BeamMode bm = (beamList.at(0) == Bww::BeamType::BM_BEGIN) ? Ms::BeamMode::BEGIN : Ms::BeamMode::AUTO;
Ms::DirectionV sd = Ms::DirectionV::AUTO;
// create chord

View file

@ -1905,7 +1905,7 @@ ChordObj::ChordObj(Capella* c)
: BasicDurationalObj(c), NoteObj(CapellaNoteObjectType::CHORD)
{
cap = c;
beamMode = BeamMode::AUTO;
beamMode = CapBeamMode::AUTO;
}
//---------------------------------------------------------
@ -1926,7 +1926,7 @@ void ChordObj::read()
BasicDurationalObj::read();
unsigned char flags = cap->readByte();
beamMode = (flags & 0x01) ? BeamMode(cap->readByte()) : BeamMode::AUTO;
beamMode = (flags & 0x01) ? CapBeamMode(cap->readByte()) : CapBeamMode::AUTO;
notationStave = (flags & 0x02) ? cap->readChar() : 0;
Q_ASSERT(notationStave >= -1 && notationStave <= 1);
@ -2631,7 +2631,7 @@ void Capella::readSystem()
s->bBarCountReset = readByte();
s->explLeftIndent = readByte();
s->beamMode = BeamMode(readByte());
s->beamMode = CapBeamMode(readByte());
s->tempo = readUnsigned();
s->color = readColor();
readExtra();

View file

@ -38,7 +38,7 @@ enum class CapellaNoteObjectType : char {
PAGE_BKGR
};
enum class BeamMode : unsigned char {
enum class CapBeamMode : unsigned char {
AUTO, FORCE, SPLIT
};
@ -228,7 +228,7 @@ struct CapSystem {
bool bBarCountReset;
unsigned char explLeftIndent; // < 0 --> Einrückung gemäß Stimmenbezeichnungen
// >= --> explizite Einrückung
BeamMode beamMode;
CapBeamMode beamMode;
unsigned tempo;
QColor color; // fuer Systemklammern
bool bJustified; // Randausgleich (Blocksatz)
@ -615,7 +615,7 @@ public:
enum class StemDir : signed char {
DOWN = -1, AUTO = 0, UP = 1, NONE = 3
};
BeamMode beamMode;
CapBeamMode beamMode;
signed char notationStave;
char dStemLength;
unsigned char nTremoloBars;

View file

@ -387,7 +387,7 @@ void ChordObj::readCapx(XmlReader& e)
rightTie = false;
beamShift = 0;
beamSlope = 0;
beamMode = BeamMode::AUTO;
beamMode = CapBeamMode::AUTO;
notationStave = 0;
while (e.readNextStartElement()) {
@ -911,7 +911,7 @@ void Capella::readCapxSystem(XmlReader& e)
s->bBarCountReset = 0;
s->explLeftIndent = 0; // ?? TODO ?? use in capella.cpp commented out
s->beamMode = BeamMode::AUTO;
s->beamMode = CapBeamMode::AUTO;
s->tempo = 0;
s->color = Qt::black;

View file

@ -1799,7 +1799,7 @@ static Measure* findMeasure(Score* score, const Fraction& tick)
static void removeBeam(Beam*& beam)
{
for (int i = 0; i < beam->elements().size(); ++i) {
beam->elements().at(i)->setBeamMode(Beam::Mode::NONE);
beam->elements().at(i)->setBeamMode(BeamMode::NONE);
}
delete beam;
beam = 0;
@ -1809,13 +1809,13 @@ static void removeBeam(Beam*& beam)
// handleBeamAndStemDir
//---------------------------------------------------------
static void handleBeamAndStemDir(ChordRest* cr, const Beam::Mode bm, const DirectionV sd, Beam*& beam, bool hasBeamingInfo)
static void handleBeamAndStemDir(ChordRest* cr, const BeamMode bm, const DirectionV sd, Beam*& beam, bool hasBeamingInfo)
{
if (!cr) {
return;
}
// create a new beam
if (bm == Beam::Mode::BEGIN) {
if (bm == BeamMode::BEGIN) {
// if currently in a beam, delete it
if (beam) {
qDebug("handleBeamAndStemDir() new beam, removing previous incomplete beam %p", beam);
@ -1836,11 +1836,11 @@ static void handleBeamAndStemDir(ChordRest* cr, const Beam::Mode bm, const Direc
beam->track(), cr->track());
// reset beam mode for all elements and remove the beam
removeBeam(beam);
} else if (bm == Beam::Mode::NONE) {
qDebug("handleBeamAndStemDir() in beam, bm Beam::Mode::NONE -> abort beam");
} else if (bm == BeamMode::NONE) {
qDebug("handleBeamAndStemDir() in beam, bm BeamMode::NONE -> abort beam");
// reset beam mode for all elements and remove the beam
removeBeam(beam);
} else if (!(bm == Beam::Mode::BEGIN || bm == Beam::Mode::MID || bm == Beam::Mode::END)) {
} else if (!(bm == BeamMode::BEGIN || bm == BeamMode::MID || bm == BeamMode::END)) {
qDebug("handleBeamAndStemDir() in beam, bm %d -> abort beam", static_cast<int>(bm));
// reset beam mode for all elements and remove the beam
removeBeam(beam);
@ -1857,13 +1857,13 @@ static void handleBeamAndStemDir(ChordRest* cr, const Beam::Mode bm, const Direc
bool canGetBeam = (cr->durationType().type() >= TDuration::DurationType::V_EIGHTH
&& cr->durationType().type() <= TDuration::DurationType::V_1024TH);
if (hasBeamingInfo && canGetBeam) {
cr->setBeamMode(Beam::Mode::NONE);
cr->setBeamMode(BeamMode::NONE);
} else {
cr->setBeamMode(Beam::Mode::AUTO);
cr->setBeamMode(BeamMode::AUTO);
}
}
// terminate the current beam and add to the score
if (beam && bm == Beam::Mode::END) {
if (beam && bm == BeamMode::END) {
beam = 0;
}
}
@ -4111,7 +4111,7 @@ static TDuration determineDuration(const bool rest, const QString& type, const i
static Chord* findOrCreateChord(Score*, Measure* m,
const Fraction& tick, const int track, const int move,
const TDuration duration, const Fraction dura,
Beam::Mode bm)
BeamMode bm)
{
//qDebug("findOrCreateChord tick %d track %d dur ticks %d ticks %s bm %hhd",
// tick, track, duration.ticks(), qPrintable(dura.print()), bm);
@ -4120,8 +4120,8 @@ static Chord* findOrCreateChord(Score*, Measure* m,
Segment* s = m->getSegment(SegmentType::ChordRest, tick);
c = Factory::createChord(s);
// better not to force beam end, as the beam palette does not support it
if (bm == Beam::Mode::END) {
c->setBeamMode(Beam::Mode::AUTO);
if (bm == BeamMode::END) {
c->setBeamMode(BeamMode::AUTO);
} else {
c->setBeamMode(bm);
}
@ -4453,7 +4453,7 @@ Note* MusicXMLParserPass2::note(const QString& partId,
int velocity = round(_e.attributes().value("dynamics").toDouble() * 0.9);
bool graceSlash = false;
bool printObject = _e.attributes().value("print-object") != "no";
Beam::Mode bm = Beam::Mode::AUTO;
BeamMode bm = BeamMode::AUTO;
QString instrumentId;
MusicXMLParserLyric lyric { _pass1.getMusicXmlPart(partId).lyricNumberHandler(), _e, _score, _logger };
MusicXMLParserNotations notations { _e, _score, _logger };
@ -4655,13 +4655,13 @@ Note* MusicXMLParserPass2::note(const QString& partId,
if (cr) {
if (currBeam) {
if (currBeam->track() == track) {
cr->setBeamMode(Beam::Mode::MID);
cr->setBeamMode(BeamMode::MID);
currBeam->add(cr);
} else {
removeBeam(currBeam);
}
} else {
cr->setBeamMode(Beam::Mode::NONE);
cr->setBeamMode(BeamMode::NONE);
}
cr->setSmall(isSmall);
if (noteColor != QColor::Invalid) {
@ -5280,18 +5280,18 @@ void MusicXMLParserPass2::harmony(const QString& partId, Measure* measure, const
Sets beamMode in case of begin, continue or end beam number 1.
*/
void MusicXMLParserPass2::beam(Beam::Mode& beamMode)
void MusicXMLParserPass2::beam(BeamMode& beamMode)
{
int beamNo = _e.attributes().value("number").toInt();
if (beamNo == 1) {
QString s = _e.readElementText();
if (s == "begin") {
beamMode = Beam::Mode::BEGIN;
beamMode = BeamMode::BEGIN;
} else if (s == "end") {
beamMode = Beam::Mode::END;
beamMode = BeamMode::END;
} else if (s == "continue") {
beamMode = Beam::Mode::MID;
beamMode = BeamMode::MID;
} else if (s == "backward hook") {
} else if (s == "forward hook") {
} else {

View file

@ -289,7 +289,7 @@ private:
FretDiagram* frame();
void harmony(const QString& partId, Measure* measure, const Fraction sTime);
Accidental* accidental();
void beam(Beam::Mode& beamMode);
void beam(BeamMode& beamMode);
void duration(Fraction& dura);
void forward(Fraction& dura);
void backup(Fraction& dura);

View file

@ -1702,8 +1702,8 @@ void OveToMScore::convertNotes(Measure* measure, int part, int staff, int track)
}
// beam
// Beam::Mode bm = container->getIsRest() ? Beam::Mode::NONE : Beam::Mode::AUTO;
Beam::Mode bm = Beam::Mode::NONE;
// BeamMode bm = container->getIsRest() ? BeamMode::NONE : BeamMode::AUTO;
BeamMode bm = BeamMode::NONE;
if (container->getInBeam()) {
ovebase::MeasurePos pos = container->start()->shiftMeasure(0);
ovebase::MusicData* data = getCrossMeasureElementByPos(part, staff, pos,
@ -1715,11 +1715,11 @@ void OveToMScore::convertNotes(Measure* measure, int part, int staff, int track)
ovebase::MeasurePos stopPos = beam->stop()->shiftMeasure(beam->start()->getMeasure());
if (startPos == pos) {
bm = Beam::Mode::BEGIN;
bm = BeamMode::BEGIN;
} else if (stopPos == pos) {
bm = Beam::Mode::END;
bm = BeamMode::END;
} else {
bm = Beam::Mode::MID;
bm = BeamMode::MID;
}
}
}

View file

@ -102,7 +102,7 @@ using TextBase = Ms::TextBase;
using TupletNumberType = Ms::TupletNumberType;
using TupletBracketType = Ms::TupletBracketType;
using GraceNoteType = Ms::NoteType;
using BeamMode = Ms::Beam::Mode;
using BeamMode = Ms::BeamMode;
using LayoutBreakType = Ms::LayoutBreakType;
using Interval = Ms::Interval;
using Drumset = Ms::Drumset;

View file

@ -882,7 +882,7 @@ bool PaletteTreeModel::insertPalette(PalettePtr pp, int row, const QModelIndex&
void PaletteTreeModel::updateCellsState(const Selection& sel)
{
const ChordRest* cr = sel.firstChordRest();
const Beam::Mode bm = cr ? cr->beamMode() : Beam::Mode::NONE;
const BeamMode bm = cr ? cr->beamMode() : BeamMode::NONE;
const ActionIconType beamActionType = Beam::actionIconTypeForBeamMode(bm);
bool deactivateAll = !cr;

View file

@ -151,10 +151,10 @@ void NoteGroups::resetClicked()
void NoteGroups::noteClicked(Note* note)
{
Chord* chord = note->chord();
if (chord->beamMode() == Beam::Mode::AUTO) {
updateBeams(chord, Beam::Mode::BEGIN);
} else if (chord->beamMode() == Beam::Mode::BEGIN) {
updateBeams(chord, Beam::Mode::AUTO);
if (chord->beamMode() == BeamMode::AUTO) {
updateBeams(chord, BeamMode::BEGIN);
} else if (chord->beamMode() == BeamMode::BEGIN) {
updateBeams(chord, BeamMode::AUTO);
}
}
@ -162,16 +162,16 @@ void NoteGroups::beamPropertyDropped(Chord* chord, ActionIcon* icon)
{
switch (icon->actionType()) {
case ActionIconType::BEAM_START:
updateBeams(chord, Beam::Mode::BEGIN);
updateBeams(chord, BeamMode::BEGIN);
break;
case ActionIconType::BEAM_MID:
updateBeams(chord, Beam::Mode::AUTO);
updateBeams(chord, BeamMode::AUTO);
break;
case ActionIconType::BEAM_BEGIN_32:
updateBeams(chord, Beam::Mode::BEGIN32);
updateBeams(chord, BeamMode::BEGIN32);
break;
case ActionIconType::BEAM_BEGIN_64:
updateBeams(chord, Beam::Mode::BEGIN64);
updateBeams(chord, BeamMode::BEGIN64);
break;
default:
break;
@ -179,7 +179,7 @@ void NoteGroups::beamPropertyDropped(Chord* chord, ActionIcon* icon)
}
/// takes into account current state of changeShorterCheckBox to update smaller valued notes as well
void NoteGroups::updateBeams(Chord* chord, Beam::Mode m)
void NoteGroups::updateBeams(Chord* chord, BeamMode m)
{
chord->setBeamMode(m);
chord->score()->doLayout();

View file

@ -52,7 +52,7 @@ class NoteGroups : public QGroupBox, Ui::NoteGroups
QString _z, _n;
Score* createScore(int n, TDuration::DurationType t, std::vector<Chord*>* chords);
void updateBeams(Chord*, Beam::Mode);
void updateBeams(Chord*, BeamMode);
private slots:
void resetClicked();

View file

@ -85,6 +85,18 @@ enum class VeloType {
};
Q_ENUM_NS(VeloType);
enum class BeamMode {
AUTO = int(mu::engraving::BeamMode::AUTO),
BEGIN = int(mu::engraving::BeamMode::BEGIN),
MID = int(mu::engraving::BeamMode::MID),
END = int(mu::engraving::BeamMode::END),
NONE = int(mu::engraving::BeamMode::NONE),
BEGIN32 = int(mu::engraving::BeamMode::BEGIN32),
BEGIN64 = int(mu::engraving::BeamMode::BEGIN64),
INVALID = int(mu::engraving::BeamMode::INVALID),
};
Q_ENUM_NS(BeamMode);
//! HACK to force the build system to run moc on this file
class Mops : public QObject
{
@ -99,5 +111,6 @@ Q_DECLARE_METATYPE(Ms::PluginAPI::Direction);
Q_DECLARE_METATYPE(Ms::PluginAPI::DirectionH);
Q_DECLARE_METATYPE(Ms::PluginAPI::LayoutBreakType);
Q_DECLARE_METATYPE(Ms::PluginAPI::VeloType);
Q_DECLARE_METATYPE(Ms::PluginAPI::BeamMode);
#endif // MU_PLUGINS_APITYPES_H

View file

@ -119,8 +119,8 @@ class PluginAPI : public Ms::QmlPlugin
DECLARE_API_ENUM(EngravingItem, elementTypeEnum, Ms::ElementType)
/// Contains Ms::AccidentalType enumeration values
DECLARE_API_ENUM(Accidental, accidentalTypeEnum, Ms::AccidentalType)
/// Contains Ms::Beam::Mode enumeration values
DECLARE_API_ENUM(Beam, beamModeEnum, Ms::Beam::Mode)
/// Contains Ms::BeamMode enumeration values
DECLARE_API_ENUM(Beam, beamModeEnum, Ms::PluginAPI::BeamMode)
/// Contains Ms::Placement enumeration values
/// \note In MuseScore 2.X this enumeration was available as
/// EngravingItem.ABOVE and EngravingItem.BELOW.