Skip to content

Commit

Permalink
fix #47181 Multi-line title spaced incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 11, 2015
1 parent 0f4605d commit 620c997
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 18 deletions.
81 changes: 80 additions & 1 deletion libmscore/part.cpp
Expand Up @@ -183,46 +183,100 @@ void Part::setMidiProgram(int program, int bank)
instr()->setChannel(0, c);
}

//---------------------------------------------------------
// volume
//---------------------------------------------------------

int Part::volume() const
{
return instr()->channel(0).volume;
}

//---------------------------------------------------------
// setVolume
//---------------------------------------------------------

void Part::setVolume(int volume)
{
instr()->channel(0).volume = volume;
}

//---------------------------------------------------------
// mute
//---------------------------------------------------------

bool Part::mute() const
{
return instr()->channel(0).mute;
}

//---------------------------------------------------------
// setMute
//---------------------------------------------------------

void Part::setMute(bool mute)
{
instr()->channel(0).mute = mute;
}

//---------------------------------------------------------
// reverb
//---------------------------------------------------------

int Part::reverb() const
{
return instr()->channel(0).reverb;
}

//---------------------------------------------------------
// setReverb
//---------------------------------------------------------

void Part::setReverb(int val)
{
instr()->channel(0).reverb = val;
}

//---------------------------------------------------------
// chorus
//---------------------------------------------------------

int Part::chorus() const
{
return instr()->channel(0).chorus;
}

//---------------------------------------------------------
// setChorus
//---------------------------------------------------------

void Part::setChorus(int val)
{
instr()->channel(0).chorus = val;
}

//---------------------------------------------------------
// pan
//---------------------------------------------------------

int Part::pan() const
{
return instr()->channel(0).pan;
}

//---------------------------------------------------------
// setPan
//---------------------------------------------------------

void Part::setPan(int pan)
{
instr()->channel(0).pan = pan;
}

//---------------------------------------------------------
// midiProgram
//---------------------------------------------------------

int Part::midiProgram() const
{
return instr()->channel(0).program;
Expand Down Expand Up @@ -253,6 +307,7 @@ int Part::midiPort() const

void Part::setMidiChannel(int) const
{
// TODO
}

//---------------------------------------------------------
Expand Down Expand Up @@ -358,7 +413,16 @@ QVariant Part::getProperty(P_ID id) const
return QVariant(_show);
case P_ID::USE_DRUMSET:
return instr()->useDrumset();

case P_ID::PART_VOLUME:
return volume();
case P_ID::PART_MUTE:
return mute();
case P_ID::PART_PAN:
return pan();
case P_ID::PART_REVERB:
return reverb();
case P_ID::PART_CHORUS:
return chorus();
default:
return QVariant();
}
Expand All @@ -384,6 +448,21 @@ bool Part::setProperty(P_ID id, const QVariant& property)
instr()->setUseDrumset(property.toBool());
score()->updateNotes();
break;
case P_ID::PART_VOLUME:
setVolume(property.toInt());
break;
case P_ID::PART_MUTE:
setMute(property.toBool());
break;
case P_ID::PART_PAN:
setPan(property.toInt());
break;
case P_ID::PART_REVERB:
setReverb(property.toInt());
break;
case P_ID::PART_CHORUS:
setChorus(property.toInt());
break;
default:
qDebug("Part::setProperty: unknown id %d", int(id));
break;
Expand Down
2 changes: 2 additions & 0 deletions libmscore/part.h
Expand Up @@ -97,7 +97,9 @@ class Part : public QObject, public ScoreElement {
void setMute(bool mute);

int reverb() const;
void setReverb(int);
int chorus() const;
void setChorus(int);
int pan() const;
void setPan(int pan);
int midiProgram() const;
Expand Down
5 changes: 5 additions & 0 deletions libmscore/property.cpp
Expand Up @@ -213,6 +213,11 @@ static const PropertyData propertyList[] = {
{ P_ID::SYSTEM_INITIAL_BARLINE_TYPE, false, "sysInitBarLineType", P_TYPE::INT },
{ P_ID::MAG, false, "mag", P_TYPE::REAL },
{ P_ID::USE_DRUMSET, false, "useDrumset", P_TYPE::BOOL },
{ P_ID::PART_VOLUME, false, "volume", P_TYPE::INT },
{ P_ID::PART_MUTE, false, "mute", P_TYPE::BOOL },
{ P_ID::PART_PAN, false, "pan", P_TYPE::INT },
{ P_ID::PART_REVERB, false, "reverb", P_TYPE::INT },
{ P_ID::PART_CHORUS, false, "chorus", P_TYPE::INT },

{ P_ID::END, false, "", P_TYPE::INT }
};
Expand Down
5 changes: 5 additions & 0 deletions libmscore/property.h
Expand Up @@ -208,6 +208,11 @@ enum class P_ID : unsigned char {

MAG,
USE_DRUMSET,
PART_VOLUME,
PART_MUTE,
PART_PAN,
PART_REVERB,
PART_CHORUS,

END
};
Expand Down
29 changes: 12 additions & 17 deletions libmscore/text.cpp
Expand Up @@ -324,7 +324,8 @@ void TextBlock::layout(Text* t)

_bbox |= r.translated(f.pos);
x += w;
_lineSpacing = _lineSpacing == 0 || fm.lineSpacing() == 0 ? qMax(_lineSpacing, fm.lineSpacing()) : qMin(_lineSpacing, fm.lineSpacing());
// _lineSpacing = (_lineSpacing == 0 || fm.lineSpacing() == 0) ? qMax(_lineSpacing, fm.lineSpacing()) : qMin(_lineSpacing, fm.lineSpacing());
_lineSpacing = qMax(_lineSpacing, fm.lineSpacing());
}
}
qreal rx;
Expand Down Expand Up @@ -798,7 +799,9 @@ TextBlock TextBlock::split(int column)
++col;
}
}
tl._text.append(TextFragment("")); //??
TextFragment tf("");
tf.format = _text.last().format;
tl._text.append(tf);
return tl;
}

Expand Down Expand Up @@ -981,24 +984,16 @@ QRectF Text::cursorRect() const
const TextBlock& tline = curLine();
const TextFragment* fragment = tline.fragment(_cursor.column());

qreal ascent;
QFont font;
if (fragment) {
QFont font = fragment->font(this);
if (font.family() == score()->scoreFont()->font().family()) {
QFontMetricsF fm = QFontMetricsF(_textStyle.fontPx(spatium()));
ascent = fm.ascent();
}
else {
QFontMetricsF fm = QFontMetrics(font);
ascent = fm.ascent();
}
}
else {
QFontMetricsF fm = QFontMetricsF(_textStyle.fontPx(spatium()));
ascent = fm.ascent();
font = fragment->font(this);
if (font.family() == score()->scoreFont()->font().family())
font = _textStyle.fontPx(spatium());
}
else
font = _textStyle.fontPx(spatium());

ascent *= 0.7;
qreal ascent = QFontMetricsF(font).ascent() * .7;
qreal h = ascent; // lineSpacing();
qreal x = tline.xpos(_cursor.column(), this);
qreal y = tline.y();
Expand Down

0 comments on commit 620c997

Please sign in to comment.