diff --git a/libmscore/bracket.cpp b/libmscore/bracket.cpp index 1562ba9d34..956a9bab5c 100644 --- a/libmscore/bracket.cpp +++ b/libmscore/bracket.cpp @@ -224,13 +224,13 @@ void Bracket::draw(QPainter* painter) const } break; case BracketType::NORMAL: { - qreal h = 2 * h2; + qreal h = 2 * h2; qreal _spatium = spatium(); - qreal w = score()->styleP(StyleIdx::bracketWidth); + qreal w = score()->styleP(StyleIdx::bracketWidth); + qreal bd = _spatium * .25; QPen pen(curColor(), w, Qt::SolidLine, Qt::FlatCap); painter->setPen(pen); - qreal bd = _spatium * .25; - painter->drawLine(QLineF(0.0, -bd, 0.0, h + bd)); + painter->drawLine(QLineF(0.0, -bd - w * .5, 0.0, h + bd + w * .5)); qreal x = -w * .5; qreal y1 = -bd; qreal y2 = h + bd; diff --git a/libmscore/iname.cpp b/libmscore/iname.cpp index 302cce7083..f460a38d9c 100644 --- a/libmscore/iname.cpp +++ b/libmscore/iname.cpp @@ -26,7 +26,6 @@ InstrumentName::InstrumentName(Score* s) : Text(s) { setInstrumentNameType(InstrumentNameType::SHORT); - _layoutPos = 0; } //--------------------------------------------------------- @@ -81,5 +80,51 @@ void InstrumentName::endEdit() score()->undo(new ChangePart(part, instrument, part->name())); } +//--------------------------------------------------------- +// getProperty +//--------------------------------------------------------- + +QVariant InstrumentName::getProperty(P_ID id) const + { + switch (id) { + case P_ID::INAME_LAYOUT_POSITION: + return _layoutPos; + default: + return Text::getProperty(id); + } + } + +//--------------------------------------------------------- +// setProperty +//--------------------------------------------------------- + +bool InstrumentName::setProperty(P_ID id, const QVariant& v) + { + switch (id) { + case P_ID::INAME_LAYOUT_POSITION: + _layoutPos = v.toInt(); +printf("%p set layoutPos %d\n", this, _layoutPos); + break; + default: + return Text::setProperty(id, v); + } + score()->setLayoutAll(); + return true; + } + +//--------------------------------------------------------- +// propertyDefault +//--------------------------------------------------------- + +QVariant InstrumentName::propertyDefault(P_ID id) const + { + switch (id) { + case P_ID::INAME_LAYOUT_POSITION: + return 0; + default: + return Text::propertyDefault(id); + } + } + } diff --git a/libmscore/iname.h b/libmscore/iname.h index a5dff9f9e2..2c514e3f08 100644 --- a/libmscore/iname.h +++ b/libmscore/iname.h @@ -27,7 +27,7 @@ enum class InstrumentNameType : char { class InstrumentName : public Text { InstrumentNameType _instrumentNameType; - int _layoutPos; + int _layoutPos { 0 }; public: InstrumentName(Score*); @@ -42,6 +42,10 @@ class InstrumentName : public Text { void setInstrumentNameType(InstrumentNameType v); void setInstrumentNameType(const QString& s); virtual void endEdit() override; + + virtual QVariant getProperty(P_ID propertyId) const override; + virtual bool setProperty(P_ID propertyId, const QVariant&) override; + virtual QVariant propertyDefault(P_ID) const override; }; diff --git a/libmscore/part.h b/libmscore/part.h index fa3dc81fdc..f6194c1080 100644 --- a/libmscore/part.h +++ b/libmscore/part.h @@ -64,7 +64,7 @@ class Part : public QObject, public ScoreElement { Q_PROPERTY(int startTrack READ startTrack) Q_PROPERTY(int volume READ volume WRITE setVolume) - QString _partName; ///< used in tracklist (mixer) + QString _partName; ///< used in tracklist (mixer) InstrumentList _instruments; QList _staves; QString _id; ///< used for MusicXml import diff --git a/libmscore/property.cpp b/libmscore/property.cpp index b45e12ab6c..f8705bbf73 100644 --- a/libmscore/property.cpp +++ b/libmscore/property.cpp @@ -270,6 +270,8 @@ static const PropertyData propertyList[] = { { P_ID::STAFF_BARLINE_SPAN_TO, false, "barLineSpanTo", P_TYPE::INT }, { P_ID::BRACKET_COLUMN, false, "level", P_TYPE::INT }, + { P_ID::INAME_LAYOUT_POSITION, false, "layoutPosition", P_TYPE::INT }, + { P_ID::END, false, "", P_TYPE::INT } }; diff --git a/libmscore/property.h b/libmscore/property.h index 4612e18a62..a40275fa51 100644 --- a/libmscore/property.h +++ b/libmscore/property.h @@ -262,6 +262,7 @@ enum class P_ID : int { STAFF_BARLINE_SPAN_TO, BRACKET_COLUMN, + INAME_LAYOUT_POSITION, END }; diff --git a/libmscore/system.cpp b/libmscore/system.cpp index 7f96d80d2a..be0cc19d13 100644 --- a/libmscore/system.cpp +++ b/libmscore/system.cpp @@ -554,7 +554,7 @@ void System::setInstrumentNames(bool longName) for (SysStaff* staff : _staves) { Staff* s = score()->staff(staffIdx); if (!s->isTop() || !s->show()) { - foreach (InstrumentName* t, staff->instrumentNames) + for (InstrumentName* t : staff->instrumentNames) score()->removeElement(t); ++staffIdx; continue; @@ -564,7 +564,7 @@ void System::setInstrumentNames(bool longName) const QList& names = longName? part->longNames(tick) : part->shortNames(tick); int idx = 0; - foreach (const StaffName& sn, names) { + for (const StaffName& sn : names) { InstrumentName* iname = staff->instrumentNames.value(idx); if (iname == 0) { iname = new InstrumentName(score()); @@ -572,10 +572,10 @@ void System::setInstrumentNames(bool longName) iname->setParent(this); iname->setTrack(staffIdx * VOICES); iname->setInstrumentNameType(longName ? InstrumentNameType::LONG : InstrumentNameType::SHORT); + iname->setLayoutPos(sn.pos()); score()->addElement(iname); } iname->setXmlText(sn.name()); - iname->setLayoutPos(sn.pos()); ++idx; } for (; idx < staff->instrumentNames.size(); ++idx) diff --git a/libmscore/tie.cpp b/libmscore/tie.cpp index dad157c28c..d994c1f8a9 100644 --- a/libmscore/tie.cpp +++ b/libmscore/tie.cpp @@ -409,6 +409,21 @@ void TieSegment::computeBezier(QPointF p6o) path.translate(staffOffset); shapePath.translate(staffOffset); + + QPainterPath p; + p.moveTo(QPointF()); + p.cubicTo(p3 + p3o - th, p4 + p4o - th, p2); + _shape.clear(); + QPointF start; + start = t.map(start); + int nbShapes = 15; + for (int i = 1; i <= nbShapes; i++) { + QPointF point = t.map(p.pointAtPercent(i/float(nbShapes))); + QRectF re(start, point); + re.translate(staffOffset); + _shape.add(re); + start = point; + } } //--------------------------------------------------------- diff --git a/mscore/CMakeLists.txt b/mscore/CMakeLists.txt index b002cdfe1f..ffd8170645 100644 --- a/mscore/CMakeLists.txt +++ b/mscore/CMakeLists.txt @@ -132,6 +132,7 @@ QT5_WRAP_UI (ui_headers inspector/inspector_tremolo.ui inspector/inspector_caesura.ui inspector/inspector_bracket.ui + inspector/inspector_iname.ui ${SCRIPT_UI} ) diff --git a/mscore/inspector/inspector.cpp b/mscore/inspector/inspector.cpp index b8a504f08a..20686e161b 100644 --- a/mscore/inspector/inspector.cpp +++ b/mscore/inspector/inspector.cpp @@ -239,10 +239,7 @@ void Inspector::setElements(const QList& l) ie = new InspectorSlurTie(this); break; case Element::Type::BAR_LINE: -// if (_element->isEditable()) - ie = new InspectorBarLine(this); -// else -// ie = new InspectorEmpty(this); + ie = new InspectorBarLine(this); break; case Element::Type::JUMP: ie = new InspectorJump(this); @@ -294,7 +291,7 @@ void Inspector::setElements(const QList& l) ie = new InspectorBracket(this); break; case Element::Type::INSTRUMENT_NAME: - ie = new InspectorEmpty(this); + ie = new InspectorIname(this); break; default: if (_element->isText()) @@ -1209,5 +1206,19 @@ InspectorBracket::InspectorBracket(QWidget* parent) : InspectorBase(parent) mapSignals(il); } +//--------------------------------------------------------- +// InspectorIname +//--------------------------------------------------------- + +InspectorIname::InspectorIname(QWidget* parent) : InspectorBase(parent) + { + i.setupUi(addWidget()); + + const std::vector il = { + { P_ID::INAME_LAYOUT_POSITION, 0, 0, i.layoutPosition, i.resetLayoutPosition } + }; + mapSignals(il); + } + } diff --git a/mscore/inspector/inspector.h b/mscore/inspector/inspector.h index 04e811f2fd..2295e60cd6 100644 --- a/mscore/inspector/inspector.h +++ b/mscore/inspector/inspector.h @@ -45,6 +45,7 @@ #include "ui_inspector_tremolo.h" #include "ui_inspector_caesura.h" #include "ui_inspector_bracket.h" +#include "ui_inspector_iname.h" namespace Ms { @@ -442,6 +443,19 @@ class InspectorBracket : public InspectorBase { InspectorBracket(QWidget* parent); }; +//--------------------------------------------------------- +// InspectorIname +//--------------------------------------------------------- + +class InspectorIname : public InspectorBase { + Q_OBJECT + + Ui::InspectorIname i; + + public: + InspectorIname(QWidget* parent); + }; + //--------------------------------------------------------- // InspectorEmpty //--------------------------------------------------------- diff --git a/mscore/inspector/inspector_iname.ui b/mscore/inspector/inspector_iname.ui new file mode 100644 index 0000000000..d540b8d967 --- /dev/null +++ b/mscore/inspector/inspector_iname.ui @@ -0,0 +1,119 @@ + + + InspectorIname + + + + 0 + 0 + 209 + 119 + + + + Breath/Caesura Inspector + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 75 + true + + + + Instrument Name + + + + + + + QFrame::HLine + + + QFrame::Raised + + + 2 + + + + + + + + 3 + + + 3 + + + 3 + + + 0 + + + + + 5 + + + + + + + Layout position: + + + + + + + Reset to default + + + Reset 'Pause' value + + + + + + + :/data/icons/edit-reset.svg:/data/icons/edit-reset.svg + + + + + + + + + + + + +