Skip to content

Commit 620c997

Browse files
committed
fix #47181 Multi-line title spaced incorrectly
1 parent 0f4605d commit 620c997

File tree

5 files changed

+104
-18
lines changed

5 files changed

+104
-18
lines changed

libmscore/part.cpp

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,46 +183,100 @@ void Part::setMidiProgram(int program, int bank)
183183
instr()->setChannel(0, c);
184184
}
185185

186+
//---------------------------------------------------------
187+
// volume
188+
//---------------------------------------------------------
189+
186190
int Part::volume() const
187191
{
188192
return instr()->channel(0).volume;
189193
}
190194

195+
//---------------------------------------------------------
196+
// setVolume
197+
//---------------------------------------------------------
198+
191199
void Part::setVolume(int volume)
192200
{
193201
instr()->channel(0).volume = volume;
194202
}
195203

204+
//---------------------------------------------------------
205+
// mute
206+
//---------------------------------------------------------
207+
196208
bool Part::mute() const
197209
{
198210
return instr()->channel(0).mute;
199211
}
200212

213+
//---------------------------------------------------------
214+
// setMute
215+
//---------------------------------------------------------
216+
201217
void Part::setMute(bool mute)
202218
{
203219
instr()->channel(0).mute = mute;
204220
}
205221

222+
//---------------------------------------------------------
223+
// reverb
224+
//---------------------------------------------------------
225+
206226
int Part::reverb() const
207227
{
208228
return instr()->channel(0).reverb;
209229
}
210230

231+
//---------------------------------------------------------
232+
// setReverb
233+
//---------------------------------------------------------
234+
235+
void Part::setReverb(int val)
236+
{
237+
instr()->channel(0).reverb = val;
238+
}
239+
240+
//---------------------------------------------------------
241+
// chorus
242+
//---------------------------------------------------------
243+
211244
int Part::chorus() const
212245
{
213246
return instr()->channel(0).chorus;
214247
}
215248

249+
//---------------------------------------------------------
250+
// setChorus
251+
//---------------------------------------------------------
252+
253+
void Part::setChorus(int val)
254+
{
255+
instr()->channel(0).chorus = val;
256+
}
257+
258+
//---------------------------------------------------------
259+
// pan
260+
//---------------------------------------------------------
261+
216262
int Part::pan() const
217263
{
218264
return instr()->channel(0).pan;
219265
}
220266

267+
//---------------------------------------------------------
268+
// setPan
269+
//---------------------------------------------------------
270+
221271
void Part::setPan(int pan)
222272
{
223273
instr()->channel(0).pan = pan;
224274
}
225275

276+
//---------------------------------------------------------
277+
// midiProgram
278+
//---------------------------------------------------------
279+
226280
int Part::midiProgram() const
227281
{
228282
return instr()->channel(0).program;
@@ -253,6 +307,7 @@ int Part::midiPort() const
253307

254308
void Part::setMidiChannel(int) const
255309
{
310+
// TODO
256311
}
257312

258313
//---------------------------------------------------------
@@ -358,7 +413,16 @@ QVariant Part::getProperty(P_ID id) const
358413
return QVariant(_show);
359414
case P_ID::USE_DRUMSET:
360415
return instr()->useDrumset();
361-
416+
case P_ID::PART_VOLUME:
417+
return volume();
418+
case P_ID::PART_MUTE:
419+
return mute();
420+
case P_ID::PART_PAN:
421+
return pan();
422+
case P_ID::PART_REVERB:
423+
return reverb();
424+
case P_ID::PART_CHORUS:
425+
return chorus();
362426
default:
363427
return QVariant();
364428
}
@@ -384,6 +448,21 @@ bool Part::setProperty(P_ID id, const QVariant& property)
384448
instr()->setUseDrumset(property.toBool());
385449
score()->updateNotes();
386450
break;
451+
case P_ID::PART_VOLUME:
452+
setVolume(property.toInt());
453+
break;
454+
case P_ID::PART_MUTE:
455+
setMute(property.toBool());
456+
break;
457+
case P_ID::PART_PAN:
458+
setPan(property.toInt());
459+
break;
460+
case P_ID::PART_REVERB:
461+
setReverb(property.toInt());
462+
break;
463+
case P_ID::PART_CHORUS:
464+
setChorus(property.toInt());
465+
break;
387466
default:
388467
qDebug("Part::setProperty: unknown id %d", int(id));
389468
break;

