Skip to content

Commit

Permalink
Merge pull request #5105 from mattmcclinch/284002-tablature-ties
Browse files Browse the repository at this point in the history
fix #284002: Tablature: unexpected default behavior with tied fret mark and parenthesis
  • Loading branch information
dmitrio95 committed Jun 11, 2019
2 parents 260d6e7 + 84ee193 commit 2ac4aff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
31 changes: 7 additions & 24 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ bool Note::isNoteName() const

void Note::draw(QPainter* painter) const
{
if (_hidden || _fretHidden)
if (_hidden)
return;

QColor c(curColor());
Expand All @@ -1111,6 +1111,11 @@ void Note::draw(QPainter* painter) const
if (tablature) {
const Staff* st = staff();
const StaffType* tab = st->staffType(tick());
if (tieBack() && !tab->showBackTied()) {
if (chord()->measure()->system() == tieBack()->startNote()->chord()->measure()->system() && el().size() == 0)
// fret should be hidden, so return without drawing it
return;
}
// draw background, if required (to hide a segment of string line or to show a fretting conflict)
if (!tab->linesThrough() || fretConflict()) {
qreal d = spatium() * .1;
Expand Down Expand Up @@ -1954,13 +1959,9 @@ void Note::layout()
const StaffType* tab = st->staffType(tick());
qreal mags = magS();
bool paren = false;
_fretHidden = false;
if (tieBack() && !tab->showBackTied()) {
_fretHidden = false;
if (el().size() > 0)
if (chord()->measure() != tieBack()->startNote()->chord()->measure() || el().size() > 0)
paren = true;
else
_fretHidden = true;
}
// not complete but we need systems to be layouted to add parenthesis
if (fixed())
Expand Down Expand Up @@ -1999,24 +2000,6 @@ void Note::layout2()
// for standard staves this is done in Score::layoutChords3()
// so that the results are available there

if (staff()->isTabStaff(chord()->tick())) {
const Staff* st = staff();
const StaffType* tab = st->staffType(tick());
qreal mags = magS();
bool paren = false;
_fretHidden = false;
if (tieBack() && !tab->showBackTied() && !_fretString.startsWith("(")) { // skip back-tied notes if not shown but between () if on another system
if (chord()->measure()->system() != tieBack()->startNote()->chord()->measure()->system() || el().size() > 0)
paren = true;
else
_fretHidden = true;
}
if (paren)
_fretString = QString("(%1)").arg(_fretString);
qreal w = tabHeadWidth(tab); // !! use _fretString
bbox().setRect(0.0, tab->fretBoxY() * mags, w, tab->fretBoxH() * mags);
}

int dots = chord()->dots();
if (dots) {
qreal d = score()->point(score()->styleS(Sid::dotNoteDistance)) * mag();
Expand Down
1 change: 0 additions & 1 deletion libmscore/note.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ class Note final : public Element {
SymId _cachedSymNull; // additional symbol for some transparent notehead

QString _fretString;
bool _fretHidden = false;

virtual void startDrag(EditData&) override;
virtual QRectF drag(EditData&) override;
Expand Down
15 changes: 15 additions & 0 deletions libmscore/tie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,13 @@ void Tie::calculateDirection()

TieSegment* Tie::layoutFor(System* system)
{
// do not layout ties in tablature if not showing back-tied fret marks
StaffType* st = staff()->staffType(startNote() ? startNote()->tick() : Fraction(0, 1));
if (st && st->isTabStaff() && !st->showBackTied()) {
if (!segmentsEmpty())
eraseSpannerSegments();
return nullptr;
}
//
// show short bow
//
Expand Down Expand Up @@ -673,6 +680,14 @@ TieSegment* Tie::layoutFor(System* system)

TieSegment* Tie::layoutBack(System* system)
{
// do not layout ties in tablature if not showing back-tied fret marks
StaffType* st = staff()->staffType(startNote() ? startNote()->tick() : Fraction(0, 1));
if (st->isTabStaff() && !st->showBackTied()) {
if (!segmentsEmpty())
eraseSpannerSegments();
return nullptr;
}

SlurPos sPos;
slurPos(&sPos);

Expand Down

0 comments on commit 2ac4aff

Please sign in to comment.