Merge pull request #2199 from MarcSabatella/74906-hairpin-text

74906 hairpin text
This commit is contained in:
Marc Sabatella 2015-09-02 10:19:57 -06:00
commit c84b19fd67
4 changed files with 14 additions and 1 deletions

View file

@ -294,6 +294,7 @@ void Score::cmdAddSpanner(Spanner* spanner, int staffIdx, Segment* startSegment,
|| spanner->type() == Element::Type::NOTELINE
|| spanner->type() == Element::Type::OTTAVA
|| spanner->type() == Element::Type::PEDAL
|| spanner->type() == Element::Type::HAIRPIN
|| spanner->type() == Element::Type::VOLTA) {
// rebase text elements to score style
TextLine* tl = static_cast<TextLine*>(spanner);

View file

@ -2402,6 +2402,8 @@ Hairpin* Score::addHairpin(bool decrescendo, int tickStart, int tickEnd, int tra
{
Hairpin* pin = new Hairpin(this);
pin->setHairpinType(decrescendo ? Hairpin::Type::DECRESCENDO : Hairpin::Type::CRESCENDO);
pin->setBeginText(decrescendo ? "dim." : "cresc.");
pin->setContinueText(decrescendo ? "(dim.)" : "(cresc.)");
pin->setTrack(track);
pin->setTrack2(track);
pin->setTick(tickStart);

View file

@ -33,8 +33,12 @@ Spatium Hairpin::editHairpinHeight;
void HairpinSegment::layout()
{
if (hairpin()->useTextLine()) {
// layout as textline rather than true hairpin
// use dynamics text style for position, so the text aligns with dynamics
// TODO: new style setting specifically for vertical offset of textline hairpins?
// or, use hairpinY but adjust by 0.5sp, which currently yields same vertical position as dynamics
if (parent())
rypos() += score()->styleS(StyleIdx::hairpinY).val() * spatium();
rypos() += score()->textStyle(TextStyleType::DYNAMICS).offset(spatium()).y();
TextLineSegment::layout();
return;
}

View file

@ -786,11 +786,15 @@ Palette* MuseScore::newLinesPalette(bool basic)
Hairpin* gabel0 = new Hairpin(gscore);
gabel0->setHairpinType(Hairpin::Type::CRESCENDO);
gabel0->setLen(w);
gabel0->setBeginText("cresc.");
gabel0->setContinueText("(cresc.)");
sp->append(gabel0, qApp->translate("lines", "Crescendo hairpin"));
Hairpin* gabel1 = new Hairpin(gscore);
gabel1->setHairpinType(Hairpin::Type::DECRESCENDO);
gabel1->setLen(w);
gabel1->setBeginText("dim.");
gabel1->setContinueText("(dim.)");
sp->append(gabel1, QT_TRANSLATE_NOOP("Palette", "Diminuendo hairpin"));
Hairpin* gabel2 = new Hairpin(gscore);
@ -799,6 +803,7 @@ Palette* MuseScore::newLinesPalette(bool basic)
gabel2->setUseTextLine(true);
gabel2->setLineStyle(Qt::CustomDashLine);
gabel2->setBeginText("cresc.");
gabel2->setContinueText("(cresc.)");
sp->append(gabel2, qApp->translate("lines", "Crescendo line"));
Hairpin* gabel3 = new Hairpin(gscore);
@ -807,6 +812,7 @@ Palette* MuseScore::newLinesPalette(bool basic)
gabel3->setUseTextLine(true);
gabel3->setLineStyle(Qt::CustomDashLine);
gabel3->setBeginText("dim.");
gabel3->setContinueText("(dim.)");
sp->append(gabel3, QT_TRANSLATE_NOOP("Palette", "Diminuendo line"));
Volta* volta = new Volta(gscore);