Merge pull request #5261 from mattmcclinch/290011-tab-duration
fix #290011: [Tablature] Note value repeat section: "At new system" renders the same as "At new measure"
This commit is contained in:
commit
2a1fc1f5d7
3 changed files with 33 additions and 13 deletions
|
@ -2263,8 +2263,6 @@ void Chord::layoutTablature()
|
|||
//
|
||||
// tab duration symbols
|
||||
//
|
||||
// check duration of prev. CR segm
|
||||
ChordRest * prevCR = prevChordRest(this);
|
||||
// if no previous CR
|
||||
// OR symbol repeat set to ALWAYS
|
||||
// OR symbol repeat condition is triggered
|
||||
|
@ -2274,23 +2272,33 @@ void Chord::layoutTablature()
|
|||
// AND no not-stem
|
||||
// set a duration symbol (trying to re-use existing symbols where existing to minimize
|
||||
// symbol creation and deletion)
|
||||
TablatureSymbolRepeat symRepeat = tab->symRepeat();
|
||||
if ( (prevCR == 0
|
||||
|| symRepeat == TablatureSymbolRepeat::ALWAYS
|
||||
|| (symRepeat == TablatureSymbolRepeat::MEASURE && measure() != prevCR->measure())
|
||||
|| (symRepeat == TablatureSymbolRepeat::SYSTEM && measure()->system() != prevCR->measure()->system())
|
||||
|| beamMode() != Beam::Mode::AUTO
|
||||
|| prevCR->durationType().type() != durationType().type()
|
||||
|| prevCR->dots() != dots()
|
||||
|| prevCR->tuplet() != tuplet()
|
||||
|| prevCR->type() == ElementType::REST)
|
||||
&& !noStem() ) {
|
||||
bool needTabDur = false;
|
||||
bool repeat = false;
|
||||
if (!noStem()) {
|
||||
// check duration of prev. CR segm
|
||||
ChordRest * prevCR = prevChordRest(this);
|
||||
if (prevCR == 0)
|
||||
needTabDur = true;
|
||||
else if (beamMode() != Beam::Mode::AUTO
|
||||
|| prevCR->durationType().type() != durationType().type()
|
||||
|| prevCR->dots() != dots()
|
||||
|| prevCR->tuplet() != tuplet()
|
||||
|| prevCR->type() == ElementType::REST)
|
||||
needTabDur = true;
|
||||
else if (tab->symRepeat() == TablatureSymbolRepeat::ALWAYS
|
||||
|| measure() != prevCR->measure()) {
|
||||
needTabDur = true;
|
||||
repeat = true;
|
||||
}
|
||||
}
|
||||
if (needTabDur) {
|
||||
// symbol needed; if not exist, create; if exists, update duration
|
||||
if (!_tabDur)
|
||||
_tabDur = new TabDurationSymbol(score(), tab, durationType().type(), dots());
|
||||
else
|
||||
_tabDur->setDuration(durationType().type(), dots(), tab);
|
||||
_tabDur->setParent(this);
|
||||
_tabDur->setRepeat(repeat);
|
||||
// _tabDur->setMag(mag()); // useless to set grace mag: graces have no dur. symbol
|
||||
_tabDur->layout();
|
||||
if (minY < 0) { // if some fret extends above tab body (like bass strings)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "stafftype.h"
|
||||
|
||||
#include "chord.h"
|
||||
#include "measure.h"
|
||||
#include "mscore.h"
|
||||
#include "navigate.h"
|
||||
#include "staff.h"
|
||||
|
@ -984,6 +985,14 @@ void TabDurationSymbol::draw(QPainter* painter) const
|
|||
{
|
||||
if (!_tab)
|
||||
return;
|
||||
|
||||
if (_repeat && (_tab->symRepeat() == TablatureSymbolRepeat::SYSTEM)) {
|
||||
Chord* chord = toChord(parent());
|
||||
ChordRest* prevCR = prevChordRest(chord);
|
||||
if (prevCR && (chord->measure()->system() == prevCR->measure()->system()))
|
||||
return;
|
||||
}
|
||||
|
||||
qreal mag = magS();
|
||||
qreal imag = 1.0 / mag;
|
||||
|
||||
|
|
|
@ -423,6 +423,7 @@ class TabDurationSymbol final : public Element {
|
|||
TabBeamGrid _beamGrid; // value for special 'English' grid display
|
||||
const StaffType* _tab;
|
||||
QString _text;
|
||||
bool _repeat;
|
||||
|
||||
public:
|
||||
TabDurationSymbol(Score* s);
|
||||
|
@ -440,6 +441,8 @@ class TabDurationSymbol final : public Element {
|
|||
_tab = tab;
|
||||
_text = tab->durationString(type, dots);
|
||||
}
|
||||
bool isRepeat() const { return _repeat; }
|
||||
void setRepeat(bool val) { _repeat = val; }
|
||||
};
|
||||
|
||||
} // namespace Ms
|
||||
|
|
Loading…
Reference in a new issue