new action+shortcut M to toggle multi measure rest creation

This commit is contained in:
ws 2013-09-28 11:24:00 +02:00
parent 2ea6dcae19
commit cf84739c84
4 changed files with 33 additions and 1 deletions

View file

@ -2388,6 +2388,10 @@ void Score::cmd(const QAction* a)
transposeSemitone(1);
else if (cmd == "transpose-down")
transposeSemitone(-1);
else if (cmd == "toggle-mmrest") {
bool val = !styleB(ST_createMultiMeasureRests);
undo(new ChangeStyleVal(this, ST_createMultiMeasureRests, val));
}
else
qDebug("1unknown cmd <%s>", qPrintable(cmd));
}

View file

@ -2502,6 +2502,18 @@ void ChangeStyle::flip()
style = tmp;
}
//---------------------------------------------------------
// ChangeStyleVal::flip
//---------------------------------------------------------
void ChangeStyleVal::flip()
{
QVariant v = score->style(idx);
score->style()->set(idx, value);
score->setLayoutAll(true);
value = v;
}
//---------------------------------------------------------
// ChangeChordStaffMove
//---------------------------------------------------------

View file

@ -835,6 +835,22 @@ class ChangeStyle : public UndoCommand {
UNDO_NAME("ChangeStyle");
};
//---------------------------------------------------------
// ChangeStyleVal
//---------------------------------------------------------
class ChangeStyleVal : public UndoCommand {
Score* score;
StyleIdx idx;
QVariant value;
void flip();
public:
ChangeStyleVal(Score* s, StyleIdx i, const QVariant& v) : score(s), idx(i), value(v) {}
UNDO_NAME("ChangeStyleVal");
};
//---------------------------------------------------------
// ChangeChordStaffMove
//---------------------------------------------------------

View file

@ -2461,7 +2461,7 @@ Shortcut Shortcut::sc[] = {
STATE_NORMAL,
A_CMD,
"toggle-mmrest",
QT_TRANSLATE_NOOP("action","toggle create multi measure rest"),
QT_TRANSLATE_NOOP("action","toggle create multi measure rest")
),
// xml==0 marks end of list
Shortcut(0, 0, 0, 0)