parent
2ec2c65dbe
commit
a6cbcd7a14
3 changed files with 41 additions and 12 deletions
|
@ -1342,13 +1342,14 @@ void Chord::layout()
|
|||
|
||||
qreal minNoteDistance = score()->styleS(ST_minNoteDistance).val() * _spatium;
|
||||
bool useTab = false;
|
||||
StaffTypeTablature* tab = 0;
|
||||
|
||||
if (staff() && staff()->isTabStaff()) {
|
||||
//
|
||||
// TABLATURE STAVES
|
||||
//
|
||||
useTab = true;
|
||||
StaffTypeTablature* tab = (StaffTypeTablature*)staff()->staffType();
|
||||
tab = (StaffTypeTablature*)staff()->staffType();
|
||||
qreal lineDist = tab->lineDistance().val();
|
||||
int n = _notes.size();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
|
@ -1516,7 +1517,7 @@ void Chord::layout()
|
|||
int n = _notes.size();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
Note* note = _notes.at(i);
|
||||
qreal lhw = note->headWidth();
|
||||
qreal lhw = useTab ? note->tabHeadWidth(tab) : note->headWidth();
|
||||
qreal rr = 0.0;
|
||||
if (note->mirror()) {
|
||||
if (up())
|
||||
|
|
|
@ -320,6 +320,9 @@ int Note::noteHead() const
|
|||
|
||||
//---------------------------------------------------------
|
||||
// headWidth
|
||||
//
|
||||
// returns the width of the note head symbol
|
||||
// or the width of the string representation of the fret mark
|
||||
//---------------------------------------------------------
|
||||
|
||||
qreal Note::headWidth() const
|
||||
|
@ -327,15 +330,46 @@ qreal Note::headWidth() const
|
|||
return symbols[score()->symIdx()][noteHead()].width(magS());
|
||||
}
|
||||
|
||||
qreal Note::tabHeadWidth(StaffTypeTablature* tab) const
|
||||
{
|
||||
qreal val;
|
||||
if (tab && _fret != FRET_NONE && _string != STRING_NONE) {
|
||||
qreal mags = magS();
|
||||
QFont f = tab->fretFont();
|
||||
int size = lrint(tab->fretFontSize() * MScore::DPI / PPI);
|
||||
f.setPixelSize(size);
|
||||
QFontMetricsF fm(f);
|
||||
QString s = tab->fretString(_fret, _ghost);
|
||||
val = fm.width(s) * mags;
|
||||
}
|
||||
else
|
||||
val = symbols[score()->symIdx()][noteHead()].width(magS());
|
||||
if (_small)
|
||||
val *= score()->styleD(ST_smallNoteMag);
|
||||
return val;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// headHeight
|
||||
//
|
||||
// returns the height of the note head symbol
|
||||
// or the height of the string representation of the fret mark
|
||||
//---------------------------------------------------------
|
||||
|
||||
qreal Note::headHeight() const
|
||||
{
|
||||
if(tab && _fret != FRET_NONE && _string != STRING_NONE)
|
||||
return tab->fretBoxH() * magS();
|
||||
return symbols[score()->symIdx()][noteHead()].height(magS());
|
||||
}
|
||||
|
||||
qreal Note::tabHeadHeight(StaffTypeTablature *tab) const
|
||||
{
|
||||
if(tab && _fret != FRET_NONE && _string != STRING_NONE)
|
||||
return tab->fretBoxH() * magS();
|
||||
return headHeight();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// attach
|
||||
//---------------------------------------------------------
|
||||
|
@ -1234,16 +1268,7 @@ void Note::layout()
|
|||
if (useTablature) {
|
||||
StaffTypeTablature* tab = (StaffTypeTablature*)staff()->staffType();
|
||||
qreal mags = magS();
|
||||
// QFont f(tab->fretFontName());
|
||||
QFont f = tab->fretFont();
|
||||
int size = lrint(tab->fretFontSize() * MScore::DPI / PPI);
|
||||
f.setPixelSize(size);
|
||||
QFontMetricsF fm(f);
|
||||
// // when using letters, "+(_fret > 8)" skips 'j'
|
||||
// QString s = _ghost ? "X" :
|
||||
// ( tab->useNumbers() ? QString::number(_fret) : QString('a' + _fret + (_fret > 8)) );
|
||||
QString s = tab->fretString(_fret, _ghost);
|
||||
qreal w = fm.width(s) * mags;
|
||||
qreal w = headWidth(tab);
|
||||
// center string name to note head
|
||||
qreal xo = (headWidth() - w) * .5;
|
||||
bbox().setRect(xo, tab->fretBoxY() * mags, w, tab->fretBoxH() * mags);
|
||||
|
|
|
@ -36,6 +36,7 @@ class AccidentalState;
|
|||
class Accidental;
|
||||
class NoteDot;
|
||||
class Spanner;
|
||||
class StaffTypeTablature;
|
||||
|
||||
//---------------------------------------------------------
|
||||
// NoteVal
|
||||
|
@ -192,6 +193,8 @@ class Note : public Element {
|
|||
|
||||
qreal headWidth() const;
|
||||
qreal headHeight() const;
|
||||
qreal tabHeadWidth(StaffTypeTablature* tab = 0) const;
|
||||
qreal tabHeadHeight(StaffTypeTablature* tab = 0) const;
|
||||
QPointF attach() const;
|
||||
|
||||
int noteHead() const;
|
||||
|
|
Loading…
Reference in a new issue