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);
|
||||
if (ssl.size() == 3) {
|
||||
RenderAction a;
|
||||
a.type = RenderAction::RENDER_MOVE;
|
||||
a.type = RenderAction::RenderActionType::MOVE;
|
||||
a.movex = ssl[1].toDouble();
|
||||
a.movey = ssl[2].toDouble();
|
||||
renderList.append(a);
|
||||
}
|
||||
}
|
||||
else if (s == ":push")
|
||||
renderList.append(RenderAction(RenderAction::RENDER_PUSH));
|
||||
renderList.append(RenderAction(RenderAction::RenderActionType::PUSH));
|
||||
else if (s == ":pop")
|
||||
renderList.append(RenderAction(RenderAction::RENDER_POP));
|
||||
renderList.append(RenderAction(RenderAction::RenderActionType::POP));
|
||||
else if (s == ":n")
|
||||
renderList.append(RenderAction(RenderAction::RENDER_NOTE));
|
||||
renderList.append(RenderAction(RenderAction::RenderActionType::NOTE));
|
||||
else if (s == ":a")
|
||||
renderList.append(RenderAction(RenderAction::RENDER_ACCIDENTAL));
|
||||
renderList.append(RenderAction(RenderAction::RenderActionType::ACCIDENTAL));
|
||||
else {
|
||||
RenderAction a(RenderAction::RENDER_SET);
|
||||
RenderAction a(RenderAction::RenderActionType::SET);
|
||||
a.text = s;
|
||||
renderList.append(a);
|
||||
}
|
||||
|
@ -336,23 +336,23 @@ static void writeRenderList(Xml& xml, const QList<RenderAction>* al, const QStri
|
|||
s += " ";
|
||||
const RenderAction& a = (*al)[i];
|
||||
switch(a.type) {
|
||||
case RenderAction::RENDER_SET:
|
||||
case RenderAction::RenderActionType::SET:
|
||||
s += a.text;
|
||||
break;
|
||||
case RenderAction::RENDER_MOVE:
|
||||
case RenderAction::RenderActionType::MOVE:
|
||||
if (a.movex != 0.0 || a.movey != 0.0)
|
||||
s += QString("m:%1:%2").arg(a.movex).arg(a.movey);
|
||||
break;
|
||||
case RenderAction::RENDER_PUSH:
|
||||
case RenderAction::RenderActionType::PUSH:
|
||||
s += ":push";
|
||||
break;
|
||||
case RenderAction::RENDER_POP:
|
||||
case RenderAction::RenderActionType::POP:
|
||||
s += ":pop";
|
||||
break;
|
||||
case RenderAction::RENDER_NOTE:
|
||||
case RenderAction::RenderActionType::NOTE:
|
||||
s += ":n";
|
||||
break;
|
||||
case RenderAction::RENDER_ACCIDENTAL:
|
||||
case RenderAction::RenderActionType::ACCIDENTAL:
|
||||
s += ":a";
|
||||
break;
|
||||
}
|
||||
|
@ -1400,7 +1400,7 @@ const QList<RenderAction>& ParsedChord::renderList(const ChordList* cl)
|
|||
_renderList.append(rl);
|
||||
else {
|
||||
// no definition for token, so render as literal
|
||||
RenderAction a(RenderAction::RENDER_SET);
|
||||
RenderAction a(RenderAction::RenderActionType::SET);
|
||||
a.text = tok.names.first();
|
||||
_renderList.append(a);
|
||||
}
|
||||
|
|
|
@ -87,14 +87,14 @@ class HChord {
|
|||
//---------------------------------------------------------
|
||||
|
||||
struct RenderAction {
|
||||
enum RenderActionType {
|
||||
RENDER_SET, RENDER_MOVE, RENDER_PUSH, RENDER_POP,
|
||||
RENDER_NOTE, RENDER_ACCIDENTAL
|
||||
enum class RenderActionType : char {
|
||||
SET, MOVE, PUSH, POP,
|
||||
NOTE, ACCIDENTAL
|
||||
};
|
||||
|
||||
RenderActionType type;
|
||||
qreal movex, movey; // RENDER_MOVE
|
||||
QString text; // RENDER_SET
|
||||
qreal movex, movey; // MOVE
|
||||
QString text; // SET
|
||||
|
||||
RenderAction() {}
|
||||
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));
|
||||
|
||||
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);
|
||||
ChordSymbol cs = chordList->symbol(a.text);
|
||||
if (cs.isValid()) {
|
||||
|
@ -1120,22 +1120,22 @@ void Harmony::render(const QList<RenderAction>& renderList, qreal& x, qreal& y,
|
|||
textList.append(ts);
|
||||
x += ts->width();
|
||||
}
|
||||
else if (a.type == RenderAction::RENDER_MOVE) {
|
||||
else if (a.type == RenderAction::RenderActionType::MOVE) {
|
||||
x += a.movex * mag;
|
||||
y += a.movey * mag;
|
||||
}
|
||||
else if (a.type == RenderAction::RENDER_PUSH)
|
||||
else if (a.type == RenderAction::RenderActionType::PUSH)
|
||||
stack.push(QPointF(x,y));
|
||||
else if (a.type == RenderAction::RENDER_POP) {
|
||||
else if (a.type == RenderAction::RenderActionType::POP) {
|
||||
if (!stack.isEmpty()) {
|
||||
QPointF pt = stack.pop();
|
||||
x = pt.x();
|
||||
y = pt.y();
|
||||
}
|
||||
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;
|
||||
int 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);
|
||||
x += ts->width();
|
||||
}
|
||||
else if (a.type == RenderAction::RENDER_ACCIDENTAL) {
|
||||
else if (a.type == RenderAction::RenderActionType::ACCIDENTAL) {
|
||||
QString c;
|
||||
QString 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));
|
||||
|
||||
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);
|
||||
ChordSymbol cs = chordList->symbol(a.text);
|
||||
if (cs.isValid()) {
|
||||
|
@ -337,22 +337,22 @@ void HarmonyCanvas::render(const QList<RenderAction>& renderList, double& x, dou
|
|||
textList.append(ts);
|
||||
x += ts->width();
|
||||
}
|
||||
else if (a.type == RenderAction::RENDER_MOVE) {
|
||||
else if (a.type == RenderAction::RenderActionType::MOVE) {
|
||||
x += a.movex;// * mag;
|
||||
y += a.movey; // * mag;
|
||||
}
|
||||
else if (a.type == RenderAction::RENDER_PUSH)
|
||||
else if (a.type == RenderAction::RenderActionType::PUSH)
|
||||
stack.push(QPointF(x,y));
|
||||
else if (a.type == RenderAction::RENDER_POP) {
|
||||
else if (a.type == RenderAction::RenderActionType::POP) {
|
||||
if (!stack.isEmpty()) {
|
||||
QPointF pt = stack.pop();
|
||||
x = pt.x();
|
||||
y = pt.y();
|
||||
}
|
||||
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;
|
||||
int acc;
|
||||
tpc2name(tpc, spelling, lowerCase, c, acc);
|
||||
|
@ -370,7 +370,7 @@ void HarmonyCanvas::render(const QList<RenderAction>& renderList, double& x, dou
|
|||
textList.append(ts);
|
||||
x += ts->width();
|
||||
}
|
||||
else if (a.type == RenderAction::RENDER_ACCIDENTAL) {
|
||||
else if (a.type == RenderAction::RenderActionType::ACCIDENTAL) {
|
||||
QString c;
|
||||
QString acc;
|
||||
tpc2name(tpc, spelling, lowerCase, c, acc);
|
||||
|
@ -599,12 +599,12 @@ void HarmonyCanvas::updateChordDescription()
|
|||
continue;
|
||||
}
|
||||
if (ts->x != x || ts->y != y) {
|
||||
RenderAction ra(RenderAction::RENDER_MOVE);
|
||||
RenderAction ra(RenderAction::RenderActionType::MOVE);
|
||||
ra.movex = ts->x - x;
|
||||
ra.movey = ts->y - y;
|
||||
chordDescription->renderList.append(ra);
|
||||
}
|
||||
RenderAction ra(RenderAction::RENDER_SET);
|
||||
RenderAction ra(RenderAction::RenderActionType::SET);
|
||||
ra.text = ts->text;
|
||||
chordDescription->renderList.append(ra);
|
||||
x = ts->x + ts->width();
|
||||
|
|
Loading…
Reference in a new issue