fix #278943: Can't copy tuplet to last beat of measure
This commit is contained in:
parent
1b1912d6ed
commit
7ff253cae0
16 changed files with 36 additions and 60 deletions
|
@ -112,7 +112,7 @@ Fraction DurationElement::afrac() const
|
||||||
return f.reduced();
|
return f.reduced();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Element::afrac();
|
return Fraction::fromTicks(tick());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
@ -125,7 +125,7 @@ Fraction DurationElement::rfrac() const
|
||||||
if (Measure* m = measure())
|
if (Measure* m = measure())
|
||||||
return afrac() - m->afrac();
|
return afrac() - m->afrac();
|
||||||
}
|
}
|
||||||
return Element::rfrac();
|
return Fraction::fromTicks(rtick());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
|
@ -1718,14 +1718,9 @@ int Element::rtick() const
|
||||||
|
|
||||||
Fraction Element::rfrac() const
|
Fraction Element::rfrac() const
|
||||||
{
|
{
|
||||||
const Element* e = this;
|
if (parent())
|
||||||
while (e) {
|
return parent()->rfrac();
|
||||||
if (e->isSegment())
|
else
|
||||||
return toSegment(e)->rfrac();
|
|
||||||
else if (e->isMeasureBase())
|
|
||||||
return toMeasureBase(e)->rfrac();
|
|
||||||
e = e->parent();
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,14 +1731,9 @@ Fraction Element::rfrac() const
|
||||||
|
|
||||||
Fraction Element::afrac() const
|
Fraction Element::afrac() const
|
||||||
{
|
{
|
||||||
const Element* e = this;
|
if (parent())
|
||||||
while (e) {
|
return parent()->afrac();
|
||||||
if (e->isSegment())
|
else
|
||||||
return toSegment(e)->afrac();
|
|
||||||
else if (e->isMeasureBase())
|
|
||||||
return toMeasureBase(e)->afrac();
|
|
||||||
e = e->parent();
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,9 +176,7 @@ bool Score::pasteStaff(XmlReader& e, Segment* dst, int dstStaff)
|
||||||
Measure* measure = tick2measure(tick);
|
Measure* measure = tick2measure(tick);
|
||||||
tuplet->setParent(measure);
|
tuplet->setParent(measure);
|
||||||
tuplet->setTick(tick);
|
tuplet->setTick(tick);
|
||||||
int ticks = tuplet->actualTicks();
|
if (tuplet->rfrac() + tuplet->duration() > measure->len()) {
|
||||||
int rticks = measure->endTick() - tick;
|
|
||||||
if (rticks < ticks) {
|
|
||||||
delete tuplet;
|
delete tuplet;
|
||||||
if (oldTuplet && oldTuplet->elements().empty())
|
if (oldTuplet && oldTuplet->elements().empty())
|
||||||
delete oldTuplet;
|
delete oldTuplet;
|
||||||
|
|
|
@ -951,27 +951,6 @@ void Tuplet::sortElements()
|
||||||
qSort(_elements.begin(), _elements.end(), tickGreater);
|
qSort(_elements.begin(), _elements.end(), tickGreater);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------
|
|
||||||
// afrac
|
|
||||||
//---------------------------------------------------------
|
|
||||||
|
|
||||||
Fraction Tuplet::afrac() const
|
|
||||||
{
|
|
||||||
return Fraction::fromTicks(tick());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
|
||||||
// rfrac
|
|
||||||
//---------------------------------------------------------
|
|
||||||
|
|
||||||
Fraction Tuplet::rfrac() const
|
|
||||||
{
|
|
||||||
const Measure* m = measure();
|
|
||||||
if (m)
|
|
||||||
return Fraction::fromTicks(tick() - m->tick());
|
|
||||||
return afrac();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// elementsDuration
|
// elementsDuration
|
||||||
/// Get the sum of the element fraction in the tuplet,
|
/// Get the sum of the element fraction in the tuplet,
|
||||||
|
|
|
@ -119,8 +119,6 @@ class Tuplet final : public DurationElement {
|
||||||
Direction direction() const { return _direction; }
|
Direction direction() const { return _direction; }
|
||||||
bool isUp() const { return _isUp; }
|
bool isUp() const { return _isUp; }
|
||||||
virtual int tick() const override { return _tick; }
|
virtual int tick() const override { return _tick; }
|
||||||
virtual Fraction afrac() const override;
|
|
||||||
virtual Fraction rfrac() const override;
|
|
||||||
void setTick(int val) { _tick = val; }
|
void setTick(int val) { _tick = val; }
|
||||||
Fraction elementsDuration();
|
Fraction elementsDuration();
|
||||||
void sortElements();
|
void sortElements();
|
||||||
|
|
|
@ -915,6 +915,7 @@ bool GuitarPro4::read(QFile* fp)
|
||||||
Tuplet* tuplet = tuplets[staffIdx];
|
Tuplet* tuplet = tuplets[staffIdx];
|
||||||
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
||||||
tuplet = new Tuplet(score);
|
tuplet = new Tuplet(score);
|
||||||
|
tuplet->setTick(tick);
|
||||||
tuplet->setTrack(cr->track());
|
tuplet->setTrack(cr->track());
|
||||||
tuplets[staffIdx] = tuplet;
|
tuplets[staffIdx] = tuplet;
|
||||||
setTuplet(tuplet, tuple);
|
setTuplet(tuplet, tuple);
|
||||||
|
|
|
@ -296,6 +296,7 @@ int GuitarPro5::readBeat(int tick, int voice, Measure* measure, int staffIdx, Tu
|
||||||
Tuplet* tuplet = tuplets[staffIdx * 2 + voice];
|
Tuplet* tuplet = tuplets[staffIdx * 2 + voice];
|
||||||
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
||||||
tuplet = new Tuplet(score);
|
tuplet = new Tuplet(score);
|
||||||
|
tuplet->setTick(tick);
|
||||||
// int track = staffIdx * 2 + voice;
|
// int track = staffIdx * 2 + voice;
|
||||||
tuplets[staffIdx * 2 + voice] = tuplet;
|
tuplets[staffIdx * 2 + voice] = tuplet;
|
||||||
tuplet->setTrack(cr->track());
|
tuplet->setTrack(cr->track());
|
||||||
|
|
|
@ -1653,6 +1653,7 @@ int GuitarPro6::readBeats(QString beats, GPPartInfo* partInfo, Measure* measure,
|
||||||
cr->setTrack(track);
|
cr->setTrack(track);
|
||||||
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
||||||
tuplet = new Tuplet(score);
|
tuplet = new Tuplet(score);
|
||||||
|
tuplet->setTick(currentTick);
|
||||||
tuplets[staffIdx * VOICES + voiceNum] = tuplet;
|
tuplets[staffIdx * VOICES + voiceNum] = tuplet;
|
||||||
tuplet->setParent(measure);
|
tuplet->setParent(measure);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1210,6 +1210,7 @@ bool GuitarPro1::read(QFile* fp)
|
||||||
Tuplet* tuplet = tuplets[staffIdx];
|
Tuplet* tuplet = tuplets[staffIdx];
|
||||||
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
||||||
tuplet = new Tuplet(score);
|
tuplet = new Tuplet(score);
|
||||||
|
tuplet->setTick(tick);
|
||||||
tuplet->setTrack(cr->track());
|
tuplet->setTrack(cr->track());
|
||||||
tuplets[staffIdx] = tuplet;
|
tuplets[staffIdx] = tuplet;
|
||||||
setTuplet(tuplet, tuple);
|
setTuplet(tuplet, tuple);
|
||||||
|
@ -1698,6 +1699,7 @@ bool GuitarPro2::read(QFile* fp)
|
||||||
Tuplet* tuplet = tuplets[staffIdx];
|
Tuplet* tuplet = tuplets[staffIdx];
|
||||||
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
||||||
tuplet = new Tuplet(score);
|
tuplet = new Tuplet(score);
|
||||||
|
tuplet->setTick(tick);
|
||||||
tuplet->setTrack(cr->track());
|
tuplet->setTrack(cr->track());
|
||||||
tuplets[staffIdx] = tuplet;
|
tuplets[staffIdx] = tuplet;
|
||||||
setTuplet(tuplet, tuple);
|
setTuplet(tuplet, tuple);
|
||||||
|
@ -2413,6 +2415,7 @@ bool GuitarPro3::read(QFile* fp)
|
||||||
Tuplet* tuplet = tuplets[staffIdx];
|
Tuplet* tuplet = tuplets[staffIdx];
|
||||||
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
if ((tuplet == 0) || (tuplet->elementsDuration() == tuplet->baseLen().fraction() * tuplet->ratio().numerator())) {
|
||||||
tuplet = new Tuplet(score);
|
tuplet = new Tuplet(score);
|
||||||
|
tuplet->setTick(tick);
|
||||||
tuplet->setTrack(cr->track());
|
tuplet->setTrack(cr->track());
|
||||||
tuplets[staffIdx] = tuplet;
|
tuplets[staffIdx] = tuplet;
|
||||||
setTuplet(tuplet, tuple);
|
setTuplet(tuplet, tuple);
|
||||||
|
|
|
@ -390,6 +390,7 @@
|
||||||
</Rest>
|
</Rest>
|
||||||
<Tuplet>
|
<Tuplet>
|
||||||
<linked>
|
<linked>
|
||||||
|
<indexDiff>1</indexDiff>
|
||||||
</linked>
|
</linked>
|
||||||
<normalNotes>2</normalNotes>
|
<normalNotes>2</normalNotes>
|
||||||
<actualNotes>3</actualNotes>
|
<actualNotes>3</actualNotes>
|
||||||
|
@ -405,11 +406,13 @@
|
||||||
</Beam>
|
</Beam>
|
||||||
<Chord>
|
<Chord>
|
||||||
<linked>
|
<linked>
|
||||||
|
<indexDiff>1</indexDiff>
|
||||||
</linked>
|
</linked>
|
||||||
<dots>1</dots>
|
<dots>1</dots>
|
||||||
<durationType>eighth</durationType>
|
<durationType>eighth</durationType>
|
||||||
<Note>
|
<Note>
|
||||||
<linked>
|
<linked>
|
||||||
|
<indexDiff>1</indexDiff>
|
||||||
</linked>
|
</linked>
|
||||||
<pitch>71</pitch>
|
<pitch>71</pitch>
|
||||||
<tpc>19</tpc>
|
<tpc>19</tpc>
|
||||||
|
|
|
@ -447,10 +447,12 @@
|
||||||
</Beam>
|
</Beam>
|
||||||
<Chord>
|
<Chord>
|
||||||
<linked>
|
<linked>
|
||||||
|
<indexDiff>1</indexDiff>
|
||||||
</linked>
|
</linked>
|
||||||
<durationType>16th</durationType>
|
<durationType>16th</durationType>
|
||||||
<Note>
|
<Note>
|
||||||
<linked>
|
<linked>
|
||||||
|
<indexDiff>1</indexDiff>
|
||||||
</linked>
|
</linked>
|
||||||
<Spanner type="Tie">
|
<Spanner type="Tie">
|
||||||
<Tie>
|
<Tie>
|
||||||
|
|
|
@ -273,7 +273,7 @@ solo concert</text>
|
||||||
</Slur>
|
</Slur>
|
||||||
<next>
|
<next>
|
||||||
<location>
|
<location>
|
||||||
<fractions>-1/1</fractions>
|
<fractions>1/4</fractions>
|
||||||
</location>
|
</location>
|
||||||
</next>
|
</next>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -313,7 +313,7 @@ solo concert</text>
|
||||||
<Spanner type="Slur">
|
<Spanner type="Slur">
|
||||||
<prev>
|
<prev>
|
||||||
<location>
|
<location>
|
||||||
<fractions>1/1</fractions>
|
<fractions>-1/4</fractions>
|
||||||
</location>
|
</location>
|
||||||
</prev>
|
</prev>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -1036,7 +1036,7 @@ solo concert</text>
|
||||||
</Slur>
|
</Slur>
|
||||||
<next>
|
<next>
|
||||||
<location>
|
<location>
|
||||||
<fractions>-1/1</fractions>
|
<fractions>1/4</fractions>
|
||||||
</location>
|
</location>
|
||||||
</next>
|
</next>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -1079,7 +1079,7 @@ solo concert</text>
|
||||||
<Spanner type="Slur">
|
<Spanner type="Slur">
|
||||||
<prev>
|
<prev>
|
||||||
<location>
|
<location>
|
||||||
<fractions>1/1</fractions>
|
<fractions>-1/4</fractions>
|
||||||
</location>
|
</location>
|
||||||
</prev>
|
</prev>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -1710,7 +1710,7 @@ solo concert</text>
|
||||||
</Slur>
|
</Slur>
|
||||||
<next>
|
<next>
|
||||||
<location>
|
<location>
|
||||||
<fractions>-1/1</fractions>
|
<fractions>1/4</fractions>
|
||||||
</location>
|
</location>
|
||||||
</next>
|
</next>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -1753,7 +1753,7 @@ solo concert</text>
|
||||||
<Spanner type="Slur">
|
<Spanner type="Slur">
|
||||||
<prev>
|
<prev>
|
||||||
<location>
|
<location>
|
||||||
<fractions>1/1</fractions>
|
<fractions>-1/4</fractions>
|
||||||
</location>
|
</location>
|
||||||
</prev>
|
</prev>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
<next>
|
<next>
|
||||||
<location>
|
<location>
|
||||||
<measures>1</measures>
|
<measures>1</measures>
|
||||||
<fractions>-1387/1920</fractions>
|
<fractions>-35/36</fractions>
|
||||||
</location>
|
</location>
|
||||||
</next>
|
</next>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
<prev>
|
<prev>
|
||||||
<location>
|
<location>
|
||||||
<measures>-1</measures>
|
<measures>-1</measures>
|
||||||
<fractions>1387/1920</fractions>
|
<fractions>35/36</fractions>
|
||||||
</location>
|
</location>
|
||||||
</prev>
|
</prev>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
|
|
@ -166,7 +166,7 @@
|
||||||
<next>
|
<next>
|
||||||
<location>
|
<location>
|
||||||
<measures>1</measures>
|
<measures>1</measures>
|
||||||
<fractions>-2/3</fractions>
|
<fractions>-11/12</fractions>
|
||||||
</location>
|
</location>
|
||||||
</next>
|
</next>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -195,7 +195,7 @@
|
||||||
<prev>
|
<prev>
|
||||||
<location>
|
<location>
|
||||||
<measures>-1</measures>
|
<measures>-1</measures>
|
||||||
<fractions>2/3</fractions>
|
<fractions>11/12</fractions>
|
||||||
</location>
|
</location>
|
||||||
</prev>
|
</prev>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
<next>
|
<next>
|
||||||
<location>
|
<location>
|
||||||
<measures>1</measures>
|
<measures>1</measures>
|
||||||
<fractions>-2/3</fractions>
|
<fractions>-11/12</fractions>
|
||||||
</location>
|
</location>
|
||||||
</next>
|
</next>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -168,7 +168,7 @@
|
||||||
<prev>
|
<prev>
|
||||||
<location>
|
<location>
|
||||||
<measures>-1</measures>
|
<measures>-1</measures>
|
||||||
<fractions>2/3</fractions>
|
<fractions>11/12</fractions>
|
||||||
</location>
|
</location>
|
||||||
</prev>
|
</prev>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
<next>
|
<next>
|
||||||
<location>
|
<location>
|
||||||
<measures>1</measures>
|
<measures>1</measures>
|
||||||
<fractions>-237/320</fractions>
|
<fractions>-107/108</fractions>
|
||||||
</location>
|
</location>
|
||||||
</next>
|
</next>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
<prev>
|
<prev>
|
||||||
<location>
|
<location>
|
||||||
<measures>-1</measures>
|
<measures>-1</measures>
|
||||||
<fractions>237/320</fractions>
|
<fractions>107/108</fractions>
|
||||||
</location>
|
</location>
|
||||||
</prev>
|
</prev>
|
||||||
</Spanner>
|
</Spanner>
|
||||||
|
|
Loading…
Reference in a new issue