libmscore/part.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ class Part : public QObject, public ScoreElement {
9797
void setMute(bool mute);
9898

9999
int reverb() const;
100+
void setReverb(int);
100101
int chorus() const;
102+
void setChorus(int);
101103
int pan() const;
102104
void setPan(int pan);
103105
int midiProgram() const;

libmscore/property.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ static const PropertyData propertyList[] = {
213213
{ P_ID::SYSTEM_INITIAL_BARLINE_TYPE, false, "sysInitBarLineType", P_TYPE::INT },
214214
{ P_ID::MAG, false, "mag", P_TYPE::REAL },
215215
{ P_ID::USE_DRUMSET, false, "useDrumset", P_TYPE::BOOL },
216+
{ P_ID::PART_VOLUME, false, "volume", P_TYPE::INT },
217+
{ P_ID::PART_MUTE, false, "mute", P_TYPE::BOOL },
218+
{ P_ID::PART_PAN, false, "pan", P_TYPE::INT },
219+
{ P_ID::PART_REVERB, false, "reverb", P_TYPE::INT },
220+
{ P_ID::PART_CHORUS, false, "chorus", P_TYPE::INT },
216221

217222
{ P_ID::END, false, "", P_TYPE::INT }
218223
};

libmscore/property.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ enum class P_ID : unsigned char {
208208

209209
MAG,
210210
USE_DRUMSET,
211+
PART_VOLUME,
212+
PART_MUTE,
213+
PART_PAN,
214+
PART_REVERB,
215+
PART_CHORUS,
211216

212217
END
213218
};

libmscore/text.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ void TextBlock::layout(Text* t)
324324

325325
_bbox |= r.translated(f.pos);
326326
x += w;
327-
_lineSpacing = _lineSpacing == 0 || fm.lineSpacing() == 0 ? qMax(_lineSpacing, fm.lineSpacing()) : qMin(_lineSpacing, fm.lineSpacing());
327+
// _lineSpacing = (_lineSpacing == 0 || fm.lineSpacing() == 0) ? qMax(_lineSpacing, fm.lineSpacing()) : qMin(_lineSpacing, fm.lineSpacing());
328+
_lineSpacing = qMax(_lineSpacing, fm.lineSpacing());
328329
}
329330
}
330331
qreal rx;
@@ -798,7 +799,9 @@ TextBlock TextBlock::split(int column)
798799
++col;
799800
}
800801
}
801-
tl._text.append(TextFragment("")); //??
802+
TextFragment tf("");
803+
tf.format = _text.last().format;
804+
tl._text.append(tf);
802805
return tl;
803806
}
804807

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

984-
qreal ascent;
987+
QFont font;
985988
if (fragment) {
986-
QFont font = fragment->font(this);
987-
if (font.family() == score()->scoreFont()->font().family()) {
988-
QFontMetricsF fm = QFontMetricsF(_textStyle.fontPx(spatium()));
989-
ascent = fm.ascent();
990-
}
991-
else {
992-
QFontMetricsF fm = QFontMetrics(font);
993-
ascent = fm.ascent();
994-
}
995-
}
996-
else {
997-
QFontMetricsF fm = QFontMetricsF(_textStyle.fontPx(spatium()));
998-
ascent = fm.ascent();
989+
font = fragment->font(this);
990+
if (font.family() == score()->scoreFont()->font().family())
991+
font = _textStyle.fontPx(spatium());
999992
}
993+
else
994+
font = _textStyle.fontPx(spatium());
1000995

1001-
ascent *= 0.7;
996+
qreal ascent = QFontMetricsF(font).ascent() * .7;
1002997
qreal h = ascent; // lineSpacing();
1003998
qreal x = tline.xpos(_cursor.column(), this);
1004999
qreal y = tline.y();

0 commit comments

Comments
 (0)