Skip to content

Commit 2d44875

Browse files
worldwidewearyJojo-Schmitz
authored andcommitted
[Cmd: Double/Half Duration] Allow to apply to a list selection - equivalent to pressing a duration toggle. Shift also allowed
Port of Jojo-Schmitz#609
1 parent a1d76de commit 2d44875

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/engraving/dom/cmd.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "chordrest.h"
4444
#include "clef.h"
4545
#include "drumset.h"
46+
#include "durationtype.h"
4647
#include "dynamic.h"
4748
#include "factory.h"
4849
#include "glissando.h"
@@ -3289,6 +3290,27 @@ void Score::cmdIncDecDuration(int nSteps, bool stepDotted)
32893290
pasteStaff(e, selection().startSegment(), selection().staffStart(), scale);
32903291
return;
32913292
}
3293+
if (selection().isList() && selection().elements().size() > 1) {
3294+
// List - act as if pressing duration toggle (distinct from range based Half/Double
3295+
TDuration newDuration(stepDotted
3296+
? m_is.duration().shiftRetainDots(nSteps, stepDotted)
3297+
: m_is.duration().shift(nSteps));
3298+
m_is.duration().shiftRetainDots(nSteps, stepDotted);
3299+
m_is.setDuration(newDuration);
3300+
std::set crs = getSelectedChordRests();
3301+
for (auto cr : getSelectedChordRests()) {
3302+
changeCRlen(cr, newDuration);
3303+
}
3304+
for (auto cr : crs) {
3305+
EngravingItem* e = cr;
3306+
if (cr->isChord()) {
3307+
e = toChord(cr)->upNote();
3308+
}
3309+
select(e, SelectType::ADD);
3310+
}
3311+
return;
3312+
}
3313+
32923314
EngravingItem* el = selection().element();
32933315
if (el == 0) {
32943316
return;

0 commit comments

Comments
 (0)