convert enum RenderActionType into enum class
This commit is contained in:
parent
bf54fc8ed1
commit
65ce677dcd
4 changed files with 34 additions and 34 deletions
|
@ -300,22 +300,22 @@ static void readRenderList(QString val, QList<RenderAction>& renderList)
|
||||||
QStringList ssl = s.split(":", QString::SkipEmptyParts);
|
QStringList ssl = s.split(":", QString::SkipEmptyParts);
|
||||||
if (ssl.size() == 3) {
|
if (ssl.size() == 3) {
|
||||||
RenderAction a;
|
RenderAction a;
|
||||||
a.type = RenderAction::RENDER_MOVE;
|
a.type = RenderAction::RenderActionType::MOVE;
|
||||||
a.movex = ssl[1].toDouble();
|
a.movex = ssl[1].toDouble();
|
||||||
a.movey = ssl[2].toDouble();
|
a.movey = ssl[2].toDouble();
|
||||||
renderList.append(a);
|
renderList.append(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s == ":push")
|
else if (s == ":push")
|
||||||
renderList.append(RenderAction(RenderAction::RENDER_PUSH));
|
renderList.append(RenderAction(RenderAction::RenderActionType::PUSH));
|
||||||
else if (s == ":pop")
|
else if (s == ":pop")
|
||||||
renderList.append(RenderAction(RenderAction::RENDER_POP));
|
renderList.append(RenderAction(RenderAction::RenderActionType::POP));
|
||||||
else if (s == ":n")
|
else if (s == ":n")
|
||||||
renderList.append(RenderAction(RenderAction::RENDER_NOTE));
|
renderList.append(RenderAction(RenderAction::RenderActionType::NOTE));
|
||||||
else if (s == ":a")
|
else if (s == ":a")
|
||||||
renderList.append(RenderAction(RenderAction::RENDER_ACCIDENTAL));
|
renderList.append(RenderAction(RenderAction::RenderActionType::ACCIDENTAL));
|
||||||
else {
|
else {
|
||||||
RenderAction a(RenderAction::RENDER_SET);
|
RenderAction a(RenderAction::RenderActionType::SET);
|
||||||
a.text = s;
|
a.text = s;
|
||||||
renderList.append(a);
|
renderList.append(a);
|
||||||
}
|
}
|
||||||
|
@ -336,23 +336,23 @@ static void writeRenderList(Xml& xml, const QList<RenderAction>* al, const QStri
|
||||||
s += " ";
|
s += " ";
|
||||||
const RenderAction& a = (*al)[i];
|
const RenderAction& a = (*al)[i];
|
||||||
switch(a.type) {
|
switch(a.type) {
|
||||||
case RenderAction::RENDER_SET:
|
case RenderAction::RenderActionType::SET:
|
||||||
s += a.text;
|
s += a.text;
|
||||||
break;
|
break;
|
||||||
case RenderAction::RENDER_MOVE:
|
case RenderAction::RenderActionType::MOVE:
|
||||||
if (a.movex != 0.0 || a.movey != 0.0)
|
if (a.movex != 0.0 || a.movey != 0.0)
|
||||||
s += QString("m:%1:%2").arg(a.movex).arg(a.movey);
|
s += QString("m:%1:%2").arg(a.movex).arg(a.movey);
|
||||||
break;
|
break;
|
||||||
case RenderAction::RENDER_PUSH:
|
case RenderAction::RenderActionType::PUSH:
|
||||||
s += ":push";
|
s += ":push";
|
||||||
break;
|
break;
|
||||||
case RenderAction::RENDER_POP:
|
case RenderAction::RenderActionType::POP:
|
||||||
s += ":pop";
|
s += ":pop";
|
||||||
break;
|
break;
|
||||||
case RenderAction::RENDER_NOTE:
|
case RenderAction::RenderActionType::NOTE:
|
||||||
s += ":n";
|
s += ":n";
|
||||||
break;
|
break;
|
||||||
case RenderAction::RENDER_ACCIDENTAL:
|
case RenderAction::RenderActionType::ACCIDENTAL:
|
||||||
s += ":a";
|
s += ":a";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1400,7 +1400,7 @@ const QList<RenderAction>& ParsedChord::renderList(const ChordList* cl)
|
||||||
_renderList.append(rl);
|
_renderList.append(rl);
|
||||||
else {
|
else {
|
||||||
// no definition for token, so render as literal
|
// no definition for token, so render as literal
|
||||||
RenderAction a(RenderAction::RENDER_SET);
|
RenderAction a(RenderAction::RenderActionType::SET);
|
||||||
a.text = tok.names.first();
|
a.text = tok.names.first();
|
||||||
_renderList.append(a);
|
_renderList.append(a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,14 +87,14 @@ class HChord {
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
struct RenderAction {
|
struct RenderAction {
|
||||||
enum RenderActionType {
|
enum class RenderActionType : char {
|
||||||
RENDER_SET, RENDER_MOVE, RENDER_PUSH, RENDER_POP,
|
SET, MOVE, PUSH, POP,
|
||||||
RENDER_NOTE, RENDER_ACCIDENTAL
|
NOTE, ACCIDENTAL
|
||||||
};
|
};
|
||||||
|
|
||||||
RenderActionType type;
|
RenderActionType type;
|
||||||
qreal movex, movey; // RENDER_MOVE
|
qreal movex, movey; // MOVE
|
||||||
QString text; // RENDER_SET
|
QString text; // SET
|
||||||
|
|
||||||
RenderAction() {}
|
RenderAction() {}
|
||||||
RenderAction(RenderActionType t) : type(t) {}
|
RenderAction(RenderActionType t) : type(t) {}
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ void Harmony::render(const QList<RenderAction>& renderList, qreal& x, qreal& y,
|
||||||
qreal mag = (MScore::DPI / PPI) * (_spatium / (SPATIUM20 * MScore::DPI));
|
qreal mag = (MScore::DPI / PPI) * (_spatium / (SPATIUM20 * MScore::DPI));
|
||||||
|
|
||||||
foreach(const RenderAction& a, renderList) {
|
foreach(const RenderAction& a, renderList) {
|
||||||
if (a.type == RenderAction::RENDER_SET) {
|
if (a.type == RenderAction::RenderActionType::SET) {
|
||||||
TextSegment* ts = new TextSegment(fontList[fontIdx], x, y);
|
TextSegment* ts = new TextSegment(fontList[fontIdx], x, y);
|
||||||
ChordSymbol cs = chordList->symbol(a.text);
|
ChordSymbol cs = chordList->symbol(a.text);
|
||||||
if (cs.isValid()) {
|
if (cs.isValid()) {
|
||||||
|
@ -1120,22 +1120,22 @@ void Harmony::render(const QList<RenderAction>& renderList, qreal& x, qreal& y,
|
||||||
textList.append(ts);
|
textList.append(ts);
|
||||||
x += ts->width();
|
x += ts->width();
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_MOVE) {
|
else if (a.type == RenderAction::RenderActionType::MOVE) {
|
||||||
x += a.movex * mag;
|
x += a.movex * mag;
|
||||||
y += a.movey * mag;
|
y += a.movey * mag;
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_PUSH)
|
else if (a.type == RenderAction::RenderActionType::PUSH)
|
||||||
stack.push(QPointF(x,y));
|
stack.push(QPointF(x,y));
|
||||||
else if (a.type == RenderAction::RENDER_POP) {
|
else if (a.type == RenderAction::RenderActionType::POP) {
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
QPointF pt = stack.pop();
|
QPointF pt = stack.pop();
|
||||||
x = pt.x();
|
x = pt.x();
|
||||||
y = pt.y();
|
y = pt.y();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
qDebug("RenderAction::RENDER_POP: stack empty");
|
qDebug("RenderAction::RenderActionType::POP: stack empty");
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_NOTE) {
|
else if (a.type == RenderAction::RenderActionType::NOTE) {
|
||||||
QString c;
|
QString c;
|
||||||
int acc;
|
int acc;
|
||||||
tpc2name(tpc, spelling, lowerCase, c, acc);
|
tpc2name(tpc, spelling, lowerCase, c, acc);
|
||||||
|
@ -1153,7 +1153,7 @@ void Harmony::render(const QList<RenderAction>& renderList, qreal& x, qreal& y,
|
||||||
textList.append(ts);
|
textList.append(ts);
|
||||||
x += ts->width();
|
x += ts->width();
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_ACCIDENTAL) {
|
else if (a.type == RenderAction::RenderActionType::ACCIDENTAL) {
|
||||||
QString c;
|
QString c;
|
||||||
QString acc;
|
QString acc;
|
||||||
tpc2name(tpc, spelling, lowerCase, c, acc);
|
tpc2name(tpc, spelling, lowerCase, c, acc);
|
||||||
|
|
|
@ -325,7 +325,7 @@ void HarmonyCanvas::render(const QList<RenderAction>& renderList, double& x, dou
|
||||||
fontList.append(st->fontPx(_spatium));
|
fontList.append(st->fontPx(_spatium));
|
||||||
|
|
||||||
foreach(const RenderAction& a, renderList) {
|
foreach(const RenderAction& a, renderList) {
|
||||||
if (a.type == RenderAction::RENDER_SET) {
|
if (a.type == RenderAction::RenderActionType::SET) {
|
||||||
TextSegment* ts = new TextSegment(fontList[fontIdx], x, y);
|
TextSegment* ts = new TextSegment(fontList[fontIdx], x, y);
|
||||||
ChordSymbol cs = chordList->symbol(a.text);
|
ChordSymbol cs = chordList->symbol(a.text);
|
||||||
if (cs.isValid()) {
|
if (cs.isValid()) {
|
||||||
|
@ -337,22 +337,22 @@ void HarmonyCanvas::render(const QList<RenderAction>& renderList, double& x, dou
|
||||||
textList.append(ts);
|
textList.append(ts);
|
||||||
x += ts->width();
|
x += ts->width();
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_MOVE) {
|
else if (a.type == RenderAction::RenderActionType::MOVE) {
|
||||||
x += a.movex;// * mag;
|
x += a.movex;// * mag;
|
||||||
y += a.movey; // * mag;
|
y += a.movey; // * mag;
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_PUSH)
|
else if (a.type == RenderAction::RenderActionType::PUSH)
|
||||||
stack.push(QPointF(x,y));
|
stack.push(QPointF(x,y));
|
||||||
else if (a.type == RenderAction::RENDER_POP) {
|
else if (a.type == RenderAction::RenderActionType::POP) {
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
QPointF pt = stack.pop();
|
QPointF pt = stack.pop();
|
||||||
x = pt.x();
|
x = pt.x();
|
||||||
y = pt.y();
|
y = pt.y();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
qDebug("RenderAction::RENDER_POP: stack empty");
|
qDebug("RenderAction::RenderActionType::POP: stack empty");
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_NOTE) {
|
else if (a.type == RenderAction::RenderActionType::NOTE) {
|
||||||
QString c;
|
QString c;
|
||||||
int acc;
|
int acc;
|
||||||
tpc2name(tpc, spelling, lowerCase, c, acc);
|
tpc2name(tpc, spelling, lowerCase, c, acc);
|
||||||
|
@ -370,7 +370,7 @@ void HarmonyCanvas::render(const QList<RenderAction>& renderList, double& x, dou
|
||||||
textList.append(ts);
|
textList.append(ts);
|
||||||
x += ts->width();
|
x += ts->width();
|
||||||
}
|
}
|
||||||
else if (a.type == RenderAction::RENDER_ACCIDENTAL) {
|
else if (a.type == RenderAction::RenderActionType::ACCIDENTAL) {
|
||||||
QString c;
|
QString c;
|
||||||
QString acc;
|
QString acc;
|
||||||
tpc2name(tpc, spelling, lowerCase, c, acc);
|
tpc2name(tpc, spelling, lowerCase, c, acc);
|
||||||
|
@ -599,12 +599,12 @@ void HarmonyCanvas::updateChordDescription()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ts->x != x || ts->y != y) {
|
if (ts->x != x || ts->y != y) {
|
||||||
RenderAction ra(RenderAction::RENDER_MOVE);
|
RenderAction ra(RenderAction::RenderActionType::MOVE);
|
||||||
ra.movex = ts->x - x;
|
ra.movex = ts->x - x;
|
||||||
ra.movey = ts->y - y;
|
ra.movey = ts->y - y;
|
||||||
chordDescription->renderList.append(ra);
|
chordDescription->renderList.append(ra);
|
||||||
}
|
}
|
||||||
RenderAction ra(RenderAction::RENDER_SET);
|
RenderAction ra(RenderAction::RenderActionType::SET);
|
||||||
ra.text = ts->text;
|
ra.text = ts->text;
|
||||||
chordDescription->renderList.append(ra);
|
chordDescription->renderList.append(ra);
|
||||||
x = ts->x + ts->width();
|
x = ts->x + ts->width();
|
||||||
|
|
Loading…
Reference in a new issue