fix 2-line and 3-line layout issues
This commit is contained in:
parent
709e1ed345
commit
73922c6898
7 changed files with 45 additions and 7 deletions
|
@ -1157,7 +1157,8 @@ void Beam::computeStemLen(const QList<ChordRest*>& cl, qreal& py1, int beamLevel
|
|||
{
|
||||
qreal _spatium = spatium();
|
||||
qreal _spatium4 = _spatium * .25;
|
||||
qreal _spStaff4 = _spatium4 * staff()->lineDistance(); // scaled to staff line distance for vert. pos. within a staff
|
||||
// TAB: scale to staff line distance for vert. pos. within a staff
|
||||
qreal _spStaff4 = staff()->isTabStaff() ? _spatium4 * staff()->lineDistance() : _spatium4;
|
||||
const ChordRest* c1 = cl.front();
|
||||
const ChordRest* c2 = cl.back();
|
||||
qreal dx = c2->pagePos().x() - c1->pagePos().x();
|
||||
|
|
|
@ -640,13 +640,14 @@ void Chord::addLedgerLine(int track, int line, bool visible, qreal x, Spatium le
|
|||
void Chord::createLedgerLines(int track, vector<LedgerLineData>& vecLines, bool visible)
|
||||
{
|
||||
qreal _spatium = spatium();
|
||||
qreal stepDistance = staff() ? staff()->lineDistance() * 0.5 : 0.5;
|
||||
for (auto lld : vecLines) {
|
||||
LedgerLine* h = new LedgerLine(score());
|
||||
h->setParent(this);
|
||||
h->setTrack(track);
|
||||
h->setVisible(lld.visible && visible);
|
||||
h->setLen(Spatium( (lld.maxX - lld.minX) / _spatium) );
|
||||
h->setPos(lld.minX, lld.line * _spatium * .5);
|
||||
h->setPos(lld.minX, lld.line * _spatium * stepDistance);
|
||||
h->setNext(_ledgerLines);
|
||||
_ledgerLines = h;
|
||||
}
|
||||
|
@ -1343,8 +1344,8 @@ qreal Chord::defaultStemLength() {
|
|||
int n = tab[_hook ? 1 : 0][up() ? 1 : 0][odd][_tremolo->lines()-1];
|
||||
stemLen += n * .5;
|
||||
}
|
||||
// scale stemLen according to staff line spacing
|
||||
if (staff())
|
||||
// TAB: scale stemLen according to staff line spacing
|
||||
if (staff() && staff()->isTabStaff())
|
||||
stemLen *= staff()->staffType()->lineDistance().val();
|
||||
|
||||
return stemLen * _spatium;
|
||||
|
|
|
@ -205,6 +205,10 @@ void Clef::layout()
|
|||
}
|
||||
|
||||
lines = staffType->lines(); // init values from staff type
|
||||
#if 0
|
||||
// with fewer than 5 lines, keep clef toward top of staff (ignore line spacing)
|
||||
if (!stf->isPitchedStaff() || lines >= 5)
|
||||
#endif
|
||||
lineDist = staffType->lineDistance().val();
|
||||
}
|
||||
|
||||
|
|
|
@ -76,9 +76,10 @@ qreal KeySig::mag() const
|
|||
|
||||
void KeySig::addLayout(SymId sym, qreal x, int line)
|
||||
{
|
||||
qreal stepDistance = staff() ? staff()->lineDistance() * 0.5 : 0.5;
|
||||
KeySym ks;
|
||||
ks.sym = sym;
|
||||
ks.spos = QPointF(x, qreal(line) * .5);
|
||||
ks.spos = QPointF(x, qreal(line) * stepDistance);
|
||||
_sig.keySymbols().append(ks);
|
||||
}
|
||||
|
||||
|
|
|
@ -778,7 +778,7 @@ void Score::layoutChords3(QList<Note*>& notes, Staff* staff, Segment* segment)
|
|||
int columnBottom[7] = { -1, -1, -1, -1, -1, -1, -1 };
|
||||
|
||||
qreal sp = staff->spatium();
|
||||
qreal stepDistance = sp * .5;
|
||||
qreal stepDistance = sp * staff->lineDistance() * .5;
|
||||
int stepOffset = staff->staffType()->stepOffset();
|
||||
|
||||
qreal lx = 10000.0; // leftmost note head position
|
||||
|
|
|
@ -537,17 +537,40 @@ int Rest::computeLineOffset()
|
|||
default:
|
||||
break;
|
||||
}
|
||||
// adjust offsets for staves with fewer than five lines
|
||||
if (lines == 1) {
|
||||
if (lineOffset > 0)
|
||||
lineOffset -= 5;
|
||||
else
|
||||
lineOffset -= 3;
|
||||
}
|
||||
else if (lines == 2) {
|
||||
if (lineOffset > 0)
|
||||
lineOffset -= 4;
|
||||
else
|
||||
lineOffset -= 2;
|
||||
}
|
||||
else if (lines < 5) {
|
||||
if (lineOffset > 0)
|
||||
lineOffset -= (5 - lines) * 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// compute reasonable offset for staves of fewer than 5 lines
|
||||
switch(durationType().type()) {
|
||||
case TDuration::DurationType::V_LONG:
|
||||
case TDuration::DurationType::V_BREVE:
|
||||
case TDuration::DurationType::V_MEASURE:
|
||||
case TDuration::DurationType::V_WHOLE:
|
||||
if (lines == 1)
|
||||
if (lines <= 2)
|
||||
lineOffset = -2;
|
||||
break;
|
||||
case TDuration::DurationType::V_HALF:
|
||||
if (lines == 1)
|
||||
lineOffset = -4;
|
||||
else if (lines <= 3)
|
||||
lineOffset = -2;
|
||||
break;
|
||||
case TDuration::DurationType::V_QUARTER:
|
||||
case TDuration::DurationType::V_EIGHTH:
|
||||
case TDuration::DurationType::V_16TH:
|
||||
|
@ -559,6 +582,10 @@ int Rest::computeLineOffset()
|
|||
case TDuration::DurationType::V_1024TH:
|
||||
if (lines == 1)
|
||||
lineOffset = -4;
|
||||
if (lines == 2)
|
||||
lineOffset = -3;
|
||||
else if (lines == 3)
|
||||
lineOffset = -2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -180,6 +180,9 @@ void StaffType::setLines(int val)
|
|||
{
|
||||
_lines = val;
|
||||
if (_group != StaffGroup::TAB) {
|
||||
#if 1
|
||||
_stepOffset = 0;
|
||||
#else
|
||||
switch(_lines) {
|
||||
case 1:
|
||||
_stepOffset = 0;
|
||||
|
@ -192,6 +195,7 @@ void StaffType::setLines(int val)
|
|||
_stepOffset = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
_stepOffset = (val / 2 - 2) * 2; // tab staff
|
||||
|
|
Loading…
Reference in a new issue