move BeamMode to Beam::Mode
needed to make it available to the plugin framework
This commit is contained in:
parent
6f55add7c8
commit
dc5c0b48f6
24 changed files with 157 additions and 152 deletions
|
@ -1568,9 +1568,9 @@ void Beam::layout2(QList<ChordRest*>crl, SpannerSegmentType, int frag)
|
|||
ChordRest* c = crl[i];
|
||||
int l = c->durationType().hooks() - 1;
|
||||
|
||||
BeamMode bm = Groups::endBeam(c);
|
||||
bool b32 = (beamLevel >= 1) && (bm == BeamMode::BEGIN32);
|
||||
bool b64 = (beamLevel >= 2) && (bm == BeamMode::BEGIN64);
|
||||
Mode bm = Groups::endBeam(c);
|
||||
bool b32 = (beamLevel >= 1) && (bm == Mode::BEGIN32);
|
||||
bool b64 = (beamLevel >= 2) && (bm == Mode::BEGIN64);
|
||||
|
||||
if ((l >= beamLevel && (b32 || b64)) || (l < beamLevel)) {
|
||||
if (i && crl[i-1]->type() == Element::Type::REST) {
|
||||
|
|
|
@ -69,6 +69,10 @@ class Beam : public Element {
|
|||
bool hasNoSlope();
|
||||
|
||||
public:
|
||||
enum class Mode : signed char {
|
||||
AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID = -1
|
||||
};
|
||||
|
||||
Beam(Score* s);
|
||||
Beam(const Beam&);
|
||||
~Beam();
|
||||
|
@ -143,5 +147,8 @@ class Beam : public Element {
|
|||
|
||||
|
||||
} // namespace Ms
|
||||
|
||||
Q_DECLARE_METATYPE(Ms::Beam::Mode);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2678,7 +2678,7 @@ QPointF Chord::layoutArticulation(Articulation* a)
|
|||
void Chord::reset()
|
||||
{
|
||||
score()->undoChangeProperty(this, P_ID::STEM_DIRECTION, int(Direction::AUTO));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::AUTO));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::AUTO));
|
||||
score()->createPlayEvents(this);
|
||||
ChordRest::reset();
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ ChordRest::ChordRest(Score* s)
|
|||
_staffMove = 0;
|
||||
_beam = 0;
|
||||
_tabDur = 0;
|
||||
_beamMode = BeamMode::AUTO;
|
||||
_beamMode = Beam::Mode::AUTO;
|
||||
_up = true;
|
||||
_small = false;
|
||||
_crossMeasure = CrossMeasure::UNKNOWN;
|
||||
|
@ -153,22 +153,22 @@ void ChordRest::writeProperties(Xml& xml) const
|
|||
DurationElement::writeProperties(xml);
|
||||
|
||||
//
|
||||
// BeamMode default:
|
||||
// REST - BeamMode::NONE
|
||||
// CHORD - BeamMode::AUTO
|
||||
// Beam::Mode default:
|
||||
// REST - Beam::Mode::NONE
|
||||
// CHORD - Beam::Mode::AUTO
|
||||
//
|
||||
if ((type() == Element::Type::REST && _beamMode != BeamMode::NONE)
|
||||
|| (type() == Element::Type::CHORD && _beamMode != BeamMode::AUTO)) {
|
||||
if ((type() == Element::Type::REST && _beamMode != Beam::Mode::NONE)
|
||||
|| (type() == Element::Type::CHORD && _beamMode != Beam::Mode::AUTO)) {
|
||||
QString s;
|
||||
switch(_beamMode) {
|
||||
case BeamMode::AUTO: s = "auto"; break;
|
||||
case BeamMode::BEGIN: s = "begin"; break;
|
||||
case BeamMode::MID: s = "mid"; break;
|
||||
case BeamMode::END: s = "end"; break;
|
||||
case BeamMode::NONE: s = "no"; break;
|
||||
case BeamMode::BEGIN32: s = "begin32"; break;
|
||||
case BeamMode::BEGIN64: s = "begin64"; break;
|
||||
case BeamMode::INVALID: s = "?"; break;
|
||||
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);
|
||||
}
|
||||
|
@ -241,24 +241,24 @@ bool ChordRest::readProperties(XmlReader& e)
|
|||
}
|
||||
else if (tag == "BeamMode") {
|
||||
QString val(e.readElementText());
|
||||
BeamMode bm = BeamMode::AUTO;
|
||||
Beam::Mode bm = Beam::Mode::AUTO;
|
||||
if (val == "auto")
|
||||
bm = BeamMode::AUTO;
|
||||
bm = Beam::Mode::AUTO;
|
||||
else if (val == "begin")
|
||||
bm = BeamMode::BEGIN;
|
||||
bm = Beam::Mode::BEGIN;
|
||||
else if (val == "mid")
|
||||
bm = BeamMode::MID;
|
||||
bm = Beam::Mode::MID;
|
||||
else if (val == "end")
|
||||
bm = BeamMode::END;
|
||||
bm = Beam::Mode::END;
|
||||
else if (val == "no")
|
||||
bm = BeamMode::NONE;
|
||||
bm = Beam::Mode::NONE;
|
||||
else if (val == "begin32")
|
||||
bm = BeamMode::BEGIN32;
|
||||
bm = Beam::Mode::BEGIN32;
|
||||
else if (val == "begin64")
|
||||
bm = BeamMode::BEGIN64;
|
||||
bm = Beam::Mode::BEGIN64;
|
||||
else
|
||||
bm = BeamMode(val.toInt());
|
||||
_beamMode = BeamMode(bm);
|
||||
bm = Beam::Mode(val.toInt());
|
||||
_beamMode = Beam::Mode(bm);
|
||||
}
|
||||
else if (tag == "Attribute" || tag == "Articulation") { // obsolete: "Attribute"
|
||||
Articulation* atr = new Articulation(score());
|
||||
|
@ -803,22 +803,22 @@ Element* ChordRest::drop(const DropData& data)
|
|||
{
|
||||
switch(static_cast<Icon*>(e)->iconType()) {
|
||||
case IconType::SBEAM:
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::BEGIN));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::BEGIN));
|
||||
break;
|
||||
case IconType::MBEAM:
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::MID));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::MID));
|
||||
break;
|
||||
case IconType::NBEAM:
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::NONE));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::NONE));
|
||||
break;
|
||||
case IconType::BEAM32:
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::BEGIN32));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::BEGIN32));
|
||||
break;
|
||||
case IconType::BEAM64:
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::BEGIN64));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::BEGIN64));
|
||||
break;
|
||||
case IconType::AUTOBEAM:
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::AUTO));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::AUTO));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1004,7 +1004,7 @@ void ChordRest::removeDeleteBeam(bool beamed)
|
|||
// undoSetBeamMode
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ChordRest::undoSetBeamMode(BeamMode mode)
|
||||
void ChordRest::undoSetBeamMode(Beam::Mode mode)
|
||||
{
|
||||
undoChangeProperty(P_ID::BEAM_MODE, int(mode));
|
||||
}
|
||||
|
@ -1030,7 +1030,7 @@ bool ChordRest::setProperty(P_ID propertyId, const QVariant& v)
|
|||
{
|
||||
switch(propertyId) {
|
||||
case P_ID::SMALL: setSmall(v.toBool()); break;
|
||||
case P_ID::BEAM_MODE: setBeamMode(BeamMode(v.toInt())); break;
|
||||
case P_ID::BEAM_MODE: setBeamMode(Beam::Mode(v.toInt())); break;
|
||||
default: return DurationElement::setProperty(propertyId, v);
|
||||
}
|
||||
score()->setLayoutAll(true);
|
||||
|
@ -1045,7 +1045,7 @@ QVariant ChordRest::propertyDefault(P_ID propertyId) const
|
|||
{
|
||||
switch(propertyId) {
|
||||
case P_ID::SMALL: return false;
|
||||
case P_ID::BEAM_MODE: return int(BeamMode::AUTO);
|
||||
case P_ID::BEAM_MODE: return int(Beam::Mode::AUTO);
|
||||
default: return DurationElement::propertyDefault(propertyId);
|
||||
}
|
||||
score()->setLayoutAll(true);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "symbol.h"
|
||||
#include "duration.h"
|
||||
#include "beam.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -27,7 +28,6 @@ enum class CrossMeasure : signed char {
|
|||
|
||||
class Score;
|
||||
class Measure;
|
||||
class Beam;
|
||||
class Tuplet;
|
||||
class Segment;
|
||||
class Slur;
|
||||
|
@ -41,15 +41,16 @@ class Spanner;
|
|||
/// Virtual base class. Chords and rests can be part of a beam
|
||||
//
|
||||
// @P durationType int
|
||||
// @P beamMode Ms::BeamMode (AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID)
|
||||
// @P small bool small chord/rest
|
||||
// @P beamMode Ms::Beam::Mode (AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID)
|
||||
// @P small bool small chord/rest
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
class ChordRest : public DurationElement {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int durationType READ durationTypeTicks WRITE setDurationType)
|
||||
Q_PROPERTY(BeamMode beamMode READ beamMode WRITE undoSetBeamMode)
|
||||
Q_PROPERTY(bool small READ small WRITE undoSetSmall)
|
||||
Q_PROPERTY(int durationType READ durationTypeTicks WRITE setDurationType)
|
||||
Q_PROPERTY(Ms::Beam::Mode beamMode READ beamMode WRITE undoSetBeamMode)
|
||||
Q_PROPERTY(bool small READ small WRITE undoSetSmall)
|
||||
Q_ENUMS(Ms::Beam::Mode)
|
||||
|
||||
TDuration _durationType;
|
||||
int _staffMove; // -1, 0, +1, used for crossbeaming
|
||||
|
@ -60,7 +61,7 @@ class ChordRest : public DurationElement {
|
|||
QList<Lyrics*> _lyricsList;
|
||||
TabDurationSymbol* _tabDur; // stores a duration symbol in tablature staves
|
||||
|
||||
BeamMode _beamMode;
|
||||
Beam::Mode _beamMode;
|
||||
bool _up; // actual stem direction
|
||||
bool _small;
|
||||
|
||||
|
@ -85,9 +86,9 @@ class ChordRest : public DurationElement {
|
|||
virtual bool readProperties(XmlReader&);
|
||||
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true);
|
||||
|
||||
void setBeamMode(BeamMode m) { _beamMode = m; }
|
||||
void undoSetBeamMode(BeamMode m);
|
||||
BeamMode beamMode() const { return _beamMode; }
|
||||
void setBeamMode(Beam::Mode m) { _beamMode = m; }
|
||||
void undoSetBeamMode(Beam::Mode m);
|
||||
Beam::Mode beamMode() const { return _beamMode; }
|
||||
|
||||
void setBeam(Beam* b);
|
||||
virtual Beam* beam() const { return _beam; }
|
||||
|
|
|
@ -1569,12 +1569,12 @@ void Score::cmdResetBeamMode()
|
|||
if (cr == 0)
|
||||
continue;
|
||||
if (cr->type() == Element::Type::CHORD) {
|
||||
if (cr->beamMode() != BeamMode::AUTO)
|
||||
undoChangeProperty(cr, P_ID::BEAM_MODE, int(BeamMode::AUTO));
|
||||
if (cr->beamMode() != Beam::Mode::AUTO)
|
||||
undoChangeProperty(cr, P_ID::BEAM_MODE, int(Beam::Mode::AUTO));
|
||||
}
|
||||
else if (cr->type() == Element::Type::REST) {
|
||||
if (cr->beamMode() != BeamMode::NONE)
|
||||
undoChangeProperty(cr, P_ID::BEAM_MODE, int(BeamMode::NONE));
|
||||
if (cr->beamMode() != Beam::Mode::NONE)
|
||||
undoChangeProperty(cr, P_ID::BEAM_MODE, int(Beam::Mode::NONE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2138,13 +2138,13 @@ void Score::cmd(const QAction* a)
|
|||
else if (cmd == "pad-dotdot")
|
||||
padToggle(Pad::DOTDOT);
|
||||
else if (cmd == "beam-start")
|
||||
cmdSetBeamMode(BeamMode::BEGIN);
|
||||
cmdSetBeamMode(Beam::Mode::BEGIN);
|
||||
else if (cmd == "beam-mid")
|
||||
cmdSetBeamMode(BeamMode::MID);
|
||||
cmdSetBeamMode(Beam::Mode::MID);
|
||||
else if (cmd == "no-beam")
|
||||
cmdSetBeamMode(BeamMode::NONE);
|
||||
cmdSetBeamMode(Beam::Mode::NONE);
|
||||
else if (cmd == "beam-32")
|
||||
cmdSetBeamMode(BeamMode::BEGIN32);
|
||||
cmdSetBeamMode(Beam::Mode::BEGIN32);
|
||||
else if (cmd == "sharp2")
|
||||
changeAccidental(Accidental::Type::SHARP2);
|
||||
else if (cmd == "sharp")
|
||||
|
|
|
@ -1251,7 +1251,7 @@ void Score::cmdAddOttava(Ottava::Type type)
|
|||
// cmdSetBeamMode
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Score::cmdSetBeamMode(BeamMode mode)
|
||||
void Score::cmdSetBeamMode(Beam::Mode mode)
|
||||
{
|
||||
ChordRest* cr = getSelectedChordRest();
|
||||
if (cr == 0)
|
||||
|
|
|
@ -66,18 +66,18 @@ static std::vector<NoteGroup> noteGroups {
|
|||
// endBeam
|
||||
//---------------------------------------------------------
|
||||
|
||||
BeamMode Groups::endBeam(ChordRest* cr)
|
||||
Beam::Mode Groups::endBeam(ChordRest* cr)
|
||||
{
|
||||
if (cr->isGrace() || cr->beamMode() != BeamMode::AUTO)
|
||||
if (cr->isGrace() || cr->beamMode() != Beam::Mode::AUTO)
|
||||
return cr->beamMode();
|
||||
Q_ASSERT(cr->staff());
|
||||
|
||||
if (cr->tuplet() && !cr->tuplet()->elements().isEmpty()) {
|
||||
if (cr->tuplet()->elements().front() == cr) // end beam at new tuplet
|
||||
return BeamMode::BEGIN;
|
||||
return Beam::Mode::BEGIN;
|
||||
if (cr->tuplet()->elements().back() == cr) // end beam at tuplet end
|
||||
return BeamMode::END;
|
||||
return BeamMode::AUTO;
|
||||
return Beam::Mode::END;
|
||||
return Beam::Mode::AUTO;
|
||||
}
|
||||
|
||||
TDuration d = cr->durationType();
|
||||
|
@ -90,7 +90,7 @@ BeamMode Groups::endBeam(ChordRest* cr)
|
|||
// tick is relative to begin of measure
|
||||
//---------------------------------------------------------
|
||||
|
||||
BeamMode Groups::beamMode(int tick, TDuration::DurationType d) const
|
||||
Beam::Mode Groups::beamMode(int tick, TDuration::DurationType d) const
|
||||
{
|
||||
int shift;
|
||||
switch (d) {
|
||||
|
@ -98,7 +98,7 @@ BeamMode Groups::beamMode(int tick, TDuration::DurationType d) const
|
|||
case TDuration::DurationType::V_16TH: shift = 4; break;
|
||||
case TDuration::DurationType::V_32ND: shift = 8; break;
|
||||
default:
|
||||
return BeamMode::AUTO;
|
||||
return Beam::Mode::AUTO;
|
||||
}
|
||||
for (const GroupNode& e : *this) {
|
||||
if (e.pos * 60 < tick)
|
||||
|
@ -108,16 +108,16 @@ BeamMode Groups::beamMode(int tick, TDuration::DurationType d) const
|
|||
|
||||
int action = (e.action >> shift) & 0xf;
|
||||
switch (action) {
|
||||
case 0: return BeamMode::AUTO;
|
||||
case 1: return BeamMode::BEGIN;
|
||||
case 2: return BeamMode::BEGIN32;
|
||||
case 3: return BeamMode::BEGIN64;
|
||||
case 0: return Beam::Mode::AUTO;
|
||||
case 1: return Beam::Mode::BEGIN;
|
||||
case 2: return Beam::Mode::BEGIN32;
|
||||
case 3: return Beam::Mode::BEGIN64;
|
||||
default:
|
||||
qDebug(" Groups::beamMode: bad action %d", action);
|
||||
return BeamMode::AUTO;
|
||||
return Beam::Mode::AUTO;
|
||||
}
|
||||
}
|
||||
return BeamMode::AUTO;
|
||||
return Beam::Mode::AUTO;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -190,7 +190,7 @@ void Groups::read(XmlReader& e)
|
|||
// addStop
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Groups::addStop(int pos, TDuration::DurationType d, BeamMode bm)
|
||||
void Groups::addStop(int pos, TDuration::DurationType d, Beam::Mode bm)
|
||||
{
|
||||
int shift;
|
||||
switch (d) {
|
||||
|
@ -201,11 +201,11 @@ void Groups::addStop(int pos, TDuration::DurationType d, BeamMode bm)
|
|||
return;
|
||||
}
|
||||
int action;
|
||||
if (bm == BeamMode::BEGIN)
|
||||
if (bm == Beam::Mode::BEGIN)
|
||||
action = 1;
|
||||
else if (bm == BeamMode::BEGIN32)
|
||||
else if (bm == Beam::Mode::BEGIN32)
|
||||
action = 2;
|
||||
else if (bm == BeamMode::BEGIN64)
|
||||
else if (bm == Beam::Mode::BEGIN64)
|
||||
action = 3;
|
||||
else
|
||||
return;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "fraction.h"
|
||||
#include "mscore.h"
|
||||
#include "durationtype.h"
|
||||
#include "beam.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -53,8 +54,8 @@ class Groups : public std::vector<GroupNode> {
|
|||
void write(Xml&) const;
|
||||
void read(XmlReader&);
|
||||
|
||||
BeamMode beamMode(int tick, TDuration::DurationType d) const;
|
||||
void addStop(int pos, TDuration::DurationType d, BeamMode bm);
|
||||
Beam::Mode beamMode(int tick, TDuration::DurationType d) const;
|
||||
void addStop(int pos, TDuration::DurationType d, Beam::Mode bm);
|
||||
bool operator==(const Groups& g) const {
|
||||
if (g.size() != size())
|
||||
return false;
|
||||
|
@ -67,7 +68,7 @@ class Groups : public std::vector<GroupNode> {
|
|||
void dump(const char*) const;
|
||||
|
||||
static const Groups& endings(const Fraction& f);
|
||||
static BeamMode endBeam(ChordRest* cr);
|
||||
static Beam::Mode endBeam(ChordRest* cr);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "mscore.h"
|
||||
#include "durationtype.h"
|
||||
#include "beam.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -40,7 +41,7 @@ class InputState {
|
|||
bool _repitchMode { false };
|
||||
bool _rest { false }; // rest mode
|
||||
NoteType _noteType { NoteType::NORMAL };
|
||||
BeamMode _beamMode { BeamMode::AUTO };
|
||||
Beam::Mode _beamMode { Beam::Mode::AUTO };
|
||||
bool _noteEntryMode { false };
|
||||
Slur* _slur { 0 };
|
||||
|
||||
|
@ -87,8 +88,8 @@ class InputState {
|
|||
NoteType noteType() const { return _noteType; }
|
||||
void setNoteType(NoteType t) { _noteType = t; }
|
||||
|
||||
BeamMode beamMode() const { return _beamMode; }
|
||||
void setBeamMode(BeamMode m) { _beamMode = m; }
|
||||
Beam::Mode beamMode() const { return _beamMode; }
|
||||
void setBeamMode(Beam::Mode m) { _beamMode = m; }
|
||||
|
||||
bool noteEntryMode() const { return _noteEntryMode; }
|
||||
void setNoteEntryMode(bool v) { _noteEntryMode = v; }
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "stem.h"
|
||||
#include "layoutbreak.h"
|
||||
#include "mscore.h"
|
||||
#include "beam.h"
|
||||
#include "accidental.h"
|
||||
#include "undo.h"
|
||||
#include "layout.h"
|
||||
|
@ -1028,6 +1029,9 @@ void Score::layoutChords3(QList<Note*>& notes, Staff* staff, Segment* segment)
|
|||
|
||||
}
|
||||
|
||||
#define beamModeMid(a) (a == Beam::Mode::MID || a == Beam::Mode::BEGIN32 || a == Beam::Mode::BEGIN64)
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
// beamGraceNotes
|
||||
//---------------------------------------------------------
|
||||
|
@ -1036,7 +1040,7 @@ void Score::beamGraceNotes(Chord* mainNote, bool after)
|
|||
{
|
||||
ChordRest* a1 = 0; // start of (potential) beam
|
||||
Beam* beam = 0; // current beam
|
||||
BeamMode bm = BeamMode::AUTO;
|
||||
Beam::Mode bm = Beam::Mode::AUTO;
|
||||
QList<Chord*> graceNotes;
|
||||
if (after)
|
||||
mainNote->getGraceNotesAfter(&graceNotes);
|
||||
|
@ -1044,7 +1048,7 @@ void Score::beamGraceNotes(Chord* mainNote, bool after)
|
|||
mainNote->getGraceNotesBefore(&graceNotes);
|
||||
foreach (ChordRest* cr, graceNotes) {
|
||||
bm = Groups::endBeam(cr);
|
||||
if ((cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == BeamMode::NONE)) {
|
||||
if ((cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == Beam::Mode::NONE)) {
|
||||
if (beam) {
|
||||
beam->layoutGraceNotes();
|
||||
beam = 0;
|
||||
|
@ -1057,12 +1061,12 @@ void Score::beamGraceNotes(Chord* mainNote, bool after)
|
|||
continue;
|
||||
}
|
||||
if (beam) {
|
||||
bool beamEnd = bm == BeamMode::BEGIN;
|
||||
bool beamEnd = bm == Beam::Mode::BEGIN;
|
||||
if (!beamEnd) {
|
||||
cr->removeDeleteBeam(true);
|
||||
beam->add(cr);
|
||||
cr = 0;
|
||||
beamEnd = (bm == BeamMode::END);
|
||||
beamEnd = (bm == Beam::Mode::END);
|
||||
}
|
||||
if (beamEnd) {
|
||||
beam->layoutGraceNotes();
|
||||
|
@ -1074,7 +1078,7 @@ void Score::beamGraceNotes(Chord* mainNote, bool after)
|
|||
if (a1 == 0)
|
||||
a1 = cr;
|
||||
else {
|
||||
if (!beamModeMid(bm) && (bm == BeamMode::BEGIN)) {
|
||||
if (!beamModeMid(bm) && (bm == Beam::Mode::BEGIN)) {
|
||||
a1->removeDeleteBeam();
|
||||
a1 = cr;
|
||||
}
|
||||
|
@ -1116,7 +1120,7 @@ void Score::layoutStage2()
|
|||
Beam* beam = 0; // current beam
|
||||
Measure* measure = 0;
|
||||
|
||||
BeamMode bm = BeamMode::AUTO;
|
||||
Beam::Mode bm = Beam::Mode::AUTO;
|
||||
Segment::Type st = Segment::Type::ChordRest;
|
||||
for (Segment* segment = firstSegment(st); segment; segment = segment->next1(st)) {
|
||||
ChordRest* cr = static_cast<ChordRest*>(segment->element(track));
|
||||
|
@ -1138,7 +1142,7 @@ void Score::layoutStage2()
|
|||
// 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 = BeamMode::NONE;
|
||||
bm = Beam::Mode::NONE;
|
||||
if (cr->measure() != measure) {
|
||||
if (measure && !beamModeMid(bm)) {
|
||||
if (beam) {
|
||||
|
@ -1156,7 +1160,7 @@ void Score::layoutStage2()
|
|||
beam = 0;
|
||||
}
|
||||
}
|
||||
if ((cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == BeamMode::NONE)) {
|
||||
if ((cr->durationType().type() <= TDuration::DurationType::V_QUARTER) || (bm == Beam::Mode::NONE)) {
|
||||
if (beam) {
|
||||
beam->layout1();
|
||||
beam = 0;
|
||||
|
@ -1170,12 +1174,12 @@ void Score::layoutStage2()
|
|||
}
|
||||
|
||||
if (beam) {
|
||||
bool beamEnd = bm == BeamMode::BEGIN;
|
||||
bool beamEnd = bm == Beam::Mode::BEGIN;
|
||||
if (!beamEnd) {
|
||||
cr->removeDeleteBeam(true);
|
||||
beam->add(cr);
|
||||
cr = 0;
|
||||
beamEnd = (bm == BeamMode::END);
|
||||
beamEnd = (bm == Beam::Mode::END);
|
||||
}
|
||||
if (beamEnd) {
|
||||
beam->layout1();
|
||||
|
@ -1190,7 +1194,7 @@ void Score::layoutStage2()
|
|||
else {
|
||||
if (!beamModeMid(bm)
|
||||
&&
|
||||
(bm == BeamMode::BEGIN
|
||||
(bm == Beam::Mode::BEGIN
|
||||
|| (a1->segment()->segmentType() != cr->segment()->segmentType())
|
||||
|| (a1->tick() + a1->actualTicks() < cr->tick())
|
||||
)
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "notedot.h"
|
||||
#include "tie.h"
|
||||
#include "staff.h"
|
||||
#include "beam.h"
|
||||
#include "timesig.h"
|
||||
#include "part.h"
|
||||
#include "measure.h"
|
||||
|
@ -125,7 +126,7 @@ void MScore::init()
|
|||
qRegisterMetaType<Dynamic::Range>("DynamicRange");
|
||||
qRegisterMetaType<JumpType>("JumpType");
|
||||
qRegisterMetaType<Marker::Type>("MarkerType");
|
||||
qRegisterMetaType<BeamMode>("BeamMode");
|
||||
qRegisterMetaType<Beam::Mode>("BeamMode");
|
||||
qRegisterMetaType<Hairpin::Type>("HairpinType");
|
||||
qRegisterMetaType<Lyrics::Syllabic>("Syllabic");
|
||||
qRegisterMetaType<LayoutBreak::Type>("LayoutBreakType");
|
||||
|
|
|
@ -162,16 +162,6 @@ enum class OffsetType : char {
|
|||
SPATIUM ///< offset in space units
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// BeamMode
|
||||
//---------------------------------------------------------
|
||||
|
||||
enum class BeamMode : signed char {
|
||||
AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID = -1
|
||||
};
|
||||
|
||||
#define beamModeMid(a) (a == BeamMode::MID || a == BeamMode::BEGIN32 || a == BeamMode::BEGIN64)
|
||||
|
||||
//---------------------------------------------------------
|
||||
// TransposeDirection
|
||||
//---------------------------------------------------------
|
||||
|
@ -422,7 +412,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Align);
|
|||
|
||||
} // namespace Ms
|
||||
|
||||
Q_DECLARE_METATYPE(Ms::BeamMode);
|
||||
Q_DECLARE_METATYPE(Ms::Direction);
|
||||
Q_DECLARE_METATYPE(Ms::DirectionH);
|
||||
|
||||
|
|
|
@ -627,21 +627,21 @@ Score::FileError Score::read114(XmlReader& e)
|
|||
}
|
||||
if(!first) {
|
||||
switch(cr->beamMode()) {
|
||||
case BeamMode::AUTO:
|
||||
case BeamMode::BEGIN:
|
||||
case BeamMode::END:
|
||||
case BeamMode::NONE:
|
||||
case Beam::Mode::AUTO:
|
||||
case Beam::Mode::BEGIN:
|
||||
case Beam::Mode::END:
|
||||
case Beam::Mode::NONE:
|
||||
break;
|
||||
case BeamMode::MID:
|
||||
case BeamMode::BEGIN32:
|
||||
case BeamMode::BEGIN64:
|
||||
cr->setBeamMode(BeamMode::BEGIN);
|
||||
case Beam::Mode::MID:
|
||||
case Beam::Mode::BEGIN32:
|
||||
case Beam::Mode::BEGIN64:
|
||||
cr->setBeamMode(Beam::Mode::BEGIN);
|
||||
break;
|
||||
case BeamMode::INVALID:
|
||||
case Beam::Mode::INVALID:
|
||||
if (cr->type() == Element::Type::CHORD)
|
||||
cr->setBeamMode(BeamMode::AUTO);
|
||||
cr->setBeamMode(Beam::Mode::AUTO);
|
||||
else
|
||||
cr->setBeamMode(BeamMode::NONE);
|
||||
cr->setBeamMode(Beam::Mode::NONE);
|
||||
break;
|
||||
}
|
||||
first = false;
|
||||
|
|
|
@ -40,7 +40,7 @@ Rest::Rest(Score* s)
|
|||
: ChordRest(s)
|
||||
{
|
||||
setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE | ElementFlag::ON_STAFF);
|
||||
_beamMode = BeamMode::NONE;
|
||||
_beamMode = Beam::Mode::NONE;
|
||||
dotline = -1;
|
||||
_sym = SymId::restQuarter;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ Rest::Rest(Score* s, const TDuration& d)
|
|||
: ChordRest(s)
|
||||
{
|
||||
setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE | ElementFlag::ON_STAFF);
|
||||
_beamMode = BeamMode::NONE;
|
||||
_beamMode = Beam::Mode::NONE;
|
||||
dotline = -1;
|
||||
_sym = SymId::restQuarter;
|
||||
setDurationType(d);
|
||||
|
@ -534,7 +534,7 @@ void Rest::setMMWidth(qreal val)
|
|||
|
||||
void Rest::reset()
|
||||
{
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(BeamMode::NONE));
|
||||
score()->undoChangeProperty(this, P_ID::BEAM_MODE, int(Beam::Mode::NONE));
|
||||
ChordRest::reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "ottava.h"
|
||||
#include "spannermap.h"
|
||||
#include "pitchspelling.h"
|
||||
#include "beam.h"
|
||||
|
||||
class QPainter;
|
||||
|
||||
|
@ -373,7 +374,7 @@ class Score : public QObject {
|
|||
|
||||
ChordRest* nextMeasure(ChordRest* element, bool selectBehavior = false);
|
||||
ChordRest* prevMeasure(ChordRest* element);
|
||||
void cmdSetBeamMode(BeamMode);
|
||||
void cmdSetBeamMode(Beam::Mode);
|
||||
void cmdFlip();
|
||||
Note* getSelectedNote();
|
||||
ChordRest* upStaff(ChordRest* cr);
|
||||
|
|
|
@ -1063,7 +1063,7 @@ void ChordDebug::upChanged(bool val)
|
|||
|
||||
void ChordDebug::beamModeChanged(int n)
|
||||
{
|
||||
((Chord*)element())->setBeamMode(BeamMode(n));
|
||||
((Chord*)element())->setBeamMode(Beam::Mode(n));
|
||||
element()->score()->setLayoutAll(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -292,16 +292,16 @@ void ExampleView::dropEvent(QDropEvent* event)
|
|||
Chord* chord = static_cast<Note*>(e)->chord();
|
||||
switch (icon->iconType()) {
|
||||
case IconType::SBEAM:
|
||||
chord->setBeamMode(BeamMode::BEGIN);
|
||||
chord->setBeamMode(Beam::Mode::BEGIN);
|
||||
break;
|
||||
case IconType::MBEAM:
|
||||
chord->setBeamMode(BeamMode::AUTO);
|
||||
chord->setBeamMode(Beam::Mode::AUTO);
|
||||
break;
|
||||
case IconType::BEAM32:
|
||||
chord->setBeamMode(BeamMode::BEGIN32);
|
||||
chord->setBeamMode(Beam::Mode::BEGIN32);
|
||||
break;
|
||||
case IconType::BEAM64:
|
||||
chord->setBeamMode(BeamMode::BEGIN64);
|
||||
chord->setBeamMode(Beam::Mode::BEGIN64);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -367,7 +367,7 @@ void MsScWriter::note(const QString pitch, const QVector<Bww::BeamType> beamList
|
|||
qDebug() << "duration:" << durationType.name();
|
||||
if (triplet != ST_NONE) ticks = 2 * ticks / 3;
|
||||
|
||||
Ms::BeamMode bm = (beamList.at(0) == Bww::BM_BEGIN) ? Ms::BeamMode::BEGIN : Ms::BeamMode::AUTO;
|
||||
Ms::Beam::Mode bm = (beamList.at(0) == Bww::BM_BEGIN) ? Ms::Beam::Mode::BEGIN : Ms::Beam::Mode::AUTO;
|
||||
Ms::Direction sd = Ms::Direction::AUTO;
|
||||
|
||||
// create chord
|
||||
|
|
|
@ -1520,7 +1520,7 @@ void OveToMScore::convertNotes(Measure* measure, int part, int staff, int track)
|
|||
}
|
||||
|
||||
// beam
|
||||
BeamMode bm = container->getIsRest() ? BeamMode::NONE : BeamMode::AUTO;
|
||||
Beam::Mode bm = container->getIsRest() ? Beam::Mode::NONE : Beam::Mode::AUTO;
|
||||
if(container->getInBeam()){
|
||||
OVE::MeasurePos pos = container->start()->shiftMeasure(0);
|
||||
OVE::MusicData* data = getCrossMeasureElementByPos(part, staff, pos, container->getVoice(), OVE::MusicData_Beam);
|
||||
|
@ -1531,13 +1531,13 @@ void OveToMScore::convertNotes(Measure* measure, int part, int staff, int track)
|
|||
OVE::MeasurePos stopPos = beam->stop()->shiftMeasure(beam->start()->getMeasure());
|
||||
|
||||
if(startPos == pos){
|
||||
bm = BeamMode::BEGIN;
|
||||
bm = Beam::Mode::BEGIN;
|
||||
}
|
||||
else if(stopPos == pos){
|
||||
bm = BeamMode::END;
|
||||
bm = Beam::Mode::END;
|
||||
}
|
||||
else{
|
||||
bm = BeamMode::MID;
|
||||
bm = Beam::Mode::MID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,7 +410,7 @@ MusicXml::MusicXml(QDomDocument* d, MxmlReaderFirstPass const& p1)
|
|||
lastVolta(0),
|
||||
doc(d),
|
||||
pass1(p1),
|
||||
beamMode(BeamMode::NONE),
|
||||
beamMode(Beam::Mode::NONE),
|
||||
pageWidth(0),
|
||||
pageHeight(0)
|
||||
{
|
||||
|
@ -1917,7 +1917,7 @@ static bool readFigBass(FiguredBass* fb, const QDomElement& de, int divisions, b
|
|||
static void removeBeam(Beam*& beam)
|
||||
{
|
||||
for (int i = 0; i < beam->elements().size(); ++i)
|
||||
beam->elements().at(i)->setBeamMode(BeamMode::NONE);
|
||||
beam->elements().at(i)->setBeamMode(Beam::Mode::NONE);
|
||||
delete beam;
|
||||
beam = 0;
|
||||
}
|
||||
|
@ -1926,11 +1926,11 @@ static void removeBeam(Beam*& beam)
|
|||
// handleBeamAndStemDir
|
||||
//---------------------------------------------------------
|
||||
|
||||
static void handleBeamAndStemDir(ChordRest* cr, const BeamMode bm, const Direction sd, Beam*& beam)
|
||||
static void handleBeamAndStemDir(ChordRest* cr, const Beam::Mode bm, const Direction sd, Beam*& beam)
|
||||
{
|
||||
if (!cr) return;
|
||||
// create a new beam
|
||||
if (bm == BeamMode::BEGIN) {
|
||||
if (bm == Beam::Mode::BEGIN) {
|
||||
// if currently in a beam, delete it
|
||||
if (beam) {
|
||||
qDebug("handleBeamAndStemDir() new beam, removing previous incomplete beam %p", beam);
|
||||
|
@ -1947,7 +1947,7 @@ static void handleBeamAndStemDir(ChordRest* cr, const BeamMode bm, const Directi
|
|||
// and in a beam ...
|
||||
// (note no check is done on correct order of beam begin/continue/end)
|
||||
if (cr->track() == beam->track()
|
||||
&& (bm == BeamMode::BEGIN || bm == BeamMode::MID || bm == BeamMode::END)) {
|
||||
&& (bm == Beam::Mode::BEGIN || bm == Beam::Mode::MID || bm == Beam::Mode::END)) {
|
||||
// ... and actually add cr to the beam
|
||||
beam->add(cr);
|
||||
}
|
||||
|
@ -1961,10 +1961,10 @@ static void handleBeamAndStemDir(ChordRest* cr, const BeamMode bm, const Directi
|
|||
// if no beam, set stem direction on chord itself
|
||||
if (!beam) {
|
||||
static_cast<Chord*>(cr)->setStemDirection(sd);
|
||||
cr->setBeamMode(BeamMode::NONE);
|
||||
cr->setBeamMode(Beam::Mode::NONE);
|
||||
}
|
||||
// terminate the currect beam and add to the score
|
||||
if (beam && bm == BeamMode::END)
|
||||
if (beam && bm == Beam::Mode::END)
|
||||
beam = 0;
|
||||
}
|
||||
|
||||
|
@ -4649,7 +4649,7 @@ Note* MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam
|
|||
|
||||
bool rest = false;
|
||||
int relStaff = 0;
|
||||
BeamMode bm = BeamMode::NONE;
|
||||
Beam::Mode bm = Beam::Mode::NONE;
|
||||
Direction sd = Direction::AUTO;
|
||||
bool grace = false;
|
||||
QString graceSlash;
|
||||
|
@ -4827,11 +4827,11 @@ Note* MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam
|
|||
int beamNo = e.attribute(QString("number"), "1").toInt();
|
||||
if (beamNo == 1) {
|
||||
if (s == "begin")
|
||||
bm = BeamMode::BEGIN;
|
||||
bm = Beam::Mode::BEGIN;
|
||||
else if (s == "end")
|
||||
bm = BeamMode::END;
|
||||
bm = Beam::Mode::END;
|
||||
else if (s == "continue")
|
||||
bm = BeamMode::MID;
|
||||
bm = Beam::Mode::MID;
|
||||
else if (s == "backward hook")
|
||||
;
|
||||
else if (s == "forward hook")
|
||||
|
@ -4922,14 +4922,14 @@ Note* MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam
|
|||
|
||||
if (beam) {
|
||||
if (beam->track() == track) {
|
||||
cr->setBeamMode(BeamMode::MID);
|
||||
cr->setBeamMode(Beam::Mode::MID);
|
||||
beam->add(cr);
|
||||
}
|
||||
else
|
||||
removeBeam(beam);
|
||||
}
|
||||
else
|
||||
cr->setBeamMode(BeamMode::NONE);
|
||||
cr->setBeamMode(Beam::Mode::NONE);
|
||||
cr->setTrack(track);
|
||||
cr->setStaffMove(move);
|
||||
Segment* s = measure->getSegment(cr, loc_tick);
|
||||
|
@ -5108,8 +5108,8 @@ Note* MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam
|
|||
// note->setAccidentalType(accidental);
|
||||
|
||||
// remember beam mode last non-grace note
|
||||
// bm == BeamMode::NONE means no <beam> was found
|
||||
if (!grace && bm != BeamMode::NONE)
|
||||
// bm == Beam::Mode::NONE means no <beam> was found
|
||||
if (!grace && bm != Beam::Mode::NONE)
|
||||
beamMode = bm;
|
||||
|
||||
// handle beam
|
||||
|
|
|
@ -334,11 +334,11 @@ void MuseScore::updateInputState(Score* score)
|
|||
getAction("grace8after")->setChecked(is.noteType() == NoteType::GRACE8_AFTER);
|
||||
getAction("grace16after")->setChecked(is.noteType() == NoteType::GRACE16_AFTER);
|
||||
getAction("grace32after")->setChecked(is.noteType() == NoteType::GRACE32_AFTER);
|
||||
getAction("beam-start")->setChecked(is.beamMode() == BeamMode::BEGIN);
|
||||
getAction("beam-mid")->setChecked(is.beamMode() == BeamMode::MID);
|
||||
getAction("no-beam")->setChecked(is.beamMode() == BeamMode::NONE);
|
||||
getAction("beam32")->setChecked(is.beamMode() == BeamMode::BEGIN32);
|
||||
getAction("auto-beam")->setChecked(is.beamMode() == BeamMode::AUTO);
|
||||
getAction("beam-start")->setChecked(is.beamMode() == Beam::Mode::BEGIN);
|
||||
getAction("beam-mid")->setChecked(is.beamMode() == Beam::Mode::MID);
|
||||
getAction("no-beam")->setChecked(is.beamMode() == Beam::Mode::NONE);
|
||||
getAction("beam32")->setChecked(is.beamMode() == Beam::Mode::BEGIN32);
|
||||
getAction("auto-beam")->setChecked(is.beamMode() == Beam::Mode::AUTO);
|
||||
getAction("repitch")->setChecked(is.repitchMode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ class MusicXml {
|
|||
Chord* tremStart; ///< Starting chord for current tremolo
|
||||
FiguredBass* figBass; ///< Current figured bass element (to attach to next note)
|
||||
bool figBassExtend; ///< Current figured bass extend
|
||||
BeamMode beamMode; ///< Current beam mode
|
||||
Beam::Mode beamMode; ///< Current beam mode
|
||||
|
||||
int pageWidth; ///< Page width read from defaults
|
||||
int pageHeight; ///< Page height read from defaults
|
||||
|
|
|
@ -134,10 +134,10 @@ void NoteGroups::resetClicked()
|
|||
void NoteGroups::noteClicked(Note* note)
|
||||
{
|
||||
Chord* chord = note->chord();
|
||||
if (chord->beamMode() == BeamMode::AUTO)
|
||||
chord->setBeamMode(BeamMode::BEGIN);
|
||||
else if (chord->beamMode() == BeamMode::BEGIN)
|
||||
chord->setBeamMode(BeamMode::AUTO);
|
||||
if (chord->beamMode() == Beam::Mode::AUTO)
|
||||
chord->setBeamMode(Beam::Mode::BEGIN);
|
||||
else if (chord->beamMode() == Beam::Mode::BEGIN)
|
||||
chord->setBeamMode(Beam::Mode::AUTO);
|
||||
chord->score()->doLayout();
|
||||
view8->update();
|
||||
view16->update();
|
||||
|
|
Loading…
Reference in a new issue